From 52f42d450fb5fb7d2b2dd1d72aef70a07d4e44d5 Mon Sep 17 00:00:00 2001 From: Evan Husted Date: Sun, 17 Nov 2024 00:57:56 -0600 Subject: [PATCH] try 1: Fix IndexOutOfBounds in SDL2GamepadDriver.cs --- src/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs b/src/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs index 0acbaaa19..fd34fe219 100644 --- a/src/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs +++ b/src/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs @@ -115,7 +115,10 @@ namespace Ryujinx.Input.SDL2 { lock (_lock) { - _gamepadsIds.Insert(joystickDeviceId, id); + if (joystickDeviceId <= _gamepadsIds.FindLastIndex(_ => true)) + _gamepadsIds.Insert(joystickDeviceId, id); + else + _gamepadsIds.Add(id); } OnGamepadConnected?.Invoke(id);