From 784f1d567c3599b1d2a24bf1bc616e75d6f08785 Mon Sep 17 00:00:00 2001 From: HarrievG Date: Sat, 3 Jul 2021 01:14:49 +0200 Subject: [PATCH] - Moved debugger intialistion after GameDll load - DebuggerServer will not intialize when the additional function FT_UpdateDebugger is not set --- neo/framework/Common.cpp | 13 ++++++++----- neo/framework/Common.h | 6 ++---- neo/tools/debugger/debugger.cpp | 6 ++++++ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/neo/framework/Common.cpp b/neo/framework/Common.cpp index 19409e92..5f2354ae 100644 --- a/neo/framework/Common.cpp +++ b/neo/framework/Common.cpp @@ -116,6 +116,8 @@ volatile int com_ticNumber; // 60 hz tics int com_editors; // currently opened editor(s) bool com_editorActive; // true if an editor has focus +bool com_debuggerSupported = false; // only set to true when the updateDebugger function is set. see GetAdditionalFunction() + #ifdef _WIN32 HWND com_hwndMsg = NULL; bool com_outputMsg = false; @@ -3181,15 +3183,15 @@ void idCommonLocal::InitGame( void ) { // initialize the user interfaces uiManager->Init(); - // startup the script debugger - if ( com_enableDebuggerServer.GetBool( ) ) - DebuggerServerInit(); - PrintLoadingMessage( common->GetLanguageDict()->GetString( "#str_04350" ) ); // load the game dll LoadGameDLL(); + // startup the script debugger + if ( com_enableDebuggerServer.GetBool( ) ) + DebuggerServerInit( ); + PrintLoadingMessage( common->GetLanguageDict()->GetString( "#str_04351" ) ); // init the session @@ -3313,6 +3315,7 @@ bool idCommonLocal::GetAdditionalFunction(idCommon::FunctionType ft, idCommon::F Warning("Called idCommon::GetAdditionalFunction() with out_fnptr == NULL!\n"); return false; } + switch(ft) { case idCommon::FT_IsDemo: @@ -3322,7 +3325,7 @@ bool idCommonLocal::GetAdditionalFunction(idCommon::FunctionType ft, idCommon::F case idCommon::FT_UpdateDebugger: *out_fnptr = (idCommon::FunctionPointer)updateDebugger; - + com_debuggerSupported = true; return true; default: diff --git a/neo/framework/Common.h b/neo/framework/Common.h index 7bf328f5..3262e6cc 100644 --- a/neo/framework/Common.h +++ b/neo/framework/Common.h @@ -87,6 +87,8 @@ extern volatile int com_ticNumber; // 60 hz tics, incremented by async functio extern int com_editors; // current active editor(s) extern bool com_editorActive; // true if an editor has focus +extern bool com_debuggerSupported; // only set to true when the updateDebugger function is set. see GetAdditionalFunction() + #ifdef _WIN32 const char DMAP_MSGID[] = "DMAPOutput"; const char DMAP_DONE[] = "DMAPDone"; @@ -271,10 +273,6 @@ public: // it returns true if we're currently running the doom3 demo // not relevant for mods, only for game/ aka base.dll/base.so/... FT_IsDemo = 1, - // the function's signature is bool fn(void) - no arguments. - // it returns true if the game debugger is active - // relevant for mods. - FT_DebuggerActive, // the function's signature is bool fn(idInterpreter,idProgram,int) with arguments: // idInterpreter *interpreter, idProgram *program, int instructionPointer // it returns true if the game debugger is active. diff --git a/neo/tools/debugger/debugger.cpp b/neo/tools/debugger/debugger.cpp index d05a29f9..3bb9043c 100644 --- a/neo/tools/debugger/debugger.cpp +++ b/neo/tools/debugger/debugger.cpp @@ -149,6 +149,12 @@ bool DebuggerServerInit ( void ) { com_enableDebuggerServer.ClearModified( ); + if ( !com_debuggerSupported ) + { + common->Warning( "Called DebuggerServerInit() without the gameDLL supporting it!\n" ); + return false; + } + // Dont do this if we are in the debugger already if ( gDebuggerServer != NULL || ( com_editors & EDITOR_DEBUGGER ) )