From 4b7fe8531e17a7f7774befa57fb6f2bab2913aaf Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Fri, 26 Apr 2024 01:41:38 +0200 Subject: [PATCH] fix mingw debug build --- Makefile | 4 ++++ build.cmd | 1 + src/hook.c | 5 +++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 98d7592..00da29b 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,10 @@ LIBS = -lgdi32 -lwinmm -lpsapi -ldbghelp -lole32 CC = i686-w64-mingw32-gcc WINDRES ?= i686-w64-mingw32-windres +ifdef DEBUG + CFLAGS += -D _DEBUG -D _DEBUG_X +endif + .PHONY: clean all all: $(TARGET) diff --git a/build.cmd b/build.cmd index 539995e..c9d3564 100644 --- a/build.cmd +++ b/build.cmd @@ -5,4 +5,5 @@ REM set PATH=C:\w64devkit\bin make clean make +REM make DEBUG=1 pause diff --git a/src/hook.c b/src/hook.c index d8f72a7..3a1b7cd 100644 --- a/src/hook.c +++ b/src/hook.c @@ -646,12 +646,13 @@ void hook_exit() hook_revert((HOOKLIST*)&g_hook_hooklist); -#if defined(_DEBUG) && defined(_MSC_VER) +#if defined(_DEBUG) +#if defined(_MSC_VER) DetourTransactionBegin(); DetourUpdateThread(GetCurrentThread()); DetourDetach((PVOID*)&real_SetUnhandledExceptionFilter, (PVOID)fake_SetUnhandledExceptionFilter); DetourTransactionCommit(); - +#endif real_SetUnhandledExceptionFilter(g_dbg_exception_filter); #endif