From f964ce03b4d77a0b74cb50d8c5b409c9c9395d98 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 28 Sep 2018 01:00:47 -0700 Subject: [PATCH] Fixed mingw-w64 build --- configure | 11 +++++------ configure.in | 11 +++++------ src/hidapi/windows/hid.c | 1 + src/joystick/hidapi/SDL_hidapi_ps4.c | 10 +++++----- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/configure b/configure index 523c1c6c9..c5d3e85fa 100755 --- a/configure +++ b/configure @@ -24296,15 +24296,14 @@ $as_echo "#define SDL_JOYSTICK_DINPUT 1" >>confdefs.h $as_echo "#define SDL_JOYSTICK_WINMM 1" >>confdefs.h fi - SOURCES="$SOURCES $srcdir/src/joystick/windows/*.c" - have_joystick=yes - fi - if test x$enable_joystick = xyes -a x$enable_hidapi = xyes; then $as_echo "#define SDL_JOYSTICK_HIDAPI 1" >>confdefs.h - EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi" + SOURCES="$SOURCES $srcdir/src/joystick/windows/*.c" SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c" + SOURCES="$SOURCES $srcdir/src/hidapi/windows/hid.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi" + have_joystick=yes fi if test x$enable_haptic = xyes; then if test x$have_dinput = xyes -o x$have_xinput = xyes; then @@ -24367,7 +24366,7 @@ $as_echo "#define SDL_LOADSO_WINDOWS 1" >>confdefs.h else LIBUUID=-luuid fi - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion $LIBUUID -static-libgcc" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion $LIBUUID -static-libgcc" # The Windows platform requires special setup VERSION_SOURCES="$srcdir/src/main/windows/*.rc" SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c" diff --git a/configure.in b/configure.in index 03e23c81c..66a00c465 100644 --- a/configure.in +++ b/configure.in @@ -3628,13 +3628,12 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau else AC_DEFINE(SDL_JOYSTICK_WINMM, 1, [ ]) fi - SOURCES="$SOURCES $srcdir/src/joystick/windows/*.c" - have_joystick=yes - fi - if test x$enable_joystick = xyes -a x$enable_hidapi = xyes; then AC_DEFINE(SDL_JOYSTICK_HIDAPI, 1, [ ]) - EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi" + SOURCES="$SOURCES $srcdir/src/joystick/windows/*.c" SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c" + SOURCES="$SOURCES $srcdir/src/hidapi/windows/hid.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi" + have_joystick=yes fi if test x$enable_haptic = xyes; then if test x$have_dinput = xyes -o x$have_xinput = xyes; then @@ -3683,7 +3682,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau else LIBUUID=-luuid fi - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion $LIBUUID -static-libgcc" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion $LIBUUID -static-libgcc" # The Windows platform requires special setup VERSION_SOURCES="$srcdir/src/main/windows/*.rc" SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c" diff --git a/src/hidapi/windows/hid.c b/src/hidapi/windows/hid.c index 11a2555b2..86b297ca0 100644 --- a/src/hidapi/windows/hid.c +++ b/src/hidapi/windows/hid.c @@ -37,6 +37,7 @@ typedef LONG NTSTATUS; #endif /* SDL C runtime functions */ +#include "../../SDL_internal.h" #include "SDL_stdinc.h" #define calloc SDL_calloc diff --git a/src/joystick/hidapi/SDL_hidapi_ps4.c b/src/joystick/hidapi/SDL_hidapi_ps4.c index 3484ddb97..f33b660ea 100644 --- a/src/joystick/hidapi/SDL_hidapi_ps4.c +++ b/src/joystick/hidapi/SDL_hidapi_ps4.c @@ -162,9 +162,9 @@ static Uint32 crc32(Uint32 crc, const void *data, int count) #undef DEFINE_GUID #define DEFINE_GUID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) static const GUID n = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} -DEFINE_GUID(CLSID_MMDeviceEnumerator, 0xBCDE0395, 0xE52F, 0x467C, 0x8E, 0x3D, 0xC4, 0x57, 0x92, 0x91, 0x69, 0x2E); -DEFINE_GUID(IID_IMMDeviceEnumerator, 0xA95664D2, 0x9614, 0x4F35, 0xA7, 0x46, 0xDE, 0x8D, 0xB6, 0x36, 0x17, 0xE6); -DEFINE_GUID(IID_IAudioEndpointVolume, 0x5CDF2C82, 0x841E, 0x4546, 0x97, 0x22, 0x0C, 0xF7, 0x40, 0x78, 0x22, 0x9A); +DEFINE_GUID(SDL_CLSID_MMDeviceEnumerator, 0xBCDE0395, 0xE52F, 0x467C, 0x8E, 0x3D, 0xC4, 0x57, 0x92, 0x91, 0x69, 0x2E); +DEFINE_GUID(SDL_IID_IMMDeviceEnumerator, 0xA95664D2, 0x9614, 0x4F35, 0xA7, 0x46, 0xDE, 0x8D, 0xB6, 0x36, 0x17, 0xE6); +DEFINE_GUID(SDL_IID_IAudioEndpointVolume, 0x5CDF2C82, 0x841E, 0x4546, 0x97, 0x22, 0x0C, 0xF7, 0x40, 0x78, 0x22, 0x9A); #endif @@ -179,7 +179,7 @@ static float GetSystemVolume(void) IMMDeviceEnumerator *pEnumerator; /* This should gracefully fail on XP and succeed on everything Vista and above */ - hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, &IID_IMMDeviceEnumerator, (LPVOID*)&pEnumerator); + hr = CoCreateInstance(&SDL_CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, &SDL_IID_IMMDeviceEnumerator, (LPVOID*)&pEnumerator); if (SUCCEEDED(hr)) { IMMDevice *pDevice; @@ -187,7 +187,7 @@ static float GetSystemVolume(void) if (SUCCEEDED(hr)) { IAudioEndpointVolume *pEndpointVolume; - hr = IMMDevice_Activate(pDevice, &IID_IAudioEndpointVolume, CLSCTX_ALL, NULL, (LPVOID*)&pEndpointVolume); + hr = IMMDevice_Activate(pDevice, &SDL_IID_IAudioEndpointVolume, CLSCTX_ALL, NULL, (LPVOID*)&pEndpointVolume); if (SUCCEEDED(hr)) { IAudioEndpointVolume_GetMasterVolumeLevelScalar(pEndpointVolume, &volume); IUnknown_Release(pEndpointVolume);