From 4990bd0517808c92871df3981bd188066b1c6944 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 27 Jul 2022 16:17:32 -0700
Subject: [PATCH] Added debug code to show available inputs on iOS/tvOS
controllers
---
src/joystick/iphoneos/SDL_mfijoystick.m | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/joystick/iphoneos/SDL_mfijoystick.m b/src/joystick/iphoneos/SDL_mfijoystick.m
index ad542848cf5..c16aa894624 100644
--- a/src/joystick/iphoneos/SDL_mfijoystick.m
+++ b/src/joystick/iphoneos/SDL_mfijoystick.m
@@ -246,6 +246,19 @@ @interface GCMicroGamepad (SDL)
device->name = SDL_CreateJoystickName(0, 0, NULL, name);
+#ifdef DEBUG_CONTROLLER_PROFILE
+ if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) {
+ if (controller.physicalInputProfile) {
+ for (id key in controller.physicalInputProfile.buttons) {
+ NSLog(@"Button %@ available\n", key);
+ }
+ for (id key in controller.physicalInputProfile.axes) {
+ NSLog(@"Axis %@ available\n", key);
+ }
+ }
+ }
+#endif
+
if (controller.extendedGamepad) {
GCExtendedGamepad *gamepad = controller.extendedGamepad;
BOOL is_xbox = IsControllerXbox(controller);