win32.c
changeset 2428 b2e4fb6665d0
parent 2338 8b953706648a
child 2458 c95808cd2ac9
--- a/win32.c	Wed Sep 14 22:03:27 2005 +0000
+++ b/win32.c	Thu Sep 15 21:59:07 2005 +0000
@@ -61,13 +61,8 @@
 }
 
 #ifdef _MSC_VER
-
 static const char *_exception_string;
-static void *_safe_esp;
-static char *_crash_msg;
-static bool _expanded;
-static bool _did_emerg_save;
-static int _ident;
+#endif
 
 void ShowOSErrorBox(const char *buf)
 {
@@ -83,6 +78,14 @@
 #endif
 }
 
+#ifdef _MSC_VER
+
+static void *_safe_esp;
+static char *_crash_msg;
+static bool _expanded;
+static bool _did_emerg_save;
+static int _ident;
+
 typedef struct DebugFileInfo {
 	uint32 size;
 	uint32 crc32;
@@ -544,15 +547,6 @@
 
 	SetUnhandledExceptionFilter(ExceptionHandler);
 }
-#else
-/* Get rid of unused variable warnings.. ShowOSErrorBox
- * is now used twice, once in MSVC, and once in all other Win
- * compilers (cygwin, mingw, etc.) */
-void ShowOSErrorBox(const char *buf)
-{
-	MyShowCursor(true);
-	MessageBoxA(GetActiveWindow(), buf, "Error!", MB_ICONSTOP);
-}
 #endif
 
 #ifndef __MINGW32__
@@ -1064,6 +1058,14 @@
 	}
 }
 
+#ifdef __MINGW32__
+	/* _set_error_mode() constants&function (do not exist in mingw headers) */
+	#define _OUT_TO_DEFAULT      0
+	#define _OUT_TO_STDERR       1
+	#define _OUT_TO_MSGBOX       2
+	#define _REPORT_ERRMODE      3
+	int _set_error_mode(int);
+#endif
 
 int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
 	LPTSTR lpCmdLine, int nCmdShow)
@@ -1075,8 +1077,7 @@
 	CreateConsole();
 #endif
 
-	// make sure we have an autosave folder - Done in DeterminePaths
-	// CreateDirectory("autosave", NULL);
+	_set_error_mode(_OUT_TO_MSGBOX); // force assertion output to messagebox
 
 	// setup random seed to something quite random
 #if defined(_MSC_VER)