diff --git a/src/dllmain.cpp b/src/dllmain.cpp index 601d7c5..46a829c 100644 --- a/src/dllmain.cpp +++ b/src/dllmain.cpp @@ -56,6 +56,10 @@ void ImGuiThread(void* param) { } } +void __stdcall _wrapper(DWORD saveSlot) { + ScriptExData::Clear(); +} + BOOL WINAPI DllMain(HINSTANCE hDllHandle, DWORD nReason, LPVOID Reserved) { if (nReason == DLL_PROCESS_ATTACH) { #ifdef RUNTIME_CLEO @@ -83,7 +87,12 @@ BOOL WINAPI DllMain(HINSTANCE hDllHandle, DWORD nReason, LPVOID Reserved) { if (id == HostId::SA_UNREAL) gGameVer = eGameVer::SA_DE; if (id == HostId::BULLY) gGameVer = eGameVer::BullySE; #endif - wOnGameLoadEvent(ScriptExData::Clear); + +#ifdef RUNTIME_CLEO + CLEO::CLEO_RegisterCallback(CLEO::eCallbackId::GameBegin, _wrapper); +#else + OnRuntimeInit((OnRuntimeInitCallback)ScriptExData::Clear); +#endif OpcodeMgr::RegisterCommands(); CreateThread(nullptr, NULL, (LPTHREAD_START_ROUTINE)&ImGuiThread, nullptr, NULL, nullptr); diff --git a/src/wrapper.hpp b/src/wrapper.hpp index bae5c75..d9d5af7 100644 --- a/src/wrapper.hpp +++ b/src/wrapper.hpp @@ -20,15 +20,6 @@ #define RUNTIME_STR_LEN 128 - -static void wOnGameLoadEvent(void* func) { -#ifdef RUNTIME_CLEO - CLEO::CLEO_RegisterCallback(CLEO::eCallbackId::GameBegin, func); -#else - OnRuntimeInit((OnRuntimeInitCallback)func); -#endif -} - static void wGetStringParam(RUNTIME_CONTEXT ctx, char* label, unsigned char length) { #ifdef RUNTIME_CLEO CLEO_ReadStringOpcodeParam(ctx, label, length);