Fixed Steam Controller not detected on macOS under Steam

This commit is contained in:
Sam Lantinga
2026-05-29 12:07:16 -07:00
parent ec0066aa0b
commit 8a701808a6
4 changed files with 9 additions and 22 deletions

View File

@@ -605,14 +605,10 @@ static struct hid_device_info *create_device_info_with_usage(IOHIDDeviceRef dev,
#endif
#ifdef HIDAPI_USING_SDL_RUNTIME
if (IOHIDDeviceGetProperty(dev, CFSTR(kIOHIDVirtualHIDevice)) == kCFBooleanTrue) {
/* Steam virtual gamepads always have kIOHIDVirtualHIDevice property unlike real devices */
if (SDL_IsJoystickSteamVirtualGamepad(dev_vid, dev_pid, dev_version)) {
const char *allow_steam_virtual_gamepad = SDL_getenv_unsafe("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD");
if (!SDL_GetStringBoolean(allow_steam_virtual_gamepad, false)) {
free(cur_dev);
return NULL;
}
if (SDL_IsJoystickSteamVirtualGamepad(dev_vid, dev_pid, dev_version)) {
if (IOHIDDeviceGetProperty(dev, CFSTR(kIOHIDVirtualHIDevice)) != kCFBooleanTrue) {
/* This is a real Xbox 360 controller, adjust the version so it's not detected as a Steam virtual gamepad */
dev_version = 1;
}
}
#endif