Console is now only initialized when the emulator is started with the -D / --debug parameter.

This commit is contained in:
OBattler
2020-04-22 13:19:28 +02:00
parent 21f979a748
commit 15dcd63e72

View File

@@ -233,6 +233,7 @@ CreateConsole(int init)
int i;
if (! init) {
if (force_debug)
FreeConsole();
return;
}
@@ -271,6 +272,13 @@ CreateConsole(int init)
}
static void
CloseConsole(void)
{
CreateConsole(0);
}
/* Process the commandline, and create standard argc/argv array. */
static int
ProcessCommandLine(wchar_t ***argw)
@@ -362,6 +370,7 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nCmdShow)
set_language(0x0409);
/* Create console window. */
if (force_debug)
CreateConsole(1);
/* Process the command line for options. */
@@ -370,6 +379,7 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nCmdShow)
/* Pre-initialize the system, this loads the config file. */
if (! pc_init(argc, argw)) {
/* Detach from console. */
if (force_debug)
CreateConsole(0);
if (source_hwnd)
@@ -380,9 +390,8 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nCmdShow)
return(1);
}
/* Cleanup: we may no longer need the console. */
if (! force_debug)
CreateConsole(0);
if (force_debug)
atexit(CloseConsole);
/* Handle our GUI. */
i = ui_init(nCmdShow);