Fixed bug 2553 - Add support to all XInput devices

This adds support for all XInput devices, exposed through the SDL joystick API.
The button and axis reporting for XInput devices has been changed to match DirectInput and other platforms.
The game controller xinput mapping has been updated so this change is seamless.
There is a new hint, SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING, for any applications that have hardcoded the old xinput button and axis set. This hint will be removed in SDL 2.1.
This commit is contained in:
Sam Lantinga 2014-06-24 13:31:25 -07:00
parent 12639925a6
commit dc434901da
7 changed files with 394 additions and 372 deletions

View file

@ -50,8 +50,8 @@ struct _SDL_Joystick
int ref_count; /* Reference count for multiple opens */
Uint8 closed; /* 1 if this device is no longer valid */
Uint8 uncentered; /* 1 if this device needs to have its state reset to 0 */
SDL_bool closed; /* SDL_TRUE if this device is no longer valid */
SDL_bool uncentered; /* SDL_TRUE if this device needs to have its state reset to 0 */
struct _SDL_Joystick *next; /* pointer to next joystick we have allocated */
};
@ -106,9 +106,8 @@ extern SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID(int device_index);
extern SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick);
#if defined(SDL_JOYSTICK_DINPUT) || defined(SDL_JOYSTICK_XINPUT)
/* Function to get the current instance id of the joystick located at device_index */
extern SDL_bool SDL_SYS_IsXInputDeviceIndex( int device_index );
extern SDL_bool SDL_SYS_IsXInputJoystick(SDL_Joystick * joystick);
/* Function returns SDL_TRUE if this device is an XInput gamepad */
extern SDL_bool SDL_SYS_IsXInputGamepad_DeviceIndex( int device_index );
#endif
/* vi: set ts=4 sw=4 expandtab: */