Ver Fonte

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 da0cf3f634cef5ab87bc60d689b0adc260298780)
Sam Lantinga há 2 meses atrás
pai
commit
964b9da519
1 ficheiros alterados com 7 adições e 0 exclusões
  1. 7 0
      src/joystick/SDL_gamecontroller.c

+ 7 - 0
src/joystick/SDL_gamecontroller.c

@@ -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)) {