From 13db6067d20e12aef0bc325ef4132b0fdba12425 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 dcbe92550..13e5ebfd0 100644 --- a/src/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs +++ b/src/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs @@ -117,7 +117,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);