mirror of
https://github.com/Ryujinx/SDL.git
synced 2025-02-01 23:41:05 +00:00
Fixed duplicate Joy-Con controllers on macOS
If both Apple and HIDAPI drivers see the controller, HIDAPI will be preferred. Fixes https://github.com/libsdl-org/SDL/issues/7479 (cherry picked from commit 61ef4efdfae7e384b0d24b1b171a9ee6203a3f0d)
This commit is contained in:
parent
7b2b99a996
commit
78a92b4f9d
|
@ -281,6 +281,7 @@ static BOOL IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle
|
|||
(is_ps4 && HIDAPI_IsDeviceTypePresent(SDL_CONTROLLER_TYPE_PS4)) ||
|
||||
(is_ps5 && HIDAPI_IsDeviceTypePresent(SDL_CONTROLLER_TYPE_PS5)) ||
|
||||
(is_switch_pro && HIDAPI_IsDeviceTypePresent(SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO)) ||
|
||||
(is_switch_joycon_pair && HIDAPI_IsDevicePresent(USB_VENDOR_NINTENDO, USB_PRODUCT_NINTENDO_SWITCH_JOYCON_PAIR, 0, "")) ||
|
||||
(is_stadia && HIDAPI_IsDeviceTypePresent(SDL_CONTROLLER_TYPE_GOOGLE_STADIA))) {
|
||||
/* The HIDAPI driver is taking care of this device */
|
||||
return FALSE;
|
||||
|
@ -434,6 +435,17 @@ static BOOL IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle
|
|||
BOOL is_switch_joyconR = IsControllerSwitchJoyConR(controller);
|
||||
int nbuttons = 0;
|
||||
|
||||
#ifdef SDL_JOYSTICK_HIDAPI
|
||||
if ((is_switch_joyconL && HIDAPI_IsDevicePresent(USB_VENDOR_NINTENDO, USB_PRODUCT_NINTENDO_SWITCH_JOYCON_LEFT, 0, "")) ||
|
||||
(is_switch_joyconR && HIDAPI_IsDevicePresent(USB_VENDOR_NINTENDO, USB_PRODUCT_NINTENDO_SWITCH_JOYCON_RIGHT, 0, ""))) {
|
||||
/* The HIDAPI driver is taking care of this device */
|
||||
return FALSE;
|
||||
}
|
||||
#else
|
||||
(void)is_switch_joyconL;
|
||||
(void)is_switch_joyconR;
|
||||
#endif
|
||||
|
||||
if (is_switch_joyconL) {
|
||||
vendor = USB_VENDOR_NINTENDO;
|
||||
product = USB_PRODUCT_NINTENDO_SWITCH_JOYCON_LEFT;
|
||||
|
|
Loading…
Reference in a new issue