mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-25 21:31:37 +00:00
added a -plugwrapper argument, so that libcef can be a little more efficient with regards to new processes, at least in terms of quake resources eaten in subprocesses that will not be running quake.
fixed -watchdog, no longer conflicts with other exception handling. try to be more efficient on behalf of videomaps git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4971 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
98f13cf884
commit
ca09c08072
11 changed files with 69 additions and 25 deletions
|
@ -2546,8 +2546,8 @@ texid_tf Media_UpdateForShader(cin_t *cin)
|
|||
if (!cin->outunchanged)
|
||||
{
|
||||
if (!TEXVALID(cin->texture))
|
||||
TEXASSIGN(cin->texture, Image_CreateTexture("***cin***", NULL, IF_NOMIPMAP|IF_NOALPHA));
|
||||
Image_Upload(cin->texture, cin->outtype, cin->outdata, cin->outpalette, cin->outwidth, cin->outheight, IF_NOMIPMAP|IF_NOALPHA|IF_NOGAMMA);
|
||||
TEXASSIGN(cin->texture, Image_CreateTexture("***cin***", NULL, IF_NOMIPMAP));
|
||||
Image_Upload(cin->texture, cin->outtype, cin->outdata, cin->outpalette, cin->outwidth, cin->outheight, IF_NOMIPMAP|IF_NOGAMMA);
|
||||
}
|
||||
|
||||
if (cin->doneframe)
|
||||
|
|
|
@ -443,12 +443,18 @@ void QCBUILTIN PF_cs_media_create_http (pubprogfuncs_t *prinst, struct globalvar
|
|||
// #488 void(string name) gecko_destroy
|
||||
void QCBUILTIN PF_cs_media_destroy (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
const char *shader = PR_GetStringOfs(prinst, OFS_PARM0);
|
||||
const char *shadername = PR_GetStringOfs(prinst, OFS_PARM0);
|
||||
shader_t *shader = R_ShaderFind(shadername);
|
||||
cin_t *cin;
|
||||
cin = R_ShaderFindCinematic(shader);
|
||||
if (!cin)
|
||||
if (!shader)
|
||||
return;
|
||||
Media_Send_Reset(cin); //FIXME. unloading shaders can be dangerous
|
||||
cin = R_ShaderGetCinematic(shader);
|
||||
if (cin && shader->uses > 1)
|
||||
{
|
||||
if (shader->uses > 1)
|
||||
Media_Send_Reset(cin); //will still be active afterwards.
|
||||
}
|
||||
R_UnloadShader(shader);
|
||||
}
|
||||
// #489 void(string name, string URI) gecko_navigate
|
||||
void QCBUILTIN PF_cs_media_command (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
|
|
|
@ -32,7 +32,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "pr_common.h"
|
||||
#include "fs.h"
|
||||
|
||||
//#define _MSC_SEH
|
||||
#ifdef _MSC_VER
|
||||
#define _MSC_SEH
|
||||
#endif
|
||||
|
||||
//#define RESTARTTEST
|
||||
|
||||
|
@ -549,6 +551,7 @@ typedef BOOL (WINAPI *MINIDUMPWRITEDUMP) (
|
|||
PMINIDUMP_CALLBACK_INFORMATION CallbackParam
|
||||
);
|
||||
void DumpGLState(void);
|
||||
void *watchdogthread;
|
||||
DWORD CrashExceptionHandler (qboolean iswatchdog, DWORD exceptionCode, LPEXCEPTION_POINTERS exceptionInfo)
|
||||
{
|
||||
char dumpPath[1024];
|
||||
|
@ -802,7 +805,7 @@ DWORD CrashExceptionHandler (qboolean iswatchdog, DWORD exceptionCode, LPEXCEPTI
|
|||
{
|
||||
if (iswatchdog)
|
||||
{
|
||||
switch (MessageBoxA(NULL, "Fizzle... We hit an infinite loop! Or something is just really slow.\nBlame the monkey in the corner.\nI hope you saved your work.\nWould you like to take a dump now?", DISTRIBUTION " Sucks", MB_ICONSTOP|MB_YESNOCANCEL))
|
||||
switch (MessageBoxA(NULL, "Fizzle... We hit an infinite loop! Or something is just really slow.\nBlame the monkey in the corner.\nI hope you saved your work.\nWould you like to take a dump now?\n(click cancel to wait a bit longer)", DISTRIBUTION " Sucks", MB_ICONSTOP|MB_YESNOCANCEL|MB_DEFBUTTON3))
|
||||
{
|
||||
case IDYES:
|
||||
break; //take a dump.
|
||||
|
@ -861,7 +864,8 @@ LONG CALLBACK nonmsvc_CrashExceptionHandler(PEXCEPTION_POINTERS ExceptionInfo)
|
|||
}
|
||||
|
||||
volatile int watchdogframe; //incremented each frame.
|
||||
int watchdogthread(void *arg)
|
||||
void *watchdogthread;
|
||||
int watchdogthreadfunction(void *arg)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
int oldframe = watchdogframe;
|
||||
|
@ -3942,6 +3946,19 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
|
|||
parms.binarydir = bindir;
|
||||
COM_InitArgv (parms.argc, parms.argv);
|
||||
|
||||
c = COM_CheckParm("--plugwrapper");
|
||||
if (c)
|
||||
{
|
||||
int (QDECL *thefunc) (void);
|
||||
void *dummy;
|
||||
dllhandle_t *QVM_LoadDLL(const char *name, qboolean binroot, void **vmMain, sys_calldll_t syscall);
|
||||
dllhandle_t *lib = QVM_LoadDLL(com_argv[c+1], true, &dummy, NULL);
|
||||
thefunc = Sys_GetAddressForName(lib, com_argv[c+2]);
|
||||
if (thefunc)
|
||||
return thefunc();
|
||||
return 0;
|
||||
}
|
||||
|
||||
c = COM_CheckParm("-qcdebug");
|
||||
if (c)
|
||||
isPlugin = 3;
|
||||
|
@ -3981,8 +3998,10 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
|
|||
*/
|
||||
|
||||
#if defined(CATCHCRASH) && defined(MULTITHREAD)
|
||||
#ifdef _MSC_VER
|
||||
if (COM_CheckParm("-watchdog"))
|
||||
Sys_CreateThread("watchdog", watchdogthread, NULL, 0, 0);
|
||||
watchdogthread = Sys_CreateThread("watchdog", watchdogthreadfunction, NULL, 0, 0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (isPlugin==1)
|
||||
|
|
|
@ -4700,6 +4700,12 @@ void COM_Version_f (void)
|
|||
Con_Printf("\n");
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
void COM_LoopMe_f(void)
|
||||
{
|
||||
while(1)
|
||||
;
|
||||
}
|
||||
void COM_CrashMe_f(void)
|
||||
{
|
||||
int *crashaddr = (int*)0x05;
|
||||
|
@ -4711,6 +4717,7 @@ void COM_ErrorMe_f(void)
|
|||
{
|
||||
Sys_Error("\"errorme\" command used");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
@ -5173,8 +5180,11 @@ void COM_Init (void)
|
|||
Cmd_AddCommand ("flocate", COM_Locate_f); //prints the pak or whatever where this file can be found.
|
||||
Cmd_AddCommand ("version", COM_Version_f); //prints the pak or whatever where this file can be found.
|
||||
|
||||
#ifdef _DEBUG
|
||||
Cmd_AddCommand ("loopme", COM_LoopMe_f);
|
||||
Cmd_AddCommand ("crashme", COM_CrashMe_f);
|
||||
Cmd_AddCommand ("errorme", COM_ErrorMe_f);
|
||||
#endif
|
||||
COM_InitFilesystem ();
|
||||
|
||||
Cvar_Register (&sys_platform, "Gamecode");
|
||||
|
|
|
@ -91,6 +91,7 @@ unsigned int WINAPI threadwrapper(void *args)
|
|||
Sys_SetThreadName(GetCurrentThreadId(), ((threadwrap_t *)args)->name);
|
||||
#endif
|
||||
#ifdef CATCHCRASH
|
||||
if (strcmp(((threadwrap_t *)args)->name, "watchdog")) //don't do this for the watchdog timer, as it just breaks the 'no' option.
|
||||
{
|
||||
PVOID (WINAPI *pAddVectoredExceptionHandler)(ULONG FirstHandler, PVECTORED_EXCEPTION_HANDLER VectoredHandler);
|
||||
dllfunction_t dbgfuncs[] = {{(void*)&pAddVectoredExceptionHandler, "AddVectoredExceptionHandler"}, {NULL,NULL}};
|
||||
|
|
|
@ -5906,11 +5906,8 @@ cin_t *R_ShaderGetCinematic(shader_t *s)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
cin_t *R_ShaderFindCinematic(const char *name)
|
||||
shader_t *R_ShaderFind(const char *name)
|
||||
{
|
||||
#ifdef NOMEDIA
|
||||
return NULL;
|
||||
#else
|
||||
int i;
|
||||
char shortname[MAX_QPATH];
|
||||
shader_t *s;
|
||||
|
@ -5930,9 +5927,17 @@ cin_t *R_ShaderFindCinematic(const char *name)
|
|||
continue;
|
||||
|
||||
if (!Q_stricmp (shortname, s->name) )
|
||||
return R_ShaderGetCinematic(s);
|
||||
return s;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cin_t *R_ShaderFindCinematic(const char *name)
|
||||
{
|
||||
#ifdef NOMEDIA
|
||||
return NULL;
|
||||
#else
|
||||
return R_ShaderGetCinematic(R_ShaderFind(name));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -610,6 +610,7 @@ void R_RemapShader(const char *sourcename, const char *destname, float timeoffse
|
|||
|
||||
cin_t *R_ShaderGetCinematic(shader_t *s);
|
||||
cin_t *R_ShaderFindCinematic(const char *name);
|
||||
shader_t *R_ShaderFind(const char *name); //does NOT increase the shader refcount.
|
||||
|
||||
void Shader_DefaultSkinShell(const char *shortname, shader_t *s, const void *args);
|
||||
void Shader_DefaultBSPLM(const char *shortname, shader_t *s, const void *args);
|
||||
|
|
|
@ -10803,8 +10803,8 @@ void PR_DumpPlatform_f(void)
|
|||
{"SOLID_TRIGGER", "const float", QW|NQ|CS, NULL, SOLID_TRIGGER},
|
||||
{"SOLID_BBOX", "const float", QW|NQ|CS, NULL, SOLID_BBOX},
|
||||
{"SOLID_SLIDEBOX", "const float", QW|NQ|CS, NULL, SOLID_SLIDEBOX},
|
||||
{"SOLID_BSP", "const float", QW|NQ|CS, NULL, SOLID_BSP},
|
||||
{"SOLID_CORPSE", "const float", QW|NQ|CS, NULL, SOLID_CORPSE},
|
||||
{"SOLID_BSP", "const float", QW|NQ|CS, "Does not collide against other SOLID_BSP entities. Normally paired with MOVETYPE_PUSH.", SOLID_BSP},
|
||||
{"SOLID_CORPSE", "const float", QW|NQ|CS, "Non-solid to SOLID_SLIDEBOX or other SOLID_CORPSE entities. For hitscan weapons to hit corpses, change the player's .solid value to SOLID_BBOX or so, perform the traceline, then revert the player's .solid value.", SOLID_CORPSE},
|
||||
{"SOLID_LADDER", "const float", QW|NQ|CS, "Obsolete and may be removed at some point. Use skin=CONTENT_LADDER and solid_bsp or solid_trigger instead.", SOLID_LADDER},
|
||||
{"SOLID_PHYSICS_BOX", "const float", QW|NQ|CS, NULL, SOLID_PHYSICS_BOX},
|
||||
{"SOLID_PHYSICS_SPHERE", "const float", QW|NQ|CS, NULL, SOLID_PHYSICS_SPHERE},
|
||||
|
|
|
@ -256,10 +256,10 @@ qintptr_t Plug_Init(qintptr_t *args)
|
|||
if ( Plug_Export("Tick", IRC_Frame) &&
|
||||
Plug_Export("ExecuteCommand", IRC_ExecuteCommand))
|
||||
{
|
||||
if (BUILTINISVALID(GetPluginName))
|
||||
if (BUILTINISVALID(Plug_GetPluginName))
|
||||
{
|
||||
char *s;
|
||||
pGetPluginName(0, commandname, sizeof(commandname));
|
||||
pPlug_GetPluginName(0, commandname, sizeof(commandname));
|
||||
while((s = strchr(commandname, '/')))
|
||||
{ //strip off the leading slashes.
|
||||
memmove(commandname, s+1, strlen(s));
|
||||
|
|
|
@ -114,7 +114,7 @@ BUILTIN(void, Cmd_AddText, (const char *text, qboolean insert)); //add stuff to
|
|||
#undef ARGNAMES
|
||||
|
||||
#define ARGNAMES ,name,value
|
||||
BUILTIN(void, Cvar_SetString, (const char *name, char *value)); //set a cvar string
|
||||
BUILTIN(void, Cvar_SetString, (const char *name, const char *value)); //set a cvar string
|
||||
#undef ARGNAMES
|
||||
#define ARGNAMES ,name,PASSFLOAT(value)
|
||||
BUILTIN(void, Cvar_SetFloat, (const char *name, float value)); //set a cvar float
|
||||
|
@ -164,7 +164,7 @@ BUILTIN(void, LocalSound, (const char *soundname));
|
|||
#undef ARGNAMES
|
||||
|
||||
#define ARGNAMES ,plugnum, buffer, bufsize
|
||||
BUILTIN(void, GetPluginName, (int plugnum, char *buffer, int bufsize));
|
||||
BUILTIN(void, Plug_GetPluginName, (int plugnum, char *buffer, int bufsize));
|
||||
#undef ARGNAMES
|
||||
|
||||
#define ARGNAMES ,ni,sizeofni
|
||||
|
@ -448,7 +448,7 @@ void Plug_InitStandardBuiltins(void)
|
|||
CHECKBUILTIN(Draw_Colour4f);
|
||||
CHECKBUILTIN(SCR_CenterPrint);
|
||||
|
||||
CHECKBUILTIN(GetPluginName);
|
||||
CHECKBUILTIN(Plug_GetPluginName);
|
||||
|
||||
//sub consoles (optional)
|
||||
CHECKBUILTIN(Con_SubPrint);
|
||||
|
|
|
@ -94,7 +94,9 @@ void BadBuiltin(void);
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
#ifdef _WIN32
|
||||
#define NATIVEEXPORT __declspec(dllexport) QDECL
|
||||
#else
|
||||
#define NATIVEEXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
|
@ -216,14 +218,14 @@ EBUILTIN(int, Cmd_Argc, (void)); //abort the entire engine.
|
|||
EBUILTIN(void, Cmd_AddText, (const char *text, qboolean insert));
|
||||
EBUILTIN(void, Cmd_Tokenize, (const char *msg)); //abort the entire engine.
|
||||
|
||||
EBUILTIN(void, Cvar_SetString, (const char *name, char *value));
|
||||
EBUILTIN(void, Cvar_SetString, (const char *name, const char *value));
|
||||
EBUILTIN(void, Cvar_SetFloat, (const char *name, float value));
|
||||
EBUILTIN(qboolean, Cvar_GetString, (const char *name, char *retstring, int sizeofretstring));
|
||||
EBUILTIN(float, Cvar_GetFloat, (const char *name));
|
||||
EBUILTIN(qhandle_t, Cvar_Register, (const char *name, const char *defaultval, int flags, const char *grouphint));
|
||||
EBUILTIN(int, Cvar_Update, (qhandle_t handle, int *modificationcount, char *stringv, float *floatv)); //stringv is 256 chars long, don't expect this function to do anything if modification count is unchanged.
|
||||
|
||||
EBUILTIN(void, GetPluginName, (int plugnum, char *buffer, int bufsize));
|
||||
EBUILTIN(void, Plug_GetPluginName, (int plugnum, char *buffer, int bufsize));
|
||||
EBUILTIN(void, LocalSound, (const char *soundname));
|
||||
EBUILTIN(int, CL_GetStats, (int pnum, unsigned int *stats, int maxstats));
|
||||
EBUILTIN(int, GetPlayerInfo, (int pnum, plugclientinfo_t *info));
|
||||
|
|
Loading…
Reference in a new issue