mirror of
https://github.com/nzp-team/fteqw.git
synced 2025-02-17 01:11:18 +00:00
webgl tweaks, in an attempt to get more friendly crashes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4462 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
e0aab1c134
commit
9e3cd210e8
6 changed files with 434 additions and 408 deletions
|
@ -3144,6 +3144,11 @@ void CL_Fog_f(void)
|
|||
}
|
||||
}
|
||||
|
||||
void CL_CrashMeEndgame_f(void)
|
||||
{
|
||||
Host_EndGame("crashme!");
|
||||
}
|
||||
|
||||
void CL_Skygroup_f(void);
|
||||
void SCR_ShowPic_Script_f(void);
|
||||
/*
|
||||
|
@ -3350,6 +3355,7 @@ void CL_Init (void)
|
|||
Cmd_AddCommand ("qtvdemos", CL_QTVDemos_f);
|
||||
Cmd_AddCommand ("demo_jump", CL_DemoJump_f);
|
||||
Cmd_AddCommand ("timedemo", CL_TimeDemo_f);
|
||||
Cmd_AddCommand ("crashme_endgame", CL_CrashMeEndgame_f);
|
||||
|
||||
Cmd_AddCommand ("showpic", SCR_ShowPic_Script_f);
|
||||
|
||||
|
|
|
@ -678,6 +678,7 @@ void QCBUILTIN PF_SubConInput (pubprogfuncs_t *prinst, struct globalvars_s *pr_g
|
|||
{
|
||||
case CSIE_KEYDOWN:
|
||||
//scan, char
|
||||
//FIXME
|
||||
G_FLOAT(OFS_RETURN) = 0;
|
||||
// G_FLOAT(OFS_RETURN) = Key_Console(con, pb, MP_TranslateQCtoFTECodes(pa));
|
||||
break;
|
||||
|
|
|
@ -129,8 +129,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#endif
|
||||
#else
|
||||
#ifdef FTE_TARGET_WEB
|
||||
#define setjmp(x) 0
|
||||
#define longjmp(b,r) abort()
|
||||
#include "web/ftejslib.h"
|
||||
//officially, emscripten supports longjmp.
|
||||
//unofficially, this makes firefox crash with memory issues.
|
||||
#define setjmp(x) (x=0,x)
|
||||
#define longjmp(b,r) emscriptenfte_abortmainloop(__func__)
|
||||
typedef int jmp_buf;
|
||||
#else
|
||||
#include <setjmp.h>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
|
||||
void emscriptenfte_async_wget_data2(const char *url, void *ctx, void (*onload)(void*ctx,void*buf,int sz), void (*onerror)(void*ctx,int code), void (*onprogress)(void*ctx,int prog,int total));
|
||||
|
||||
//filesystem buffers are implemented in javascript so that we are not bound by power-of-two heap limitations quite so much.
|
||||
//also, we can't use emscripten because it reserves 16m file handles or something.
|
||||
//also, we can't use emscripten's stdio because it reserves 16m file handles or something.
|
||||
int emscriptenfte_buf_create(void);
|
||||
int emscriptenfte_buf_open(const char *name, int createifneeded);
|
||||
int emscriptenfte_buf_rename(const char *oldname, const char *newname);
|
||||
|
@ -18,9 +19,14 @@ int emscriptenfte_ws_cansend(int sockid, int extra, int maxpending);
|
|||
int emscriptenfte_ws_send(int sockid, const void *data, int len);
|
||||
int emscriptenfte_ws_recv(int sockid, void *data, int len);
|
||||
|
||||
void Sys_Print(const char *msg);
|
||||
unsigned long emscriptenfte_ticks_ms(void);
|
||||
//misc stuff for printf replacements
|
||||
void emscriptenfte_alert(const char *msg);
|
||||
void emscriptenfte_print(const char *msg);
|
||||
void emscriptenfte_abortmainloop(const char *caller);
|
||||
|
||||
//avoid all of emscripten's sdl emulation.
|
||||
//this resolves input etc issues.
|
||||
unsigned long emscriptenfte_ticks_ms(void);
|
||||
int emscriptenfte_setupcanvas(
|
||||
int width,
|
||||
int height,
|
||||
|
|
|
@ -144,8 +144,20 @@ mergeInto(LibraryManager.library,
|
|||
return 1;
|
||||
},
|
||||
|
||||
emscriptenfte_abortmainloop : function(msg)
|
||||
{
|
||||
msg = Pointer_stringify(msg);
|
||||
throw 'oh noes! something bad happened in ' + msg + '!';
|
||||
},
|
||||
emscriptenfte_alert : function(msg)
|
||||
{
|
||||
msg = Pointer_stringify(msg);
|
||||
console.log(msg);
|
||||
alert(msg);
|
||||
},
|
||||
|
||||
Sys_Print : function(msg)
|
||||
//FIXME: split+merge by \n
|
||||
emscriptenfte_print : function(msg)
|
||||
{
|
||||
console.log(Pointer_stringify(msg));
|
||||
},
|
||||
|
@ -332,7 +344,7 @@ console.log('deleted '+name);
|
|||
var s = FTEH.h[sockid];
|
||||
if (!s)
|
||||
return -1;
|
||||
s.ws.send(HEAPU8.subarray(data, data+len).buffer);
|
||||
s.s.send(HEAPU8.subarray(data, data+len).buffer);
|
||||
return len;
|
||||
},
|
||||
emscriptenfte_ws_recv : function(sockid, data, len)
|
||||
|
|
|
@ -28,10 +28,8 @@ void Sys_Error (const char *error, ...)
|
|||
Con_Print (string);
|
||||
Con_Print ("\n");
|
||||
|
||||
if (COM_CheckParm("-crashonerror"))
|
||||
*(int*)-3 = 0;
|
||||
|
||||
Host_Shutdown ();
|
||||
emscriptenfte_alert(string);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
|
@ -52,7 +50,7 @@ void Sys_Printf (char *fmt, ...)
|
|||
|
||||
va_start (argptr,fmt);
|
||||
vsnprintf (buf, sizeof(buf), fmt, argptr);
|
||||
Sys_Print(buf);
|
||||
emscriptenfte_print(buf);
|
||||
va_end (argptr);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue