fix: crash when connecting a joycon (ryubing/ryujinx!211)

See merge request ryubing/ryujinx!211
This commit is contained in:
Maki 2025-11-09 13:35:16 -06:00 committed by GreemDev
parent 58be57bf73
commit a49822470c
2 changed files with 8 additions and 2 deletions

View File

@ -154,8 +154,14 @@ namespace Ryujinx.Input.SDL3
if (SDL3JoyConPair.IsCombinable(_gamepadsIds))
{
// TODO - It appears that you can only have one joy con pair connected at a time?
// This was also the behavior before SDL3
_gamepadsIds.Remove(GetInstanceIdFromId(SDL3JoyConPair.Id));
_gamepadsIds.Add(joystickInstanceId, SDL3JoyConPair.Id);
uint fakeInstanceID = uint.MaxValue;
while (!_gamepadsIds.TryAdd((SDL_JoystickID)fakeInstanceID, SDL3JoyConPair.Id))
{
fakeInstanceID--;
}
joyConPairConnected = true;
}
}

View File

@ -110,7 +110,7 @@ namespace Ryujinx.Input.SDL3
.ToDictionary();
SDL_JoystickID idx;
int leftIndex = gamepadNames.TryGetValue(SDL3JoyCon.LeftName, out idx) ? (int)idx : -1;
int rightIndex = gamepadNames.TryGetValue(SDL3JoyCon.LeftName, out idx) ? (int)idx : -1;
int rightIndex = gamepadNames.TryGetValue(SDL3JoyCon.RightName, out idx) ? (int)idx : -1;
return (leftIndex, rightIndex);
}