mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-17 07:16:00 +00:00
Refactor joystick GUID creation
This commit is contained in:
@@ -171,14 +171,7 @@ static SDL_JoystickGUID PS2_JoystickGetDeviceGUID(int device_index)
|
||||
{
|
||||
/* the GUID is just the name for now */
|
||||
const char *name = PS2_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);
|
||||
}
|
||||
|
||||
/* Function to get the current instance id of the joystick located at device_index */
|
||||
|
Reference in New Issue
Block a user