mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-05 22:30:29 +00:00
Fixed Steam Controller not detected on macOS under Steam
(cherry picked from commit 8a701808a6)
This commit is contained in:
parent
5e55c12d78
commit
f38994c15c
4 changed files with 9 additions and 22 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue