mirror of
https://github.com/Ryujinx/SDL.git
synced 2025-03-23 21:55:12 +00:00
Continue running XInput detection while RAWINPUT is active
This allows us to re-enable XInput correlation for RAWINPUT devices without reintroducing the controller shutdown bug for controllers using the wireless adapter in https://github.com/libsdl-org/SDL/issues/3468. Fixes https://github.com/libsdl-org/SDL/issues/7940
This commit is contained in:
parent
b90343e512
commit
a0a3957eb6
|
@ -47,7 +47,7 @@
|
||||||
raw input will turn off the Xbox Series X controller when it is connected via the
|
raw input will turn off the Xbox Series X controller when it is connected via the
|
||||||
Xbox One Wireless Adapter.
|
Xbox One Wireless Adapter.
|
||||||
*/
|
*/
|
||||||
#if 0 /*def HAVE_XINPUT_H*/
|
#ifdef HAVE_XINPUT_H
|
||||||
#define SDL_JOYSTICK_RAWINPUT_XINPUT
|
#define SDL_JOYSTICK_RAWINPUT_XINPUT
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_WINDOWS_GAMING_INPUT_H
|
#ifdef HAVE_WINDOWS_GAMING_INPUT_H
|
||||||
|
|
|
@ -235,6 +235,20 @@ static void AddXInputDevice(Uint8 userid, BYTE SubType, JoyStick_DeviceData **pC
|
||||||
JoyStick_DeviceData *pPrevJoystick = NULL;
|
JoyStick_DeviceData *pPrevJoystick = NULL;
|
||||||
JoyStick_DeviceData *pNewJoystick = *pContext;
|
JoyStick_DeviceData *pNewJoystick = *pContext;
|
||||||
|
|
||||||
|
#ifdef SDL_JOYSTICK_RAWINPUT
|
||||||
|
if (RAWINPUT_IsEnabled()) {
|
||||||
|
/* The raw input driver handles more than 4 controllers, so prefer that when available */
|
||||||
|
/* We do this check here rather than at the top of SDL_XINPUT_JoystickDetect() because
|
||||||
|
we need to check XInput state before RAWINPUT gets a hold of the device, otherwise
|
||||||
|
when a controller is connected via the wireless adapter, it will shut down at the
|
||||||
|
first subsequent XInput call. This seems like a driver stack bug?
|
||||||
|
|
||||||
|
Reference: https://github.com/libsdl-org/SDL/issues/3468
|
||||||
|
*/
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (SDL_XInputUseOldJoystickMapping() && SubType != XINPUT_DEVSUBTYPE_GAMEPAD) {
|
if (SDL_XInputUseOldJoystickMapping() && SubType != XINPUT_DEVSUBTYPE_GAMEPAD) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -322,13 +336,6 @@ void SDL_XINPUT_JoystickDetect(JoyStick_DeviceData **pContext)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SDL_JOYSTICK_RAWINPUT
|
|
||||||
if (RAWINPUT_IsEnabled()) {
|
|
||||||
/* The raw input driver handles more than 4 controllers, so prefer that when available */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* iterate in reverse, so these are in the final list in ascending numeric order. */
|
/* iterate in reverse, so these are in the final list in ascending numeric order. */
|
||||||
for (iuserid = XUSER_MAX_COUNT - 1; iuserid >= 0; iuserid--) {
|
for (iuserid = XUSER_MAX_COUNT - 1; iuserid >= 0; iuserid--) {
|
||||||
const Uint8 userid = (Uint8)iuserid;
|
const Uint8 userid = (Uint8)iuserid;
|
||||||
|
|
Loading…
Reference in a new issue