mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-23 00:05:35 +00:00
Use XINPUT_STATE instead of XINPUT_STATE_EX (thanks Andrew!)
XINPUT_STATE_EX isn't actually a thing, we can just use the normal XINPUT_STATE Fixes https://github.com/libsdl-org/SDL/issues/2797
This commit is contained in:
parent
aa129c9257
commit
e8f4045d0b
|
@ -1824,16 +1824,6 @@ elseif(WINDOWS)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <xinput.h>
|
#include <xinput.h>
|
||||||
int main(int argc, char **argv) { return 0; }" HAVE_XINPUT_H)
|
int main(int argc, char **argv) { return 0; }" HAVE_XINPUT_H)
|
||||||
check_c_source_compiles("
|
|
||||||
#include <windows.h>
|
|
||||||
#include <xinput.h>
|
|
||||||
XINPUT_GAMEPAD_EX x1;
|
|
||||||
int main(int argc, char **argv) { return 0; }" HAVE_XINPUT_GAMEPAD_EX)
|
|
||||||
check_c_source_compiles("
|
|
||||||
#include <windows.h>
|
|
||||||
#include <xinput.h>
|
|
||||||
XINPUT_STATE_EX s1;
|
|
||||||
int main(int argc, char **argv) { return 0; }" HAVE_XINPUT_STATE_EX)
|
|
||||||
check_c_source_compiles("
|
check_c_source_compiles("
|
||||||
#define COBJMACROS
|
#define COBJMACROS
|
||||||
#include <windows.gaming.input.h>
|
#include <windows.gaming.input.h>
|
||||||
|
|
62
configure
vendored
62
configure
vendored
|
@ -27619,77 +27619,15 @@ else $as_nop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test x$enable_xinput = xyes; then
|
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"
|
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
|
if test "x$ac_cv_header_xinput_h" = xyes
|
||||||
then :
|
then :
|
||||||
have_xinput=yes
|
have_xinput=yes
|
||||||
fi
|
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 <windows.h>
|
|
||||||
#include <xinput.h>
|
|
||||||
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 <windows.h>
|
|
||||||
#include <xinput.h>
|
|
||||||
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
|
if test x$have_xinput = xyes; then
|
||||||
|
|
||||||
printf "%s\n" "#define HAVE_XINPUT_H 1" >>confdefs.h
|
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
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
23
configure.ac
23
configure.ac
|
@ -3368,33 +3368,10 @@ asdf
|
||||||
[AS_HELP_STRING([--enable-xinput], [use Xinput for Windows [default=yes]])],
|
[AS_HELP_STRING([--enable-xinput], [use Xinput for Windows [default=yes]])],
|
||||||
, enable_xinput=yes)
|
, enable_xinput=yes)
|
||||||
if test x$enable_xinput = xyes; then
|
if test x$enable_xinput = xyes; then
|
||||||
have_xinput_gamepadex=no
|
|
||||||
have_xinput_stateex=no
|
|
||||||
AC_CHECK_HEADER(xinput.h, have_xinput=yes)
|
AC_CHECK_HEADER(xinput.h, have_xinput=yes)
|
||||||
AC_MSG_CHECKING(for struct XINPUT_GAMEPAD_EX)
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
|
||||||
#include <windows.h>
|
|
||||||
#include <xinput.h>
|
|
||||||
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 <windows.h>
|
|
||||||
#include <xinput.h>
|
|
||||||
XINPUT_STATE_EX s1;
|
|
||||||
]],[])], [have_xinput_stateex=yes],[])
|
|
||||||
AC_MSG_RESULT($have_xinput_stateex)
|
|
||||||
|
|
||||||
if test x$have_xinput = xyes; then
|
if test x$have_xinput = xyes; then
|
||||||
AC_DEFINE(HAVE_XINPUT_H, 1, [ ])
|
AC_DEFINE(HAVE_XINPUT_H, 1, [ ])
|
||||||
fi
|
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
|
fi
|
||||||
|
|
||||||
AC_MSG_CHECKING(for windows.gaming.input.h)
|
AC_MSG_CHECKING(for windows.gaming.input.h)
|
||||||
|
|
|
@ -259,9 +259,6 @@
|
||||||
#cmakedefine HAVE_ROAPI_H @HAVE_ROAPI_H@
|
#cmakedefine HAVE_ROAPI_H @HAVE_ROAPI_H@
|
||||||
#cmakedefine HAVE_SHELLSCALINGAPI_H @HAVE_SHELLSCALINGAPI_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@
|
#cmakedefine USE_POSIX_SPAWN @USE_POSIX_SPAWN@
|
||||||
|
|
||||||
/* SDL internal assertion support */
|
/* SDL internal assertion support */
|
||||||
|
|
|
@ -241,8 +241,6 @@
|
||||||
#undef HAVE_DXGI_H
|
#undef HAVE_DXGI_H
|
||||||
#undef HAVE_WINDOWS_GAMING_INPUT_H
|
#undef HAVE_WINDOWS_GAMING_INPUT_H
|
||||||
#undef HAVE_XINPUT_H
|
#undef HAVE_XINPUT_H
|
||||||
#undef HAVE_XINPUT_GAMEPAD_EX
|
|
||||||
#undef HAVE_XINPUT_STATE_EX
|
|
||||||
|
|
||||||
#undef HAVE_MMDEVICEAPI_H
|
#undef HAVE_MMDEVICEAPI_H
|
||||||
#undef HAVE_AUDIOCLIENT_H
|
#undef HAVE_AUDIOCLIENT_H
|
||||||
|
|
|
@ -163,28 +163,8 @@ extern "C" {
|
||||||
|
|
||||||
/* typedef's for XInput structs we use */
|
/* 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
|
typedef struct
|
||||||
{
|
{
|
||||||
BYTE BatteryType;
|
BYTE BatteryType;
|
||||||
|
@ -204,6 +184,12 @@ typedef struct
|
||||||
SHORT sThumbRY;
|
SHORT sThumbRY;
|
||||||
} XINPUT_GAMEPAD;
|
} XINPUT_GAMEPAD;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
DWORD dwPacketNumber;
|
||||||
|
XINPUT_GAMEPAD Gamepad;
|
||||||
|
} XINPUT_STATE;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
WORD wLeftMotorSpeed;
|
WORD wLeftMotorSpeed;
|
||||||
|
@ -224,7 +210,7 @@ typedef struct
|
||||||
/* Forward decl's for XInput API's we load dynamically and use if available */
|
/* Forward decl's for XInput API's we load dynamically and use if available */
|
||||||
typedef DWORD(WINAPI *XInputGetState_t)(
|
typedef DWORD(WINAPI *XInputGetState_t)(
|
||||||
DWORD dwUserIndex, /* [in] Index of the gamer associated with the device */
|
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)(
|
typedef DWORD(WINAPI *XInputSetState_t)(
|
||||||
|
|
|
@ -321,7 +321,7 @@ static void RAWINPUT_FillMatchState(WindowsMatchState *state, Uint64 match_state
|
||||||
|
|
||||||
static struct
|
static struct
|
||||||
{
|
{
|
||||||
XINPUT_STATE_EX state;
|
XINPUT_STATE state;
|
||||||
XINPUT_BATTERY_INFORMATION_EX battery;
|
XINPUT_BATTERY_INFORMATION_EX battery;
|
||||||
SDL_bool connected; /* Currently has an active XInput device */
|
SDL_bool connected; /* Currently has an active XInput device */
|
||||||
SDL_bool used; /* Is currently mapped to an SDL device */
|
SDL_bool used; /* Is currently mapped to an SDL device */
|
||||||
|
|
|
@ -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[] = {
|
static WORD s_XInputButtons[] = {
|
||||||
XINPUT_GAMEPAD_DPAD_UP, XINPUT_GAMEPAD_DPAD_DOWN, XINPUT_GAMEPAD_DPAD_LEFT, XINPUT_GAMEPAD_DPAD_RIGHT,
|
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);
|
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[] = {
|
static WORD s_XInputButtons[] = {
|
||||||
XINPUT_GAMEPAD_A, XINPUT_GAMEPAD_B, XINPUT_GAMEPAD_X, XINPUT_GAMEPAD_Y,
|
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)
|
void SDL_XINPUT_JoystickUpdate(SDL_Joystick *joystick)
|
||||||
{
|
{
|
||||||
HRESULT result;
|
HRESULT result;
|
||||||
XINPUT_STATE_EX XInputState;
|
XINPUT_STATE XInputState;
|
||||||
XINPUT_BATTERY_INFORMATION_EX XBatteryInformation;
|
XINPUT_BATTERY_INFORMATION_EX XBatteryInformation;
|
||||||
|
|
||||||
if (!XINPUTGETSTATE) {
|
if (!XINPUTGETSTATE) {
|
||||||
|
|
Loading…
Reference in a new issue