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) {
207 if (num_events <= 0) {
217 for (i = 0; i < num_events; ++
i) {
253 for (i = 0; i < gamecontroller->num_bindings; ++
i) {
258 if (value >= binding->
input.
axis.axis_min &&
264 if (value >= binding->
input.
axis.axis_max &&
273 if (last_match && (!match || !
HasSameOutput(last_match, match))) {
296 gamecontroller->last_match_axis[
axis] = match;
303 for (i = 0; i < gamecontroller->num_bindings; ++
i) {
321 Uint8 last_mask = gamecontroller->last_hat_mask[hat];
324 for (i = 0; i < gamecontroller->num_bindings; ++
i) {
327 if ((changed_mask & binding->
input.
hat.hat_mask) != 0) {
328 if (value & binding->
input.
hat.hat_mask) {
340 gamecontroller->last_hat_mask[hat] =
value;
348 switch(event->
type) {
352 while (controllerlist) {
353 if (controllerlist->joystick->instance_id == event->
jaxis.
which) {
357 controllerlist = controllerlist->next;
365 while (controllerlist) {
366 if (controllerlist->joystick->instance_id == event->
jbutton.
which) {
370 controllerlist = controllerlist->next;
377 while (controllerlist) {
378 if (controllerlist->joystick->instance_id == event->
jhat.
which) {
382 controllerlist = controllerlist->next;
399 while (controllerlist) {
400 if (controllerlist->joystick->instance_id == event->
jdevice.
which) {
410 controllerlist = controllerlist->next;
427 while (pSupportedController) {
428 if (
SDL_memcmp(guid, &pSupportedController->
guid,
sizeof(*guid)) == 0) {
429 return pSupportedController;
431 pSupportedController = pSupportedController->
next;
438 #if SDL_JOYSTICK_XINPUT 465 if (pchString && (*pchString ==
'+' || *pchString ==
'-')) {
469 if (!pchString || !pchString[0]) {
516 if (!pchString || !pchString[0])
546 char half_axis_input = 0;
547 char half_axis_output = 0;
549 if (*szGameButton ==
'+' || *szGameButton ==
'-') {
550 half_axis_output = *szGameButton++;
562 if (half_axis_output ==
'+') {
565 }
else if (half_axis_output ==
'-') {
577 SDL_SetError(
"Unexpected controller element %s", szGameButton);
581 if (*szJoystickButton ==
'+' || *szJoystickButton ==
'-') {
582 half_axis_input = *szJoystickButton++;
584 if (szJoystickButton[
SDL_strlen(szJoystickButton) - 1] ==
'~') {
588 if (szJoystickButton[0] ==
'a' &&
SDL_isdigit(szJoystickButton[1])) {
591 if (half_axis_input ==
'+') {
594 }
else if (half_axis_input ==
'-') {
606 }
else if (szJoystickButton[0] ==
'b' &&
SDL_isdigit(szJoystickButton[1])) {
609 }
else if (szJoystickButton[0] ==
'h' &&
SDL_isdigit(szJoystickButton[1]) &&
610 szJoystickButton[2] ==
'.' &&
SDL_isdigit(szJoystickButton[3])) {
611 int hat =
SDL_atoi(&szJoystickButton[1]);
617 SDL_SetError(
"Unexpected joystick element: %s", szJoystickButton);
621 ++gamecontroller->num_bindings;
623 if (!gamecontroller->bindings) {
624 gamecontroller->num_bindings = 0;
628 gamecontroller->bindings[gamecontroller->num_bindings - 1] = bind;
638 char szGameButton[20];
639 char szJoystickButton[20];
642 const char *pchPos = pchString;
647 while (pchPos && *pchPos) {
648 if (*pchPos ==
':') {
651 }
else if (*pchPos ==
' ') {
653 }
else if (*pchPos ==
',') {
660 }
else if (bGameButton) {
661 if (i >=
sizeof(szGameButton)) {
662 SDL_SetError(
"Button name too large: %s", szGameButton);
665 szGameButton[
i] = *pchPos;
668 if (i >=
sizeof(szJoystickButton)) {
669 SDL_SetError(
"Joystick button name too large: %s", szJoystickButton);
672 szJoystickButton[
i] = *pchPos;
689 gamecontroller->name = pchName;
690 gamecontroller->num_bindings = 0;
691 SDL_memset(gamecontroller->last_match_axis, 0, gamecontroller->joystick->naxes *
sizeof(*gamecontroller->last_match_axis));
696 for (i = 0; i < gamecontroller->num_bindings; ++
i) {
702 if (binding->
input.
axis.axis < gamecontroller->joystick->naxes) {
703 gamecontroller->joystick->axes[binding->
input.
axis.axis].value =
716 const char *pFirstComma =
SDL_strchr(pMapping,
',');
718 char *pchGUID =
SDL_malloc(pFirstComma - pMapping + 1);
723 SDL_memcpy(pchGUID, pMapping, pFirstComma - pMapping);
724 pchGUID[pFirstComma - pMapping] =
'\0';
729 SDL_memcmp(&pchGUID[20],
"504944564944", 12) == 0) {
737 SDL_memcmp(&pchGUID[4],
"000000000000", 12) == 0 &&
738 SDL_memcmp(&pchGUID[20],
"000000000000", 12) == 0) {
755 const char *pFirstComma, *pSecondComma;
762 pSecondComma =
SDL_strchr(pFirstComma + 1,
',');
766 pchName =
SDL_malloc(pSecondComma - pFirstComma);
771 SDL_memcpy(pchName, pFirstComma + 1, pSecondComma - pFirstComma);
772 pchName[pSecondComma - pFirstComma - 1] = 0;
782 const char *pFirstComma, *pSecondComma;
788 pSecondComma =
SDL_strchr(pFirstComma + 1,
',');
801 while (gamecontrollerlist) {
802 if (!
SDL_memcmp(&gamecontrollerlist->joystick->guid, &pControllerMapping->
guid,
sizeof(pControllerMapping->
guid))) {
809 event.cdevice.which = gamecontrollerlist->joystick->instance_id;
814 gamecontrollerlist = gamecontrollerlist->next;
830 SDL_SetError(
"Couldn't parse name from %s", mappingString);
842 if (pControllerMapping) {
844 if (pControllerMapping->
priority <= priority) {
847 pControllerMapping->
name = pchName;
849 pControllerMapping->
mapping = pchMapping;
850 pControllerMapping->
priority = priority;
859 pControllerMapping =
SDL_malloc(
sizeof(*pControllerMapping));
860 if (!pControllerMapping) {
866 pControllerMapping->
guid = jGUID;
867 pControllerMapping->
name = pchName;
868 pControllerMapping->
mapping = pchMapping;
870 pControllerMapping->
priority = priority;
872 if (s_pSupportedControllers) {
876 for ( pPrevMapping = s_pSupportedControllers, pCurrMapping = pPrevMapping->
next;
878 pPrevMapping = pCurrMapping, pCurrMapping = pCurrMapping->
next ) {
881 pPrevMapping->
next = pControllerMapping;
883 s_pSupportedControllers = pControllerMapping;
887 return pControllerMapping;
897 char name_string[128];
898 char mapping_string[1024];
904 if (!button_mask && !axis_mask) {
913 for (spot = name_string; *spot; ++spot) {
919 SDL_snprintf(mapping_string,
sizeof(mapping_string),
"none,%s,", name_string);
921 SDL_strlcat(mapping_string,
"a:b0,",
sizeof(mapping_string));
924 SDL_strlcat(mapping_string,
"b:b1,",
sizeof(mapping_string));
927 SDL_strlcat(mapping_string,
"b:b4,",
sizeof(mapping_string));
931 SDL_strlcat(mapping_string,
"x:b2,",
sizeof(mapping_string));
934 SDL_strlcat(mapping_string,
"y:b3,",
sizeof(mapping_string));
937 SDL_strlcat(mapping_string,
"back:b4,",
sizeof(mapping_string));
941 SDL_strlcat(mapping_string,
"guide:b5,",
sizeof(mapping_string));
947 SDL_strlcat(mapping_string,
"guide:b6,",
sizeof(mapping_string));
953 SDL_strlcat(mapping_string,
"start:b6,",
sizeof(mapping_string));
956 SDL_strlcat(mapping_string,
"leftstick:b7,",
sizeof(mapping_string));
959 SDL_strlcat(mapping_string,
"rightstick:b8,",
sizeof(mapping_string));
962 SDL_strlcat(mapping_string,
"leftshoulder:b9,",
sizeof(mapping_string));
965 SDL_strlcat(mapping_string,
"rightshoulder:b10,",
sizeof(mapping_string));
968 SDL_strlcat(mapping_string,
"dpup:b11,",
sizeof(mapping_string));
971 SDL_strlcat(mapping_string,
"dpdown:b12,",
sizeof(mapping_string));
974 SDL_strlcat(mapping_string,
"dpleft:b13,",
sizeof(mapping_string));
977 SDL_strlcat(mapping_string,
"dpright:b14,",
sizeof(mapping_string));
980 SDL_strlcat(mapping_string,
"leftx:a0,",
sizeof(mapping_string));
983 SDL_strlcat(mapping_string,
"lefty:a1,",
sizeof(mapping_string));
986 SDL_strlcat(mapping_string,
"rightx:a2,",
sizeof(mapping_string));
989 SDL_strlcat(mapping_string,
"righty:a3,",
sizeof(mapping_string));
992 SDL_strlcat(mapping_string,
"lefttrigger:a4,",
sizeof(mapping_string));
995 SDL_strlcat(mapping_string,
"righttrigger:a5,",
sizeof(mapping_string));
1012 if (!mapping && name) {
1013 if (
SDL_strstr(name,
"Xbox 360 Wireless Receiver")) {
1017 "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,",
1023 if (!mapping && name) {
1030 mapping = SDL_CreateMappingForAndroidController(name, guid);
1068 char *
buf, *line, *line_end, *tmp, *comma, line_platform[64];
1069 size_t db_size, platform_len;
1081 return SDL_SetError(
"Could not allocate space to read DB into memory");
1096 buf[db_size] =
'\0';
1099 while (line < buf + db_size) {
1101 if (line_end !=
NULL) {
1104 line_end = buf + db_size;
1112 if (comma !=
NULL) {
1113 platform_len = comma - tmp + 1;
1124 line = line_end + 1;
1145 if (!mappingString) {
1151 return SDL_SetError(
"Couldn't parse GUID from %s", mappingString);
1164 if (!pControllerMapping) {
1171 if (is_default_mapping) {
1172 s_pDefaultMapping = pControllerMapping;
1173 }
else if (is_hidapi_mapping) {
1174 s_pHIDAPIMapping = pControllerMapping;
1175 }
else if (is_xinput_mapping) {
1176 s_pXInputMapping = pControllerMapping;
1197 int num_mappings = 0;
1200 for (mapping = s_pSupportedControllers;
mapping; mapping = mapping->
next) {
1206 return num_mappings;
1217 for (mapping = s_pSupportedControllers;
mapping; mapping = mapping->
next) {
1221 if (mapping_index == 0) {
1222 char *pMappingString;
1230 if (!pMappingString) {
1235 return pMappingString;
1248 char *pMappingString =
NULL;
1257 if (!pMappingString) {
1263 return pMappingString;
1272 if (!gamecontroller) {
1283 if (hint && hint[0]) {
1285 char *pUserMappings =
SDL_malloc(nchHints + 1);
1286 char *pTempMappings = pUserMappings;
1288 pUserMappings[nchHints] =
'\0';
1289 while (pUserMappings) {
1290 char *pchNewLine =
NULL;
1292 pchNewLine =
SDL_strchr(pUserMappings,
'\n');
1299 pUserMappings = pchNewLine + 1;
1301 pUserMappings =
NULL;
1315 #ifdef CONTROLLER_MAPPING_FILE 1316 #define STRING(X) SDL_STRINGIFY_ARG(X) 1317 return SDL_strlcpy(path, STRING(CONTROLLER_MAPPING_FILE), size) <
size;
1318 #elif defined(__ANDROID__) 1331 char szControllerMapPath[1024];
1333 const char *pMappingString =
NULL;
1335 while (pMappingString) {
1386 if (pSupportedController) {
1390 return pSupportedController->
name;
1405 char *pMappingString =
NULL;
1419 if (!pMappingString) {
1427 return pMappingString;
1438 if (pSupportedController) {
1451 if (pSupportedController) {
1478 #if defined(__LINUX__) 1479 bSteamVirtualGamepad = (vendor == 0x28DE && product == 0x11FF);
1480 #elif defined(__MACOSX__) 1481 bSteamVirtualGamepad = (vendor == 0x045E && product == 0x028E && version == 1);
1482 #elif defined(__WIN32__) 1486 if (bSteamVirtualGamepad) {
1494 for (i = 0; i < SDL_allowed_controllers.
num_entries; ++
i) {
1495 if (vidpid == SDL_allowed_controllers.
entries[i]) {
1501 for (i = 0; i < SDL_ignored_controllers.
num_entries; ++
i) {
1502 if (vidpid == SDL_ignored_controllers.
entries[i]) {
1517 SDL_GameController *
1521 SDL_GameController *gamecontroller;
1522 SDL_GameController *gamecontrollerlist;
1530 while (gamecontrollerlist) {
1531 if (instance_id == gamecontrollerlist->joystick->instance_id) {
1532 gamecontroller = gamecontrollerlist;
1533 ++gamecontroller->ref_count;
1535 return (gamecontroller);
1537 gamecontrollerlist = gamecontrollerlist->next;
1542 if (!pSupportedController) {
1543 SDL_SetError(
"Couldn't find mapping for device (%d)", device_index);
1549 gamecontroller = (SDL_GameController *)
SDL_calloc(1,
sizeof(*gamecontroller));
1550 if (gamecontroller ==
NULL) {
1557 if (!gamecontroller->joystick) {
1563 if (gamecontroller->joystick->naxes) {
1565 if (!gamecontroller->last_match_axis) {
1573 if (gamecontroller->joystick->nhats) {
1574 gamecontroller->last_hat_mask = (
Uint8 *)
SDL_calloc(gamecontroller->joystick->nhats,
sizeof(*gamecontroller->last_hat_mask));
1575 if (!gamecontroller->last_hat_mask) {
1578 SDL_free(gamecontroller->last_match_axis);
1588 ++gamecontroller->ref_count;
1595 return (gamecontroller);
1616 if (!gamecontroller)
1619 for (i = 0; i < gamecontroller->num_bindings; ++
i) {
1629 valid_input_range = (value >= binding->
input.
axis.axis_min && value <= binding->
input.
axis.axis_max);
1631 valid_input_range = (value >= binding->
input.
axis.axis_max && value <= binding->
input.
axis.axis_min);
1633 if (valid_input_range) {
1635 float normalized_value = (float)(value - binding->
input.
axis.axis_min) / (binding->
input.
axis.axis_max - binding->
input.
axis.axis_min);
1646 if (hat_mask & binding->
input.
hat.hat_mask) {
1652 valid_output_range = (value >= binding->
output.
axis.axis_min && value <= binding->
output.
axis.axis_max);
1654 valid_output_range = (value >= binding->
output.
axis.axis_max && value <= binding->
output.
axis.axis_min);
1657 if (value != 0 && valid_output_range) {
1673 if (!gamecontroller)
1676 for (i = 0; i < gamecontroller->num_bindings; ++
i) {
1685 valid_input_range = (value >= binding->
input.
axis.axis_min && value <= binding->
input.
axis.axis_max);
1686 if (valid_input_range) {
1690 valid_input_range = (value >= binding->
input.
axis.axis_max && value <= binding->
input.
axis.axis_min);
1691 if (valid_input_range) {
1709 if (!gamecontroller)
1712 if (
SDL_strcmp(gamecontroller->name,
"*") == 0) {
1715 return gamecontroller->name;
1750 if (!gamecontroller)
1761 if (!gamecontroller)
1764 return gamecontroller->joystick;
1771 SDL_GameController *
1774 SDL_GameController *gamecontroller;
1778 while (gamecontroller) {
1779 if (gamecontroller->joystick->instance_id == joyid) {
1781 return gamecontroller;
1783 gamecontroller = gamecontroller->next;
1802 for (i = 0; i < gamecontroller->num_bindings; ++
i) {
1834 for (i = 0; i < gamecontroller->num_bindings; ++
i) {
1862 SDL_GameController *gamecontrollerlist, *gamecontrollerlistprev;
1864 if (!gamecontroller)
1870 if (--gamecontroller->ref_count > 0) {
1878 gamecontrollerlistprev =
NULL;
1879 while (gamecontrollerlist) {
1880 if (gamecontroller == gamecontrollerlist) {
1881 if (gamecontrollerlistprev) {
1883 gamecontrollerlistprev->next = gamecontrollerlist->next;
1889 gamecontrollerlistprev = gamecontrollerlist;
1890 gamecontrollerlist = gamecontrollerlist->next;
1893 SDL_free(gamecontroller->bindings);
1894 SDL_free(gamecontroller->last_match_axis);
1895 SDL_free(gamecontroller->last_hat_mask);
1921 while (s_pSupportedControllers) {
1923 s_pSupportedControllers = s_pSupportedControllers->
next;
1936 if (SDL_allowed_controllers.
entries) {
1940 if (SDL_ignored_controllers.
entries) {
1956 #if !SDL_EVENTS_DISABLED 1960 event.caxis.which = gamecontroller->joystick->instance_id;
1961 event.caxis.axis =
axis;
1962 event.caxis.value =
value;
1977 #if !SDL_EVENTS_DISABLED 1999 gamecontroller->guide_button_down = now;
2001 if (gamecontroller->joystick->delayed_guide_button) {
2007 gamecontroller->joystick->delayed_guide_button =
SDL_TRUE;
2010 gamecontroller->joystick->delayed_guide_button =
SDL_FALSE;
2016 #if !SDL_EVENTS_DISABLED 2018 event.cbutton.which = gamecontroller->joystick->instance_id;
2019 event.cbutton.button =
button;
2020 event.cbutton.state =
state;
2033 #if SDL_EVENTS_DISABLED 2036 const Uint32 event_list[] = {
2066 while (controllerlist) {
2067 if (controllerlist->joystick == joystick) {
2071 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)
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)
#define SDL_RWread(ctx, ptr, size, n)
void SDL_GameControllerHandleDelayedGuideButton(SDL_Joystick *joystick)
#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
struct _SDL_GameController * next
#define SDL_JoystickGetDeviceGUID
SDL_GameController * SDL_GameControllerFromInstanceID(SDL_JoystickID joyid)
#define SDL_GetHintBoolean
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)
#define SDL_stack_alloc(type, count)
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[]
union SDL_ExtendedGameControllerBind::@21 input
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
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
#define SDL_stack_free(data)
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)
#define SDL_LoadFile(file, datasize)
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)
union SDL_ExtendedGameControllerBind::@22 output
const char * SDL_GameControllerNameForIndex(int device_index)