SDL: Fixed detecting the Steam virtual gamepad when HIDAPI is disabled (bfdd7)

From bfdd7ee8b4dd3c88d2ab77fdc026844736f27a14 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Fri, 29 May 2026 10:55:57 -0700
Subject: [PATCH] Fixed detecting the Steam virtual gamepad when HIDAPI is
 disabled

(cherry picked from commit ec0066aa0b8de1e8fca9e179ad3e33c0607e9a97)
---
 src/joystick/apple/SDL_mfijoystick.m | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/joystick/apple/SDL_mfijoystick.m b/src/joystick/apple/SDL_mfijoystick.m
index dbbee97eb3fd4..4916e842e16d7 100644
--- a/src/joystick/apple/SDL_mfijoystick.m
+++ b/src/joystick/apple/SDL_mfijoystick.m
@@ -1773,6 +1773,11 @@ bool IOS_SupportedHIDDevice(IOHIDDeviceRef device)
         return false;
     }
 
+    if (IOHIDDeviceGetProperty(device, CFSTR(kIOHIDVirtualHIDevice)) == kCFBooleanTrue) {
+        // Steam virtual gamepads always have kIOHIDVirtualHIDevice property unlike real devices, and are also not exposed as GCController
+        return false;
+    }
+
     if (@available(macOS 11.0, *)) {
         const int MAX_ATTEMPTS = 3;
         for (int attempt = 0; attempt < MAX_ATTEMPTS; ++attempt) {