From 09b86dcb355cc0cfa8159d40ccd2fa01a5eb909d Mon Sep 17 00:00:00 2001 From: Nils Date: Wed, 3 Feb 2021 16:21:24 +0100 Subject: [PATCH] Removing Debug Console --- TR5Main/Specific/winmain.cpp | 45 ------------------------------------ 1 file changed, 45 deletions(-) diff --git a/TR5Main/Specific/winmain.cpp b/TR5Main/Specific/winmain.cpp index 1ef179967..8fa1a96b2 100644 --- a/TR5Main/Specific/winmain.cpp +++ b/TR5Main/Specific/winmain.cpp @@ -33,7 +33,6 @@ extern int IsLevelLoading; extern GameFlow* g_GameFlow; extern GameScript* g_GameScript; extern GameConfiguration g_Configuration; -DWORD DebugConsoleThreadID; DWORD MainThreadID; bool BlockAllInput = true; int skipLoop = -1; @@ -191,12 +190,6 @@ void HandleScriptMessage(WPARAM wParam) LRESULT CALLBACK WinAppProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { - if (msg == WM_USER + 0) - { - HandleScriptMessage(wParam); - return 0; - } - // Disables ALT + SPACE if (msg == WM_SYSCOMMAND && wParam == SC_KEYMENU) return 0; @@ -388,44 +381,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine UpdateWindow(WindowsHandle); ShowWindow(WindowsHandle, nShowCmd); - //Create debug script terminal - if (Debug) - { - MainThreadID = GetWindowThreadProcessId(WindowsHandle, NULL); - AllocConsole(); - HANDLE handle_in = GetStdHandle(STD_INPUT_HANDLE); - DWORD consoleModeIn; - int hCrt = _open_osfhandle((long)handle_in, _O_BINARY); - FILE* hf_in = _fdopen(hCrt, "r"); - setvbuf(hf_in, NULL, _IONBF, 512); - GetConsoleMode(handle_in, &consoleModeIn); - consoleModeIn = consoleModeIn | ENABLE_LINE_INPUT; - SetConsoleMode(handle_in, consoleModeIn); - freopen_s(&hf_in, "CONIN$", "r", stdin); - - HANDLE ConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE); - int SystemOutput = _open_osfhandle(intptr_t(ConsoleOutput), _O_TEXT); - FILE* COutputHandle = _fdopen(SystemOutput, "w"); - freopen_s(&COutputHandle, "CONOUT$", "w", stdout); - - LPTHREAD_START_ROUTINE readConsoleLoop = [](LPVOID params) -> DWORD { - DWORD read; - CHAR buffer[4096]; - while (true) - { - BOOL success = ReadFile(params, &buffer, 4096, &read, NULL); - if (success && read > 2) - { - //Only send the actual written message minus \r\n - string msg(buffer, read-2); - SendMessage(WindowsHandle, WM_USER, (WPARAM)&msg, NULL); - } - }; - return 0; - }; - CreateThread(NULL, 0, readConsoleLoop, handle_in, 0, &DebugConsoleThreadID); - } - SetCursor(NULL); ShowCursor(FALSE); hAccTable = LoadAccelerators(hInstance, (LPCSTR)0x65);