Fixed Joy-Con type detection for the Nintendo Joy-Con Charging Grip

This commit is contained in:
Sam Lantinga 2022-08-08 15:38:19 -07:00
parent a35cff634b
commit ada55c690d
1 changed files with 7 additions and 0 deletions

View File

@ -1983,6 +1983,13 @@ SDL_GetJoystickGameControllerTypeFromVIDPID(Uint16 vendor, Uint16 product, const
type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT;
}
} else if (vendor == USB_VENDOR_NINTENDO && product == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_GRIP) {
if (name && SDL_strstr(name, "(L)") != NULL) {
type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT;
} else {
type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT;
}
} else if (vendor == USB_VENDOR_NINTENDO && product == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_PAIR) {
type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR;