diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2d3a33b40..fbf2d6f2a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -310,15 +310,6 @@ if("${SRB2_CONFIG_HWRENDER}") endif() endif() -# TODO: build this with the game -if(${CMAKE_SYSTEM} MATCHES Windows AND ${CMAKE_C_COMPILER_ID} MATCHES "GNU" AND ${SRB2_SYSTEM_BITS} EQUAL 32) - target_link_libraries(SRB2SDL2 PRIVATE - "${CMAKE_CURRENT_SOURCE_DIR}/../libs/drmingw/lib/win32/libexchndl.a" - "${CMAKE_CURRENT_SOURCE_DIR}/../libs/drmingw/lib/win32/libmgwhelp.a" - ) - target_include_directories(SRB2SDL2 PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../libs/drmingw/include") -endif() - if(${SRB2_CONFIG_USEASM}) #SRB2_ASM_FLAGS can be used to pass flags to either nasm or yasm. if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") @@ -401,7 +392,7 @@ target_compile_options(SRB2SDL2 PRIVATE -Winline -Wformat-y2k -Wformat-security - + $<$,2.9.5>: -Wno-div-by-zero -Wendif-labels diff --git a/src/sdl/i_main.cpp b/src/sdl/i_main.cpp index 105352e41..be3664ab4 100644 --- a/src/sdl/i_main.cpp +++ b/src/sdl/i_main.cpp @@ -71,10 +71,6 @@ char logfilename[1024]; #endif #endif -#if defined (_WIN32) -#include -#endif - #if defined (_WIN32) extern "C" { #include "../win32/win_dbg.h" @@ -202,6 +198,20 @@ static void InitLogging(void) } #endif +static void init_exchndl() +{ +#ifdef _WIN32 + HMODULE exchndl_module = LoadLibraryA("exchndl.dll"); + if (exchndl_module != NULL) + { + using PFN_ExcHndlInit = void(*)(void); + PFN_ExcHndlInit pfnExcHndlInit = reinterpret_cast( + GetProcAddress(exchndl_module, "ExcHndlInit")); + if (pfnExcHndlInit != NULL) + (pfnExcHndlInit)(); + } +#endif +} #ifdef _WIN32 static void @@ -294,7 +304,7 @@ int main(int argc, char **argv) ) #endif { - ExcHndlInit(); + init_exchndl(); } } #ifndef __MINGW32__