[Commits] SDL: Added a private hint for Steam to bypass the controller fil...

libsdl.org revision control commits-owner at libsdl.org
Wed Aug 9 12:38:23 PDT 2017


details:   https://hg.libsdl.org/SDL/rev/2c405337cf3d
changeset: 11203:2c405337cf3d
user:      Sam Lantinga <slouken at libsdl.org>
date:      Wed Aug 09 12:38:20 2017 -0700
description:
Added a private hint for Steam to bypass the controller filtering for the Steam virtual gamepad

diffstat:

 src/joystick/SDL_gamecontroller.c |  16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diffs (26 lines):

diff -r e393438c4a95 -r 2c405337cf3d src/joystick/SDL_gamecontroller.c
--- a/src/joystick/SDL_gamecontroller.c	Wed Aug 09 12:11:59 2017 -0700
+++ b/src/joystick/SDL_gamecontroller.c	Wed Aug 09 12:38:20 2017 -0700
@@ -1264,6 +1264,22 @@
     SDL_GetJoystickGUIDInfo(guid, &vendor, &product, NULL);
     vidpid = MAKE_VIDPID(vendor, product);
 
+    if (SDL_GetHintBoolean("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD", SDL_FALSE)) {
+        /* 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 */
+        SDL_bool bSteamVirtualGamepad = SDL_FALSE;
+#if defined(__LINUX__)
+        bSteamVirtualGamepad = (vendor == 0x28DE && product == 0x11FF);
+#elif defined(__MACOSX__)
+        bSteamVirtualGamepad = (SDL_strncmp(name, "GamePad-", 8) == 0);
+#elif defined(__WIN32__)
+        /* We can't tell on Windows, but Steam will block others in input hooks */
+        bSteamVirtualGamepad = SDL_TRUE;
+#endif
+        if (bSteamVirtualGamepad) {
+            return SDL_FALSE;
+        }
+    }
+
     if (SDL_allowed_controllers.num_entries > 0) {
         for (i = 0; i < SDL_allowed_controllers.num_entries; ++i) {
             if (vidpid == SDL_allowed_controllers.entries[i]) {


More information about the commits mailing list