diff --git a/polymer/eduke32/build/src/sdlayer.c b/polymer/eduke32/build/src/sdlayer.c index 88e454f15..45f53b8a9 100644 --- a/polymer/eduke32/build/src/sdlayer.c +++ b/polymer/eduke32/build/src/sdlayer.c @@ -109,6 +109,7 @@ static mutex_t m_initprintf; uint16_t *joydead, *joysatur; #ifdef _WIN32 +# if SDL_MAJOR_VERSION != 1 // // win_gethwnd() -- gets the window handle // @@ -127,6 +128,7 @@ HWND win_gethwnd(void) return 0; } +# endif // // win_gethinstance() -- gets the application instance // @@ -245,13 +247,14 @@ void wm_setapptitle(const char *name) Bstrncpyz(apptitle, name, sizeof(apptitle)); #if !defined(__APPLE__) - appicon = loadappicon(); + if (!appicon) + appicon = loadappicon(); #endif #if SDL_MAJOR_VERSION == 1 SDL_WM_SetCaption(apptitle, NULL); - if (appicon) + if (appicon && sdl_surface) SDL_WM_SetIcon(appicon, 0); #else SDL_SetWindowTitle(sdl_window, apptitle); diff --git a/polymer/eduke32/build/src/sdlayer12.c b/polymer/eduke32/build/src/sdlayer12.c index e42a9d0c1..53822df19 100644 --- a/polymer/eduke32/build/src/sdlayer12.c +++ b/polymer/eduke32/build/src/sdlayer12.c @@ -1,4 +1,4 @@ -// SDL 1.2 compatibility. Not for Windows, Android, iOS or anything with a working port of SDL 2.0 +// SDL 1.2 compatibility. #include @@ -33,6 +33,22 @@ int32_t wm_ynbox(const char *name, const char *fmt, ...) return 0; } +#ifdef _WIN32 +HWND win_gethwnd(void) +{ + struct SDL_SysWMinfo wmInfo; + SDL_VERSION(&wmInfo.version); + + if (SDL_GetWMInfo(&wmInfo) != 1) + { + initprintf("win_gethwnd: SDL_GetWindowWMInfo() failed: %s\n", SDL_GetError()); + return 0; + } + + return wmInfo.window; +} +#endif + #ifdef USE_OPENGL void setvsync(int32_t sync) { @@ -174,7 +190,9 @@ static inline char grabmouse_low(char a) // high-resolution timers for profiling uint64_t getu64ticks(void) { -#if defined __APPLE__ +# if defined _WIN32 + return win_getu64ticks(); +# elif defined __APPLE__ return mach_absolute_time(); # elif _POSIX_TIMERS>0 && defined _POSIX_MONOTONIC_CLOCK // This is SDL HG's SDL_GetPerformanceCounter() when clock_gettime() is diff --git a/polymer/eduke32/build/src/winbits.c b/polymer/eduke32/build/src/winbits.c index 38c709933..f6fdc4e50 100644 --- a/polymer/eduke32/build/src/winbits.c +++ b/polymer/eduke32/build/src/winbits.c @@ -292,5 +292,6 @@ int32_t addsearchpath_ProgramFiles(const char *p) // Workaround for a bug in mingwrt-4.0.0 and up where a function named main() in misc/src/libcrt/gdtoa/qnan.c takes precedence over the proper one in src/libcrt/crt/main.c. #if (defined __MINGW32__ && EDUKE32_GCC_PREREQ(4,8)) || EDUKE32_CLANG_PREREQ(3,4) +# undef main # include "mingw_main.c" #endif diff --git a/polymer/eduke32/rsrc/eduke32_icon.c b/polymer/eduke32/rsrc/eduke32_icon.c index d0e3039d7..babf6bd6f 100644 --- a/polymer/eduke32/rsrc/eduke32_icon.c +++ b/polymer/eduke32/rsrc/eduke32_icon.c @@ -1,6 +1,7 @@ #include "compat.h" #include "sdlappicon.h" +#include "sdl_inc.h" static uint8_t sdlappicon_pixels[] = { #if defined _WIN32 && SDL_MAJOR_VERSION==1