mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-18 15:51:44 +00:00
Added the CRC of the joystick name to the GUID
This will make it possible to have mappings for different controllers that have the same VID/PID. This happens frequently with some generic controller boards that have been reused in many products. Fixes https://github.com/libsdl-org/SDL/issues/6004
This commit is contained in:
@@ -241,7 +241,7 @@ IsJoystick(const char *path, int fd, char **name_return, SDL_JoystickGUID *guid)
|
||||
/* We only need 16 bits for each of these; space them out to fill 128. */
|
||||
/* Byteswap so devices get same GUID on little/big endian platforms. */
|
||||
*guid16++ = SDL_SwapLE16(inpid.bustype);
|
||||
*guid16++ = 0;
|
||||
*guid16++ = SDL_SwapLE16(SDL_crc16(0, name, SDL_strlen(name)));
|
||||
|
||||
if (inpid.vendor && inpid.product) {
|
||||
*guid16++ = SDL_SwapLE16(inpid.vendor);
|
||||
|
Reference in New Issue
Block a user