Sam Lantinga 1 день назад
Родитель
Сommit
75dead7f96
2 измененных файлов с 18 добавлено и 23 удалено
  1. 18 17
      src/joystick/SDL_joystick.c
  2. 0 6
      src/joystick/SDL_joystick_c.h

+ 18 - 17
src/joystick/SDL_joystick.c

@@ -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]) {

+ 0 - 6
src/joystick/SDL_joystick_c.h

@@ -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);