SDL: Added support for the HORI Taiko No Tatsujin Drum Controller (976c9)

From 976c92a2fb71673445440585a22d4b948286f67f Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 2 Apr 2025 08:30:26 -0700
Subject: [PATCH] Added support for the HORI Taiko No Tatsujin Drum Controller

(cherry picked from commit 82b245d13a544b2120945f0996f1031e1640b877)
---
 src/SDL_utils.c             | 6 +++++-
 src/joystick/SDL_joystick.c | 3 ++-
 src/joystick/usb_ids.h      | 1 +
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/SDL_utils.c b/src/SDL_utils.c
index 8d321430b274c..f2090747a8d35 100644
--- a/src/SDL_utils.c
+++ b/src/SDL_utils.c
@@ -403,6 +403,10 @@ const char *SDL_GetPersistentString(const char *string)
 static int PrefixMatch(const char *a, const char *b)
 {
     int matchlen = 0;
+    // Fixes the "HORI HORl Taiko No Tatsujin Drum Controller"
+    if (SDL_strncmp(a, "HORI ", 5) == 0 && SDL_strncmp(b, "HORl ", 5) == 0) {
+        return 5;
+    }
     while (*a && *b) {
         if (SDL_tolower((unsigned char)*a++) == SDL_tolower((unsigned char)*b++)) {
             ++matchlen;
@@ -424,8 +428,8 @@ char *SDL_CreateDeviceName(Uint16 vendor, Uint16 product, const char *vendor_nam
         { "ASTRO Gaming", "ASTRO" },
         { "Bensussen Deutsch & Associates,Inc.(BDA)", "BDA" },
         { "Guangzhou Chicken Run Network Technology Co., Ltd.", "GameSir" },
-        { "HORI CO.,LTD", "HORI" },
         { "HORI CO.,LTD.", "HORI" },
+        { "HORI CO.,LTD", "HORI" },
         { "Mad Catz Inc.", "Mad Catz" },
         { "Nintendo Co., Ltd.", "Nintendo" },
         { "NVIDIA Corporation ", "" },
diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c
index 78c64b7f64168..a270724ccd6a4 100644
--- a/src/joystick/SDL_joystick.c
+++ b/src/joystick/SDL_joystick.c
@@ -2858,7 +2858,8 @@ bool SDL_IsJoystickXboxSeriesX(Uint16 vendor_id, Uint16 product_id)
     }
     if (vendor_id == USB_VENDOR_HORI) {
         if (product_id == USB_PRODUCT_HORI_FIGHTING_COMMANDER_OCTA_SERIES_X ||
-            product_id == USB_PRODUCT_HORI_HORIPAD_PRO_SERIES_X) {
+            product_id == USB_PRODUCT_HORI_HORIPAD_PRO_SERIES_X ||
+            product_id == USB_PRODUCT_HORI_TAIKO_DRUM_CONTROLLER) {
             return true;
         }
     }
diff --git a/src/joystick/usb_ids.h b/src/joystick/usb_ids.h
index 794beb864b9c5..15c1bb74542d3 100644
--- a/src/joystick/usb_ids.h
+++ b/src/joystick/usb_ids.h
@@ -76,6 +76,7 @@
 #define USB_PRODUCT_HORI_FIGHTING_STICK_ALPHA_PS5         0x0184
 #define USB_PRODUCT_HORI_STEAM_CONTROLLER                 0x01AB
 #define USB_PRODUCT_HORI_STEAM_CONTROLLER_BT              0x0196
+#define USB_PRODUCT_HORI_TAIKO_DRUM_CONTROLLER            0x01b2
 #define USB_PRODUCT_LOGITECH_F310                         0xc216
 #define USB_PRODUCT_LOGITECH_CHILLSTREAM                  0xcad1
 #define USB_PRODUCT_MADCATZ_SAITEK_SIDE_PANEL_CONTROL_DECK 0x2218