From c805a4d6327dc33a8a9df0ccfc393967d10dade8 Mon Sep 17 00:00:00 2001
From: Nintorch <[EMAIL REDACTED]>
Date: Sun, 3 May 2026 21:26:15 +0500
Subject: [PATCH] Fix Xbox controller names in MFI joystick backend (#15499)
controller.vendorName returns a generic name for Xbox controllers ("Controller"), so we have to give them proper names.
---
src/joystick/apple/SDL_mfijoystick.m | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/joystick/apple/SDL_mfijoystick.m b/src/joystick/apple/SDL_mfijoystick.m
index d512521a4b4e2..758da444829a3 100644
--- a/src/joystick/apple/SDL_mfijoystick.m
+++ b/src/joystick/apple/SDL_mfijoystick.m
@@ -340,8 +340,6 @@ static bool IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle
name = "MFi Gamepad";
}
- device->name = SDL_CreateJoystickName(0, 0, NULL, name);
-
#ifdef DEBUG_CONTROLLER_PROFILE
NSLog(@"Product name: %@\n", controller.vendorName);
NSLog(@"Product category: %@\n", controller.productCategory);
@@ -428,12 +426,19 @@ static bool IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle
if (device->has_xbox_paddles) {
// Assume Xbox One Elite Series 2 Controller unless/until GCController flows VID/PID
product = USB_PRODUCT_XBOX_ONE_ELITE_SERIES_2_BLUETOOTH;
+
+ // controller.vendorName returns a generic name for Xbox controllers ("Controller"),
+ // and controller.productCategory only returns "Xbox One" for those controllers,
+ // so we give them proper names based on the ones from SDL_gamepad_db.h
+ name = "Xbox One Elite 2 Controller";
} else if (device->has_xbox_share_button) {
// Assume Xbox Series X Controller unless/until GCController flows VID/PID
product = USB_PRODUCT_XBOX_SERIES_X_BLE;
+ name = "Xbox Series X Controller";
} else {
// Assume Xbox One S Bluetooth Controller unless/until GCController flows VID/PID
product = USB_PRODUCT_XBOX_ONE_S_REV1_BLUETOOTH;
+ name = "Xbox One Wireless Controller";
}
} else if (device->is_ps4) {
// Assume DS4 Slim unless/until GCController flows VID/PID
@@ -611,6 +616,8 @@ static bool IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle
// We don't know how to get input events from this device
return false;
}
+
+ device->name = SDL_CreateJoystickName(0, 0, NULL, name);
Uint16 signature;
if (@available(macOS 11.0, iOS 14.0, tvOS 14.0, *)) {