mirror of
https://bitbucket.org/CPMADevs/cnq3
synced 2025-01-22 00:11:20 +00:00
can now pass "/crashreport:yes" and "/crashreport:no" to the Windows executables
this will disable the use of message boxes and won't open the crash report directory
This commit is contained in:
parent
ac4928e18d
commit
f9cfe48d11
2 changed files with 27 additions and 8 deletions
|
@ -1,6 +1,9 @@
|
||||||
|
|
||||||
DD Mmm 18 - 1.50
|
DD Mmm 18 - 1.50
|
||||||
|
|
||||||
|
add: on Windows, "/crashreport:yes" and "/crashreport:no" command-line arguments
|
||||||
|
they enable the the crash handler's quiet mode (no dialog window will be shown)
|
||||||
|
|
||||||
add: the fs_restart command to manually restart the file system
|
add: the fs_restart command to manually restart the file system
|
||||||
|
|
||||||
chg: even lower CPU usage when minimized
|
chg: even lower CPU usage when minimized
|
||||||
|
|
|
@ -474,6 +474,8 @@ static qbool WIN_WouldDebuggingBeOkay()
|
||||||
//
|
//
|
||||||
|
|
||||||
static qbool exc_exitCalled = qfalse;
|
static qbool exc_exitCalled = qfalse;
|
||||||
|
static qbool exc_quietMode = qfalse;
|
||||||
|
static int exc_quietModeDlgRes = IDYES;
|
||||||
|
|
||||||
static LONG WIN_HandleCrash( EXCEPTION_POINTERS* ep )
|
static LONG WIN_HandleCrash( EXCEPTION_POINTERS* ep )
|
||||||
{
|
{
|
||||||
|
@ -513,13 +515,15 @@ static LONG WIN_HandleCrash( EXCEPTION_POINTERS* ep )
|
||||||
|
|
||||||
static const char* mbTitle = "CNQ3 Crash";
|
static const char* mbTitle = "CNQ3 Crash";
|
||||||
static const char* mbMsg = "CNQ3 crashed!\n\nYes to generate a crash report\nNo to continue after attaching a debugger\nCancel to quit";
|
static const char* mbMsg = "CNQ3 crashed!\n\nYes to generate a crash report\nNo to continue after attaching a debugger\nCancel to quit";
|
||||||
const int result = MessageBoxA(NULL, mbMsg, mbTitle, MB_YESNOCANCEL | MB_ICONERROR | MB_TOPMOST);
|
const int result = exc_quietMode ? exc_quietModeDlgRes : MessageBoxA(NULL, mbMsg, mbTitle, MB_YESNOCANCEL | MB_ICONERROR | MB_TOPMOST);
|
||||||
if (result == IDYES) {
|
if (result == IDYES) {
|
||||||
WIN_WriteExceptionFiles(ep);
|
WIN_WriteExceptionFiles(ep);
|
||||||
if (exc_reportWritten)
|
if (!exc_quietMode) {
|
||||||
ShellExecute(NULL, "open", exc_reportFolderPath, NULL, NULL, SW_SHOW);
|
if (exc_reportWritten)
|
||||||
else
|
ShellExecute(NULL, "open", exc_reportFolderPath, NULL, NULL, SW_SHOW);
|
||||||
MessageBoxA(NULL, "CNQ3's crash report generation failed!\nExiting now", mbTitle, MB_OK | MB_ICONERROR);
|
else
|
||||||
|
MessageBoxA(NULL, "CNQ3's crash report generation failed!\nExiting now", mbTitle, MB_OK | MB_ICONERROR);
|
||||||
|
}
|
||||||
} else if (result == IDNO && IsDebuggerPresent()) {
|
} else if (result == IDNO && IsDebuggerPresent()) {
|
||||||
return EXCEPTION_CONTINUE_SEARCH;
|
return EXCEPTION_CONTINUE_SEARCH;
|
||||||
}
|
}
|
||||||
|
@ -530,7 +534,7 @@ static LONG WIN_HandleCrash( EXCEPTION_POINTERS* ep )
|
||||||
// Always called.
|
// Always called.
|
||||||
static LONG CALLBACK WIN_FirstExceptionHandler( EXCEPTION_POINTERS* ep )
|
static LONG CALLBACK WIN_FirstExceptionHandler( EXCEPTION_POINTERS* ep )
|
||||||
{
|
{
|
||||||
#if defined(DEBUG) || defined(CNQ3_DEV)
|
#if defined(CNQ3_DEV)
|
||||||
MessageBeep(MB_OK);
|
MessageBeep(MB_OK);
|
||||||
Sleep(1000);
|
Sleep(1000);
|
||||||
#endif
|
#endif
|
||||||
|
@ -549,7 +553,7 @@ static LONG CALLBACK WIN_FirstExceptionHandler( EXCEPTION_POINTERS* ep )
|
||||||
// we won't get the chance to minimize the window etc. :-(
|
// we won't get the chance to minimize the window etc. :-(
|
||||||
static LONG CALLBACK WIN_LastExceptionHandler( EXCEPTION_POINTERS* ep )
|
static LONG CALLBACK WIN_LastExceptionHandler( EXCEPTION_POINTERS* ep )
|
||||||
{
|
{
|
||||||
#if defined(DEBUG) || defined(CNQ3_DEV)
|
#if defined(CNQ3_DEV)
|
||||||
MessageBeep(MB_ICONERROR);
|
MessageBeep(MB_ICONERROR);
|
||||||
Sleep(1000);
|
Sleep(1000);
|
||||||
#endif
|
#endif
|
||||||
|
@ -585,9 +589,21 @@ void WIN_InstallExceptionHandlers()
|
||||||
// SEM_FAILCRITICALERRORS -> no abort/retry/fail errors
|
// SEM_FAILCRITICALERRORS -> no abort/retry/fail errors
|
||||||
// SEM_NOGPFAULTERRORBOX -> the Windows Error Reporting dialog will not be shown
|
// SEM_NOGPFAULTERRORBOX -> the Windows Error Reporting dialog will not be shown
|
||||||
SetErrorMode(SetErrorMode(0) | SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
|
SetErrorMode(SetErrorMode(0) | SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
|
||||||
|
|
||||||
|
for (int i = 1; i < __argc; ++i) {
|
||||||
|
if (!Q_stricmp(__argv[i], "/crashreport:yes")) {
|
||||||
|
exc_quietMode = qtrue;
|
||||||
|
exc_quietModeDlgRes = IDYES;
|
||||||
|
break;
|
||||||
|
} else if (!Q_stricmp(__argv[i], "/crashreport:no")) {
|
||||||
|
exc_quietMode = qtrue;
|
||||||
|
exc_quietModeDlgRes = IDCANCEL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(DEBUG) || defined(CNQ3_DEV)
|
#if defined(CNQ3_DEV)
|
||||||
|
|
||||||
static void WIN_RaiseException_f()
|
static void WIN_RaiseException_f()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue