From e6e79353e8ad879781969dc2bb3092fbf572624c Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 10 Aug 2013 10:55:12 -0700 Subject: [PATCH] Fixed bug 2024 - Update OSX Joystick code to fully support Saitek p2500 gamepad Patrick Maloney Saitek p2500 (Cyborg Rumble Force Pad) has a D-pad, two analog sticks, and numerous buttons. SDL 2.x on OSX detected everything except the right-side analog stick. The right-side stick is considered a 'simulation device' with the axes mapped to throttle and rudder. The patch adds support for throttle and rudder on the HID simulation page. --- src/joystick/darwin/SDL_sysjoystick.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/joystick/darwin/SDL_sysjoystick.c b/src/joystick/darwin/SDL_sysjoystick.c index 97f0e393b..83fcafd04 100644 --- a/src/joystick/darwin/SDL_sysjoystick.c +++ b/src/joystick/darwin/SDL_sysjoystick.c @@ -362,6 +362,22 @@ HIDAddElement(CFTypeRef refElement, recDevice * pDevice) } } break; + case kHIDPage_Simulation: + switch (usage) { + case kHIDUsage_Sim_Rudder: + case kHIDUsage_Sim_Throttle: + element = (recElement *) + NewPtrClear(sizeof(recElement)); + if (element) { + pDevice->axes++; + headElement = &(pDevice->firstAxis); + } + break; + + default: + break; + } + break; case kHIDPage_Button: element = (recElement *) NewPtrClear(sizeof(recElement));