mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-13 09:55:42 +00:00
Respect SDL_HINT_JOYSTICK_MFI
Backport of 0bd95b0430 (https://github.com/libsdl-org/SDL/pull/15791) to SDL2
This commit is contained in:
parent
27e5c2e9a5
commit
77d2f62c23
2 changed files with 14 additions and 12 deletions
|
|
@ -116,18 +116,19 @@ static SDL_bool HIDAPI_DriverXbox360_IsSupportedDevice(SDL_HIDAPI_Device *device
|
|||
}
|
||||
#endif
|
||||
#if defined(__MACOSX__) && defined(SDL_JOYSTICK_MFI)
|
||||
if (SDL_IsJoystickSteamVirtualGamepad(vendor_id, product_id, version)) {
|
||||
/* GCController support doesn't work with the Steam Virtual Gamepad */
|
||||
return SDL_TRUE;
|
||||
} else {
|
||||
// On macOS when it isn't controlled by the 360Controller driver and
|
||||
// it doesn't look like a Steam virtual gamepad we should rely on
|
||||
// GCController support instead.
|
||||
return SDL_FALSE;
|
||||
if (SDL_GetHintBoolean(SDL_HINT_JOYSTICK_MFI, SDL_TRUE)) {
|
||||
if (SDL_IsJoystickSteamVirtualGamepad(vendor_id, product_id, version)) {
|
||||
// GCController support doesn't work with the Steam Virtual Gamepad
|
||||
return SDL_TRUE;
|
||||
} else {
|
||||
// On macOS when it isn't controlled by the 360Controller driver and
|
||||
// it doesn't look like a Steam virtual gamepad we should rely on
|
||||
// GCController support instead, if supported.
|
||||
return SDL_FALSE;
|
||||
}
|
||||
}
|
||||
#else
|
||||
return (type == SDL_CONTROLLER_TYPE_XBOX360) ? SDL_TRUE : SDL_FALSE;
|
||||
#endif
|
||||
return (type == SDL_CONTROLLER_TYPE_XBOX360) ? SDL_TRUE : SDL_FALSE;
|
||||
}
|
||||
|
||||
static SDL_bool SetSlotLED(SDL_hid_device *dev, Uint8 slot, SDL_bool on)
|
||||
|
|
|
|||
|
|
@ -355,10 +355,11 @@ static SDL_bool HIDAPI_DriverXboxOne_IsEnabled(void)
|
|||
static SDL_bool HIDAPI_DriverXboxOne_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
{
|
||||
#if defined(__MACOSX__) && defined(SDL_JOYSTICK_MFI)
|
||||
if (!SDL_IsJoystickBluetoothXboxOne(vendor_id, product_id)) {
|
||||
if (SDL_GetHintBoolean(SDL_HINT_JOYSTICK_MFI, SDL_TRUE) &&
|
||||
!SDL_IsJoystickBluetoothXboxOne(vendor_id, product_id)) {
|
||||
/* On macOS we get a shortened version of the real report and
|
||||
you can't write output reports for wired controllers, so
|
||||
we'll just use the GCController support instead.
|
||||
we'll just use the GCController support instead, if available.
|
||||
*/
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue