Skip to content

Commit

Permalink
move allocconsole into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Ciremun committed May 27, 2024
1 parent 6e79672 commit 11d0a52
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions freedom/dll/dll_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,6 @@ __declspec(naked) void opengl_update()
g_process = GetCurrentProcess();
g_hwnd = WindowFromDC(wglGetCurrentDC());

#ifdef FR_LOG_TO_CONSOLE
AllocConsole();
FILE *f;
freopen_s(&f, "CONOUT$", "w", stdout);
freopen_s(&f, "CONOUT$", "w", stderr);
#endif // FR_LOG_TO_CONSOLE

init_ui();
CloseHandle(CreateThread(0, 0, (LPTHREAD_START_ROUTINE)init_hooks, 0, 0, 0));
}
Expand Down Expand Up @@ -178,6 +171,13 @@ DWORD WINAPI freedom_main(HMODULE hModule)
{
g_module = hModule;

#ifdef FR_LOG_TO_CONSOLE
AllocConsole();
FILE *f;
freopen_s(&f, "CONOUT$", "w", stdout);
freopen_s(&f, "CONOUT$", "w", stderr);
#endif // FR_LOG_TO_CONSOLE

SwapBuffersHook = Hook<Trampoline32>("wglSwapBuffers", "opengl32.dll", (BYTE *)opengl_update, (BYTE *)&wglSwapBuffersGateway, 5);
SwapBuffersHook.free_gateway = false;
SwapBuffersHook.src += 14;
Expand Down

0 comments on commit 11d0a52

Please sign in to comment.