21 #include "../SDL_internal.h" 33 #if !SDL_EVENTS_DISABLED 34 #include "../events/SDL_events_c.h" 37 #if defined(__ANDROID__) 43 #define SDL_MINIMUM_GUIDE_BUTTON_DELAY_MS 250 45 #define SDL_CONTROLLER_PLATFORM_FIELD "platform:" 93 typedef struct _ControllerMapping_t
99 struct _ControllerMapping_t *
next;
144 if (hint && *hint ==
'@') {
166 if (entries ==
NULL) {
208 if (num_events <= 0) {
218 for (i = 0; i < num_events; ++
i) {
254 for (i = 0; i < gamecontroller->num_bindings; ++
i) {
259 if (value >= binding->
input.
axis.axis_min &&
265 if (value >= binding->
input.
axis.axis_max &&
274 if (last_match && (!match || !
HasSameOutput(last_match, match))) {
297 gamecontroller->last_match_axis[
axis] = match;
304 for (i = 0; i < gamecontroller->num_bindings; ++
i) {
322 Uint8 last_mask = gamecontroller->last_hat_mask[hat];
325 for (i = 0; i < gamecontroller->num_bindings; ++
i) {
328 if ((changed_mask & binding->
input.
hat.hat_mask) != 0) {
329 if (value & binding->
input.
hat.hat_mask) {
341 gamecontroller->last_hat_mask[hat] =
value;
349 switch(event->
type) {
353 while (controllerlist) {
354 if (controllerlist->joystick->instance_id == event->
jaxis.
which) {
358 controllerlist = controllerlist->next;
366 while (controllerlist) {
367 if (controllerlist->joystick->instance_id == event->
jbutton.
which) {
371 controllerlist = controllerlist->next;
378 while (controllerlist) {
379 if (controllerlist->joystick->instance_id == event->
jhat.
which) {
383 controllerlist = controllerlist->next;
400 while (controllerlist) {
401 if (controllerlist->joystick->instance_id == event->
jdevice.
which) {
411 controllerlist = controllerlist->next;
428 while (pSupportedController) {
429 if (
SDL_memcmp(guid, &pSupportedController->
guid,
sizeof(*guid)) == 0) {
430 return pSupportedController;
432 pSupportedController = pSupportedController->
next;
439 #if SDL_JOYSTICK_XINPUT 466 if (pchString && (*pchString ==
'+' || *pchString ==
'-')) {
470 if (!pchString || !pchString[0]) {
517 if (!pchString || !pchString[0])
547 char half_axis_input = 0;
548 char half_axis_output = 0;
550 if (*szGameButton ==
'+' || *szGameButton ==
'-') {
551 half_axis_output = *szGameButton++;
563 if (half_axis_output ==
'+') {
566 }
else if (half_axis_output ==
'-') {
578 SDL_SetError(
"Unexpected controller element %s", szGameButton);
582 if (*szJoystickButton ==
'+' || *szJoystickButton ==
'-') {
583 half_axis_input = *szJoystickButton++;
585 if (szJoystickButton[
SDL_strlen(szJoystickButton) - 1] ==
'~') {
589 if (szJoystickButton[0] ==
'a' &&
SDL_isdigit(szJoystickButton[1])) {
592 if (half_axis_input ==
'+') {
595 }
else if (half_axis_input ==
'-') {
607 }
else if (szJoystickButton[0] ==
'b' &&
SDL_isdigit(szJoystickButton[1])) {
610 }
else if (szJoystickButton[0] ==
'h' &&
SDL_isdigit(szJoystickButton[1]) &&
611 szJoystickButton[2] ==
'.' &&
SDL_isdigit(szJoystickButton[3])) {
612 int hat =
SDL_atoi(&szJoystickButton[1]);
618 SDL_SetError(
"Unexpected joystick element: %s", szJoystickButton);
622 ++gamecontroller->num_bindings;
624 if (!gamecontroller->bindings) {
625 gamecontroller->num_bindings = 0;
629 gamecontroller->bindings[gamecontroller->num_bindings - 1] = bind;
639 char szGameButton[20];
640 char szJoystickButton[20];
643 const char *pchPos = pchString;
648 while (pchPos && *pchPos) {
649 if (*pchPos ==
':') {
652 }
else if (*pchPos ==
' ') {
654 }
else if (*pchPos ==
',') {
661 }
else if (bGameButton) {
662 if (i >=
sizeof(szGameButton)) {
663 SDL_SetError(
"Button name too large: %s", szGameButton);
666 szGameButton[
i] = *pchPos;
669 if (i >=
sizeof(szJoystickButton)) {
670 SDL_SetError(
"Joystick button name too large: %s", szJoystickButton);
673 szJoystickButton[
i] = *pchPos;
680 if (szGameButton[0] !=
'\0' || szJoystickButton[0] !=
'\0') {
692 gamecontroller->name = pchName;
693 gamecontroller->num_bindings = 0;
694 SDL_memset(gamecontroller->last_match_axis, 0, gamecontroller->joystick->naxes *
sizeof(*gamecontroller->last_match_axis));
699 for (i = 0; i < gamecontroller->num_bindings; ++
i) {
705 if (binding->
input.
axis.axis < gamecontroller->joystick->naxes) {
706 gamecontroller->joystick->axes[binding->
input.
axis.axis].value =
719 const char *pFirstComma =
SDL_strchr(pMapping,
',');
721 char *pchGUID =
SDL_malloc(pFirstComma - pMapping + 1);
726 SDL_memcpy(pchGUID, pMapping, pFirstComma - pMapping);
727 pchGUID[pFirstComma - pMapping] =
'\0';
732 SDL_memcmp(&pchGUID[20],
"504944564944", 12) == 0) {
740 SDL_memcmp(&pchGUID[4],
"000000000000", 12) == 0 &&
741 SDL_memcmp(&pchGUID[20],
"000000000000", 12) == 0) {
758 const char *pFirstComma, *pSecondComma;
765 pSecondComma =
SDL_strchr(pFirstComma + 1,
',');
769 pchName =
SDL_malloc(pSecondComma - pFirstComma);
774 SDL_memcpy(pchName, pFirstComma + 1, pSecondComma - pFirstComma);
775 pchName[pSecondComma - pFirstComma - 1] = 0;
785 const char *pFirstComma, *pSecondComma;
791 pSecondComma =
SDL_strchr(pFirstComma + 1,
',');
804 while (gamecontrollerlist) {
805 if (!
SDL_memcmp(&gamecontrollerlist->joystick->guid, &pControllerMapping->
guid,
sizeof(pControllerMapping->
guid))) {
812 event.cdevice.which = gamecontrollerlist->joystick->instance_id;
817 gamecontrollerlist = gamecontrollerlist->next;
833 SDL_SetError(
"Couldn't parse name from %s", mappingString);
845 if (pControllerMapping) {
847 if (pControllerMapping->
priority <= priority) {
850 pControllerMapping->
name = pchName;
852 pControllerMapping->
mapping = pchMapping;
853 pControllerMapping->
priority = priority;
862 pControllerMapping =
SDL_malloc(
sizeof(*pControllerMapping));
863 if (!pControllerMapping) {
869 pControllerMapping->
guid = jGUID;
870 pControllerMapping->
name = pchName;
871 pControllerMapping->
mapping = pchMapping;
873 pControllerMapping->
priority = priority;
875 if (s_pSupportedControllers) {
879 for ( pPrevMapping = s_pSupportedControllers, pCurrMapping = pPrevMapping->
next;
881 pPrevMapping = pCurrMapping, pCurrMapping = pCurrMapping->
next ) {
884 pPrevMapping->
next = pControllerMapping;
886 s_pSupportedControllers = pControllerMapping;
890 return pControllerMapping;
900 char name_string[128];
901 char mapping_string[1024];
907 if (!button_mask && !axis_mask) {
916 for (spot = name_string; *spot; ++spot) {
922 SDL_snprintf(mapping_string,
sizeof(mapping_string),
"none,%s,", name_string);
924 SDL_strlcat(mapping_string,
"a:b0,",
sizeof(mapping_string));
927 SDL_strlcat(mapping_string,
"b:b1,",
sizeof(mapping_string));
930 SDL_strlcat(mapping_string,
"b:b4,",
sizeof(mapping_string));
934 SDL_strlcat(mapping_string,
"x:b2,",
sizeof(mapping_string));
937 SDL_strlcat(mapping_string,
"y:b3,",
sizeof(mapping_string));
940 SDL_strlcat(mapping_string,
"back:b4,",
sizeof(mapping_string));
944 SDL_strlcat(mapping_string,
"guide:b5,",
sizeof(mapping_string));
950 SDL_strlcat(mapping_string,
"guide:b6,",
sizeof(mapping_string));
956 SDL_strlcat(mapping_string,
"start:b6,",
sizeof(mapping_string));
959 SDL_strlcat(mapping_string,
"leftstick:b7,",
sizeof(mapping_string));
962 SDL_strlcat(mapping_string,
"rightstick:b8,",
sizeof(mapping_string));
965 SDL_strlcat(mapping_string,
"leftshoulder:b9,",
sizeof(mapping_string));
968 SDL_strlcat(mapping_string,
"rightshoulder:b10,",
sizeof(mapping_string));
971 SDL_strlcat(mapping_string,
"dpup:b11,",
sizeof(mapping_string));
974 SDL_strlcat(mapping_string,
"dpdown:b12,",
sizeof(mapping_string));
977 SDL_strlcat(mapping_string,
"dpleft:b13,",
sizeof(mapping_string));
980 SDL_strlcat(mapping_string,
"dpright:b14,",
sizeof(mapping_string));
983 SDL_strlcat(mapping_string,
"leftx:a0,",
sizeof(mapping_string));
986 SDL_strlcat(mapping_string,
"lefty:a1,",
sizeof(mapping_string));
989 SDL_strlcat(mapping_string,
"rightx:a2,",
sizeof(mapping_string));
992 SDL_strlcat(mapping_string,
"righty:a3,",
sizeof(mapping_string));
995 SDL_strlcat(mapping_string,
"lefttrigger:a4,",
sizeof(mapping_string));
998 SDL_strlcat(mapping_string,
"righttrigger:a5,",
sizeof(mapping_string));
1003 int pos = (int)
SDL_strlen(mapping_string) - 1;
1005 if (mapping_string[pos] ==
',') {
1006 mapping_string[pos] =
'\0';
1026 if (!mapping && name) {
1027 if (
SDL_strstr(name,
"Xbox 360 Wireless Receiver")) {
1031 "none,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3",
1037 if (!mapping && name) {
1044 mapping = SDL_CreateMappingForAndroidController(name, guid);
1082 char *
buf, *line, *line_end, *tmp, *comma, line_platform[64];
1083 size_t db_size, platform_len;
1095 return SDL_SetError(
"Could not allocate space to read DB into memory");
1110 buf[db_size] =
'\0';
1113 while (line < buf + db_size) {
1115 if (line_end !=
NULL) {
1118 line_end = buf + db_size;
1126 if (comma !=
NULL) {
1127 platform_len = comma - tmp + 1;
1138 line = line_end + 1;
1159 if (!mappingString) {
1165 return SDL_SetError(
"Couldn't parse GUID from %s", mappingString);
1178 if (!pControllerMapping) {
1185 if (is_default_mapping) {
1186 s_pDefaultMapping = pControllerMapping;
1187 }
else if (is_hidapi_mapping) {
1188 s_pHIDAPIMapping = pControllerMapping;
1189 }
else if (is_xinput_mapping) {
1190 s_pXInputMapping = pControllerMapping;
1211 int num_mappings = 0;
1214 for (mapping = s_pSupportedControllers;
mapping; mapping = mapping->
next) {
1220 return num_mappings;
1231 for (mapping = s_pSupportedControllers;
mapping; mapping = mapping->
next) {
1235 if (mapping_index == 0) {
1236 char *pMappingString;
1244 if (!pMappingString) {
1249 return pMappingString;
1262 char *pMappingString =
NULL;
1271 if (!pMappingString) {
1277 return pMappingString;
1286 if (!gamecontroller) {
1297 if (hint && hint[0]) {
1299 char *pUserMappings =
SDL_malloc(nchHints + 1);
1300 char *pTempMappings = pUserMappings;
1302 pUserMappings[nchHints] =
'\0';
1303 while (pUserMappings) {
1304 char *pchNewLine =
NULL;
1306 pchNewLine =
SDL_strchr(pUserMappings,
'\n');
1313 pUserMappings = pchNewLine + 1;
1315 pUserMappings =
NULL;
1330 if (hint && *hint) {
1334 #if defined(__ANDROID__) 1347 char szControllerMapPath[1024];
1349 const char *pMappingString =
NULL;
1351 while (pMappingString) {
1402 if (pSupportedController) {
1406 return pSupportedController->
name;
1421 char *pMappingString =
NULL;
1435 if (!pMappingString) {
1443 return pMappingString;
1454 if (pSupportedController) {
1467 if (pSupportedController) {
1484 #if defined(__LINUX__) 1485 if (name &&
SDL_strstr(name,
"Wireless Controller Motion Sensors")) {
1501 #if defined(__LINUX__) 1502 bSteamVirtualGamepad = (vendor == 0x28DE && product == 0x11FF);
1503 #elif defined(__MACOSX__) 1504 bSteamVirtualGamepad = (vendor == 0x045E && product == 0x028E && version == 1);
1505 #elif defined(__WIN32__) 1509 if (bSteamVirtualGamepad) {
1517 for (i = 0; i < SDL_allowed_controllers.
num_entries; ++
i) {
1518 if (vidpid == SDL_allowed_controllers.
entries[i]) {
1524 for (i = 0; i < SDL_ignored_controllers.
num_entries; ++
i) {
1525 if (vidpid == SDL_ignored_controllers.
entries[i]) {
1540 SDL_GameController *
1544 SDL_GameController *gamecontroller;
1545 SDL_GameController *gamecontrollerlist;
1553 while (gamecontrollerlist) {
1554 if (instance_id == gamecontrollerlist->joystick->instance_id) {
1555 gamecontroller = gamecontrollerlist;
1556 ++gamecontroller->ref_count;
1558 return (gamecontroller);
1560 gamecontrollerlist = gamecontrollerlist->next;
1565 if (!pSupportedController) {
1566 SDL_SetError(
"Couldn't find mapping for device (%d)", device_index);
1572 gamecontroller = (SDL_GameController *)
SDL_calloc(1,
sizeof(*gamecontroller));
1573 if (gamecontroller ==
NULL) {
1580 if (!gamecontroller->joystick) {
1586 if (gamecontroller->joystick->naxes) {
1588 if (!gamecontroller->last_match_axis) {
1596 if (gamecontroller->joystick->nhats) {
1597 gamecontroller->last_hat_mask = (
Uint8 *)
SDL_calloc(gamecontroller->joystick->nhats,
sizeof(*gamecontroller->last_hat_mask));
1598 if (!gamecontroller->last_hat_mask) {
1601 SDL_free(gamecontroller->last_match_axis);
1611 ++gamecontroller->ref_count;
1618 return (gamecontroller);
1639 if (!gamecontroller)
1642 for (i = 0; i < gamecontroller->num_bindings; ++
i) {
1652 valid_input_range = (value >= binding->
input.
axis.axis_min && value <= binding->
input.
axis.axis_max);
1654 valid_input_range = (value >= binding->
input.
axis.axis_max && value <= binding->
input.
axis.axis_min);
1656 if (valid_input_range) {
1658 float normalized_value = (float)(value - binding->
input.
axis.axis_min) / (binding->
input.
axis.axis_max - binding->
input.
axis.axis_min);
1671 if (hat_mask & binding->
input.
hat.hat_mask) {
1677 valid_output_range = (value >= binding->
output.
axis.axis_min && value <= binding->
output.
axis.axis_max);
1679 valid_output_range = (value >= binding->
output.
axis.axis_max && value <= binding->
output.
axis.axis_min);
1682 if (value != 0 && valid_output_range) {
1698 if (!gamecontroller)
1701 for (i = 0; i < gamecontroller->num_bindings; ++
i) {
1710 valid_input_range = (value >= binding->
input.
axis.axis_min && value <= binding->
input.
axis.axis_max);
1711 if (valid_input_range) {
1715 valid_input_range = (value >= binding->
input.
axis.axis_max && value <= binding->
input.
axis.axis_min);
1716 if (valid_input_range) {
1734 if (!gamecontroller)
1737 if (
SDL_strcmp(gamecontroller->name,
"*") == 0) {
1740 return gamecontroller->name;
1775 if (!gamecontroller)
1786 if (!gamecontroller)
1789 return gamecontroller->joystick;
1796 SDL_GameController *
1799 SDL_GameController *gamecontroller;
1803 while (gamecontroller) {
1804 if (gamecontroller->joystick->instance_id == joyid) {
1806 return gamecontroller;
1808 gamecontroller = gamecontroller->next;
1827 for (i = 0; i < gamecontroller->num_bindings; ++
i) {
1859 for (i = 0; i < gamecontroller->num_bindings; ++
i) {
1887 SDL_GameController *gamecontrollerlist, *gamecontrollerlistprev;
1889 if (!gamecontroller)
1895 if (--gamecontroller->ref_count > 0) {
1903 gamecontrollerlistprev =
NULL;
1904 while (gamecontrollerlist) {
1905 if (gamecontroller == gamecontrollerlist) {
1906 if (gamecontrollerlistprev) {
1908 gamecontrollerlistprev->next = gamecontrollerlist->next;
1914 gamecontrollerlistprev = gamecontrollerlist;
1915 gamecontrollerlist = gamecontrollerlist->next;
1918 SDL_free(gamecontroller->bindings);
1919 SDL_free(gamecontroller->last_match_axis);
1920 SDL_free(gamecontroller->last_hat_mask);
1946 while (s_pSupportedControllers) {
1948 s_pSupportedControllers = s_pSupportedControllers->
next;
1961 if (SDL_allowed_controllers.
entries) {
1965 if (SDL_ignored_controllers.
entries) {
1981 #if !SDL_EVENTS_DISABLED 1985 event.caxis.which = gamecontroller->joystick->instance_id;
1986 event.caxis.axis =
axis;
1987 event.caxis.value =
value;
2002 #if !SDL_EVENTS_DISABLED 2024 gamecontroller->guide_button_down = now;
2026 if (gamecontroller->joystick->delayed_guide_button) {
2032 gamecontroller->joystick->delayed_guide_button =
SDL_TRUE;
2035 gamecontroller->joystick->delayed_guide_button =
SDL_FALSE;
2041 #if !SDL_EVENTS_DISABLED 2043 event.cbutton.which = gamecontroller->joystick->instance_id;
2044 event.cbutton.button =
button;
2045 event.cbutton.state =
state;
2058 #if SDL_EVENTS_DISABLED 2061 const Uint32 event_list[] = {
2091 while (controllerlist) {
2092 if (controllerlist->joystick == joystick) {
2096 controllerlist = controllerlist->next;
static const char * map_StringForControllerAxis[]
char * SDL_GameControllerMapping(SDL_GameController *gamecontroller)
#define SDL_DelEventWatch
Uint16 SDL_GameControllerGetProduct(SDL_GameController *gamecontroller)
SDL_GameControllerBindType
#define SDL_CONTROLLER_PLATFORM_FIELD
int SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller)
#define SDL_JoystickGetButton
SDL_GameControllerButton SDL_GameControllerGetButtonFromString(const char *pchString)
SDL_JoyDeviceEvent jdevice
#define SDL_UnlockJoysticks
#define SDL_JoystickClose
#define MAKE_VIDPID(VID, PID)
static int SDL_GameControllerEventWatcher(void *userdata, SDL_Event *event)
union SDL_ExtendedGameControllerBind::@24 input
static void HandleJoystickHat(SDL_GameController *gamecontroller, int hat, Uint8 value)
#define SDL_JoystickGetVendor
void SDL_GameControllerQuitMappings(void)
SDL_ControllerDeviceEvent cdevice
int SDL_GameControllerInitMappings(void)
SDL_GameControllerButtonBind SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button)
SDL_ControllerMappingPriority priority
SDL_JoyButtonEvent jbutton
struct _ControllerMapping_t * next
static void ResetOutput(SDL_GameController *gamecontroller, SDL_ExtendedGameControllerBind *bind)
static SDL_bool SDL_GetControllerMappingFilePath(char *path, size_t size)
static void UpdateEventsForDeviceRemoval()
char * SDL_GameControllerMappingForIndex(int mapping_index)
Uint16 SDL_GameControllerGetVendor(SDL_GameController *gamecontroller)
Sint16 SDL_GameControllerGetAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis)
SDL_GameControllerAxis SDL_GameControllerGetAxisFromString(const char *pchString)
#define SDL_JoystickNameForIndex
static SDL_vidpid_list SDL_ignored_controllers
static SDL_Event events[EVENT_BUF_SIZE]
SDL_GameControllerBindType inputType
static ControllerMapping_t * s_pDefaultMapping
static ControllerMapping_t * SDL_PrivateGetControllerMappingForNameAndGUID(const char *name, SDL_JoystickGUID guid)
void SDL_GameControllerHandleDelayedGuideButton(SDL_Joystick *joystick)
union SDL_ExtendedGameControllerBind::@25 output
#define SDL_InvalidParamError(param)
static void SDL_GameControllerLoadHints()
SDL_ExtendedGameControllerBind * bindings
#define SDL_JoystickGetGUIDString
#define SDL_JoystickGetProduct
#define SDL_JoystickGetHat
GLuint const GLchar * name
SDL_GameControllerAxis axis
#define SDL_HINT_GAMECONTROLLERCONFIG_FILE
A variable that lets you provide a file with extra gamecontroller db entries.
struct _SDL_GameController * next
#define SDL_JoystickGetDeviceGUID
SDL_GameController * SDL_GameControllerFromInstanceID(SDL_JoystickID joyid)
#define SDL_GetHintBoolean
#define SDL_small_alloc(type, count, pisstack)
static int SDL_PrivateGameControllerAddMapping(const char *mappingString, SDL_ControllerMappingPriority priority)
#define SDL_JOYSTICK_AXIS_MIN
#define SDL_JoystickGetPlayerIndex
void SDL_GameControllerClose(SDL_GameController *gamecontroller)
#define SDL_JOYSTICK_AXIS_MAX
GLenum GLenum GLenum input
#define SDL_GetEventState(type)
#define SDL_JoystickGetDeviceInstanceID
Uint32 SDL_GetTicks(void)
Get the number of milliseconds since the SDL library initialization.
static SDL_GameController * SDL_gamecontrollers
static ControllerMapping_t * s_pSupportedControllers
int SDL_GameControllerEventState(int state)
void SDL_GameControllerQuit(void)
int SDL_GameControllerAddMapping(const char *mappingString)
const char * SDL_GameControllerGetStringForAxis(SDL_GameControllerAxis axis)
static ControllerMapping_t * SDL_PrivateGetControllerMappingForGUID(SDL_JoystickGUID *guid, SDL_bool exact_match)
const char * SDL_GameControllerName(SDL_GameController *gamecontroller)
static void SDL_PrivateGameControllerParseControllerConfigString(SDL_GameController *gamecontroller, const char *pchString)
SDL_GameControllerBindType outputType
SDL_ExtendedGameControllerBind ** last_match_axis
static ControllerMapping_t * s_pHIDAPIMapping
static SDL_bool HasSameOutput(SDL_ExtendedGameControllerBind *a, SDL_ExtendedGameControllerBind *b)
Uint16 SDL_GameControllerGetProductVersion(SDL_GameController *gamecontroller)
SDL_bool SDL_ShouldIgnoreGameController(const char *name, SDL_JoystickGUID guid)
SDL_bool SDL_IsJoystickXInput(SDL_JoystickGUID guid)
GLsizei const GLfloat * value
#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT
SDL_ControllerMappingPriority
static int SDL_PrivateGameControllerButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button, Uint8 state)
#define SDL_JoystickGetAttached
SDL_bool SDL_IsJoystickHIDAPI(SDL_JoystickGUID guid)
#define SDL_JoystickRumble
static const char * map_StringForControllerButton[]
int SDL_GameControllerRumble(SDL_GameController *gamecontroller, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms)
void SDL_GameControllerUpdate(void)
GLenum GLuint GLenum GLsizei const GLchar * buf
static ControllerMapping_t * SDL_PrivateGetControllerMapping(int device_index)
static char * SDL_PrivateGetControllerMappingFromMappingString(const char *pMapping)
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
SDL_bool SDL_IsGameControllerNameAndGUID(const char *name, SDL_JoystickGUID guid)
static void SDL_PrivateGameControllerParseElement(SDL_GameController *gamecontroller, const char *szGameButton, const char *szJoystickButton)
SDL_GameController * SDL_GameControllerOpen(int device_index)
static char * SDL_PrivateGetControllerGUIDFromMappingString(const char *pMapping)
static void HandleJoystickButton(SDL_GameController *gamecontroller, int button, Uint8 state)
static void SDL_PrivateGameControllerRefreshMapping(ControllerMapping_t *pControllerMapping)
SDL_bool SDL_IsGameController(int device_index)
#define SDL_OutOfMemory()
static char * SDL_PrivateGetControllerNameFromMappingString(const char *pMapping)
static void SDL_GameControllerIgnoreDevicesExceptChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
static const char * s_ControllerMappings[]
#define SDL_JoystickUpdate
static SDL_JoystickGUID s_zeroGUID
SDL_GameControllerButtonBind SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis)
static SDL_vidpid_list SDL_allowed_controllers
#define SDL_JoystickGetAxis
static void SDL_PrivateLoadButtonMapping(SDL_GameController *gamecontroller, const char *pchName, const char *pchMapping)
void SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint16 *vendor, Uint16 *product, Uint16 *version)
#define SDL_AddEventWatch
SDL_Joystick * SDL_GameControllerGetJoystick(SDL_GameController *gamecontroller)
#define SDL_AddHintCallback
#define SDL_small_free(ptr, isstack)
static ControllerMapping_t * s_pXInputMapping
#define SDL_DelHintCallback
int SDL_GameControllerNumMappings(void)
#define SDL_arraysize(array)
GLenum GLenum GLenum GLenum mapping
#define SDL_HINT_GAMECONTROLLERCONFIG
A variable that lets you manually hint extra gamecontroller db entries.
GLsizei const GLchar *const * path
#define SDL_MINIMUM_GUIDE_BUTTON_DELAY_MS
SDL_GameControllerButton button
#define SDL_GameControllerAddMappingsFromFile(file)
#define SDL_JoystickGetProductVersion
GLboolean GLboolean GLboolean GLboolean a
static void SDL_LoadVIDPIDListFromHint(const char *hint, SDL_vidpid_list *list)
int SDL_GameControllerAddMappingsFromRW(SDL_RWops *rw, int freerw)
int SDL_GameControllerInit(void)
#define SDL_TICKS_PASSED(A, B)
Compare SDL ticks values, and return true if A has passed B.
const char * SDL_GameControllerGetStringForButton(SDL_GameControllerButton axis)
char * SDL_GameControllerMappingForGUID(SDL_JoystickGUID guid)
#define SDL_LockJoysticks
static ControllerMapping_t * SDL_PrivateAddMappingForGUID(SDL_JoystickGUID jGUID, const char *mappingString, SDL_bool *existing, SDL_ControllerMappingPriority priority)
Uint8 SDL_GameControllerGetButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button)
GLboolean GLboolean GLboolean b
#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES
#define SDL_AndroidGetInternalStoragePath
char * SDL_GameControllerMappingForDeviceIndex(int joystick_index)
static int SDL_PrivateGameControllerAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis, Sint16 value)
static void HandleJoystickAxis(SDL_GameController *gamecontroller, int axis, int value)
SDL_bool SDL_GameControllerGetAttached(SDL_GameController *gamecontroller)
#define SDL_JoystickGetGUIDFromString
static void SDL_GameControllerIgnoreDevicesChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
const char * SDL_GameControllerNameForIndex(int device_index)