Skip to content

Commit b6fa4dc

Browse files
committed
Only use Steam Virtual Gamepads if we're running under Steam
Fixes #11214 Fixes #11215 (cherry picked from commit 8a30def)
1 parent cfb3db0 commit b6fa4dc

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

src/joystick/SDL_gamecontroller.c

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2123,28 +2123,10 @@ SDL_bool SDL_ShouldIgnoreGameController(const char *name, SDL_JoystickGUID guid)
21232123
return SDL_TRUE;
21242124
}
21252125

2126-
if (SDL_allowed_controllers.num_included_entries == 0 &&
2127-
SDL_ignored_controllers.num_included_entries == 0) {
2128-
return SDL_FALSE;
2129-
}
2130-
21312126
SDL_GetJoystickGUIDInfo(guid, &vendor, &product, &version, NULL);
21322127

2133-
if (SDL_GetHintBoolean("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD", SDL_FALSE)) {
2134-
/* We shouldn't ignore Steam's virtual gamepad since it's using the hints to filter out the real controllers so it can remap input for the virtual controller */
2135-
/* https://partner.steamgames.com/doc/features/steam_controller/steam_input_gamepad_emulation_bestpractices */
2136-
SDL_bool bSteamVirtualGamepad = SDL_FALSE;
2137-
#if defined(__LINUX__)
2138-
bSteamVirtualGamepad = (vendor == USB_VENDOR_VALVE && product == USB_PRODUCT_STEAM_VIRTUAL_GAMEPAD);
2139-
#elif defined(__MACOSX__)
2140-
bSteamVirtualGamepad = (vendor == USB_VENDOR_MICROSOFT && product == USB_PRODUCT_XBOX360_WIRED_CONTROLLER && version == 0);
2141-
#elif defined(__WIN32__)
2142-
/* We can't tell on Windows, but Steam will block others in input hooks */
2143-
bSteamVirtualGamepad = SDL_TRUE;
2144-
#endif
2145-
if (bSteamVirtualGamepad) {
2146-
return SDL_FALSE;
2147-
}
2128+
if (SDL_IsJoystickSteamVirtualGamepad(vendor, product, version)) {
2129+
return !SDL_GetHintBoolean("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD", SDL_FALSE);
21482130
}
21492131

21502132
if (SDL_allowed_controllers.num_included_entries > 0) {

0 commit comments

Comments
 (0)