sdl2 guid, remove the 2 CRC bytes when creating guid
This commit is contained in:
parent
57c22a1f32
commit
d19324f687
@ -50,6 +50,9 @@ namespace Ryujinx.Input.SDL2
|
|||||||
{
|
{
|
||||||
Guid guid = SDL_JoystickGetDeviceGUID(joystickIndex);
|
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.
|
// Add a unique identifier to the start of the GUID in case of duplicates.
|
||||||
|
|
||||||
if (guid == Guid.Empty)
|
if (guid == Guid.Empty)
|
||||||
@ -62,11 +65,11 @@ namespace Ryujinx.Input.SDL2
|
|||||||
lock (_lock)
|
lock (_lock)
|
||||||
{
|
{
|
||||||
int guidIndex = 0;
|
int guidIndex = 0;
|
||||||
id = guidIndex + "-" + guid;
|
id = guidIndex + "-" + guidString;
|
||||||
|
|
||||||
while (_gamepadsIds.Contains(id))
|
while (_gamepadsIds.Contains(id))
|
||||||
{
|
{
|
||||||
id = (++guidIndex) + "-" + guid;
|
id = (++guidIndex) + "-" + guidString;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user