Commit 16010f7561cc4e7c3078f147e9639b5ec7efb24a

Sam Lantinga 2021-07-30T18:23:43

Added support for the PowerA Nintendo Switch Fusion Arcade Stick

diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c
index 5880b66..d352141 100644
--- a/src/joystick/SDL_joystick.c
+++ b/src/joystick/SDL_joystick.c
@@ -2114,6 +2114,40 @@ static SDL_bool SDL_IsJoystickProductWheel(Uint32 vidpid)
     return SDL_FALSE;
 }
 
+static SDL_bool SDL_IsJoystickProductArcadeStick(Uint32 vidpid)
+{
+    static Uint32 arcadestick_joysticks[] = {
+        MAKE_VIDPID(0x0079, 0x181a),    /* Venom Arcade Stick */
+        MAKE_VIDPID(0x0f0d, 0x006a),    /* Real Arcade Pro 4 */
+        MAKE_VIDPID(0x0079, 0x181b),    /* Venom Arcade Stick */
+        MAKE_VIDPID(0x0c12, 0x0ef6),    /* Hitbox Arcade Stick */
+        MAKE_VIDPID(0x0f0d, 0x008a),    /* HORI Real Arcade Pro 4 */
+        MAKE_VIDPID(0x0f0d, 0x0016),    /* Hori Real Arcade Pro.EX */
+        MAKE_VIDPID(0x0f0d, 0x001b),    /* Hori Real Arcade Pro VX */
+        MAKE_VIDPID(0x0f0d, 0x008c),    /* Hori Real Arcade Pro 4 */
+        MAKE_VIDPID(0x1bad, 0xf03d),    /* Street Fighter IV Arcade Stick TE - Chun Li */
+        MAKE_VIDPID(0x1bad, 0xf502),    /* Hori Real Arcade Pro.VX SA */
+        MAKE_VIDPID(0x1bad, 0xf504),    /* Hori Real Arcade Pro. EX */
+        MAKE_VIDPID(0x1bad, 0xf506),    /* Hori Real Arcade Pro.EX Premium VLX */
+        MAKE_VIDPID(0x24c6, 0x5000),    /* Razer Atrox Arcade Stick */
+        MAKE_VIDPID(0x24c6, 0x5501),    /* Hori Real Arcade Pro VX-SA */
+        MAKE_VIDPID(0x24c6, 0x550e),    /* Hori Real Arcade Pro V Kai 360 */
+        MAKE_VIDPID(0x0f0d, 0x0063),    /* Hori Real Arcade Pro Hayabusa (USA) Xbox One */
+        MAKE_VIDPID(0x0f0d, 0x0078),    /* Hori Real Arcade Pro V Kai Xbox One */
+        MAKE_VIDPID(0x1532, 0x0a00),    /* Razer Atrox Arcade Stick */
+        MAKE_VIDPID(0x0f0d, 0x00aa),    /* HORI Real Arcade Pro V Hayabusa in Switch Mode */
+        MAKE_VIDPID(0x20d6, 0xa715),    /* PowerA Nintendo Switch Fusion Arcade Stick */
+    };
+    int i;
+
+    for (i = 0; i < SDL_arraysize(arcadestick_joysticks); ++i) {
+        if (vidpid == arcadestick_joysticks[i]) {
+            return SDL_TRUE;
+        }
+    }
+    return SDL_FALSE;
+}
+
 static SDL_bool SDL_IsJoystickProductFlightStick(Uint32 vidpid)
 {
     static Uint32 flightstick_joysticks[] = {
@@ -2194,6 +2228,10 @@ static SDL_JoystickType SDL_GetJoystickGUIDType(SDL_JoystickGUID guid)
         return SDL_JOYSTICK_TYPE_WHEEL;
     }
 
+    if (SDL_IsJoystickProductArcadeStick(vidpid)) {
+        return SDL_JOYSTICK_TYPE_ARCADE_STICK;
+    }
+
     if (SDL_IsJoystickProductFlightStick(vidpid)) {
         return SDL_JOYSTICK_TYPE_FLIGHT_STICK;
     }
diff --git a/src/joystick/controller_type.h b/src/joystick/controller_type.h
index 5d55579..3b03cda 100644
--- a/src/joystick/controller_type.h
+++ b/src/joystick/controller_type.h
@@ -587,6 +587,7 @@ static const ControllerDescription_t arrControllers[] = {
 	{ MAKE_CONTROLLER_ID( 0x20d6, 0xa712 ), k_eControllerType_SwitchInputOnlyController, NULL },  // PowerA Nintendo Switch Fusion Fight Pad
 	{ MAKE_CONTROLLER_ID( 0x20d6, 0xa713 ), k_eControllerType_SwitchInputOnlyController, NULL },  // PowerA Super Mario Controller
 	{ MAKE_CONTROLLER_ID( 0x20d6, 0xa714 ), k_eControllerType_SwitchInputOnlyController, NULL },  // PowerA Nintendo Switch Spectra Controller
+	{ MAKE_CONTROLLER_ID( 0x20d6, 0xa715 ), k_eControllerType_SwitchInputOnlyController, NULL },  // PowerA Nintendo Switch Fusion Arcade Stick
 	{ MAKE_CONTROLLER_ID( 0x20d6, 0xa716 ), k_eControllerType_SwitchInputOnlyController, NULL },  // PowerA Nintendo Switch Fusion Pro Controller
 
 	// Valve products