From 7206103e09eaf1c85f1f0e3841e0fb3d9ef6b8f8 Mon Sep 17 00:00:00 2001 From: Grinch_ Date: Sat, 22 Jun 2024 03:31:36 -0600 Subject: [PATCH] Fix bugs --- src/dllmain.cpp | 11 ++++++++++- src/wrapper.hpp | 9 --------- 2 files changed, 10 insertions(+), 10 deletions(-) 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);