From d19324f687ead760e7059fb0637a5c721f19b5f3 Mon Sep 17 00:00:00 2001 From: "Benoit S." Date: Tue, 4 Mar 2025 21:58:47 +0100 Subject: [PATCH 1/2] sdl2 guid, remove the 2 CRC bytes when creating guid --- src/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs b/src/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs index 67c68d8ec..1fbee4359 100644 --- a/src/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs +++ b/src/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs @@ -50,6 +50,9 @@ namespace Ryujinx.Input.SDL2 { Guid guid = SDL_JoystickGetDeviceGUID(joystickIndex); + // Remove the first 4 char of the guid (CRC part) to make it stable + string guidString = "0000" + guid.ToString().Substring(4); + // Add a unique identifier to the start of the GUID in case of duplicates. if (guid == Guid.Empty) @@ -62,11 +65,11 @@ namespace Ryujinx.Input.SDL2 lock (_lock) { int guidIndex = 0; - id = guidIndex + "-" + guid; + id = guidIndex + "-" + guidString; while (_gamepadsIds.Contains(id)) { - id = (++guidIndex) + "-" + guid; + id = (++guidIndex) + "-" + guidString; } } -- 2.47.1 From 96f1048748490391dbfc32a1aebb8aca4ef764ad Mon Sep 17 00:00:00 2001 From: "Ben. S." Date: Wed, 5 Mar 2025 14:41:52 +0100 Subject: [PATCH 2/2] Update SDL2GamepadDriver.cs Move the section after the check for empty guid (dumb me) --- src/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs b/src/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs index 1fbee4359..60120ab58 100644 --- a/src/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs +++ b/src/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs @@ -50,9 +50,6 @@ namespace Ryujinx.Input.SDL2 { Guid guid = SDL_JoystickGetDeviceGUID(joystickIndex); - // Remove the first 4 char of the guid (CRC part) to make it stable - string guidString = "0000" + guid.ToString().Substring(4); - // Add a unique identifier to the start of the GUID in case of duplicates. if (guid == Guid.Empty) @@ -60,6 +57,9 @@ namespace Ryujinx.Input.SDL2 return null; } + // Remove the first 4 char of the guid (CRC part) to make it stable + string guidString = "0000" + guid.ToString().Substring(4); + string id; lock (_lock) -- 2.47.1