diff options
-rw-r--r-- | NorthstarDedicatedTest/squirrel.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/NorthstarDedicatedTest/squirrel.cpp b/NorthstarDedicatedTest/squirrel.cpp index 7851192b..34eb0fdc 100644 --- a/NorthstarDedicatedTest/squirrel.cpp +++ b/NorthstarDedicatedTest/squirrel.cpp @@ -5,6 +5,7 @@ #include "concommand.h" #include "modmanager.h" #include "gameutils.h" +#include "NSMem.h" RegisterSquirrelFuncType ClientRegisterSquirrelFunc; RegisterSquirrelFuncType ServerRegisterSquirrelFunc; @@ -142,7 +143,8 @@ template <ScriptContext context> void ScriptCompileErrorHook(void* sqvm, const c .c_str(), cmd_source_t::kCommandSrcCode); - // TODO: for ui script, we need to prevent the infinite compilation error loop the game will get into on uiscript_reset if there is a compilation error + if (realContext == ScriptContext::UI) + Cbuf_AddText(Cbuf_GetCurrentPlayer(), "toggleconsole", cmd_source_t::kCommandSrcCode); // likely temp: show console so user can see any errors } // dont call the original function since it kills game lol @@ -296,6 +298,9 @@ ON_DLL_LOAD_RELIESON("client.dll", ClientSquirrel, ConCommand, (HMODULE baseAddr g_pClientSquirrel->sq_get = (sq_getType)((char*)baseAddress + 0x7C30); g_pUISquirrel->sq_get = (sq_getType)((char*)baseAddress + 0x7C30); + // uiscript_reset concommand: don't loop forever if compilation fails + NSMem::NOP((uintptr_t)baseAddress + 0x3C6E4C, 6); + ENABLER_CREATEHOOK( hook, (char*)baseAddress + 0x26130, |