From a8120104adc7a1cd05220ac98d1ffb28bda0babb Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 3 Aug 2022 13:53:49 -0700 Subject: [PATCH] The Nintendo Online classic controllers and Joy-Cons shouldn't show up as Switch Pro controllers --- src/joystick/SDL_joystick.c | 9 --------- src/joystick/controller_type.c | 8 ++++---- src/joystick/hidapi/SDL_hidapi_switch.c | 5 +++++ 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index 8c926ddd7..d6f7e0c7e 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -1960,11 +1960,6 @@ SDL_GetJoystickGameControllerTypeFromVIDPID(Uint16 vendor, Uint16 product, const } else if (vendor == USB_VENDOR_NVIDIA && product == USB_PRODUCT_NVIDIA_SHIELD_CONTROLLER) { type = SDL_CONTROLLER_TYPE_NVIDIA_SHIELD; - } else if (vendor == USB_VENDOR_NINTENDO && - (product == USB_PRODUCT_NINTENDO_SWITCH_JOY_CON_GRIP || - product == USB_PRODUCT_NINTENDO_SWITCH_JOY_CON_PAIR)) { - type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO; - } else { switch (GuessControllerType(vendor, product)) { case k_eControllerType_XBox360Controller: @@ -2000,10 +1995,6 @@ SDL_GetJoystickGameControllerTypeFromVIDPID(Uint16 vendor, Uint16 product, const type = SDL_CONTROLLER_TYPE_UNKNOWN; } break; - case k_eControllerType_SwitchJoyConLeft: - case k_eControllerType_SwitchJoyConRight: - type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO; - break; default: break; } diff --git a/src/joystick/controller_type.c b/src/joystick/controller_type.c index 9c460ca86..df4d8505b 100644 --- a/src/joystick/controller_type.c +++ b/src/joystick/controller_type.c @@ -535,10 +535,10 @@ static const ControllerDescription_t arrControllers[] = { // * ZhiXu Gamepad Wireless // * Sunwaytek Wireless Motion Controller for Nintendo Switch { MAKE_CONTROLLER_ID( 0x057e, 0x2009 ), k_eControllerType_SwitchProController, NULL }, // Nintendo Switch Pro Controller - { MAKE_CONTROLLER_ID( 0x057e, 0x2017 ), k_eControllerType_SwitchProController, NULL }, // Nintendo Online SNES Controller - { MAKE_CONTROLLER_ID( 0x057e, 0x2019 ), k_eControllerType_SwitchProController, NULL }, // Nintendo Online N64 Controller - { MAKE_CONTROLLER_ID( 0x057e, 0x201e ), k_eControllerType_SwitchProController, NULL }, // Nintendo Online SEGA Genesis Controller - + //{ MAKE_CONTROLLER_ID( 0x057e, 0x2017 ), k_eControllerType_SwitchProController, NULL }, // Nintendo Online SNES Controller + //{ MAKE_CONTROLLER_ID( 0x057e, 0x2019 ), k_eControllerType_SwitchProController, NULL }, // Nintendo Online N64 Controller + //{ MAKE_CONTROLLER_ID( 0x057e, 0x201e ), k_eControllerType_SwitchProController, NULL }, // Nintendo Online SEGA Genesis Controller + { 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 diff --git a/src/joystick/hidapi/SDL_hidapi_switch.c b/src/joystick/hidapi/SDL_hidapi_switch.c index 1851e9979..d1271f134 100644 --- a/src/joystick/hidapi/SDL_hidapi_switch.c +++ b/src/joystick/hidapi/SDL_hidapi_switch.c @@ -410,6 +410,11 @@ HIDAPI_DriverSwitch_IsSupportedDevice(const char *name, SDL_GameControllerType t return SDL_FALSE; } + if (vendor_id == USB_VENDOR_NINTENDO) { + if (product_id == USB_PRODUCT_NINTENDO_SWITCH_JOY_CON_GRIP) { + return SDL_TRUE; + } + } return (type == SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO) ? SDL_TRUE : SDL_FALSE; }