Fixed bug 2025 - Update 1.2 OSX Joystick code to fully support Saitek p2500 gamepad SDL-1.2
authorSam Lantinga <slouken@libsdl.org>
Sat, 10 Aug 2013 10:54:03 -0700
branchSDL-1.2
changeset 7625 952791dbe6ba
parent 7491 3665bc284271
child 7726 e9466ead70e5
Fixed bug 2025 - Update 1.2 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
--- a/src/joystick/darwin/SDL_sysjoystick.c	Sun Jul 21 11:09:53 2013 -0700
+++ b/src/joystick/darwin/SDL_sysjoystick.c	Sat Aug 10 10:54:03 2013 -0700
@@ -340,6 +340,22 @@
 							headElement = &(pDevice->firstButton);
 						}
 						break;
+					case kHIDPage_Simulation:
+                        {
+                            switch (usage) /* look at usage to determine function */
+                            {
+                                case kHIDUsage_Sim_Rudder:
+                                case kHIDUsage_Sim_Throttle:
+                                    element = (recElement *) NewPtrClear (sizeof (recElement));
+                                    if (element)
+                                    {
+                                        pDevice->axes++;
+                                        headElement = &(pDevice->firstAxis);
+                                    }
+                                    break;
+                            }							
+                        }
+						break;
 					default:
 						break;
 				}