Tier2: only show message boxes if -nomessagebox isn't passed in

Typically for dedicated servers you don't want any message boxes as they hang the process. The '-nomessagebox' helps solve this problem. Also removed extraneous check on MessageBoxA in EngineLoggerSink, we should always terminate regardless if MessageBoxA fails or not. The error will always be logged anyways.
This commit is contained in:
Kawe Mazidjatari 2024-10-06 22:29:22 +02:00
parent 02ba900a18
commit 7a62cf8c8b
2 changed files with 11 additions and 4 deletions

View File

@ -1,4 +1,7 @@
#include "tier0/utility.h"
#ifndef _TOOLS
#include "tier0/commandline.h"
#endif // !_TOOLS
#include "init.h"
#include "logdef.h"
#include "logger.h"
@ -320,10 +323,12 @@ void EngineLoggerSink(LogType_t logType, LogLevel_t logLevel, eDLL_T context,
if (exitCode) // Terminate the process if an exit code was passed.
{
if (MessageBoxA(NULL, Format("%s- %s", pszUpTime, formatted.c_str()).c_str(),
"SDK Error", MB_ICONERROR | MB_OK))
#ifndef _TOOLS
if (!CommandLine()->CheckParm("-nomessagebox"))
#endif // !_TOOLS
{
MessageBoxA(NULL, Format("%s- %s", pszUpTime, formatted.c_str()).c_str(), "SDK Error", MB_ICONERROR | MB_OK);
}
TerminateProcess(GetCurrentProcess(), exitCode);
}
}
}

View File

@ -5,6 +5,7 @@
//=============================================================================//
#include "tier0/crashhandler.h"
#include "tier0/cpu.h"
#include "tier0/commandline.h"
#include "tier2/curlutils.h"
#include "tier2/crashreporter.h"
@ -69,6 +70,7 @@ static inline string CrashReporter_FormatAttributes(const CCrashHandler* const h
void CrashReporter_SubmitToCollector(const CCrashHandler* const handler)
{
if (!CommandLine()->CheckParm("-nomessagebox"))
handler->CreateMessageProcess();
if (!CrashReporter_ShouldSubmitReport())