diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-12-16 19:50:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-16 19:50:33 +0100 |
commit | 350013f5f2413a9f8cbedd635a26001a1255d902 (patch) | |
tree | 0c77800520bb3156de7f9fd1255c167a73ead193 | |
parent | 9c9cc1b22258d21d2a5393847a587d2ce1584d82 (diff) | |
parent | 8df0baf6f5086106f073b3124e93a6e52291e1db (diff) |
Merge pull request #55980 from slouken/fix-xinput-detection
Fixed detecting the Valve Streaming Gamepad
-rw-r--r-- | platform/windows/joypad_windows.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/platform/windows/joypad_windows.cpp b/platform/windows/joypad_windows.cpp index 1d3761ee83..f76749ec54 100644 --- a/platform/windows/joypad_windows.cpp +++ b/platform/windows/joypad_windows.cpp @@ -97,11 +97,13 @@ bool JoypadWindows::have_device(const GUID &p_guid) { // adapted from SDL2, works a lot better than the MSDN version bool JoypadWindows::is_xinput_device(const GUID *p_guid) { - static GUID IID_ValveStreamingGamepad = { MAKELONG(0x28DE, 0x11FF), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } }; + static GUID IID_ValveStreamingGamepad = { MAKELONG(0x28DE, 0x11FF), 0x28DE, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } }; static GUID IID_X360WiredGamepad = { MAKELONG(0x045E, 0x02A1), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } }; static GUID IID_X360WirelessGamepad = { MAKELONG(0x045E, 0x028E), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } }; - if (p_guid == &IID_ValveStreamingGamepad || p_guid == &IID_X360WiredGamepad || p_guid == &IID_X360WirelessGamepad) + if (memcmp(p_guid, &IID_ValveStreamingGamepad, sizeof(*p_guid)) == 0 || + memcmp(p_guid, &IID_X360WiredGamepad, sizeof(*p_guid)) == 0 || + memcmp(p_guid, &IID_X360WirelessGamepad, sizeof(*p_guid)) == 0) return true; PRAWINPUTDEVICELIST dev_list = nullptr; |