]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Show SDL message box on Sys_Error for SDL target. Removed Windows message box
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 26 May 2020 14:40:35 +0000 (14:40 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 26 May 2020 14:40:35 +0000 (14:40 +0000)
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

sys_sdl.c

index b4698fb2440fef08bed06e4ae6718a2fb772227d..757d9d8fdd08f3b60828a1c58f45f69d30f9451e 100644 (file)
--- 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;