mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-17 22:23:31 +00:00
Fix false positives in SDL_GameControllerRumble() support detection
This commit is contained in:
@@ -999,8 +999,10 @@ void SdlInputHandler::handleControllerDeviceEvent(SDL_ControllerDeviceEvent* eve
|
|||||||
state->jsId = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(state->controller));
|
state->jsId = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(state->controller));
|
||||||
|
|
||||||
#if SDL_VERSION_ATLEAST(2, 0, 9)
|
#if SDL_VERSION_ATLEAST(2, 0, 9)
|
||||||
// Perform a no-op rumble to see if haptics are supported
|
// Perform a tiny rumble to see if haptics are supported.
|
||||||
hapticCaps = SDL_GameControllerRumble(controller, 0, 0, 0) == 0 ?
|
// NB: We cannot use zeros for rumble intensity or SDL will not actually call the JS driver
|
||||||
|
// and we'll get a (potentially false) success value returned.
|
||||||
|
hapticCaps = SDL_GameControllerRumble(controller, 1, 1, 1) == 0 ?
|
||||||
ML_HAPTIC_GC_RUMBLE : 0;
|
ML_HAPTIC_GC_RUMBLE : 0;
|
||||||
#else
|
#else
|
||||||
state->haptic = SDL_HapticOpenFromJoystick(SDL_GameControllerGetJoystick(state->controller));
|
state->haptic = SDL_HapticOpenFromJoystick(SDL_GameControllerGetJoystick(state->controller));
|
||||||
|
|||||||
Reference in New Issue
Block a user