From 4a9ceb7be915edc007e89642d37908657cadb397 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 4 Aug 2022 11:33:36 -0700
Subject: [PATCH] The HORIPAD S uses the Xbox 360 protocol on all platforms and
shows up as multiple styles of controller, depending on what model you have.
---
src/joystick/controller_type.c | 14 +++++++++-----
src/joystick/hidapi/SDL_hidapi_switch.c | 5 -----
2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/src/joystick/controller_type.c b/src/joystick/controller_type.c
index df4d8505bc9..bf4c8ee7bb1 100644
--- a/src/joystick/controller_type.c
+++ b/src/joystick/controller_type.c
@@ -542,11 +542,15 @@ static const ControllerDescription_t arrControllers[] = {
{ MAKE_CONTROLLER_ID( 0x0f0d, 0x00c1 ), k_eControllerType_SwitchInputOnlyController, NULL }, // HORIPAD for Nintendo Switch
{ MAKE_CONTROLLER_ID( 0x0f0d, 0x0092 ), k_eControllerType_SwitchInputOnlyController, NULL }, // HORI Pokken Tournament DX Pro Pad
{ MAKE_CONTROLLER_ID( 0x0f0d, 0x00f6 ), k_eControllerType_SwitchProController, NULL }, // HORI Wireless Switch Pad
-#ifdef _WIN32
- { MAKE_CONTROLLER_ID( 0x0f0d, 0x00dc ), k_eControllerType_XInputSwitchController, NULL }, // HORI Fighting Commander - Is a Switch controller but shows up through XInput on Windows.
-#else
- { MAKE_CONTROLLER_ID( 0x0f0d, 0x00dc ), k_eControllerType_SwitchProController, "HORI Fighting Commander" },
-#endif
+ // The HORIPAD S, which comes in multiple styles:
+ // - NSW-108, classic GameCube controller
+ // - NSW-244, Fighting Commander arcade pad
+ // - NSW-278, Hori Pad Mini gamepad
+ //
+ // The first two, at least, shouldn't have their buttons remapped, and since we
+ // can't tell which model we're actually using, we won't do any button remapping
+ // for any of them.
+ { MAKE_CONTROLLER_ID( 0x0f0d, 0x00dc ), k_eControllerType_XInputSwitchController, NULL }, // HORIPAD S - Looks like a Switch controller but uses the Xbox 360 controller protocol
{ MAKE_CONTROLLER_ID( 0x0e6f, 0x0180 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PDP Faceoff Wired Pro Controller for Nintendo Switch
{ MAKE_CONTROLLER_ID( 0x0e6f, 0x0181 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PDP Faceoff Deluxe Wired Pro Controller for Nintendo Switch
{ MAKE_CONTROLLER_ID( 0x0e6f, 0x0184 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PDP Faceoff Wired Deluxe+ Audio Controller
diff --git a/src/joystick/hidapi/SDL_hidapi_switch.c b/src/joystick/hidapi/SDL_hidapi_switch.c
index 088ce375a87..c1ef34debbe 100644
--- a/src/joystick/hidapi/SDL_hidapi_switch.c
+++ b/src/joystick/hidapi/SDL_hidapi_switch.c
@@ -328,11 +328,6 @@ static SDL_bool
AlwaysUsesLabels(int vendor_id, int product_id, ESwitchDeviceInfoControllerType eControllerType)
{
/* These controllers don't have a diamond button configuration, so always use labels */
- if (vendor_id == 0x0f0d && product_id == 0x00dc) {
- /* The HORIPAD S, which comes in two flavors: a GameCube style and an arcade pad style,
- * neither of which should have their buttons remapped */
- return SDL_TRUE;
- }
switch (eControllerType) {
case k_eSwitchDeviceInfoControllerType_NESLeft:
case k_eSwitchDeviceInfoControllerType_NESRight: