Bob Ziuchkovski : dinput: Ignore vendor-specific usage pages for joystick elements on Mac.

Alexandre Julliard julliard at winehq.org
Sun Mar 18 09:02:33 CDT 2018


Module: wine
Branch: oldstable
Commit: 7d506ed9339cfa9dd03b4c0987ad4e3cf17db211
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=7d506ed9339cfa9dd03b4c0987ad4e3cf17db211

Author: Bob Ziuchkovski <bob.ziuchkovski at gmail.com>
Date:   Sun Jan  7 16:26:04 2018 -0700

dinput: Ignore vendor-specific usage pages for joystick elements on Mac.

Signed-off-by: Bob Ziuchkovski <bob.ziuchkovski at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit 221708d64ebf7b9c6bed3674e9363779a3ed1a4d)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 dlls/dinput/joystick_osx.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/dlls/dinput/joystick_osx.c b/dlls/dinput/joystick_osx.c
index 43fa20e..b0dcdd9 100644
--- a/dlls/dinput/joystick_osx.c
+++ b/dlls/dinput/joystick_osx.c
@@ -640,14 +640,20 @@ static void get_osx_device_elements(JoystickImpl *device, int axis_map[8])
         {
             IOHIDElementRef element = ( IOHIDElementRef ) CFArrayGetValueAtIndex( elements, idx );
             int type = IOHIDElementGetType( element );
+            int usage_page = IOHIDElementGetUsagePage( element );
 
             TRACE("element %s\n", debugstr_element(element));
 
+            if (usage_page >= kHIDPage_VendorDefinedStart)
+            {
+                /* vendor pages can repurpose type ids, resulting in incorrect case matches below (e.g. ds4 controllers) */
+                continue;
+            }
+
             switch(type)
             {
                 case kIOHIDElementTypeInput_Button:
                 {
-                    int usage_page = IOHIDElementGetUsagePage( element );
                     TRACE("kIOHIDElementTypeInput_Button usage_page %d\n", usage_page);
                     if (usage_page != kHIDPage_Button)
                     {




More information about the wine-cvs mailing list