mirror of
https://github.com/encounter/SDL.git
synced 2025-12-16 16:37:09 +00:00
Refactor joystick GUID creation
This commit is contained in:
@@ -252,14 +252,7 @@ extern "C"
|
||||
{
|
||||
/* the GUID is just the name for now */
|
||||
const char *name = HAIKU_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 HAIKU_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)
|
||||
|
||||
Reference in New Issue
Block a user