From 3060105cfa8e67dc47936274c63580a7adb2736d Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 5 Dec 2024 19:22:32 -0800 Subject: [PATCH] Don't filter out controllers when launched by Steam under Proton Fixes https://github.com/libsdl-org/SDL/issues/11579 --- src/joystick/SDL_gamepad.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/joystick/SDL_gamepad.c b/src/joystick/SDL_gamepad.c index 0ad193f5dc1f2..f967185bb37a7 100644 --- a/src/joystick/SDL_gamepad.c +++ b/src/joystick/SDL_gamepad.c @@ -2620,6 +2620,17 @@ bool SDL_ShouldIgnoreGamepad(Uint16 vendor_id, Uint16 product_id, Uint16 version return true; } +#ifdef SDL_PLATFORM_WIN32 + if (SDL_GetHintBoolean("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD", false) && + SDL_GetHintBoolean("STEAM_COMPAT_PROTON", false)) { + // We are launched by Steam and running under Proton + // We can't tell whether this controller is a Steam Virtual Gamepad, + // so assume that Proton is doing the appropriate filtering of controllers + // and anything we see here is fine to use. + return false; + } +#endif // SDL_PLATFORM_WIN32 + if (SDL_IsJoystickSteamVirtualGamepad(vendor_id, product_id, version)) { return !SDL_GetHintBoolean("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD", false); }