From 0bd95b04307a42f09bb0f3baafc41bd353d6f280 Mon Sep 17 00:00:00 2001
From: QwertyChouskie <[EMAIL REDACTED]>
Date: Tue, 9 Jun 2026 07:33:22 -0700
Subject: [PATCH] Respect SDL_HINT_JOYSTICK_MFI
---
src/joystick/hidapi/SDL_hidapi_xbox360.c | 21 +++++++++++----------
src/joystick/hidapi/SDL_hidapi_xboxone.c | 5 +++--
2 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/src/joystick/hidapi/SDL_hidapi_xbox360.c b/src/joystick/hidapi/SDL_hidapi_xbox360.c
index b3393c4cf89fc..2a3990a9af656 100644
--- a/src/joystick/hidapi/SDL_hidapi_xbox360.c
+++ b/src/joystick/hidapi/SDL_hidapi_xbox360.c
@@ -212,18 +212,19 @@ static bool HIDAPI_DriverXbox360_IsSupportedDevice(SDL_HIDAPI_Device *device, co
}
#endif
#if defined(SDL_PLATFORM_MACOS) && defined(SDL_JOYSTICK_MFI)
- if (SDL_IsJoystickSteamVirtualGamepad(vendor_id, product_id, version)) {
- // GCController support doesn't work with the Steam Virtual Gamepad
- return 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 false;
+ if (SDL_GetHintBoolean(SDL_HINT_JOYSTICK_MFI, true)) {
+ if (SDL_IsJoystickSteamVirtualGamepad(vendor_id, product_id, version)) {
+ // GCController support doesn't work with the Steam Virtual Gamepad
+ return 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 false;
+ }
}
-#else
- return (type == SDL_GAMEPAD_TYPE_XBOX360);
#endif
+ return (type == SDL_GAMEPAD_TYPE_XBOX360);
}
static bool SetSlotLED(SDL_hid_device *dev, Uint8 slot, bool on)
diff --git a/src/joystick/hidapi/SDL_hidapi_xboxone.c b/src/joystick/hidapi/SDL_hidapi_xboxone.c
index a3fa66e7c8ca3..14dc6cb0d3857 100644
--- a/src/joystick/hidapi/SDL_hidapi_xboxone.c
+++ b/src/joystick/hidapi/SDL_hidapi_xboxone.c
@@ -368,10 +368,11 @@ static bool HIDAPI_DriverXboxOne_IsSupportedDevice(SDL_HIDAPI_Device *device, co
static const int XBONE_IFACE_PROTOCOL = 208;
#if defined(SDL_PLATFORM_MACOS) && defined(SDL_JOYSTICK_MFI)
- if (!SDL_IsJoystickBluetoothXboxOne(vendor_id, product_id)) {
+ if (SDL_GetHintBoolean(SDL_HINT_JOYSTICK_MFI, 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 false;
}
#endif