From f457f25b711873cb206662b9b9cc98b0eacfa840 Mon Sep 17 00:00:00 2001 From: David Lawrie Date: Tue, 14 Jun 2016 20:33:49 -0700 Subject: [PATCH] winejoystick.drv: Fix Slider mapping. Sliders, Dials, and Wheels now map to Z, U (Ry), or V (Rx) depending on availability. Thus, also add support for up to 3 such HID elements. Signed-off-by: David Lawrie Signed-off-by: Ken Thomases Signed-off-by: Alexandre Julliard --- dlls/winejoystick.drv/joystick_osx.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/dlls/winejoystick.drv/joystick_osx.c b/dlls/winejoystick.drv/joystick_osx.c index 42046a4b3da..1edd8e94d4f 100644 --- a/dlls/winejoystick.drv/joystick_osx.c +++ b/dlls/winejoystick.drv/joystick_osx.c @@ -442,8 +442,25 @@ static void collect_joystick_elements(joystick_t* joystick, IOHIDElementRef coll break; } case kHIDUsage_GD_Slider: - TRACE("kIOHIDElementTypeInput_Misc / kHIDUsage_GD_Slider; ignoring\n"); + case kHIDUsage_GD_Dial: + case kHIDUsage_GD_Wheel: + { + /* if one axis is taken, fall to the next until axes are filled */ + int possible_axes[3] = {AXIS_Z,AXIS_RY,AXIS_RX}; + int axis = 0; + while(axis < 3 && joystick->axes[possible_axes[axis]].element) + axis++; + if (axis == 3) + TRACE("kIOHIDElementTypeInput_Misc / kHIDUsage_GD_ (%d)\n ignoring\n", usage); + else + { + TRACE("kIOHIDElementTypeInput_Misc / kHIDUsage_GD_ (%d) axis %d\n", usage, possible_axes[axis]); + joystick->axes[possible_axes[axis]].element = (IOHIDElementRef)CFRetain(child); + joystick->axes[possible_axes[axis]].min_value = IOHIDElementGetLogicalMin(child); + joystick->axes[possible_axes[axis]].max_value = IOHIDElementGetLogicalMax(child); + } break; + } default: FIXME("kIOHIDElementTypeInput_Misc / Unhandled usage %d\n", usage); break;