Add support for controllers that SDL is unaware of or to cause an existing controller to have a different binding.
Defined in SDL_gamecontroller.h
mappingString | the mapping string |
Returns 1 if a new mapping is added, 0 if an existing mapping is updated, -1 on error; call SDL_GetError() for more information.
The mapping string has the format "GUID,name,mapping", where GUID is the string value from SDL_JoystickGetGUIDString(), name is the human readable string for the device and mappings are controller mappings to joystick ones. Under Windows there is a reserved GUID of "xinput" that covers all XInput devices. The mapping format for joystick is: {| |bX |a joystick button, index X |- |hX.Y |hat X with value Y |- |aX |axis X of the joystick |} Buttons can be used as a controller axes and vice versa.
This string shows an example of a valid mapping for a controller:
This function is available since SDL 2.0.0.