SDL_joystick_c.h File Reference
`#include "../SDL_internal.h"`
`#include "SDL_joystick.h"`
Include dependency graph for SDL_joystick_c.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Functions

int | SDL_JoystickInit (void)
void | SDL_JoystickQuit (void)
SDL_JoystickID | SDL_GetNextJoystickInstanceID (void)
int | SDL_GameControllerInitMappings (void)
void | SDL_GameControllerQuitMappings (void)
int | SDL_GameControllerInit (void)
void | SDL_GameControllerQuit (void)
SDL_bool | SDL_GetDriverAndJoystickIndex (int device_index, struct _SDL_JoystickDriver **driver, int *driver_index)
int | SDL_JoystickGetDeviceIndexFromInstanceID (SDL_JoystickID instance_id)
void | SDL_GetJoystickGUIDInfo (SDL_JoystickGUID guid, Uint16 *vendor, Uint16 *product, Uint16 *version)
SDL_bool | SDL_IsJoystickPS4 (Uint16 vendor_id, Uint16 product_id)
SDL_bool | SDL_IsJoystickNintendoSwitchPro (Uint16 vendor_id, Uint16 product_id)
SDL_bool | SDL_IsJoystickSteamController (Uint16 vendor_id, Uint16 product_id)
SDL_bool | SDL_IsJoystickXbox360 (Uint16 vendor_id, Uint16 product_id)
SDL_bool | SDL_IsJoystickXboxOne (Uint16 vendor_id, Uint16 product_id)
SDL_bool | SDL_IsJoystickXInput (SDL_JoystickGUID guid)
SDL_bool | SDL_IsJoystickHIDAPI (SDL_JoystickGUID guid)
SDL_bool | SDL_ShouldIgnoreJoystick (const char *name, SDL_JoystickGUID guid)
SDL_bool | SDL_IsGameControllerNameAndGUID (const char *name, SDL_JoystickGUID guid)
SDL_bool | SDL_ShouldIgnoreGameController (const char *name, SDL_JoystickGUID guid)
void | SDL_GameControllerHandleDelayedGuideButton (SDL_Joystick *joystick)
void | SDL_PrivateJoystickAdded (SDL_JoystickID device_instance)
void | SDL_PrivateJoystickRemoved (SDL_JoystickID device_instance)
int | SDL_PrivateJoystickAxis (SDL_Joystick *joystick, Uint8 axis, Sint16 value)
int | SDL_PrivateJoystickBall (SDL_Joystick *joystick, Uint8 ball, Sint16 xrel, Sint16 yrel)
int | SDL_PrivateJoystickHat (SDL_Joystick *joystick, Uint8 hat, Uint8 value)
int | SDL_PrivateJoystickButton (SDL_Joystick *joystick, Uint8 button, Uint8 state)
void | SDL_PrivateJoystickBatteryLevel (SDL_Joystick *joystick, SDL_JoystickPowerLevel ePowerLevel)
int | SDL_PrivateJoystickValid (SDL_Joystick *joystick)

## Function Documentation

## SDL_GameControllerHandleDelayedGuideButton()

void SDL_GameControllerHandleDelayedGuideButton | ( | SDL_Joystick * | joystick | ) |

Definition at line 2088 of file SDL_gamecontroller.c.

{
SDL_GameController *controllerlist = SDL_gamecontrollers;
while (controllerlist) {
if (controllerlist->joystick == joystick) {
SDL_PrivateGameControllerButton(controllerlist, SDL_CONTROLLER_BUTTON_GUIDE, SDL_RELEASED);
break;
}
controllerlist = controllerlist->next;
}
}

References SDL_GameController::joystick, SDL_CONTROLLER_BUTTON_GUIDE, SDL_gamecontrollers, SDL_PrivateGameControllerButton(), and SDL_RELEASED.

Referenced by SDL_JoystickUpdate().

## SDL_GameControllerInit()

int SDL_GameControllerInit | ( | void |  | ) |

Definition at line 1374 of file SDL_gamecontroller.c.

{
int i;
/* watch for joy events and fire controller ones if needed */
SDL_AddEventWatch(SDL_GameControllerEventWatcher, NULL);
/* Send added events for controllers currently attached */
for (i = 0; i < SDL_NumJoysticks(); ++i) {
if (SDL_IsGameController(i)) {
SDL_Event deviceevent;
deviceevent.type = SDL_CONTROLLERDEVICEADDED;
deviceevent.cdevice.which = i;
SDL_PushEvent(&deviceevent);
}
}
return (0);
}

References SDL_Event::cdevice, i, NULL, SDL_AddEventWatch, SDL_CONTROLLERDEVICEADDED, SDL_GameControllerEventWatcher(), SDL_IsGameController(), SDL_NumJoysticks, SDL_PushEvent, SDL_Event::type, and SDL_ControllerDeviceEvent::which.

Referenced by SDL_InitSubSystem().

## SDL_GameControllerInitMappings()

int SDL_GameControllerInitMappings | ( | void |  | ) |

Definition at line 1345 of file SDL_gamecontroller.c.

{
char szControllerMapPath[1024];
int i = 0;
const char *pMappingString = NULL;
pMappingString = s_ControllerMappings[i];
while (pMappingString) {
SDL_PrivateGameControllerAddMapping(pMappingString, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT);
i++;
pMappingString = s_ControllerMappings[i];
}
if (SDL_GetControllerMappingFilePath(szControllerMapPath, sizeof(szControllerMapPath))) {
SDL_GameControllerAddMappingsFromFile(szControllerMapPath);
}
/* load in any user supplied config */
SDL_GameControllerLoadHints();
SDL_AddHintCallback(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES,
SDL_GameControllerIgnoreDevicesChanged, NULL);
SDL_AddHintCallback(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT,
SDL_GameControllerIgnoreDevicesExceptChanged, NULL);
return (0);
}

References i, NULL, s_ControllerMappings, SDL_AddHintCallback, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT, SDL_GameControllerAddMappingsFromFile, SDL_GameControllerIgnoreDevicesChanged(), SDL_GameControllerIgnoreDevicesExceptChanged(), SDL_GameControllerLoadHints(), SDL_GetControllerMappingFilePath(), SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES, SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT, and SDL_PrivateGameControllerAddMapping().

Referenced by SDL_JoystickInit().

## SDL_GameControllerQuit()

void SDL_GameControllerQuit | ( | void |  | ) |

Definition at line 1931 of file SDL_gamecontroller.c.

{
SDL_LockJoysticks();
while (SDL_gamecontrollers) {
SDL_gamecontrollers->ref_count = 1;
SDL_GameControllerClose(SDL_gamecontrollers);
}
SDL_UnlockJoysticks();
}

References SDL_GameControllerClose(), SDL_gamecontrollers, SDL_LockJoysticks, and SDL_UnlockJoysticks.

Referenced by SDL_QuitSubSystem().

## SDL_GameControllerQuitMappings()

void SDL_GameControllerQuitMappings | ( | void |  | ) |

Definition at line 1942 of file SDL_gamecontroller.c.

{
ControllerMapping_t *pControllerMap;
while (s_pSupportedControllers) {
pControllerMap = s_pSupportedControllers;
s_pSupportedControllers = s_pSupportedControllers->next;
SDL_free(pControllerMap->name);
SDL_free(pControllerMap->mapping);
SDL_free(pControllerMap);
}
SDL_DelEventWatch(SDL_GameControllerEventWatcher, NULL);
SDL_DelHintCallback(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES,
SDL_GameControllerIgnoreDevicesChanged, NULL);
SDL_DelHintCallback(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT,
SDL_GameControllerIgnoreDevicesExceptChanged, NULL);
if (SDL_allowed_controllers.entries) {
SDL_free(SDL_allowed_controllers.entries);
SDL_zero(SDL_allowed_controllers);
}
if (SDL_ignored_controllers.entries) {
SDL_free(SDL_ignored_controllers.entries);
SDL_zero(SDL_ignored_controllers);
}
}

References SDL_vidpid_list::entries, NULL, s_pSupportedControllers, SDL_allowed_controllers, SDL_DelEventWatch, SDL_DelHintCallback, SDL_free, SDL_GameControllerEventWatcher(), SDL_GameControllerIgnoreDevicesChanged(), SDL_GameControllerIgnoreDevicesExceptChanged(), SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES, SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT, SDL_ignored_controllers, and SDL_zero.

Referenced by SDL_JoystickQuit().

## SDL_GetDriverAndJoystickIndex()

SDL_bool SDL_GetDriverAndJoystickIndex | ( | int | device_index,
|  | struct _SDL_JoystickDriver ** | driver,
|  | int * | driver_index
| ) |  |

## SDL_GetJoystickGUIDInfo()

void SDL_GetJoystickGUIDInfo | ( | SDL_JoystickGUID | guid,
|  | Uint16 * | vendor,
|  | Uint16 * | product,
|  | Uint16 * | version
| ) |  |

Definition at line 1125 of file SDL_joystick.c.

{
Uint16 *guid16 = (Uint16 *)guid.data;
/* If the GUID fits the form of BUS 0000 VENDOR 0000 PRODUCT 0000, return the data */
if (/* guid16[0] is device bus type */
guid16[1] == 0x0000 &&
/* guid16[2] is vendor ID */
guid16[3] == 0x0000 &&
/* guid16[4] is product ID */
guid16[5] == 0x0000
/* guid16[6] is product version */
) {
if (vendor) {
*vendor = guid16[2];
}
if (product) {
*product = guid16[4];
}
if (version) {
*version = guid16[6];
}
} else {
if (vendor) {
*vendor = 0;
}
if (product) {
*product = 0;
}
if (version) {
*version = 0;
}
}
}

References SDL_JoystickGUID::data.

Referenced by SDL_GetJoystickGUIDType(), SDL_JoystickGetDeviceProduct(), SDL_JoystickGetDeviceProductVersion(), SDL_JoystickGetDeviceVendor(), SDL_JoystickGetProduct(), SDL_JoystickGetProductVersion(), SDL_JoystickGetVendor(), SDL_ShouldIgnoreGameController(), and SDL_ShouldIgnoreJoystick().

## SDL_GetNextJoystickInstanceID()

SDL_JoystickID SDL_GetNextJoystickInstanceID | ( | void |  | ) |

Definition at line 163 of file SDL_joystick.c.

{
return SDL_AtomicIncRef(&SDL_next_joystick_instance_id);
}

References SDL_AtomicIncRef, and SDL_next_joystick_instance_id.

Referenced by IOS_AddJoystickDevice().

## SDL_IsGameControllerNameAndGUID()

SDL_bool SDL_IsGameControllerNameAndGUID | ( | const char * | name,
|  | SDL_JoystickGUID | guid
| ) |  |

Definition at line 1451 of file SDL_gamecontroller.c.

{
ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMappingForNameAndGUID(name, guid);
if (pSupportedController) {
return SDL_TRUE;
}
return SDL_FALSE;
}

References SDL_FALSE, SDL_PrivateGetControllerMappingForNameAndGUID(), and SDL_TRUE.

Referenced by SDL_ShouldIgnoreJoystick().

## SDL_IsJoystickHIDAPI()

SDL_bool SDL_IsJoystickHIDAPI | ( | SDL_JoystickGUID | guid | ) |

Definition at line 1208 of file SDL_joystick.c.

{
return (guid.data[14] == 'h') ? SDL_TRUE : SDL_FALSE;
}

References SDL_JoystickGUID::data, SDL_FALSE, and SDL_TRUE.

Referenced by SDL_PrivateGetControllerMappingForGUID(), and SDL_PrivateGetControllerMappingForNameAndGUID().

## SDL_IsJoystickNintendoSwitchPro()

SDL_bool SDL_IsJoystickNintendoSwitchPro | ( | Uint16 | vendor_id,
|  | Uint16 | product_id
| ) |  |

Definition at line 1167 of file SDL_joystick.c.

{
EControllerType eType = GuessControllerType(vendor, product);
return (eType == k_eControllerType_SwitchProController ||
eType == k_eControllerType_SwitchInputOnlyController);
}

References GuessControllerType(), k_eControllerType_SwitchInputOnlyController, and k_eControllerType_SwitchProController.

## SDL_IsJoystickPS4()

SDL_bool SDL_IsJoystickPS4 | ( | Uint16 | vendor_id,
|  | Uint16 | product_id
| ) |  |

Definition at line 1161 of file SDL_joystick.c.

{
return (GuessControllerType(vendor, product) == k_eControllerType_PS4Controller);
}

References GuessControllerType(), and k_eControllerType_PS4Controller.

Referenced by SDL_ShouldIgnoreJoystick().

## SDL_IsJoystickSteamController()

SDL_bool SDL_IsJoystickSteamController | ( | Uint16 | vendor_id,
|  | Uint16 | product_id
| ) |  |

Definition at line 1175 of file SDL_joystick.c.

{
EControllerType eType = GuessControllerType(vendor, product);
return (eType == k_eControllerType_SteamController ||
eType == k_eControllerType_SteamControllerV2);
}

References GuessControllerType(), k_eControllerType_SteamController, and k_eControllerType_SteamControllerV2.

## SDL_IsJoystickXbox360()

SDL_bool SDL_IsJoystickXbox360 | ( | Uint16 | vendor_id,
|  | Uint16 | product_id
| ) |  |

Definition at line 1183 of file SDL_joystick.c.

{
/* Filter out some bogus values here */
if (vendor == 0x0000 && product == 0x0000) {
return SDL_FALSE;
}
if (vendor == 0x0001 && product == 0x0001) {
return SDL_FALSE;
}
return (GuessControllerType(vendor, product) == k_eControllerType_XBox360Controller);
}

References GuessControllerType(), k_eControllerType_XBox360Controller, and SDL_FALSE.

## SDL_IsJoystickXboxOne()

SDL_bool SDL_IsJoystickXboxOne | ( | Uint16 | vendor_id,
|  | Uint16 | product_id
| ) |  |

Definition at line 1196 of file SDL_joystick.c.

{
return (GuessControllerType(vendor, product) == k_eControllerType_XBoxOneController);
}

References GuessControllerType(), and k_eControllerType_XBoxOneController.

## SDL_IsJoystickXInput()

SDL_bool SDL_IsJoystickXInput | ( | SDL_JoystickGUID | guid | ) |

Definition at line 1202 of file SDL_joystick.c.

{
return (guid.data[14] == 'x') ? SDL_TRUE : SDL_FALSE;
}

References SDL_JoystickGUID::data, SDL_FALSE, and SDL_TRUE.

Referenced by SDL_GetJoystickGUIDType(), and SDL_PrivateGetControllerMappingForGUID().

## SDL_JoystickGetDeviceIndexFromInstanceID()

int SDL_JoystickGetDeviceIndexFromInstanceID | ( | SDL_JoystickID | instance_id | ) |

Definition at line 1560 of file SDL_joystick.c.

{
int i, num_joysticks, device_index = -1;
SDL_LockJoysticks();
num_joysticks = SDL_NumJoysticks();
for (i = 0; i < num_joysticks; ++i) {
if (SDL_JoystickGetDeviceInstanceID(i) == instance_id) {
device_index = i;
break;
}
}
SDL_UnlockJoysticks();
return device_index;
}

References i, SDL_JoystickGetDeviceInstanceID(), SDL_LockJoysticks(), SDL_NumJoysticks(), and SDL_UnlockJoysticks().

Referenced by SDL_PrivateJoystickAdded().

## SDL_JoystickInit()

int SDL_JoystickInit | ( | void |  | ) |

Definition at line 114 of file SDL_joystick.c.

{
int i, status;
SDL_GameControllerInitMappings();
/* Create the joystick list lock */
if (!SDL_joystick_lock) {
SDL_joystick_lock = SDL_CreateMutex();
}
/* See if we should allow joystick events while in the background */
SDL_AddHintCallback(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS,
SDL_JoystickAllowBackgroundEventsChanged, NULL);
#if !SDL_EVENTS_DISABLED
if (SDL_InitSubSystem(SDL_INIT_EVENTS) < 0) {
return -1;
}
#endif /* !SDL_EVENTS_DISABLED */
status = -1;
for (i = 0; i < SDL_arraysize(SDL_joystick_drivers); ++i) {
if (SDL_joystick_drivers[i]->Init() >= 0) {
status = 0;
}
}
return status;
}

References i, NULL, SDL_AddHintCallback, SDL_arraysize, SDL_CreateMutex, SDL_GameControllerInitMappings(), SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, SDL_INIT_EVENTS, SDL_InitSubSystem, SDL_joystick_drivers, SDL_joystick_lock, and SDL_JoystickAllowBackgroundEventsChanged().

Referenced by SDL_InitSubSystem().

## SDL_JoystickQuit()

void SDL_JoystickQuit | ( | void |  | ) |

Definition at line 697 of file SDL_joystick.c.

{
int i;
/* Make sure we're not getting called in the middle of updating joysticks */
SDL_LockJoysticks();
while (SDL_updating_joystick) {
SDL_UnlockJoysticks();
SDL_Delay(1);
SDL_LockJoysticks();
}
/* Stop the event polling */
while (SDL_joysticks) {
SDL_joysticks->ref_count = 1;
SDL_JoystickClose(SDL_joysticks);
}
/* Quit the joystick setup */
for (i = 0; i < SDL_arraysize(SDL_joystick_drivers); ++i) {
SDL_joystick_drivers[i]->Quit();
}
SDL_UnlockJoysticks();
#if !SDL_EVENTS_DISABLED
SDL_QuitSubSystem(SDL_INIT_EVENTS);
#endif
SDL_DelHintCallback(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS,
SDL_JoystickAllowBackgroundEventsChanged, NULL);
if (SDL_joystick_lock) {
SDL_mutex *mutex = SDL_joystick_lock;
SDL_joystick_lock = NULL;
SDL_DestroyMutex(mutex);
}
SDL_GameControllerQuitMappings();
}

References i, mutex, NULL, SDL_arraysize, SDL_Delay, SDL_DelHintCallback, SDL_DestroyMutex, SDL_GameControllerQuitMappings(), SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, SDL_INIT_EVENTS, SDL_joystick_drivers, SDL_joystick_lock, SDL_JoystickAllowBackgroundEventsChanged(), SDL_JoystickClose(), SDL_joysticks, SDL_LockJoysticks(), SDL_QuitSubSystem, SDL_UnlockJoysticks(), and SDL_updating_joystick.

Referenced by SDL_QuitSubSystem().

## SDL_PrivateJoystickAdded()

void SDL_PrivateJoystickAdded | ( | SDL_JoystickID | device_instance | ) |

Definition at line 755 of file SDL_joystick.c.

{
#if !SDL_EVENTS_DISABLED
SDL_Event event;
int device_index;
device_index = SDL_JoystickGetDeviceIndexFromInstanceID(device_instance);
if (device_index < 0) {
return;
}
event.type = SDL_JOYDEVICEADDED;
if (SDL_GetEventState(event.type) == SDL_ENABLE) {
event.jdevice.which = device_index;
SDL_PushEvent(&event);
}
#endif /* !SDL_EVENTS_DISABLED */
}

References SDL_ENABLE, SDL_GetEventState, SDL_JOYDEVICEADDED, SDL_JoystickGetDeviceIndexFromInstanceID(), and SDL_PushEvent.

Referenced by IOS_AddJoystickDevice().

## SDL_PrivateJoystickAxis()

int SDL_PrivateJoystickAxis | ( | SDL_Joystick * | joystick,
|  | Uint8 | axis,
|  | Sint16 | value
| ) |  |

Definition at line 833 of file SDL_joystick.c.

{
int posted;
/* Make sure we're not getting garbage or duplicate events */
if (axis >= joystick->naxes) {
return 0;
}
if (!joystick->axes[axis].has_initial_value) {
joystick->axes[axis].initial_value = value;
joystick->axes[axis].value = value;
joystick->axes[axis].zero = value;
joystick->axes[axis].has_initial_value = SDL_TRUE;
}
if (value == joystick->axes[axis].value) {
return 0;
}
if (!joystick->axes[axis].sent_initial_value) {
/* Make sure we don't send motion until there's real activity on this axis */
const int MAX_ALLOWED_JITTER = SDL_JOYSTICK_AXIS_MAX / 80; /* ShanWan PS3 controller needed 96 */
if (SDL_abs(value - joystick->axes[axis].value) <= MAX_ALLOWED_JITTER) {
return 0;
}
joystick->axes[axis].sent_initial_value = SDL_TRUE;
joystick->axes[axis].value = value; /* Just so we pass the check above */
SDL_PrivateJoystickAxis(joystick, axis, joystick->axes[axis].initial_value);
}
/* We ignore events if we don't have keyboard focus, except for centering
* events.
*/
if (SDL_PrivateJoystickShouldIgnoreEvent()) {
if ((value > joystick->axes[axis].zero && value >= joystick->axes[axis].value) ||
(value < joystick->axes[axis].zero && value <= joystick->axes[axis].value)) {
return 0;
}
}
/* Update internal joystick state */
joystick->axes[axis].value = value;
/* Post the event, if desired */
posted = 0;
#if !SDL_EVENTS_DISABLED
if (SDL_GetEventState(SDL_JOYAXISMOTION) == SDL_ENABLE) {
SDL_Event event;
event.type = SDL_JOYAXISMOTION;
event.jaxis.which = joystick->instance_id;
event.jaxis.axis = axis;
event.jaxis.value = value;
posted = SDL_PushEvent(&event) == 1;
}
#endif /* !SDL_EVENTS_DISABLED */
return posted;
}

References axis, SDL_abs, SDL_ENABLE, SDL_GetEventState, SDL_JOYAXISMOTION, SDL_JOYSTICK_AXIS_MAX, SDL_PrivateJoystickAxis(), SDL_PrivateJoystickShouldIgnoreEvent(), SDL_PushEvent, and SDL_TRUE.

Referenced by IOS_AccelerometerUpdate(), IOS_MFIJoystickUpdate(), SDL_JoystickUpdate(), and SDL_PrivateJoystickAxis().

## SDL_PrivateJoystickBall()

int SDL_PrivateJoystickBall | ( | SDL_Joystick * | joystick,
|  | Uint8 | ball,
|  | Sint16 | xrel,
|  | Sint16 | yrel
| ) |  |

Definition at line 930 of file SDL_joystick.c.

{
int posted;
/* Make sure we're not getting garbage events */
if (ball >= joystick->nballs) {
return 0;
}
/* We ignore events if we don't have keyboard focus. */
if (SDL_PrivateJoystickShouldIgnoreEvent()) {
return 0;
}
/* Update internal mouse state */
joystick->balls[ball].dx += xrel;
joystick->balls[ball].dy += yrel;
/* Post the event, if desired */
posted = 0;
#if !SDL_EVENTS_DISABLED
if (SDL_GetEventState(SDL_JOYBALLMOTION) == SDL_ENABLE) {
SDL_Event event;
event.jball.type = SDL_JOYBALLMOTION;
event.jball.which = joystick->instance_id;
event.jball.ball = ball;
event.jball.xrel = xrel;
event.jball.yrel = yrel;
posted = SDL_PushEvent(&event) == 1;
}
#endif /* !SDL_EVENTS_DISABLED */
return posted;
}

References SDL_ENABLE, SDL_GetEventState, SDL_JOYBALLMOTION, SDL_PrivateJoystickShouldIgnoreEvent(), and SDL_PushEvent.

## SDL_PrivateJoystickBatteryLevel()

void SDL_PrivateJoystickBatteryLevel | ( | SDL_Joystick * | joystick,
|  | SDL_JoystickPowerLevel | ePowerLevel
| ) |  |

Definition at line 1696 of file SDL_joystick.c.

{
joystick->epowerlevel = ePowerLevel;
}

## SDL_PrivateJoystickButton()

int SDL_PrivateJoystickButton | ( | SDL_Joystick * | joystick,
|  | Uint8 | button,
|  | Uint8 | state
| ) |  |

Definition at line 966 of file SDL_joystick.c.

{
int posted;
#if !SDL_EVENTS_DISABLED
SDL_Event event;
switch (state) {
case SDL_PRESSED:
event.type = SDL_JOYBUTTONDOWN;
break;
case SDL_RELEASED:
event.type = SDL_JOYBUTTONUP;
break;
default:
/* Invalid state -- bail */
return 0;
}
#endif /* !SDL_EVENTS_DISABLED */
/* Make sure we're not getting garbage or duplicate events */
if (button >= joystick->nbuttons) {
return 0;
}
if (state == joystick->buttons[button]) {
return 0;
}
/* We ignore events if we don't have keyboard focus, except for button
* release. */
if (SDL_PrivateJoystickShouldIgnoreEvent()) {
if (state == SDL_PRESSED) {
return 0;
}
}
/* Update internal joystick state */
joystick->buttons[button] = state;
/* Post the event, if desired */
posted = 0;
#if !SDL_EVENTS_DISABLED
if (SDL_GetEventState(event.type) == SDL_ENABLE) {
event.jbutton.which = joystick->instance_id;
event.jbutton.button = button;
event.jbutton.state = state;
posted = SDL_PushEvent(&event) == 1;
}
#endif /* !SDL_EVENTS_DISABLED */
return posted;
}

References button, SDL_ENABLE, SDL_GetEventState, SDL_JOYBUTTONDOWN, SDL_JOYBUTTONUP, SDL_PRESSED, SDL_PrivateJoystickShouldIgnoreEvent(), SDL_PushEvent, SDL_RELEASED, and state.

Referenced by IOS_MFIJoystickUpdate(), and SDL_JoystickUpdate().

## SDL_PrivateJoystickHat()

int SDL_PrivateJoystickHat | ( | SDL_Joystick * | joystick,
|  | Uint8 | hat,
|  | Uint8 | value
| ) |  |

Definition at line 890 of file SDL_joystick.c.

{
int posted;
/* Make sure we're not getting garbage or duplicate events */
if (hat >= joystick->nhats) {
return 0;
}
if (value == joystick->hats[hat]) {
return 0;
}
/* We ignore events if we don't have keyboard focus, except for centering
* events.
*/
if (SDL_PrivateJoystickShouldIgnoreEvent()) {
if (value != SDL_HAT_CENTERED) {
return 0;
}
}
/* Update internal joystick state */
joystick->hats[hat] = value;
/* Post the event, if desired */
posted = 0;
#if !SDL_EVENTS_DISABLED
if (SDL_GetEventState(SDL_JOYHATMOTION) == SDL_ENABLE) {
SDL_Event event;
event.jhat.type = SDL_JOYHATMOTION;
event.jhat.which = joystick->instance_id;
event.jhat.hat = hat;
event.jhat.value = value;
posted = SDL_PushEvent(&event) == 1;
}
#endif /* !SDL_EVENTS_DISABLED */
return posted;
}

References SDL_ENABLE, SDL_GetEventState, SDL_HAT_CENTERED, SDL_JOYHATMOTION, SDL_PrivateJoystickShouldIgnoreEvent(), and SDL_PushEvent.

Referenced by IOS_MFIJoystickUpdate(), and SDL_JoystickUpdate().

## SDL_PrivateJoystickRemoved()

void SDL_PrivateJoystickRemoved | ( | SDL_JoystickID | device_instance | ) |

Definition at line 805 of file SDL_joystick.c.

{
SDL_Joystick *joystick;
#if !SDL_EVENTS_DISABLED
SDL_Event event;
event.type = SDL_JOYDEVICEREMOVED;
if (SDL_GetEventState(event.type) == SDL_ENABLE) {
event.jdevice.which = device_instance;
SDL_PushEvent(&event);
}
UpdateEventsForDeviceRemoval();
#endif /* !SDL_EVENTS_DISABLED */
/* Mark this joystick as no longer attached */
for (joystick = SDL_joysticks; joystick; joystick = joystick->next) {
if (joystick->instance_id == device_instance) {
joystick->attached = SDL_FALSE;
joystick->force_recentering = SDL_TRUE;
break;
}
}
}

References SDL_ENABLE, SDL_FALSE, SDL_GetEventState, SDL_JOYDEVICEREMOVED, SDL_joysticks, SDL_PushEvent, SDL_TRUE, and UpdateEventsForDeviceRemoval().

Referenced by IOS_RemoveJoystickDevice().

## SDL_PrivateJoystickValid()

int SDL_PrivateJoystickValid | ( | SDL_Joystick * | joystick | ) |

Definition at line 394 of file SDL_joystick.c.

{
int valid;
if (joystick == NULL) {
SDL_SetError("Joystick hasn't been opened yet");
valid = 0;
} else {
valid = 1;
}
return valid;
}

References NULL, and SDL_SetError.

Referenced by SDL_HapticOpenFromJoystick(), SDL_JoystickClose(), SDL_JoystickCurrentPowerLevel(), SDL_JoystickGetAttached(), SDL_JoystickGetAxis(), SDL_JoystickGetAxisInitialState(), SDL_JoystickGetBall(), SDL_JoystickGetButton(), SDL_JoystickGetGUID(), SDL_JoystickGetHat(), SDL_JoystickGetPlayerIndex(), SDL_JoystickInstanceID(), SDL_JoystickIsHaptic(), SDL_JoystickName(), SDL_JoystickNumAxes(), SDL_JoystickNumBalls(), SDL_JoystickNumButtons(), SDL_JoystickNumHats(), and SDL_JoystickRumble().

## SDL_ShouldIgnoreGameController()

SDL_bool SDL_ShouldIgnoreGameController | ( | const char * | name,
|  | SDL_JoystickGUID | guid
| ) |  |

Definition at line 1476 of file SDL_gamecontroller.c.

{
int i;
Uint16 vendor;
Uint16 product;
Uint16 version;
Uint32 vidpid;
#if defined(__LINUX__)
if (name && SDL_strstr(name, "Wireless Controller Motion Sensors")) {
/* Don't treat the PS4 motion controls as a separate game controller */
return SDL_TRUE;
}
#endif
if (SDL_allowed_controllers.num_entries == 0 &&
SDL_ignored_controllers.num_entries == 0) {
return SDL_FALSE;
}
SDL_GetJoystickGUIDInfo(guid, &vendor, &product, &version);
if (SDL_GetHintBoolean("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD", SDL_FALSE)) {
/* We shouldn't ignore Steam's virtual gamepad since it's using the hints to filter out the real controllers so it can remap input for the virtual controller */
SDL_bool bSteamVirtualGamepad = SDL_FALSE;
#if defined(__LINUX__)
bSteamVirtualGamepad = (vendor == 0x28DE && product == 0x11FF);
#elif defined(__MACOSX__)
bSteamVirtualGamepad = (vendor == 0x045E && product == 0x028E && version == 1);
#elif defined(__WIN32__)
/* We can't tell on Windows, but Steam will block others in input hooks */
bSteamVirtualGamepad = SDL_TRUE;
#endif
if (bSteamVirtualGamepad) {
return SDL_FALSE;
}
}
vidpid = MAKE_VIDPID(vendor, product);
if (SDL_allowed_controllers.num_entries > 0) {
for (i = 0; i < SDL_allowed_controllers.num_entries; ++i) {
if (vidpid == SDL_allowed_controllers.entries[i]) {
return SDL_FALSE;
}
}
return SDL_TRUE;
} else {
for (i = 0; i < SDL_ignored_controllers.num_entries; ++i) {
if (vidpid == SDL_ignored_controllers.entries[i]) {
return SDL_TRUE;
}
}
return SDL_FALSE;
}
}

References SDL_vidpid_list::entries, i, MAKE_VIDPID, SDL_vidpid_list::num_entries, SDL_allowed_controllers, SDL_FALSE, SDL_GetHintBoolean, SDL_GetJoystickGUIDInfo(), SDL_ignored_controllers, SDL_strstr, and SDL_TRUE.

Referenced by SDL_ShouldIgnoreJoystick().

## SDL_ShouldIgnoreJoystick()

SDL_bool SDL_ShouldIgnoreJoystick | ( | const char * | name,
|  | SDL_JoystickGUID | guid
| ) |  |

Definition at line 1359 of file SDL_joystick.c.

{
/* This list is taken from:
https://raw.githubusercontent.com/denilsonsa/udev-joystick-blacklist/master/generate_rules.py
*/
static Uint32 joystick_blacklist[] = {
/* Microsoft Microsoft Wireless Optical Desktop® 2.10 */
/* Microsoft Wireless Desktop - Comfort Edition */
MAKE_VIDPID(0x045e, 0x009d),
/* Microsoft Microsoft® Digital Media Pro Keyboard */
/* Microsoft Corp. Digital Media Pro Keyboard */
MAKE_VIDPID(0x045e, 0x00b0),
/* Microsoft Microsoft® Digital Media Keyboard */
/* Microsoft Corp. Digital Media Keyboard 1.0A */
MAKE_VIDPID(0x045e, 0x00b4),
/* Microsoft Microsoft® Digital Media Keyboard 3000 */
MAKE_VIDPID(0x045e, 0x0730),
/* Microsoft Microsoft® 2.4GHz Transceiver v6.0 */
/* Microsoft Microsoft® 2.4GHz Transceiver v8.0 */
/* Microsoft Corp. Nano Transceiver v1.0 for Bluetooth */
/* Microsoft Wireless Mobile Mouse 1000 */
/* Microsoft Wireless Desktop 3000 */
MAKE_VIDPID(0x045e, 0x0745),
/* Microsoft® SideWinder(TM) 2.4GHz Transceiver */
MAKE_VIDPID(0x045e, 0x0748),
/* Microsoft Corp. Wired Keyboard 600 */
MAKE_VIDPID(0x045e, 0x0750),
/* Microsoft Corp. Sidewinder X4 keyboard */
MAKE_VIDPID(0x045e, 0x0768),
/* Microsoft Corp. Arc Touch Mouse Transceiver */
MAKE_VIDPID(0x045e, 0x0773),
/* Microsoft® 2.4GHz Transceiver v9.0 */
/* Microsoft® Nano Transceiver v2.1 */
/* Microsoft Sculpt Ergonomic Keyboard (5KV-00001) */
MAKE_VIDPID(0x045e, 0x07a5),
/* Microsoft® Nano Transceiver v1.0 */
/* Microsoft Wireless Keyboard 800 */
MAKE_VIDPID(0x045e, 0x07b2),
/* Microsoft® Nano Transceiver v2.0 */
MAKE_VIDPID(0x045e, 0x0800),
MAKE_VIDPID(0x046d, 0xc30a), /* Logitech, Inc. iTouch Composite keboard */
MAKE_VIDPID(0x04d9, 0xa0df), /* Tek Syndicate Mouse (E-Signal USB Gaming Mouse) */
/* List of Wacom devices at: http://linuxwacom.sourceforge.net/wiki/index.php/Device_IDs */
MAKE_VIDPID(0x056a, 0x0010), /* Wacom ET-0405 Graphire */
MAKE_VIDPID(0x056a, 0x0011), /* Wacom ET-0405A Graphire2 (4x5) */
MAKE_VIDPID(0x056a, 0x0012), /* Wacom ET-0507A Graphire2 (5x7) */
MAKE_VIDPID(0x056a, 0x0013), /* Wacom CTE-430 Graphire3 (4x5) */
MAKE_VIDPID(0x056a, 0x0014), /* Wacom CTE-630 Graphire3 (6x8) */
MAKE_VIDPID(0x056a, 0x0015), /* Wacom CTE-440 Graphire4 (4x5) */
MAKE_VIDPID(0x056a, 0x0016), /* Wacom CTE-640 Graphire4 (6x8) */
MAKE_VIDPID(0x056a, 0x0017), /* Wacom CTE-450 Bamboo Fun (4x5) */
MAKE_VIDPID(0x056a, 0x0018), /* Wacom CTE-650 Bamboo Fun 6x8 */
MAKE_VIDPID(0x056a, 0x0019), /* Wacom CTE-631 Bamboo One */
MAKE_VIDPID(0x056a, 0x00d1), /* Wacom Bamboo Pen and Touch CTH-460 */
MAKE_VIDPID(0x056a, 0x030e), /* Wacom Intuos Pen (S) CTL-480 */
MAKE_VIDPID(0x09da, 0x054f), /* A4 Tech Co., G7 750 mouse */
MAKE_VIDPID(0x09da, 0x1410), /* A4 Tech Co., Ltd Bloody AL9 mouse */
MAKE_VIDPID(0x09da, 0x3043), /* A4 Tech Co., Ltd Bloody R8A Gaming Mouse */
MAKE_VIDPID(0x09da, 0x31b5), /* A4 Tech Co., Ltd Bloody TL80 Terminator Laser Gaming Mouse */
MAKE_VIDPID(0x09da, 0x3997), /* A4 Tech Co., Ltd Bloody RT7 Terminator Wireless */
MAKE_VIDPID(0x09da, 0x3f8b), /* A4 Tech Co., Ltd Bloody V8 mouse */
MAKE_VIDPID(0x09da, 0x51f4), /* Modecom MC-5006 Keyboard */
MAKE_VIDPID(0x09da, 0x5589), /* A4 Tech Co., Ltd Terminator TL9 Laser Gaming Mouse */
MAKE_VIDPID(0x09da, 0x7b22), /* A4 Tech Co., Ltd Bloody V5 */
MAKE_VIDPID(0x09da, 0x7f2d), /* A4 Tech Co., Ltd Bloody R3 mouse */
MAKE_VIDPID(0x09da, 0x8090), /* A4 Tech Co., Ltd X-718BK Oscar Optical Gaming Mouse */
MAKE_VIDPID(0x09da, 0x9033), /* A4 Tech Co., X7 X-705K */
MAKE_VIDPID(0x09da, 0x9066), /* A4 Tech Co., Sharkoon Fireglider Optical */
MAKE_VIDPID(0x09da, 0x9090), /* A4 Tech Co., Ltd XL-730K / XL-750BK / XL-755BK Laser Mouse */
MAKE_VIDPID(0x09da, 0x90c0), /* A4 Tech Co., Ltd X7 G800V keyboard */
MAKE_VIDPID(0x09da, 0xf012), /* A4 Tech Co., Ltd Bloody V7 mouse */
MAKE_VIDPID(0x09da, 0xf32a), /* A4 Tech Co., Ltd Bloody B540 keyboard */
MAKE_VIDPID(0x09da, 0xf613), /* A4 Tech Co., Ltd Bloody V2 mouse */
MAKE_VIDPID(0x09da, 0xf624), /* A4 Tech Co., Ltd Bloody B120 Keyboard */
MAKE_VIDPID(0x1b1c, 0x1b3c), /* Corsair Harpoon RGB gaming mouse */
MAKE_VIDPID(0x1d57, 0xad03), /* [T3] 2.4GHz and IR Air Mouse Remote Control */
MAKE_VIDPID(0x1e7d, 0x2e4a), /* Roccat Tyon Mouse */
MAKE_VIDPID(0x20a0, 0x422d), /* Winkeyless.kr Keyboards */
MAKE_VIDPID(0x2516, 0x001f), /* Cooler Master Storm Mizar Mouse */
MAKE_VIDPID(0x2516, 0x0028), /* Cooler Master Storm Alcor Mouse */
};
unsigned int i;
Uint32 id;
Uint16 vendor;
Uint16 product;
SDL_GetJoystickGUIDInfo(guid, &vendor, &product, NULL);
/* Check the joystick blacklist */
id = MAKE_VIDPID(vendor, product);
for (i = 0; i < SDL_arraysize(joystick_blacklist); ++i) {
if (id == joystick_blacklist[i]) {
return SDL_TRUE;
}
}
if (SDL_IsJoystickPS4(vendor, product) && SDL_IsPS4RemapperRunning()) {
return SDL_TRUE;
}
if (SDL_IsGameControllerNameAndGUID(name, guid) &&
SDL_ShouldIgnoreGameController(name, guid)) {
return SDL_TRUE;
}
return SDL_FALSE;
}

References i, MAKE_VIDPID, NULL, SDL_arraysize, SDL_FALSE, SDL_GetJoystickGUIDInfo(), SDL_IsGameControllerNameAndGUID(), SDL_IsJoystickPS4(), SDL_IsPS4RemapperRunning(), SDL_ShouldIgnoreGameController(), and SDL_TRUE.

SDL_zero
#define SDL_zero(x)
Definition: SDL_stdinc.h:416
SDL_Event::type
Uint32 type
Definition: SDL_events.h:559
k_eControllerType_SteamController
@ k_eControllerType_SteamController
Definition: controller_type.h:42
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:203
k_eControllerType_SwitchInputOnlyController
@ k_eControllerType_SwitchInputOnlyController
Definition: controller_type.h:58
SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
#define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
A variable that lets you enable joystick (and gamecontroller) events even when your app is in the bac...
Definition: SDL_hints.h:496
SDL_IsGameController
SDL_bool SDL_IsGameController(int device_index)
Definition: SDL_gamecontroller.c:1464
SDL_GameControllerEventWatcher
static int SDL_GameControllerEventWatcher(void *userdata, SDL_Event *event)
Definition: SDL_gamecontroller.c:347
SDL_gamecontrollers
static SDL_GameController * SDL_gamecontrollers
Definition: SDL_gamecontroller.c:48
SDL_abs
#define SDL_abs
Definition: SDL_dynapi_overrides.h:381
SDL_UnlockJoysticks
#define SDL_UnlockJoysticks
Definition: SDL_dynapi_overrides.h:639
SDL_HAT_CENTERED
#define SDL_HAT_CENTERED
Definition: SDL_joystick.h:329
NULL
#define NULL
Definition: begin_code.h:167
k_eControllerType_SwitchProController
@ k_eControllerType_SwitchProController
Definition: controller_type.h:54
SDL_JoystickGetDeviceIndexFromInstanceID
int SDL_JoystickGetDeviceIndexFromInstanceID(SDL_JoystickID instance_id)
Definition: SDL_joystick.c:1560
SDL_IsPS4RemapperRunning
static SDL_bool SDL_IsPS4RemapperRunning(void)
Definition: SDL_joystick.c:1326
SDL_INIT_EVENTS
#define SDL_INIT_EVENTS
Definition: SDL.h:83
SDL_mutex
Definition: SDL_sysmutex.c:29
mutex
static SDL_mutex * mutex
Definition: testlock.c:23
SDL_IsJoystickPS4
SDL_bool SDL_IsJoystickPS4(Uint16 vendor, Uint16 product)
Definition: SDL_joystick.c:1161
SDL_GameControllerIgnoreDevicesChanged
static void SDL_GameControllerIgnoreDevicesChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
Definition: SDL_gamecontroller.c:182
SDL_NumJoysticks
#define SDL_NumJoysticks
Definition: SDL_dynapi_overrides.h:195
SDL_AtomicIncRef
#define SDL_AtomicIncRef(a)
Increment an atomic variable used as a reference count.
Definition: SDL_atomic.h:252
SDL_QuitSubSystem
#define SDL_QuitSubSystem
Definition: SDL_dynapi_overrides.h:56
SDL_CreateMutex
#define SDL_CreateMutex
Definition: SDL_dynapi_overrides.h:259
SDL_vidpid_list::entries
Uint32 * entries
Definition: SDL_gamecontroller.c:129
SDL_ControllerDeviceEvent::which
Sint32 which
Definition: SDL_events.h:413
SDL_ENABLE
#define SDL_ENABLE
Definition: SDL_events.h:759
SDL_NumJoysticks
int SDL_NumJoysticks(void)
Definition: SDL_joystick.c:148
SDL_UnlockJoysticks
void SDL_UnlockJoysticks(void)
Definition: SDL_joystick.c:95
SDL_JoystickGUID::data
Uint8 data[16]
Definition: SDL_joystick.h:71
SDL_JOYDEVICEREMOVED
@ SDL_JOYDEVICEREMOVED
Definition: SDL_events.h:117
SDL_RELEASED
#define SDL_RELEASED
Definition: SDL_events.h:49
SDL_JoystickGetDeviceInstanceID
SDL_JoystickID SDL_JoystickGetDeviceInstanceID(int device_index)
Definition: SDL_joystick.c:1546
SDL_InitSubSystem
#define SDL_InitSubSystem
Definition: SDL_dynapi_overrides.h:55
s_pSupportedControllers
static ControllerMapping_t * s_pSupportedControllers
Definition: SDL_gamecontroller.c:103
SDL_CONTROLLERDEVICEADDED
@ SDL_CONTROLLERDEVICEADDED
Definition: SDL_events.h:123
SDL_ShouldIgnoreGameController
SDL_bool SDL_ShouldIgnoreGameController(const char *name, SDL_JoystickGUID guid)
Definition: SDL_gamecontroller.c:1476
SDL_PrivateJoystickAxis
int SDL_PrivateJoystickAxis(SDL_Joystick *joystick, Uint8 axis, Sint16 value)
Definition: SDL_joystick.c:833
SDL_vidpid_list::num_entries
int num_entries
Definition: SDL_gamecontroller.c:127
k_eControllerType_PS4Controller
@ k_eControllerType_PS4Controller
Definition: controller_type.h:50
SDL_PRESSED
#define SDL_PRESSED
Definition: SDL_events.h:50
SDL_GetHintBoolean
#define SDL_GetHintBoolean
Definition: SDL_dynapi_overrides.h:608
event
struct _cl_event * event
Definition: SDL_opengl_glext.h:2649
SDL_FALSE
@ SDL_FALSE
Definition: SDL_stdinc.h:163
SDL_GetEventState
#define SDL_GetEventState(type)
Definition: SDL_events.h:772
k_eControllerType_XBox360Controller
@ k_eControllerType_XBox360Controller
Definition: controller_type.h:47
SDL_GetJoystickGUIDInfo
void SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint16 *vendor, Uint16 *product, Uint16 *version)
Definition: SDL_joystick.c:1125
SDL_free
#define SDL_free
Definition: SDL_dynapi_overrides.h:377
SDL_updating_joystick
static SDL_bool SDL_updating_joystick
Definition: SDL_joystick.c:82
UpdateEventsForDeviceRemoval
static void UpdateEventsForDeviceRemoval()
Definition: SDL_joystick.c:780
SDL_PushEvent
#define SDL_PushEvent
Definition: SDL_dynapi_overrides.h:125
SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT
#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT
Definition: SDL_hints.h:483
SDL_ignored_controllers
static SDL_vidpid_list SDL_ignored_controllers
Definition: SDL_gamecontroller.c:133
SDL_PrivateJoystickShouldIgnoreEvent
static SDL_bool SDL_PrivateJoystickShouldIgnoreEvent()
Definition: SDL_joystick.c:740
name
GLuint const GLchar * name
Definition: SDL_opengl_glext.h:660
s_ControllerMappings
static const char * s_ControllerMappings[]
Definition: SDL_gamecontrollerdb.h:32
SDL_GameControllerInitMappings
int SDL_GameControllerInitMappings(void)
Definition: SDL_gamecontroller.c:1345
Uint16
uint16_t Uint16
Definition: SDL_stdinc.h:191
k_eControllerType_SteamControllerV2
@ k_eControllerType_SteamControllerV2
Definition: controller_type.h:43
GuessControllerType
static EControllerType GuessControllerType(int nVID, int nPID)
Definition: controller_type.h:427
MAKE_VIDPID
#define MAKE_VIDPID(VID, PID)
Definition: SDL_sysjoystick.h:90
SDL_JOYAXISMOTION
@ SDL_JOYAXISMOTION
Definition: SDL_events.h:111
SDL_next_joystick_instance_id
static SDL_atomic_t SDL_next_joystick_instance_id
Definition: SDL_joystick.c:84
SDL_JoystickAllowBackgroundEventsChanged
static void SDL_JoystickAllowBackgroundEventsChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
Definition: SDL_joystick.c:104
SDL_GameControllerLoadHints
static void SDL_GameControllerLoadHints()
Definition: SDL_gamecontroller.c:1294
SDL_Delay
#define SDL_Delay
Definition: SDL_dynapi_overrides.h:486
SDL_joystick_lock
static SDL_mutex * SDL_joystick_lock
Definition: SDL_joystick.c:83
SDL_JOYSTICK_AXIS_MAX
#define SDL_JOYSTICK_AXIS_MAX
Definition: SDL_joystick.h:301
SDL_LockJoysticks
void SDL_LockJoysticks(void)
Definition: SDL_joystick.c:87
SDL_joystick_drivers
static SDL_JoystickDriver * SDL_joystick_drivers[]
Definition: SDL_joystick.c:48
axis
SDL_Texture * axis
Definition: testgamecontroller.c:67
id
GLuint id
Definition: SDL_opengl_glext.h:528
SDL_arraysize
#define SDL_arraysize(array)
Definition: SDL_stdinc.h:115
SDL_PrivateGameControllerAddMapping
static int SDL_PrivateGameControllerAddMapping(const char *mappingString, SDL_ControllerMappingPriority priority)
Definition: SDL_gamecontroller.c:1149
SDL_GameControllerQuitMappings
void SDL_GameControllerQuitMappings(void)
Definition: SDL_gamecontroller.c:1942
SDL_TRUE
@ SDL_TRUE
Definition: SDL_stdinc.h:164
SDL_AddHintCallback
#define SDL_AddHintCallback
Definition: SDL_dynapi_overrides.h:192
SDL_JoystickClose
void SDL_JoystickClose(SDL_Joystick *joystick)
Definition: SDL_joystick.c:643
SDL_allowed_controllers
static SDL_vidpid_list SDL_allowed_controllers
Definition: SDL_gamecontroller.c:132
value
GLsizei const GLfloat * value
Definition: SDL_opengl_glext.h:698
SDL_PrivateGetControllerMappingForNameAndGUID
static ControllerMapping_t * SDL_PrivateGetControllerMappingForNameAndGUID(const char *name, SDL_JoystickGUID guid)
Definition: SDL_gamecontroller.c:1020
SDL_SetError
#define SDL_SetError
Definition: SDL_dynapi_overrides.h:30
SDL_GameControllerClose
void SDL_GameControllerClose(SDL_GameController *gamecontroller)
Definition: SDL_gamecontroller.c:1885
SDL_IsGameControllerNameAndGUID
SDL_bool SDL_IsGameControllerNameAndGUID(const char *name, SDL_JoystickGUID guid)
Definition: SDL_gamecontroller.c:1451
SDL_JOYBUTTONUP
@ SDL_JOYBUTTONUP
Definition: SDL_events.h:115
SDL_DestroyMutex
#define SDL_DestroyMutex
Definition: SDL_dynapi_overrides.h:263
EControllerType
EControllerType
Definition: controller_type.h:35
SDL_AddEventWatch
#define SDL_AddEventWatch
Definition: SDL_dynapi_overrides.h:128
SDL_joysticks
static SDL_Joystick * SDL_joysticks
Definition: SDL_joystick.c:81
SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT
@ SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT
Definition: SDL_gamecontroller.c:88
SDL_JOYDEVICEADDED
@ SDL_JOYDEVICEADDED
Definition: SDL_events.h:116
SDL_Event
General event structure.
Definition: SDL_events.h:557
SDL_PrivateGameControllerButton
static int SDL_PrivateGameControllerButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button, Uint8 state)
Definition: SDL_gamecontroller.c:1999
SDL_DelHintCallback
#define SDL_DelHintCallback
Definition: SDL_dynapi_overrides.h:193
SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES
#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES
Definition: SDL_hints.h:470
SDL_JOYBUTTONDOWN
@ SDL_JOYBUTTONDOWN
Definition: SDL_events.h:114
SDL_strstr
#define SDL_strstr
Definition: SDL_dynapi_overrides.h:403
SDL_Event::cdevice
SDL_ControllerDeviceEvent cdevice
Definition: SDL_events.h:576
state
struct xkb_state * state
Definition: SDL_waylandsym.h:113
SDL_GameControllerAddMappingsFromFile
#define SDL_GameControllerAddMappingsFromFile(file)
Definition: SDL_gamecontroller.h:129
i
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)
Definition: SDL_x11sym.h:50
SDL_JOYHATMOTION
@ SDL_JOYHATMOTION
Definition: SDL_events.h:113
SDL_LockJoysticks
#define SDL_LockJoysticks
Definition: SDL_dynapi_overrides.h:638
button
SDL_Texture * button
Definition: testgamecontroller.c:67
k_eControllerType_XBoxOneController
@ k_eControllerType_XBoxOneController
Definition: controller_type.h:48
SDL_GetControllerMappingFilePath
static SDL_bool SDL_GetControllerMappingFilePath(char *path, size_t size)
Definition: SDL_gamecontroller.c:1327
SDL_JOYBALLMOTION
@ SDL_JOYBALLMOTION
Definition: SDL_events.h:112
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:161
SDL_DelEventWatch
#define SDL_DelEventWatch
Definition: SDL_dynapi_overrides.h:129
SDL_GameControllerIgnoreDevicesExceptChanged
static void SDL_GameControllerIgnoreDevicesExceptChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
Definition: SDL_gamecontroller.c:188
SDL_CONTROLLER_BUTTON_GUIDE
@ SDL_CONTROLLER_BUTTON_GUIDE
Definition: SDL_gamecontroller.h:324