[SDL] Correctly byteswap Guid

Fixes an issue where GamePad Guids would fail to be matched with the
Guids in the configuration database.
This commit is contained in:
thefiddler 2014-09-12 08:43:20 +02:00
parent 71e5a4f4f3
commit 2df0496c44

View file

@ -1542,6 +1542,16 @@ namespace OpenTK.Platform.SDL2
}
}
// The Guid(byte[]) constructor swaps the first 4+2+2 bytes.
// Compensate for that, otherwise we will not be able to match
// the Guids in the configuration database.
if (BitConverter.IsLittleEndian)
{
Array.Reverse(data, 0, 4);
Array.Reverse(data, 4, 2);
Array.Reverse(data, 6, 2);
}
return new Guid(data);
}
}