De-duplicate Google Stadia controllers on macOS

main
Sam Lantinga 2023-02-21 15:31:32 -08:00
parent 4aeec9d8c2
commit 87a83787a3
1 changed files with 10 additions and 1 deletions

View File

@ -205,6 +205,13 @@ static BOOL IsControllerSwitchJoyConPair(GCController *controller)
}
return FALSE;
}
static BOOL IsControllerStadia(GCController *controller)
{
if ([controller.vendorName hasPrefix:@"Stadia"]) {
return TRUE;
}
return FALSE;
}
static BOOL IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCController *controller)
{
Uint16 vendor = 0;
@ -252,6 +259,7 @@ static BOOL IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle
BOOL is_ps5 = IsControllerPS5(controller);
BOOL is_switch_pro = IsControllerSwitchPro(controller);
BOOL is_switch_joycon_pair = IsControllerSwitchJoyConPair(controller);
BOOL is_stadia = IsControllerStadia(controller);
int nbuttons = 0;
BOOL has_direct_menu;
@ -259,7 +267,8 @@ static BOOL IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle
if ((is_xbox && HIDAPI_IsDeviceTypePresent(SDL_GAMEPAD_TYPE_XBOXONE)) ||
(is_ps4 && HIDAPI_IsDeviceTypePresent(SDL_GAMEPAD_TYPE_PS4)) ||
(is_ps5 && HIDAPI_IsDeviceTypePresent(SDL_GAMEPAD_TYPE_PS5)) ||
(is_switch_pro && HIDAPI_IsDeviceTypePresent(SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_PRO))) {
(is_switch_pro && HIDAPI_IsDeviceTypePresent(SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_PRO)) ||
(is_stadia && HIDAPI_IsDeviceTypePresent(SDL_GAMEPAD_TYPE_GOOGLE_STADIA))) {
/* The HIDAPI driver is taking care of this device */
return FALSE;
}