Minor cleanup

This commit is contained in:
Sam Lantinga
2026-03-17 09:49:15 -07:00
parent fdc5efe1cb
commit 75dead7f96
2 changed files with 18 additions and 23 deletions

View File

@@ -3425,16 +3425,6 @@ bool SDL_IsJoystickVIRTUAL(SDL_GUID guid)
return (guid.data[14] == 'v') ? true : false;
}
bool SDL_IsJoystickDrumKit(Uint16 vendor_id, Uint16 product_id)
{
return SDL_VIDPIDInList(vendor_id, product_id, &drum_devices);
}
bool SDL_IsJoystickGuitar(Uint16 vendor_id, Uint16 product_id)
{
return SDL_VIDPIDInList(vendor_id, product_id, &guitar_devices);
}
bool SDL_IsJoystickWheel(Uint16 vendor_id, Uint16 product_id)
{
return SDL_VIDPIDInList(vendor_id, product_id, &wheel_devices);
@@ -3455,6 +3445,16 @@ static bool SDL_IsJoystickThrottle(Uint16 vendor_id, Uint16 product_id)
return SDL_VIDPIDInList(vendor_id, product_id, &throttle_devices);
}
static bool SDL_IsJoystickGuitar(Uint16 vendor_id, Uint16 product_id)
{
return SDL_VIDPIDInList(vendor_id, product_id, &guitar_devices);
}
static bool SDL_IsJoystickDrumKit(Uint16 vendor_id, Uint16 product_id)
{
return SDL_VIDPIDInList(vendor_id, product_id, &drum_devices);
}
static SDL_JoystickType SDL_GetJoystickGUIDType(SDL_GUID guid)
{
Uint16 vendor;
@@ -3462,13 +3462,6 @@ static SDL_JoystickType SDL_GetJoystickGUIDType(SDL_GUID guid)
SDL_GetJoystickGUIDInfo(guid, &vendor, &product, NULL, NULL);
if (SDL_IsJoystickDrumKit(vendor, product)) {
return SDL_JOYSTICK_TYPE_DRUM_KIT;
}
if (SDL_IsJoystickGuitar(vendor, product)) {
return SDL_JOYSTICK_TYPE_GUITAR;
}
if (SDL_IsJoystickWheel(vendor, product)) {
return SDL_JOYSTICK_TYPE_WHEEL;
}
@@ -3485,6 +3478,14 @@ static SDL_JoystickType SDL_GetJoystickGUIDType(SDL_GUID guid)
return SDL_JOYSTICK_TYPE_THROTTLE;
}
if (SDL_IsJoystickGuitar(vendor, product)) {
return SDL_JOYSTICK_TYPE_GUITAR;
}
if (SDL_IsJoystickDrumKit(vendor, product)) {
return SDL_JOYSTICK_TYPE_DRUM_KIT;
}
if (SDL_IsJoystickXInput(guid)) {
// XInput GUID, get the type based on the XInput device subtype
switch (guid.data[15]) {

View File

@@ -174,12 +174,6 @@ extern bool SDL_IsJoystickVIRTUAL(SDL_GUID guid);
// Function to return whether a joystick is a wheel
extern bool SDL_IsJoystickWheel(Uint16 vendor_id, Uint16 product_id);
// Function to return whether a joystick is a guitar
extern bool SDL_IsJoystickGuitar(Uint16 vendor_id, Uint16 product_id);
// Function to return whether a joystick is a drum kit
extern bool SDL_IsJoystickDrumKit(Uint16 vendor_id, Uint16 product_id);
// Function to return whether a joystick should be ignored
extern bool SDL_ShouldIgnoreJoystick(Uint16 vendor_id, Uint16 product_id, Uint16 version, const char *name);