Skip to content

Commit

Permalink
Fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
user-grinch committed Jun 22, 2024
1 parent 638ef32 commit 7206103
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
11 changes: 10 additions & 1 deletion src/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
9 changes: 0 additions & 9 deletions src/wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7206103

Please sign in to comment.