From: cloudwalk Date: Tue, 26 May 2020 14:40:35 +0000 (+0000) Subject: Show SDL message box on Sys_Error for SDL target. Removed Windows message box X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ceb1f2c61e7baf03ec86aa002c663dad9592f5a8;p=xonotic%2Fdarkplaces.git Show SDL message box on Sys_Error for SDL target. Removed Windows message box Added a new command-line option "-nocrashdialog" to disable, if needed. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12588 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/sys_sdl.c b/sys_sdl.c index b4698fb2..757d9d8f 100644 --- a/sys_sdl.c +++ b/sys_sdl.c @@ -45,7 +45,7 @@ void Sys_Shutdown (void) SDL_Quit(); } - +static qboolean nocrashdialog; void Sys_Error (const char *error, ...) { va_list argptr; @@ -61,10 +61,9 @@ void Sys_Error (const char *error, ...) va_end (argptr); Con_Errorf ("Engine Error: %s\n", string); - -#ifdef WIN32 - MessageBox(NULL, string, "Engine Error", MB_OK | MB_SETFOREGROUND | MB_ICONSTOP); -#endif + + if(!nocrashdialog) + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Quake Error", string, NULL); Host_Shutdown (); exit (1); @@ -197,8 +196,16 @@ int main (int argc, char *argv[]) com_argc = argc; com_argv = (const char **)argv; + + // Sys_Error this early in startup might screw with automated + // workflows or something if we show the dialog by default. + nocrashdialog = true; + Sys_ProvideSelfFD(); + // COMMANDLINEOPTION: -nocrashdialog disables "Engine Error" crash dialog boxes + if(!COM_CheckParm("-nocrashdialog")) + nocrashdialog = false; // COMMANDLINEOPTION: sdl: -noterminal disables console output on stdout if(COM_CheckParm("-noterminal")) outfd = -1;