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

Bob Ziuchkovski bob.ziuchkovski at gmail.com
Sun Jan 7 17:26:04 CST 2018


Fixes https://bugs.winehq.org/show_bug.cgi?id=36441

Tested on Mac OS 10.13.2.

Signed-off-by: Bob Ziuchkovski <bob.ziuchkovski at gmail.com>
---
 dlls/dinput/joystick_osx.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/dlls/dinput/joystick_osx.c b/dlls/dinput/joystick_osx.c
index 43fa20ea94..c1e05939d5 100644
--- a/dlls/dinput/joystick_osx.c
+++ b/dlls/dinput/joystick_osx.c
@@ -643,11 +643,16 @@ static void get_osx_device_elements(JoystickImpl *device, int axis_map[8])
 
             TRACE("element %s\n", debugstr_element(element));
 
+            int usage_page = IOHIDElementGetUsagePage( 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)
                     {
-- 
2.15.0




More information about the wine-devel mailing list