mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-10 20:46:47 +03:00
Removing Debug Console
This commit is contained in:
parent
4521994088
commit
09b86dcb35
1 changed files with 0 additions and 45 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue