Skip to content

Commit

Permalink
Hook only in debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ScriptedSnark committed Jul 17, 2024
1 parent 8471dce commit 91029e6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions launcher/launcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
}
#endif

#ifdef DEBUG
MH_Initialize();
#endif

WSADATA WSAData;
::WSAStartup(MAKEWORD(2, 0), &WSAData);
Expand Down Expand Up @@ -286,9 +288,11 @@ int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi

CSysModule* hLibModule = Sys_LoadModule(pszLibFileName);

#ifdef DEBUG
HookSDL2();
HookEngine(); // it must be here!!!
MH_EnableHook(MH_ALL_HOOKS);
#endif

if (hLibModule)
{
Expand Down Expand Up @@ -353,7 +357,9 @@ int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
g_pFileSystem->Unmount();
Sys_UnloadModule(hModule);

#ifdef DEBUG
MH_Uninitialize();
#endif
} while (bRestartEngine);

registry->Shutdown();
Expand Down

0 comments on commit 91029e6

Please sign in to comment.