Hooks
static bool BeforeLuaSupport_CallAccumulator(ICvEngineScriptSystem1* pkScriptSystem, const char* szName, ICvEngineScriptSystemArgs1* args, int& value, bool& result);static void AfterLuaSupport_CallAccumulator(ICvEngineScriptSystem1* pkScriptSystem, const char* szName, ICvEngineScriptSystemArgs1* args, int& value, bool& result);static bool ReplaceLuaSupport_CallAccumulator(bool (*original)(ICvEngineScriptSystem1*, const char*, ICvEngineScriptSystemArgs1*, int&), ICvEngineScriptSystem1* pkScriptSystem, const char* szName, ICvEngineScriptSystemArgs1* args, int& value);CivRegisterBefore<CivHooks::LuaSupport_CallAccumulator>(host, &BeforeLuaSupport_CallAccumulator);CivRegisterAfter<CivHooks::LuaSupport_CallAccumulator>(host, &AfterLuaSupport_CallAccumulator);CivRegisterReplace<CivHooks::LuaSupport_CallAccumulator>(host, &ReplaceLuaSupport_CallAccumulator);
Code
111bool LuaSupport::CallAccumulator(_In_ ICvEngineScriptSystem1* pkScriptSystem, _In_z_ const char* szName, _In_opt_ ICvEngineScriptSystemArgs1* args, int& value)112{113 // Must release our lock so that if the main thread has the Lua lock and is waiting for the Game Core lock, we don't freeze114 bool bHadLock = gDLL->HasGameCoreLock();115 if(bHadLock)116 gDLL->ReleaseGameCoreLock();117 bool bResult = pkScriptSystem->CallAccumulator(szName, args, value);118 if(bHadLock)119 gDLL->GetGameCoreLock();120 return bResult;121}