diff --git a/CMakeLists.txt b/CMakeLists.txt index 02aa602939..2dba6ca6d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1824,16 +1824,6 @@ elseif(WINDOWS) #include #include int main(int argc, char **argv) { return 0; }" HAVE_XINPUT_H) - check_c_source_compiles(" - #include - #include - XINPUT_GAMEPAD_EX x1; - int main(int argc, char **argv) { return 0; }" HAVE_XINPUT_GAMEPAD_EX) - check_c_source_compiles(" - #include - #include - XINPUT_STATE_EX s1; - int main(int argc, char **argv) { return 0; }" HAVE_XINPUT_STATE_EX) check_c_source_compiles(" #define COBJMACROS #include diff --git a/configure b/configure index 2a912d3175..4bbeee8c41 100755 --- a/configure +++ b/configure @@ -27619,77 +27619,15 @@ else $as_nop fi if test x$enable_xinput = xyes; then - have_xinput_gamepadex=no - have_xinput_stateex=no ac_fn_c_check_header_compile "$LINENO" "xinput.h" "ac_cv_header_xinput_h" "$ac_includes_default" if test "x$ac_cv_header_xinput_h" = xyes then : have_xinput=yes fi - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct XINPUT_GAMEPAD_EX" >&5 -printf %s "checking for struct XINPUT_GAMEPAD_EX... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -XINPUT_GAMEPAD_EX x1; - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - have_xinput_gamepadex=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_xinput_gamepadex" >&5 -printf "%s\n" "$have_xinput_gamepadex" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct XINPUT_STATE_EX" >&5 -printf %s "checking for struct XINPUT_STATE_EX... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -XINPUT_STATE_EX s1; - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - have_xinput_stateex=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_xinput_stateex" >&5 -printf "%s\n" "$have_xinput_stateex" >&6; } - if test x$have_xinput = xyes; then printf "%s\n" "#define HAVE_XINPUT_H 1" >>confdefs.h - fi - if test x$have_xinput_gamepadex = xyes; then - -printf "%s\n" "#define HAVE_XINPUT_GAMEPAD_EX 1" >>confdefs.h - - fi - if test x$have_xinput_stateex = xyes; then - -printf "%s\n" "#define HAVE_XINPUT_STATE_EX 1" >>confdefs.h - fi fi diff --git a/configure.ac b/configure.ac index d83f5128d0..861d2b5281 100644 --- a/configure.ac +++ b/configure.ac @@ -3368,33 +3368,10 @@ asdf [AS_HELP_STRING([--enable-xinput], [use Xinput for Windows [default=yes]])], , enable_xinput=yes) if test x$enable_xinput = xyes; then - have_xinput_gamepadex=no - have_xinput_stateex=no AC_CHECK_HEADER(xinput.h, have_xinput=yes) - AC_MSG_CHECKING(for struct XINPUT_GAMEPAD_EX) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#include -#include -XINPUT_GAMEPAD_EX x1; - ]],[])], [have_xinput_gamepadex=yes],[]) - AC_MSG_RESULT($have_xinput_gamepadex) - AC_MSG_CHECKING(for struct XINPUT_STATE_EX) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#include -#include -XINPUT_STATE_EX s1; - ]],[])], [have_xinput_stateex=yes],[]) - AC_MSG_RESULT($have_xinput_stateex) - if test x$have_xinput = xyes; then AC_DEFINE(HAVE_XINPUT_H, 1, [ ]) fi - if test x$have_xinput_gamepadex = xyes; then - AC_DEFINE(HAVE_XINPUT_GAMEPAD_EX, 1, [ ]) - fi - if test x$have_xinput_stateex = xyes; then - AC_DEFINE(HAVE_XINPUT_STATE_EX, 1, [ ]) - fi fi AC_MSG_CHECKING(for windows.gaming.input.h) diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake index 35923d0207..fde90ef4ef 100644 --- a/include/SDL_config.h.cmake +++ b/include/SDL_config.h.cmake @@ -259,9 +259,6 @@ #cmakedefine HAVE_ROAPI_H @HAVE_ROAPI_H@ #cmakedefine HAVE_SHELLSCALINGAPI_H @HAVE_SHELLSCALINGAPI_H@ -#cmakedefine HAVE_XINPUT_GAMEPAD_EX @HAVE_XINPUT_GAMEPAD_EX@ -#cmakedefine HAVE_XINPUT_STATE_EX @HAVE_XINPUT_STATE_EX@ - #cmakedefine USE_POSIX_SPAWN @USE_POSIX_SPAWN@ /* SDL internal assertion support */ diff --git a/include/SDL_config.h.in b/include/SDL_config.h.in index d6460b783e..070306a69d 100644 --- a/include/SDL_config.h.in +++ b/include/SDL_config.h.in @@ -241,8 +241,6 @@ #undef HAVE_DXGI_H #undef HAVE_WINDOWS_GAMING_INPUT_H #undef HAVE_XINPUT_H -#undef HAVE_XINPUT_GAMEPAD_EX -#undef HAVE_XINPUT_STATE_EX #undef HAVE_MMDEVICEAPI_H #undef HAVE_AUDIOCLIENT_H diff --git a/src/core/windows/SDL_xinput.h b/src/core/windows/SDL_xinput.h index acdd8d5d4c..2eb9145895 100644 --- a/src/core/windows/SDL_xinput.h +++ b/src/core/windows/SDL_xinput.h @@ -163,28 +163,8 @@ extern "C" { /* typedef's for XInput structs we use */ -#ifndef HAVE_XINPUT_GAMEPAD_EX -typedef struct -{ - WORD wButtons; - BYTE bLeftTrigger; - BYTE bRightTrigger; - SHORT sThumbLX; - SHORT sThumbLY; - SHORT sThumbRX; - SHORT sThumbRY; - DWORD dwPaddingReserved; -} XINPUT_GAMEPAD_EX; -#endif - -#ifndef HAVE_XINPUT_STATE_EX -typedef struct -{ - DWORD dwPacketNumber; - XINPUT_GAMEPAD_EX Gamepad; -} XINPUT_STATE_EX; -#endif +/* This is the same as XINPUT_BATTERY_INFORMATION, but always defined instead of just if WIN32_WINNT >= _WIN32_WINNT_WIN8 */ typedef struct { BYTE BatteryType; @@ -204,6 +184,12 @@ typedef struct SHORT sThumbRY; } XINPUT_GAMEPAD; +typedef struct +{ + DWORD dwPacketNumber; + XINPUT_GAMEPAD Gamepad; +} XINPUT_STATE; + typedef struct { WORD wLeftMotorSpeed; @@ -224,7 +210,7 @@ typedef struct /* Forward decl's for XInput API's we load dynamically and use if available */ typedef DWORD(WINAPI *XInputGetState_t)( DWORD dwUserIndex, /* [in] Index of the gamer associated with the device */ - XINPUT_STATE_EX *pState /* [out] Receives the current state */ + XINPUT_STATE *pState /* [out] Receives the current state */ ); typedef DWORD(WINAPI *XInputSetState_t)( diff --git a/src/joystick/windows/SDL_rawinputjoystick.c b/src/joystick/windows/SDL_rawinputjoystick.c index 26b5c27643..7741129ce7 100644 --- a/src/joystick/windows/SDL_rawinputjoystick.c +++ b/src/joystick/windows/SDL_rawinputjoystick.c @@ -321,7 +321,7 @@ static void RAWINPUT_FillMatchState(WindowsMatchState *state, Uint64 match_state static struct { - XINPUT_STATE_EX state; + XINPUT_STATE state; XINPUT_BATTERY_INFORMATION_EX battery; SDL_bool connected; /* Currently has an active XInput device */ SDL_bool used; /* Is currently mapped to an SDL device */ diff --git a/src/joystick/windows/SDL_xinputjoystick.c b/src/joystick/windows/SDL_xinputjoystick.c index 6ac0ad8873..087161ce10 100644 --- a/src/joystick/windows/SDL_xinputjoystick.c +++ b/src/joystick/windows/SDL_xinputjoystick.c @@ -423,7 +423,7 @@ static void UpdateXInputJoystickBatteryInformation(SDL_Joystick *joystick, XINPU } } -static void UpdateXInputJoystickState_OLD(SDL_Joystick *joystick, XINPUT_STATE_EX *pXInputState, XINPUT_BATTERY_INFORMATION_EX *pBatteryInformation) +static void UpdateXInputJoystickState_OLD(SDL_Joystick *joystick, XINPUT_STATE *pXInputState, XINPUT_BATTERY_INFORMATION_EX *pBatteryInformation) { static WORD s_XInputButtons[] = { XINPUT_GAMEPAD_DPAD_UP, XINPUT_GAMEPAD_DPAD_DOWN, XINPUT_GAMEPAD_DPAD_LEFT, XINPUT_GAMEPAD_DPAD_RIGHT, @@ -449,7 +449,7 @@ static void UpdateXInputJoystickState_OLD(SDL_Joystick *joystick, XINPUT_STATE_E UpdateXInputJoystickBatteryInformation(joystick, pBatteryInformation); } -static void UpdateXInputJoystickState(SDL_Joystick *joystick, XINPUT_STATE_EX *pXInputState, XINPUT_BATTERY_INFORMATION_EX *pBatteryInformation) +static void UpdateXInputJoystickState(SDL_Joystick *joystick, XINPUT_STATE *pXInputState, XINPUT_BATTERY_INFORMATION_EX *pBatteryInformation) { static WORD s_XInputButtons[] = { XINPUT_GAMEPAD_A, XINPUT_GAMEPAD_B, XINPUT_GAMEPAD_X, XINPUT_GAMEPAD_Y, @@ -513,7 +513,7 @@ Uint32 SDL_XINPUT_JoystickGetCapabilities(SDL_Joystick *joystick) void SDL_XINPUT_JoystickUpdate(SDL_Joystick *joystick) { HRESULT result; - XINPUT_STATE_EX XInputState; + XINPUT_STATE XInputState; XINPUT_BATTERY_INFORMATION_EX XBatteryInformation; if (!XINPUTGETSTATE) {