From 11d0a52a1f5ba3d0c3358f3a9a1871e8f6671954 Mon Sep 17 00:00:00 2001 From: Ciremun Date: Tue, 28 May 2024 00:22:41 +0300 Subject: [PATCH] move allocconsole into main --- freedom/dll/dll_main.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/freedom/dll/dll_main.cpp b/freedom/dll/dll_main.cpp index 2f7b107..c2d0254 100644 --- a/freedom/dll/dll_main.cpp +++ b/freedom/dll/dll_main.cpp @@ -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)); } @@ -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("wglSwapBuffers", "opengl32.dll", (BYTE *)opengl_update, (BYTE *)&wglSwapBuffersGateway, 5); SwapBuffersHook.free_gateway = false; SwapBuffersHook.src += 14;