#ifdef WIN32
-#ifdef _MSC_VER
-#pragma comment(lib, "sdl.lib")
-#pragma comment(lib, "sdlmain.lib")
-#endif
#include <io.h>
#include "conio.h"
#else
#include <SDL.h>
+#ifdef WIN32
+#ifdef _MSC_VER
+#pragma comment(lib, "sdl2.lib")
+#pragma comment(lib, "sdl2main.lib")
+#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);
+ 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)
{
-#ifdef 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 ();
+ cliptext = SDL_GetClipboardText();
+ if (cliptext != NULL) {
+ size_t allocsize;
+ allocsize = strlen(cliptext) + 1;
+ data = (char *)Z_Malloc (allocsize);
+ strlcpy (data, cliptext, allocsize);
+ SDL_free(cliptext);
}
+
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;