From 87d61ab21bfde7d63aa1c1bc3925e1d2f6673129 Mon Sep 17 00:00:00 2001 From: Aric Stewart Date: Tue, 10 Mar 2009 14:59:35 -0500 Subject: [PATCH] dinput: OS/X joystick add POV controls. --- dlls/dinput/joystick_osx.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/dlls/dinput/joystick_osx.c b/dlls/dinput/joystick_osx.c index 9dafcb506fc..fb59ec5cbcf 100644 --- a/dlls/dinput/joystick_osx.c +++ b/dlls/dinput/joystick_osx.c @@ -332,6 +332,22 @@ static void get_osx_device_elements(JoystickImpl *device) axes++; break; } + case kIOHIDElementTypeInput_Misc: + { + uint32_t usage = IOHIDElementGetUsage( tIOHIDElementRef ); + switch(usage) + { + case kHIDUsage_GD_Hatswitch: + { + CFArrayInsertValueAtIndex(device->elementCFArrayRef, (axes+povs), tIOHIDElementRef); + povs++; + break; + } + default: + FIXME("Unhandled usage %i\n",usage); + } + break; + } default: FIXME("Unhandled type %i\n",eleType); } @@ -384,6 +400,7 @@ static void poll_osx_device_state(JoystickGenericImpl *device_in) if (gElementCFArrayRef) { int button_idx = 0; + int pov_idx = 0; CFIndex idx, cnt = CFArrayGetCount( gElementCFArrayRef ); for ( idx = 0; idx < cnt; idx++ ) @@ -404,6 +421,27 @@ static void poll_osx_device_state(JoystickGenericImpl *device_in) button_idx ++; } break; + case kIOHIDElementTypeInput_Misc: + { + uint32_t usage = IOHIDElementGetUsage( tIOHIDElementRef ); + switch(usage) + { + case kHIDUsage_GD_Hatswitch: + { + IOHIDDeviceGetValue(tIOHIDDeviceRef, tIOHIDElementRef, &valueRef); + val = IOHIDValueGetIntegerValue(valueRef); + if (val >= 8) + device->generic.js.rgdwPOV[pov_idx] = -1; + else + device->generic.js.rgdwPOV[pov_idx] = val * 4500; + pov_idx ++; + break; + } + default: + FIXME("unhandled usage %i\n",usage); + } + break; + } default: FIXME("Unhandled type %i\n",eleType); }