mirror of
https://git.743378673.xyz/MeloNX/MeloNX.git
synced 2025-07-29 09:57:09 +02:00
Fix doubling of detected gamepads on program start (#3398)
* 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
This commit is contained in:
parent
a93db142f8
commit
3011dc09ea
1 changed files with 7 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue