diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 7b46f3949..7ce74c9cc 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -2312,6 +2312,9 @@ void CL_Init (void) // register our commands // CLSCR_Init(); +#ifdef MENU_DAT + MP_RegisterCvarsAndCmds(); +#endif #ifdef CSQC_DAT CSQC_RegisterCvarsAndThings(); #endif diff --git a/engine/client/pr_csqc.c b/engine/client/pr_csqc.c index 3f2814277..96b3b9f14 100644 --- a/engine/client/pr_csqc.c +++ b/engine/client/pr_csqc.c @@ -3582,8 +3582,28 @@ qboolean CSQC_Init (unsigned int checksum) return true; //success! } +void CSQC_CoreDump(void) +{ + if (!csqcprogs) + { + Con_Printf("Can't core dump, you need to be running the CSQC progs first."); + return; + } + + { + int size = 1024*1024*8; + char *buffer = BZ_Malloc(size); + csqcprogs->save_ents(csqcprogs, buffer, &size, 3); + COM_WriteFile("csqccore.txt", buffer, size); + BZ_Free(buffer); + } + +} + void CSQC_RegisterCvarsAndThings(void) { + Cmd_AddCommand("coredump_csqc", CSQC_CoreDump); + Cvar_Register(&pr_csmaxedicts, "csqc"); Cvar_Register(&cl_csqcdebug, "csqc"); } diff --git a/engine/client/pr_menu.c b/engine/client/pr_menu.c index c3b0c57d0..f71402a55 100644 --- a/engine/client/pr_menu.c +++ b/engine/client/pr_menu.c @@ -1444,6 +1444,28 @@ void MP_Init (void) } } +void MP_CoreDump(void) +{ + if (!menuprogs) + { + Con_Printf("Can't core dump, you need to be running the CSQC progs first."); + return; + } + + { + int size = 1024*1024*8; + char *buffer = BZ_Malloc(size); + menuprogs->save_ents(menuprogs, buffer, &size, 3); + COM_WriteFile("menucore.txt", buffer, size); + BZ_Free(buffer); + } +} + +void MP_RegisterCvarsAndCmds(void) +{ + Cmd_AddCommand("coredump_menuqc", MP_CoreDump); +} + void MP_Draw(void) { if (setjmp(mp_abort)) diff --git a/engine/server/pr_cmds.c b/engine/server/pr_cmds.c index c2561dcc4..e25e40802 100644 --- a/engine/server/pr_cmds.c +++ b/engine/server/pr_cmds.c @@ -801,6 +801,24 @@ void PR_BreakPoint_f(void) Con_Printf("Breakpoint has been cleared\n"); } + +void PR_SSCoreDump_f(void) +{ + if (!svprogfuncs) + { + Con_Printf("Progs not running, you need to start a server first\n"); + return; + } + + { + int size = 1024*1024*8; + char *buffer = BZ_Malloc(size); + svprogfuncs->save_ents(svprogfuncs, buffer, &size, 3); + COM_WriteFile("ssqccore.txt", buffer, size); + BZ_Free(buffer); + } +} + /* #ifdef _DEBUG void QCLibTest(void) @@ -824,6 +842,7 @@ void PR_Init(void) Cmd_AddCommand ("decompile", PR_Decompile_f); Cmd_AddCommand ("compile", PR_Compile_f); Cmd_AddCommand ("applycompile", PR_ApplyCompilation_f); + Cmd_AddCommand ("coredump_ssqc", PR_SSCoreDump_f); /* #ifdef _DEBUG Cmd_AddCommand ("svtestprogs", QCLibTest);