The Nintendo Online classic controllers and Joy-Cons shouldn't show up as Switch Pro controllers

This commit is contained in:
Sam Lantinga 2022-08-03 13:53:49 -07:00
parent 6e1ee1d4a5
commit a8120104ad
3 changed files with 9 additions and 13 deletions

View file

@ -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;
}

View file

@ -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

View file

@ -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;
}