Skip to content

Commit

Permalink
Fixed mingw-w64 build
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Sep 28, 2018
1 parent 20dfda4 commit f964ce0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
11 changes: 5 additions & 6 deletions configure
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
11 changes: 5 additions & 6 deletions configure.in
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions src/hidapi/windows/hid.c
Expand Up @@ -37,6 +37,7 @@ typedef LONG NTSTATUS;
#endif

/* SDL C runtime functions */
#include "../../SDL_internal.h"
#include "SDL_stdinc.h"

#define calloc SDL_calloc
Expand Down
10 changes: 5 additions & 5 deletions src/joystick/hidapi/SDL_hidapi_ps4.c
Expand Up @@ -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


Expand All @@ -179,15 +179,15 @@ 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;

hr = IMMDeviceEnumerator_GetDefaultAudioEndpoint(pEnumerator, eRender, eConsole, &pDevice);
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);
Expand Down

0 comments on commit f964ce0

Please sign in to comment.