#ifdef WIN32
#ifdef _MSC_VER
-#if SDL_MAJOR_VERSION == 1
-#pragma comment(lib, "sdl.lib")
-#pragma comment(lib, "sdlmain.lib")
-#else
#pragma comment(lib, "sdl2.lib")
#pragma comment(lib, "sdl2main.lib")
#endif
#endif
-#endif
#include "quakedef.h"
SDL_Quit();
}
-
+static qboolean nocrashdialog;
void Sys_Error (const char *error, ...)
{
va_list argptr;
dpvsnprintf (string, sizeof (string), error, argptr);
va_end (argptr);
- Con_Printf ("Quake Error: %s\n", string);
-
-#ifdef WIN32
- MessageBox(NULL, string, "Quake 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);
char *Sys_GetClipboardData (void)
{
-#if SDL_MAJOR_VERSION != 1
char *data = NULL;
char *cliptext;
}
return data;
-#elif defined(WIN32)
- char *data = NULL;
- char *cliptext;
-
- if (OpenClipboard (NULL) != 0)
- {
- HANDLE hClipboardData;
-
- if ((hClipboardData = GetClipboardData (CF_TEXT)) != 0)
- {
- if ((cliptext = (char *)GlobalLock (hClipboardData)) != 0)
- {
- size_t allocsize;
- allocsize = GlobalSize (hClipboardData) + 1;
- data = (char *)Z_Malloc (allocsize);
- strlcpy (data, cliptext, allocsize);
- GlobalUnlock (hClipboardData);
- }
- }
- CloseClipboard ();
- }
- return data;
-#else
- return NULL;
-#endif
}
void Sys_InitConsole (void)
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;