From 857e5b08c39cbd5a2a057669448e40a301b071b1 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sun, 24 Dec 2023 11:19:16 -0800
Subject: [PATCH] Fixed trying to add a game controller mapping for the
accelerometer on iOS
Fixes https://github.com/libsdl-org/SDL/issues/8716
(cherry picked from commit 0e5ea3cc4b98d061688a098836254ab6470b07e8)
---
src/joystick/iphoneos/SDL_mfijoystick.m | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/joystick/iphoneos/SDL_mfijoystick.m b/src/joystick/iphoneos/SDL_mfijoystick.m
index 9a9a4defcc2b..ed38cf5b44a6 100644
--- a/src/joystick/iphoneos/SDL_mfijoystick.m
+++ b/src/joystick/iphoneos/SDL_mfijoystick.m
@@ -1834,6 +1834,9 @@ static SDL_bool IOS_JoystickGetGamepadMapping(int device_index, SDL_GamepadMappi
if (device == NULL) {
return SDL_FALSE;
}
+ if (device->accelerometer) {
+ return SDL_FALSE;
+ }
if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) {
int axis = 0;