SDL: Added support for the ROG RAIKIRI (d126e)

From d126e7bbba97f198979878f1c70632721b20dc47 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 3 Jul 2024 13:54:00 -0700
Subject: [PATCH] Added support for the ROG RAIKIRI

(cherry picked from commit a04596c9a7b3c29e08d258c077bf466ccad1a66a)
(cherry picked from commit 845ebbbe96b0c05a4b64736122dbbc4f51900694)
---
 .../app/src/main/java/org/libsdl/app/HIDDeviceManager.java   | 1 +
 src/hidapi/libusb/hid.c                                      | 1 +
 src/joystick/SDL_joystick.c                                  | 5 +++++
 src/joystick/hidapi/SDL_hidapijoystick.c                     | 1 +
 src/joystick/usb_ids.h                                       | 2 ++
 5 files changed, 10 insertions(+)

diff --git a/android-project/app/src/main/java/org/libsdl/app/HIDDeviceManager.java b/android-project/app/src/main/java/org/libsdl/app/HIDDeviceManager.java
index ea6b5d5b17a18..21a1c1d18eea5 100644
--- a/android-project/app/src/main/java/org/libsdl/app/HIDDeviceManager.java
+++ b/android-project/app/src/main/java/org/libsdl/app/HIDDeviceManager.java
@@ -277,6 +277,7 @@ private boolean isXboxOneController(UsbDevice usbDevice, UsbInterface usbInterfa
             0x044f, // Thrustmaster
             0x045e, // Microsoft
             0x0738, // Mad Catz
+            0x0b05, // ASUS
             0x0e6f, // PDP
             0x0f0d, // Hori
             0x10f5, // Turtle Beach
diff --git a/src/hidapi/libusb/hid.c b/src/hidapi/libusb/hid.c
index 008131bd9d2d0..7da8a959f44b6 100644
--- a/src/hidapi/libusb/hid.c
+++ b/src/hidapi/libusb/hid.c
@@ -715,6 +715,7 @@ static int is_xboxone(unsigned short vendor_id, const struct libusb_interface_de
 		0x044f, /* Thrustmaster */
 		0x045e, /* Microsoft */
 		0x0738, /* Mad Catz */
+		0x0b05, /* ASUS */
 		0x0e6f, /* PDP */
 		0x0f0d, /* Hori */
         0x10f5, /* Turtle Beach */
diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c
index 73c63c5d777b3..0884cf92dd0fe 100644
--- a/src/joystick/SDL_joystick.c
+++ b/src/joystick/SDL_joystick.c
@@ -2748,6 +2748,11 @@ SDL_bool SDL_IsJoystickXboxSeriesX(Uint16 vendor_id, Uint16 product_id)
             return SDL_TRUE;
         }
     }
+    if (vendor_id == USB_VENDOR_ASUS) {
+        if (product_id == USB_PRODUCT_ROG_RAIKIRI) {
+            return SDL_TRUE;
+        }
+    }
     return SDL_FALSE;
 }
 
diff --git a/src/joystick/hidapi/SDL_hidapijoystick.c b/src/joystick/hidapi/SDL_hidapijoystick.c
index 84767dca528d9..0db0cbb1c34d9 100644
--- a/src/joystick/hidapi/SDL_hidapijoystick.c
+++ b/src/joystick/hidapi/SDL_hidapijoystick.c
@@ -280,6 +280,7 @@ static SDL_GameControllerType SDL_GetJoystickGameControllerProtocol(const char *
             0x044f, /* Thrustmaster */
             0x045e, /* Microsoft */
             0x0738, /* Mad Catz */
+            0x0b05, /* ASUS */
             0x0e6f, /* PDP */
             0x0f0d, /* Hori */
             0x10f5, /* Turtle Beach */
diff --git a/src/joystick/usb_ids.h b/src/joystick/usb_ids.h
index 9cdcfa68ad7da..d16605751b47d 100644
--- a/src/joystick/usb_ids.h
+++ b/src/joystick/usb_ids.h
@@ -28,6 +28,7 @@
 #define USB_VENDOR_AMAZON       0x1949
 #define USB_VENDOR_APPLE        0x05ac
 #define USB_VENDOR_ASTRO        0x9886
+#define USB_VENDOR_ASUS         0x0b05
 #define USB_VENDOR_BACKBONE     0x358a
 #define USB_VENDOR_GAMESIR      0x3537
 #define USB_VENDOR_DRAGONRISE   0x0079
@@ -105,6 +106,7 @@
 #define USB_PRODUCT_RAZER_WOLVERINE_V2_PRO_PS5_WIRELESS   0x100c
 #define USB_PRODUCT_RAZER_WOLVERINE_V2_PRO_XBOX_WIRED     0x1010
 #define USB_PRODUCT_RAZER_WOLVERINE_V2_PRO_XBOX_WIRELESS  0x1011
+#define USB_PRODUCT_ROG_RAIKIRI                           0x1a38
 #define USB_PRODUCT_SAITEK_CYBORG_V3                      0xf622
 #define USB_PRODUCT_SHANWAN_DS3                           0x0523
 #define USB_PRODUCT_SONY_DS3                              0x0268