diff --git a/src/hidapi/mac/hid.c b/src/hidapi/mac/hid.c index e58b9a990f..79d86bee19 100644 --- a/src/hidapi/mac/hid.c +++ b/src/hidapi/mac/hid.c @@ -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 diff --git a/src/joystick/SDL_gamepad.c b/src/joystick/SDL_gamepad.c index ffe3f2944c..dd5b4166a9 100644 --- a/src/joystick/SDL_gamepad.c +++ b/src/joystick/SDL_gamepad.c @@ -3286,11 +3286,6 @@ bool SDL_ShouldIgnoreGamepad(Uint16 vendor_id, Uint16 product_id, Uint16 version } } -#ifdef SDL_PLATFORM_MACOS - // On macOS do nothing here since we detect Steam virtual gamepads - // in IOKit HID backends to ensure accuracy. - // See joystick/darwin/SDL_iokitjoystick.c and hidapi/mac/hid.c. -#else const char *hint = SDL_getenv_unsafe("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD"); bool allow_steam_virtual_gamepad = SDL_GetStringBoolean(hint, false); #ifdef SDL_PLATFORM_WIN32 @@ -3306,7 +3301,6 @@ bool SDL_ShouldIgnoreGamepad(Uint16 vendor_id, Uint16 product_id, Uint16 version if (SDL_IsJoystickSteamVirtualGamepad(vendor_id, product_id, version)) { return !allow_steam_virtual_gamepad; } -#endif if (SDL_allowed_gamepads.num_included_entries > 0) { if (SDL_VIDPIDInList(vendor_id, product_id, &SDL_allowed_gamepads)) { diff --git a/src/joystick/apple/SDL_mfijoystick.m b/src/joystick/apple/SDL_mfijoystick.m index 4916e842e1..98756f2eab 100644 --- a/src/joystick/apple/SDL_mfijoystick.m +++ b/src/joystick/apple/SDL_mfijoystick.m @@ -1774,7 +1774,7 @@ bool IOS_SupportedHIDDevice(IOHIDDeviceRef device) } if (IOHIDDeviceGetProperty(device, CFSTR(kIOHIDVirtualHIDevice)) == kCFBooleanTrue) { - // Steam virtual gamepads always have kIOHIDVirtualHIDevice property unlike real devices, and are also not exposed as GCController + // Steam virtual gamepads always have kIOHIDVirtualHIDevice property unlike real devices, and are also not supported as GCController return false; } diff --git a/src/joystick/darwin/SDL_iokitjoystick.c b/src/joystick/darwin/SDL_iokitjoystick.c index 7e36391f42..b88258f18d 100644 --- a/src/joystick/darwin/SDL_iokitjoystick.c +++ b/src/joystick/darwin/SDL_iokitjoystick.c @@ -516,13 +516,10 @@ static bool GetDeviceInfo(IOHIDDeviceRef hidDevice, recDevice *pDevice) return false; } - if (IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDVirtualHIDevice)) == kCFBooleanTrue) { - // Steam virtual gamepads always have kIOHIDVirtualHIDevice property unlike real devices - if (SDL_IsJoystickSteamVirtualGamepad(vendor, product, version)) { - const char *allow_steam_virtual_gamepad = SDL_getenv_unsafe("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD"); - if (!SDL_GetStringBoolean(allow_steam_virtual_gamepad, false)) { - return false; - } + if (SDL_IsJoystickSteamVirtualGamepad(vendor, product, version)) { + if (IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDVirtualHIDevice)) != kCFBooleanTrue) { + // This is a real Xbox 360 controller, adjust the version so it's not detected as a Steam virtual gamepad + version = 1; } }