]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sys_sdl.c
Correct wrong function names in the VM_SAFEPARMCOUNT calls, found by terencehill
[xonotic/darkplaces.git] / sys_sdl.c
index b4698fb2440fef08bed06e4ae6718a2fb772227d..e3b2956edafe19a3c9ba40e72a1a3104e14c6964 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, "Engine Error", string, NULL);
 
        Host_Shutdown ();
        exit (1);
@@ -174,7 +173,7 @@ char *Sys_GetClipboardData (void)
        cliptext = SDL_GetClipboardText();
        if (cliptext != NULL) {
                size_t allocsize;
-               allocsize = strlen(cliptext) + 1;
+               allocsize = min(MAX_INPUTLINE, strlen(cliptext) + 1);
                data = (char *)Z_Malloc (allocsize);
                strlcpy (data, cliptext, allocsize);
                SDL_free(cliptext);
@@ -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;