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 7625952791dbe6ba
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
     1.1 --- a/src/joystick/darwin/SDL_sysjoystick.c	Sun Jul 21 11:09:53 2013 -0700
     1.2 +++ b/src/joystick/darwin/SDL_sysjoystick.c	Sat Aug 10 10:54:03 2013 -0700
     1.3 @@ -340,6 +340,22 @@
     1.4  							headElement = &(pDevice->firstButton);
     1.5  						}
     1.6  						break;
     1.7 +					case kHIDPage_Simulation:
     1.8 +                        {
     1.9 +                            switch (usage) /* look at usage to determine function */
    1.10 +                            {
    1.11 +                                case kHIDUsage_Sim_Rudder:
    1.12 +                                case kHIDUsage_Sim_Throttle:
    1.13 +                                    element = (recElement *) NewPtrClear (sizeof (recElement));
    1.14 +                                    if (element)
    1.15 +                                    {
    1.16 +                                        pDevice->axes++;
    1.17 +                                        headElement = &(pDevice->firstAxis);
    1.18 +                                    }
    1.19 +                                    break;
    1.20 +                            }							
    1.21 +                        }
    1.22 +						break;
    1.23  					default:
    1.24  						break;
    1.25  				}