mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-28 11:57:24 +08:00
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
(cherry picked from commit da0cf3f634)
This commit is contained in:
@@ -2126,9 +2126,16 @@ SDL_bool SDL_ShouldIgnoreGameController(const char *name, SDL_JoystickGUID guid)
|
|||||||
|
|
||||||
SDL_GetJoystickGUIDInfo(guid, &vendor, &product, &version, NULL);
|
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)) {
|
if (SDL_IsJoystickSteamVirtualGamepad(vendor, product, version)) {
|
||||||
return !SDL_GetHintBoolean("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD", SDL_FALSE);
|
return !SDL_GetHintBoolean("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD", SDL_FALSE);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (SDL_allowed_controllers.num_included_entries > 0) {
|
if (SDL_allowed_controllers.num_included_entries > 0) {
|
||||||
if (SDL_VIDPIDInList(vendor, product, &SDL_allowed_controllers)) {
|
if (SDL_VIDPIDInList(vendor, product, &SDL_allowed_controllers)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user