CommonHostInterface: Fix command line help not printing on Windows

This commit is contained in:
Connor McLaughlin
2020-07-20 01:50:01 +10:00
parent dae54d06ea
commit eb7da791ea
3 changed files with 52 additions and 25 deletions

View File

@@ -75,6 +75,16 @@ void UnregisterCallback(CallbackFunctionType callbackFunction, void* pUserParam)
}
}
bool IsConsoleOutputEnabled()
{
return s_consoleOutputEnabled;
}
bool IsDebugOutputEnabled()
{
return s_debugOutputEnabled;
}
static void ExecuteCallbacks(const char* channelName, const char* functionName, LOGLEVEL level, const char* message)
{
std::lock_guard<std::mutex> guard(s_callback_mutex);
@@ -273,8 +283,15 @@ void SetConsoleOutputParams(bool Enabled, const char* ChannelFilter, LOGLEVEL Le
if (GetConsoleWindow() == NULL)
{
DebugAssert(!console_was_allocated);
// Attach to the parent console if we're running from a command window
if (!AttachConsole(ATTACH_PARENT_PROCESS))
{
if (!AllocConsole())
return;
}
console_was_allocated = true;
AllocConsole();
std::FILE* fp;
freopen_s(&fp, "CONIN$", "r", stdin);