mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2026-05-02 19:35:46 +00:00
Fix SDL3 gamepad crash, broken motion, and thread safety issues
- Remove SDL_DestroyProperties call on SDL-owned properties in SDL3Gamepad.GetFeaturesFlag(). SDL_GetGamepadProperties returns properties owned internally by SDL, freed when SDL_CloseGamepad is called. Destroying them causes use-after-free, breaking motion sensor data retrieval and crashing on controller reconnect. - Fix GetGamepads() using wrong lock objects (_gamepadsIds, _joyConsIds, _linkedJoyConsIds instead of _lock) and holding locks across yield boundaries, which is incompatible with System.Threading.Lock. Snapshot IDs under _lock and iterate outside it. - Add null-conditional to _gamepad.Rumble() in NpadController.UpdateRumble() to prevent NullReferenceException if gamepad is disconnected mid-update.
This commit is contained in:
@@ -563,7 +563,7 @@ namespace Ryujinx.Input.HLE
|
||||
float low = Math.Min(1f, (float)((rightVibrationValue.AmplitudeLow * 0.85 + rightVibrationValue.AmplitudeHigh * 0.15) * controllerConfig.Rumble.StrongRumble));
|
||||
float high = Math.Min(1f, (float)((leftVibrationValue.AmplitudeLow * 0.15 + leftVibrationValue.AmplitudeHigh * 0.85) * controllerConfig.Rumble.WeakRumble));
|
||||
|
||||
_gamepad.Rumble(low, high, uint.MaxValue);
|
||||
_gamepad?.Rumble(low, high, uint.MaxValue);
|
||||
|
||||
Logger.Debug?.Print(LogClass.Hid, $"Effect for {controllerConfig.PlayerIndex} " +
|
||||
$"L.low.amp={leftVibrationValue.AmplitudeLow}, " +
|
||||
|
||||
Reference in New Issue
Block a user