Don't filter out controllers when launched by Steam under Proton
Fixes https://github.com/libsdl-org/SDL/issues/11579
Fixes https://github.com/libsdl-org/SDL/issues/12106
(cherry picked from commit 3060105cfa8e67dc47936274c63580a7adb2736d)
(cherry picked from commit 482d964733e5ab42390a16bceff9f1ba3b750b95)
diff --git a/src/joystick/SDL_gamecontroller.c b/src/joystick/SDL_gamecontroller.c
index fffc010..36e521e 100644
--- a/src/joystick/SDL_gamecontroller.c
+++ b/src/joystick/SDL_gamecontroller.c
@@ -2127,15 +2127,20 @@
SDL_GetJoystickGUIDInfo(guid, &vendor, &product, &version, NULL);
#ifdef __WIN32__
- if (SDL_GetHintBoolean("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD", SDL_FALSE)) {
- /* We're running under Steam and it will hide any controllers that we shouldn't open */
- return FALSE;
+ if (SDL_GetHintBoolean("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD", SDL_FALSE) &&
+ SDL_GetHintBoolean("STEAM_COMPAT_PROTON", SDL_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 SDL_FALSE;
}
-#else
+#endif // __WIN32__
+
if (SDL_IsJoystickSteamVirtualGamepad(vendor, product, version)) {
return !SDL_GetHintBoolean("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD", SDL_FALSE);
}
-#endif
if (SDL_allowed_controllers.num_included_entries > 0) {
if (SDL_VIDPIDInList(vendor, product, &SDL_allowed_controllers)) {