diff options
author | RhavoX <rhavox@gmail.com> | 2022-06-20 19:01:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-20 19:01:55 +0200 |
commit | c881cd2d1452dc6ad87a570db76139a0c6105132 (patch) | |
tree | b0da62f22ce8d2493bedb53f39a9354ac3ca826f | |
parent | 68f909187045c9e5a6c1ecaf3b8160399238f8c5 (diff) |
Fix doubling of detected gamepads on program start (#3398)1.1.151
* Fix doubling of detected gamepads (sometimes the connected event is fired when the app starts even though the pad was connected for some time now).
The fix rejects the gamepad if one with the same ID is already present.
* Fixed review findings
-rw-r--r-- | Ryujinx.Input.SDL2/SDL2GamepadDriver.cs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs b/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs index 927d7fe6..b20a76b8 100644 --- a/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs +++ b/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs @@ -79,6 +79,13 @@ namespace Ryujinx.Input.SDL2 return; } + // Sometimes a JoyStick connected event fires after the app starts even though it was connected before + // so it is rejected to avoid doubling the entries. + if (_gamepadsIds.Contains(id)) + { + return; + } + if (_gamepadsInstanceIdsMapping.TryAdd(joystickInstanceId, id)) { _gamepadsIds.Add(id); |