Skip to content

Commit de1616b

Browse files
committed
Don't filter out controllers when launched by Steam under Proton
Fixes libsdl-org#11579 Fixes libsdl-org#12106 (cherry picked from commit 3060105) (cherry picked from commit 482d964)
1 parent 964b9da commit de1616b

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/joystick/SDL_gamecontroller.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2127,15 +2127,20 @@ SDL_bool SDL_ShouldIgnoreGameController(const char *name, SDL_JoystickGUID guid)
21272127
SDL_GetJoystickGUIDInfo(guid, &vendor, &product, &version, NULL);
21282128

21292129
#ifdef __WIN32__
2130-
if (SDL_GetHintBoolean("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD", SDL_FALSE)) {
2131-
/* We're running under Steam and it will hide any controllers that we shouldn't open */
2132-
return FALSE;
2130+
if (SDL_GetHintBoolean("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD", SDL_FALSE) &&
2131+
SDL_GetHintBoolean("STEAM_COMPAT_PROTON", SDL_FALSE)) {
2132+
/* We are launched by Steam and running under Proton
2133+
* We can't tell whether this controller is a Steam Virtual Gamepad,
2134+
* so assume that Proton is doing the appropriate filtering of controllers
2135+
* and anything we see here is fine to use.
2136+
*/
2137+
return SDL_FALSE;
21332138
}
2134-
#else
2139+
#endif // __WIN32__
2140+
21352141
if (SDL_IsJoystickSteamVirtualGamepad(vendor, product, version)) {
21362142
return !SDL_GetHintBoolean("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD", SDL_FALSE);
21372143
}
2138-
#endif
21392144

21402145
if (SDL_allowed_controllers.num_included_entries > 0) {
21412146
if (SDL_VIDPIDInList(vendor, product, &SDL_allowed_controllers)) {

0 commit comments

Comments
 (0)