From bf56157c9a3a50452d322dd99aa5b82baf4b0013 Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Mon, 9 May 2022 19:53:22 +0100 Subject: uiscript_reset concommand: don't loop forever if compilation fails --- NorthstarDedicatedTest/squirrel.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'NorthstarDedicatedTest') 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 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, -- cgit v1.2.3