mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-16 00:12:51 +00:00
(svn r2954) - Force assertion message to be output to a messagebox instead to the console which MinGW32 had the habit of doing. Using undocumented (in mingw) __set_error_mode() function.
This commit is contained in:
parent
3907e46939
commit
3926d006b0
35
win32.c
35
win32.c
@ -61,13 +61,8 @@ bool LoadLibraryList(Function proc[], const char* dll)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
|
||||||
static const char *_exception_string;
|
static const char *_exception_string;
|
||||||
static void *_safe_esp;
|
#endif
|
||||||
static char *_crash_msg;
|
|
||||||
static bool _expanded;
|
|
||||||
static bool _did_emerg_save;
|
|
||||||
static int _ident;
|
|
||||||
|
|
||||||
void ShowOSErrorBox(const char *buf)
|
void ShowOSErrorBox(const char *buf)
|
||||||
{
|
{
|
||||||
@ -83,6 +78,14 @@ void ShowOSErrorBox(const char *buf)
|
|||||||
#endif
|
#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 {
|
typedef struct DebugFileInfo {
|
||||||
uint32 size;
|
uint32 size;
|
||||||
uint32 crc32;
|
uint32 crc32;
|
||||||
@ -544,15 +547,6 @@ static void Win32InitializeExceptions(void)
|
|||||||
|
|
||||||
SetUnhandledExceptionFilter(ExceptionHandler);
|
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
|
#endif
|
||||||
|
|
||||||
#ifndef __MINGW32__
|
#ifndef __MINGW32__
|
||||||
@ -1064,6 +1058,14 @@ void ShowInfo(const char *str)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#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,
|
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||||
LPTSTR lpCmdLine, int nCmdShow)
|
LPTSTR lpCmdLine, int nCmdShow)
|
||||||
@ -1075,8 +1077,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
|||||||
CreateConsole();
|
CreateConsole();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// make sure we have an autosave folder - Done in DeterminePaths
|
_set_error_mode(_OUT_TO_MSGBOX); // force assertion output to messagebox
|
||||||
// CreateDirectory("autosave", NULL);
|
|
||||||
|
|
||||||
// setup random seed to something quite random
|
// setup random seed to something quite random
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
|
Loading…
Reference in New Issue
Block a user