mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-01 15:38:29 +00:00
Refactor joystick GUID creation
This commit is contained in:
@@ -704,14 +704,7 @@ BSD_JoystickGetDeviceGUID(int device_index)
|
||||
{
|
||||
/* the GUID is just the name for now */
|
||||
const char *name = BSD_JoystickGetDeviceName(device_index);
|
||||
SDL_JoystickGUID guid;
|
||||
Uint16 *guid16 = (Uint16 *)guid.data;
|
||||
|
||||
SDL_zero(guid);
|
||||
*guid16++ = SDL_SwapLE16(SDL_HARDWARE_BUS_UNKNOWN);
|
||||
*guid16++ = SDL_SwapLE16(SDL_crc16(0, name, SDL_strlen(name)));
|
||||
SDL_strlcpy((char*)guid16, name, sizeof(guid.data) - 4);
|
||||
return guid;
|
||||
return SDL_CreateJoystickGUIDForName(name);
|
||||
}
|
||||
|
||||
static int
|
||||
|
Reference in New Issue
Block a user