From 6bbec8e660911ab26198abb583b80e2d905efe23 Mon Sep 17 00:00:00 2001 From: Aric Stewart Date: Wed, 11 Mar 2009 15:06:31 -0500 Subject: [PATCH] dinput: OS/X joystick: Check usage page to avoid odd non-button elements found on the 360 controller. --- dlls/dinput/joystick_osx.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dlls/dinput/joystick_osx.c b/dlls/dinput/joystick_osx.c index c8a333fa70f..b44896c1615 100644 --- a/dlls/dinput/joystick_osx.c +++ b/dlls/dinput/joystick_osx.c @@ -320,6 +320,13 @@ static void get_osx_device_elements(JoystickImpl *device, int axis_map[8]) { case kIOHIDElementTypeInput_Button: { + int usagePage = IOHIDElementGetUsagePage( tIOHIDElementRef ); + if (usagePage != kHIDPage_Button) + { + /* avoid strange elements found on the 360 controler */ + continue; + } + if (buttons < 128) { CFArrayInsertValueAtIndex(device->elementCFArrayRef, (axes+povs+buttons), tIOHIDElementRef);