Fixed detecting Steam Deck controller on Proton 9.04

Newer versions of Proton properly pass through the Steam virtual gamepad VID/PID, but older Proton (9.x and older) don't, so we have to rely on Steam and Proton hiding controllers we shouldn't have access to.

Fixes https://github.com/libsdl-org/SDL/issues/12106
This commit is contained in:
Sam Lantinga
2025-01-31 15:32:33 -08:00
parent 55a75875f0
commit da0cf3f634

View File

@@ -2126,9 +2126,16 @@ SDL_bool SDL_ShouldIgnoreGameController(const char *name, SDL_JoystickGUID guid)
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;
}
#else
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)) {