]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sys_sdl.c
Add hook.[ch] to VS2017 project.
[xonotic/darkplaces.git] / sys_sdl.c
index 88369e1f9760fd5384e682165de39bcf6735906c..819848614080f06cbe5d79d6c05568bf38c30590 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;
@@ -60,11 +60,10 @@ void Sys_Error (const char *error, ...)
        dpvsnprintf (string, sizeof (string), error, argptr);
        va_end (argptr);
 
-       Con_Printf ("Engine Error: %s\n", string);
-
-#ifdef WIN32
-       MessageBox(NULL, string, "Engine Error", MB_OK | MB_SETFOREGROUND | MB_ICONSTOP);
-#endif
+       Con_Errorf ("Engine Error: %s\n", string);
+       
+       if(!nocrashdialog)
+               SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Engine 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;