diff options
author | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2022-05-09 19:53:22 +0100 |
---|---|---|
committer | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2022-05-09 19:53:22 +0100 |
commit | bf56157c9a3a50452d322dd99aa5b82baf4b0013 (patch) | |
tree | 84343d53c8e0f6ff1fac4d5fbfa7137e6915ed23 | |
parent | 7a2f17c9d13371e1beb62014f2ec0169124c9862 (diff) | |
download | NorthstarLauncher-bf56157c9a3a50452d322dd99aa5b82baf4b0013.tar.gz NorthstarLauncher-bf56157c9a3a50452d322dd99aa5b82baf4b0013.zip |
uiscript_reset concommand: don't loop forever if compilation fails
-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, |