Free console earlier

This commit is contained in:
momo5502 2016-09-08 21:46:12 +02:00
parent af21b8a6d9
commit daac5489d9
3 changed files with 12 additions and 1 deletions

View File

@ -483,6 +483,14 @@ namespace Components
Console::SkipShutdown = true; Console::SkipShutdown = true;
} }
void Console::FreeNativeConsole()
{
if (Flags::HasFlag("console") || ZoneBuilder::IsEnabled())
{
FreeConsole();
}
}
Console::Console() Console::Console()
{ {
// Console '%s: %s> ' string // Console '%s: %s> ' string
@ -527,7 +535,6 @@ namespace Components
} }
else if (Flags::HasFlag("console") || ZoneBuilder::IsEnabled()) // ZoneBuilder uses the game's console, until the native one is adapted. else if (Flags::HasFlag("console") || ZoneBuilder::IsEnabled()) // ZoneBuilder uses the game's console, until the native one is adapted.
{ {
FreeConsole();
Utils::Hook::Nop(0x60BB58, 11); Utils::Hook::Nop(0x60BB58, 11);
// Redirect input (]command) // Redirect input (]command)

View File

@ -15,6 +15,8 @@ namespace Components
static void SetSkipShutdown(); static void SetSkipShutdown();
static void FreeNativeConsole();
private: private:
// Text-based console stuff // Text-based console stuff
static WINDOW* OutputWindow; static WINDOW* OutputWindow;

View File

@ -17,6 +17,8 @@ namespace Components
ExitProcess(0); ExitProcess(0);
} }
Console::FreeNativeConsole();
if (Dedicated::IsEnabled() || ZoneBuilder::IsEnabled()) return; if (Dedicated::IsEnabled() || ZoneBuilder::IsEnabled()) return;
Singleton::FirstInstance = (CreateMutexA(NULL, FALSE, "iw4x_mutex") && GetLastError() != ERROR_ALREADY_EXISTS); Singleton::FirstInstance = (CreateMutexA(NULL, FALSE, "iw4x_mutex") && GetLastError() != ERROR_ALREADY_EXISTS);