SDL: Switch the menu button on the Apple TV remote to the B button to match UI guidelines

From 64939d3586db1bb1e55bf48b18d5ad2081590780 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 15 Nov 2023 17:30:27 -0800
Subject: [PATCH] Switch the menu button on the Apple TV remote to the B button
 to match UI guidelines

---
 src/joystick/apple/SDL_mfijoystick.m | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/joystick/apple/SDL_mfijoystick.m b/src/joystick/apple/SDL_mfijoystick.m
index b3929f192903..d8d21892d1d9 100644
--- a/src/joystick/apple/SDL_mfijoystick.m
+++ b/src/joystick/apple/SDL_mfijoystick.m
@@ -638,8 +638,8 @@ static BOOL IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle
         int nbuttons = 0;
 
         device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_SOUTH);
-        device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_EAST); /* Button X on microGamepad */
-        device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_START);
+        device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_WEST); /* Button X on microGamepad */
+        device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_EAST);
         nbuttons += 3;
         device->pause_button_index = (nbuttons - 1);
 
@@ -1965,7 +1965,11 @@ static SDL_bool IOS_JoystickGetGamepadMapping(int device_index, SDL_GamepadMappi
         } else if ([(NSString *)key isEqualToString:GCInputButtonHome]) {
             mapping = &out->guide;
         } else if ([(NSString *)key isEqualToString:GCInputButtonMenu]) {
-            mapping = &out->start;
+            if (device->is_siri_remote) {
+                mapping = &out->b;
+            } else {
+                mapping = &out->start;
+            }
         } else if ([(NSString *)key isEqualToString:GCInputButtonOptions]) {
             mapping = &out->back;
         } else if ([(NSString *)key isEqualToString:GCInputButtonShare]) {