mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-20 22:16:49 +01:00
Fixed XInput haptic support on Windows 8
It turns out the XBox 360 controller driver never reports force feedback capability, so we'll try to set 0 state and see if that succeeds.
This commit is contained in:
parent
229b438d42
commit
764aa147ad
@ -321,9 +321,8 @@ int
|
|||||||
XInputHaptic_MaybeAddDevice(const DWORD dwUserid)
|
XInputHaptic_MaybeAddDevice(const DWORD dwUserid)
|
||||||
{
|
{
|
||||||
const Uint8 userid = (Uint8) dwUserid;
|
const Uint8 userid = (Uint8) dwUserid;
|
||||||
XINPUT_CAPABILITIES caps;
|
|
||||||
const SDL_bool bIs14OrLater = (SDL_XInputVersion >= ((1<<16)|4));
|
|
||||||
SDL_hapticlist_item *item;
|
SDL_hapticlist_item *item;
|
||||||
|
XINPUT_VIBRATION state;
|
||||||
|
|
||||||
if ((!loaded_xinput) || (dwUserid >= SDL_XINPUT_MAX_DEVICES)) {
|
if ((!loaded_xinput) || (dwUserid >= SDL_XINPUT_MAX_DEVICES)) {
|
||||||
return -1;
|
return -1;
|
||||||
@ -336,13 +335,8 @@ XInputHaptic_MaybeAddDevice(const DWORD dwUserid)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (XINPUTGETCAPABILITIES(dwUserid, XINPUT_FLAG_GAMEPAD, &caps) != ERROR_SUCCESS) {
|
SDL_zero(state);
|
||||||
return -1; /* maybe controller isn't plugged in. */
|
if (XINPUTSETSTATE(dwUserid, &state) != ERROR_SUCCESS) {
|
||||||
}
|
|
||||||
|
|
||||||
/* XInput < 1.4 is probably only for original XBox360 controllers,
|
|
||||||
which don't offer the flag, and always have force feedback */
|
|
||||||
if ( (bIs14OrLater) && ((caps.Flags & XINPUT_CAPS_FFB_SUPPORTED) == 0) ) {
|
|
||||||
return -1; /* no force feedback on this device. */
|
return -1; /* no force feedback on this device. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user