add drmingw's exchndl support

This commit is contained in:
radius 2018-12-10 20:03:03 -05:00
parent fc8abd7baf
commit 0b13cba4ea
4 changed files with 25 additions and 2 deletions

View File

@ -82,6 +82,11 @@ else
OPTIMIZE_FLAG = -O3 -ffast-math
endif
ifeq ($(HAVE_DRMINGW), 1)
CFLAGS += -DHAVE_DRMINGW
LDFLAGS += $(DRMINGW_LIBS)
endif
ifneq ($(findstring Win32,$(OS)),)
LDFLAGS += -mwindows
endif

View File

@ -418,6 +418,9 @@ if [ "$HAVE_THREADS" = 'no' ] && [ "$HAVE_FFMPEG" != 'no' ]; then
die : 'Notice: Threads are not available, FFmpeg will also be disabled.'
fi
check_header DRMINGW exchndl.h
check_lib '' DRMINGW -lexchndl
if [ "$HAVE_FFMPEG" != 'no' ]; then
check_pkgconf AVCODEC libavcodec 54
check_pkgconf AVFORMAT libavformat 54

View File

@ -134,3 +134,4 @@ HAVE_LANGEXTRA=yes # Multi-language support
HAVE_OSMESA=no # Off-screen Mesa rendering
HAVE_VIDEOPROCESSOR=auto # Enable video processor core
HAVE_VIDEOCORE=auto # Broadcom Videocore 4 support
HAVE_DRMINGW=no # DrMingw exception handler

View File

@ -23,6 +23,9 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
#if defined(DEBUG) && defined(HAVE_DRMINGW)
#include "exchndl.h"
#endif
#endif
#include <stdlib.h>
@ -1255,7 +1258,7 @@ static void retroarch_validate_cpu_features(void)
static void retroarch_main_init_media(void)
{
settings_t *settings = config_get_ptr();
settings_t *settings = config_get_ptr();
const char *fullpath = path_get(RARCH_PATH_CONTENT);
bool builtin_imageviewer = false;
bool builtin_mediaplayer = false;
@ -1316,6 +1319,10 @@ bool retroarch_main_init(int argc, char *argv[])
bool init_failed = false;
global_t *global = global_get_ptr();
#if defined(DEBUG) && defined(HAVE_DRMINGW)
char log_file_name[128];
#endif
retroarch_init_state();
if (setjmp(error_sjlj_context) > 0)
@ -1334,7 +1341,6 @@ bool retroarch_main_init(int argc, char *argv[])
if (verbosity_is_enabled())
{
char str[128];
str[0] = '\0';
RARCH_LOG_OUTPUT("=== Build =======================================\n");
@ -1348,6 +1354,14 @@ bool retroarch_main_init(int argc, char *argv[])
RARCH_LOG_OUTPUT("=================================================\n");
}
#if defined(DEBUG) && defined(HAVE_DRMINGW)
RARCH_LOG("Initializing Dr.MingW Exception handler\n");
fill_str_dated_filename(log_file_name, "crash",
"log", sizeof(log_file_name));
ExcHndlInit();
ExcHndlSetLogFileNameA(log_file_name);
#endif
retroarch_validate_cpu_features();
rarch_ctl(RARCH_CTL_TASK_INIT, NULL);