SDL  2.0
SDL_joystick_c.h File Reference
#include "../SDL_internal.h"
#include "SDL_gamecontroller.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)
 
const char * SDL_GetCustomJoystickManufacturer (const char *manufacturer)
 
const char * SDL_GetCustomJoystickName (Uint16 vendor, Uint16 product)
 
SDL_GameControllerType SDL_GetJoystickGameControllerTypeFromGUID (SDL_JoystickGUID guid, const char *name)
 
SDL_GameControllerType SDL_GetJoystickGameControllerType (const char *name, Uint16 vendor, Uint16 product, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
 
SDL_bool SDL_IsJoystickNintendoSwitchProInputOnly (Uint16 vendor_id, Uint16 product_id)
 
SDL_bool SDL_IsJoystickSteamController (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)
 
SDL_bool SDL_PrivateJoystickValid (SDL_Joystick *joystick)
 

Function Documentation

◆ SDL_GameControllerHandleDelayedGuideButton()

void SDL_GameControllerHandleDelayedGuideButton ( SDL_Joystick *  joystick)

Definition at line 2151 of file SDL_gamecontroller.c.

2152 {
2153  SDL_GameController *controllerlist = SDL_gamecontrollers;
2154  while (controllerlist) {
2155  if (controllerlist->joystick == joystick) {
2157  break;
2158  }
2159  controllerlist = controllerlist->next;
2160  }
2161 }

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 1399 of file SDL_gamecontroller.c.

1400 {
1401  int i;
1402 
1403  /* watch for joy events and fire controller ones if needed */
1405 
1406  /* Send added events for controllers currently attached */
1407  for (i = 0; i < SDL_NumJoysticks(); ++i) {
1408  if (SDL_IsGameController(i)) {
1409  SDL_Event deviceevent;
1410  deviceevent.type = SDL_CONTROLLERDEVICEADDED;
1411  deviceevent.cdevice.which = i;
1412  SDL_PushEvent(&deviceevent);
1413  }
1414  }
1415 
1416  return (0);
1417 }

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 1370 of file SDL_gamecontroller.c.

1371 {
1372  char szControllerMapPath[1024];
1373  int i = 0;
1374  const char *pMappingString = NULL;
1375  pMappingString = s_ControllerMappings[i];
1376  while (pMappingString) {
1378 
1379  i++;
1380  pMappingString = s_ControllerMappings[i];
1381  }
1382 
1383  if (SDL_GetControllerMappingFilePath(szControllerMapPath, sizeof(szControllerMapPath))) {
1384  SDL_GameControllerAddMappingsFromFile(szControllerMapPath);
1385  }
1386 
1387  /* load in any user supplied config */
1389 
1394 
1395  return (0);
1396 }

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 1994 of file SDL_gamecontroller.c.

1995 {
1997  while (SDL_gamecontrollers) {
1998  SDL_gamecontrollers->ref_count = 1;
2000  }
2002 }

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

Referenced by SDL_QuitSubSystem().

◆ SDL_GameControllerQuitMappings()

void SDL_GameControllerQuitMappings ( void  )

Definition at line 2005 of file SDL_gamecontroller.c.

References SDL_vidpid_list::entries, ControllerMapping_t::mapping, ControllerMapping_t::name, ControllerMapping_t::next, 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_GetCustomJoystickManufacturer()

const char* SDL_GetCustomJoystickManufacturer ( const char *  manufacturer)

Definition at line 1373 of file SDL_joystick.c.

1374 {
1375  if (manufacturer) {
1376  if (SDL_strcmp(manufacturer, "Performance Designed Products") == 0) {
1377  return "PDP";
1378  } else if (SDL_strcmp(manufacturer, "HORI CO.,LTD") == 0) {
1379  return "HORI";
1380  }
1381  }
1382  return manufacturer;
1383 }

References SDL_strcmp.

◆ SDL_GetCustomJoystickName()

const char* SDL_GetCustomJoystickName ( Uint16  vendor,
Uint16  product 
)

Definition at line 1386 of file SDL_joystick.c.

1387 {
1388  return GuessControllerName(vendor, product);
1389 }

References GuessControllerName().

◆ SDL_GetDriverAndJoystickIndex()

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

◆ SDL_GetJoystickGameControllerType()

SDL_GameControllerType SDL_GetJoystickGameControllerType ( const char *  name,
Uint16  vendor,
Uint16  product,
int  interface_number,
int  interface_class,
int  interface_subclass,
int  interface_protocol 
)

Definition at line 1409 of file SDL_joystick.c.

1410 {
1411  static const int LIBUSB_CLASS_VENDOR_SPEC = 0xFF;
1412  static const int XB360_IFACE_SUBCLASS = 93;
1413  static const int XB360_IFACE_PROTOCOL = 1; /* Wired */
1414  static const int XB360W_IFACE_PROTOCOL = 129; /* Wireless */
1415  static const int XBONE_IFACE_SUBCLASS = 71;
1416  static const int XBONE_IFACE_PROTOCOL = 208;
1417 
1419 
1420  /* This code should match the checks in libusb/hid.c and HIDDeviceManager.java */
1421  if (interface_class == LIBUSB_CLASS_VENDOR_SPEC &&
1422  interface_subclass == XB360_IFACE_SUBCLASS &&
1423  (interface_protocol == XB360_IFACE_PROTOCOL ||
1424  interface_protocol == XB360W_IFACE_PROTOCOL)) {
1425 
1426  static const int SUPPORTED_VENDORS[] = {
1427  0x0079, /* GPD Win 2 */
1428  0x044f, /* Thrustmaster */
1429  0x045e, /* Microsoft */
1430  0x046d, /* Logitech */
1431  0x056e, /* Elecom */
1432  0x06a3, /* Saitek */
1433  0x0738, /* Mad Catz */
1434  0x07ff, /* Mad Catz */
1435  0x0e6f, /* PDP */
1436  0x0f0d, /* Hori */
1437  0x1038, /* SteelSeries */
1438  0x11c9, /* Nacon */
1439  0x12ab, /* Unknown */
1440  0x1430, /* RedOctane */
1441  0x146b, /* BigBen */
1442  0x1532, /* Razer Sabertooth */
1443  0x15e4, /* Numark */
1444  0x162e, /* Joytech */
1445  0x1689, /* Razer Onza */
1446  0x1bad, /* Harmonix */
1447  0x24c6, /* PowerA */
1448  };
1449 
1450  int i;
1451  for (i = 0; i < SDL_arraysize(SUPPORTED_VENDORS); ++i) {
1452  if (vendor == SUPPORTED_VENDORS[i]) {
1454  break;
1455  }
1456  }
1457  }
1458 
1459  if (interface_number == 0 &&
1460  interface_class == LIBUSB_CLASS_VENDOR_SPEC &&
1461  interface_subclass == XBONE_IFACE_SUBCLASS &&
1462  interface_protocol == XBONE_IFACE_PROTOCOL) {
1463 
1464  static const int SUPPORTED_VENDORS[] = {
1465  0x045e, /* Microsoft */
1466  0x0738, /* Mad Catz */
1467  0x0e6f, /* PDP */
1468  0x0f0d, /* Hori */
1469  0x1532, /* Razer Wildcat */
1470  0x24c6, /* PowerA */
1471  0x2e24, /* Hyperkin */
1472  };
1473 
1474  int i;
1475  for (i = 0; i < SDL_arraysize(SUPPORTED_VENDORS); ++i) {
1476  if (vendor == SUPPORTED_VENDORS[i]) {
1478  break;
1479  }
1480  }
1481  }
1482 
1484  if (vendor == 0x0000 && product == 0x0000) {
1485  /* Some devices are only identifiable by their name */
1486  if (SDL_strcmp(name, "Lic Pro Controller") == 0 ||
1487  SDL_strcmp(name, "Nintendo Wireless Gamepad") == 0 ||
1488  SDL_strcmp(name, "Wireless Gamepad") == 0) {
1489  /* HORI or PowerA Switch Pro Controller clone */
1491  } else {
1493  }
1494 
1495  } else if (vendor == 0x0001 && product == 0x0001) {
1497 
1498  } else {
1499  switch (GuessControllerType(vendor, product)) {
1502  break;
1505  break;
1508  break;
1511  break;
1515  break;
1516  default:
1518  break;
1519  }
1520  }
1521  }
1522  return type;
1523 }

References GuessControllerType(), i, k_eControllerType_PS3Controller, k_eControllerType_PS4Controller, k_eControllerType_SwitchInputOnlyController, k_eControllerType_SwitchProController, k_eControllerType_XBox360Controller, k_eControllerType_XBoxOneController, SDL_arraysize, SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO, SDL_CONTROLLER_TYPE_PS3, SDL_CONTROLLER_TYPE_PS4, SDL_CONTROLLER_TYPE_UNKNOWN, SDL_CONTROLLER_TYPE_XBOX360, SDL_CONTROLLER_TYPE_XBOXONE, and SDL_strcmp.

Referenced by SDL_GetJoystickGameControllerTypeFromGUID(), and SDL_ShouldIgnoreJoystick().

◆ SDL_GetJoystickGameControllerTypeFromGUID()

SDL_GameControllerType SDL_GetJoystickGameControllerTypeFromGUID ( SDL_JoystickGUID  guid,
const char *  name 
)

Definition at line 1392 of file SDL_joystick.c.

1393 {
1395  Uint16 vendor, product;
1396 
1397  SDL_GetJoystickGUIDInfo(guid, &vendor, &product, NULL);
1398  type = SDL_GetJoystickGameControllerType(name, vendor, product, -1, 0, 0, 0);
1400  if (SDL_IsJoystickXInput(guid)) {
1401  /* This is probably an Xbox One controller */
1403  }
1404  }
1405  return type;
1406 }

References NULL, SDL_CONTROLLER_TYPE_UNKNOWN, SDL_CONTROLLER_TYPE_XBOXONE, SDL_GetJoystickGameControllerType(), SDL_GetJoystickGUIDInfo(), and SDL_IsJoystickXInput().

Referenced by SDL_GameControllerGetType(), and SDL_GameControllerTypeForIndex().

◆ SDL_GetJoystickGUIDInfo()

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

Definition at line 1337 of file SDL_joystick.c.

1338 {
1339  Uint16 *guid16 = (Uint16 *)guid.data;
1340 
1341  /* If the GUID fits the form of BUS 0000 VENDOR 0000 PRODUCT 0000, return the data */
1342  if (/* guid16[0] is device bus type */
1343  guid16[1] == 0x0000 &&
1344  /* guid16[2] is vendor ID */
1345  guid16[3] == 0x0000 &&
1346  /* guid16[4] is product ID */
1347  guid16[5] == 0x0000
1348  /* guid16[6] is product version */
1349  ) {
1350  if (vendor) {
1351  *vendor = guid16[2];
1352  }
1353  if (product) {
1354  *product = guid16[4];
1355  }
1356  if (version) {
1357  *version = guid16[6];
1358  }
1359  } else {
1360  if (vendor) {
1361  *vendor = 0;
1362  }
1363  if (product) {
1364  *product = 0;
1365  }
1366  if (version) {
1367  *version = 0;
1368  }
1369  }
1370 }

References SDL_JoystickGUID::data, and if.

Referenced by SDL_GetJoystickGameControllerTypeFromGUID(), 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 250 of file SDL_joystick.c.

251 {
253 }

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 1486 of file SDL_gamecontroller.c.

1487 {
1489  if (pSupportedController) {
1490  return SDL_TRUE;
1491  }
1492  return SDL_FALSE;
1493 }

References SDL_FALSE, SDL_PrivateGetControllerMappingForNameAndGUID(), and SDL_TRUE.

Referenced by SDL_ShouldIgnoreJoystick().

◆ SDL_IsJoystickHIDAPI()

SDL_bool SDL_IsJoystickHIDAPI ( SDL_JoystickGUID  guid)

Definition at line 1547 of file SDL_joystick.c.

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

References SDL_JoystickGUID::data, SDL_FALSE, and SDL_TRUE.

Referenced by SDL_PrivateGetControllerMappingForGUID(), and SDL_PrivateGetControllerMappingForNameAndGUID().

◆ SDL_IsJoystickNintendoSwitchProInputOnly()

SDL_bool SDL_IsJoystickNintendoSwitchProInputOnly ( Uint16  vendor_id,
Uint16  product_id 
)

Definition at line 1526 of file SDL_joystick.c.

1527 {
1528  EControllerType eType = GuessControllerType(vendor, product);
1530 }

References GuessControllerType(), and k_eControllerType_SwitchInputOnlyController.

◆ SDL_IsJoystickSteamController()

SDL_bool SDL_IsJoystickSteamController ( Uint16  vendor_id,
Uint16  product_id 
)

Definition at line 1533 of file SDL_joystick.c.

1534 {
1535  EControllerType eType = GuessControllerType(vendor, product);
1536  return (eType == k_eControllerType_SteamController ||
1538 }

References GuessControllerType(), k_eControllerType_SteamController, and k_eControllerType_SteamControllerV2.

◆ SDL_IsJoystickXInput()

SDL_bool SDL_IsJoystickXInput ( SDL_JoystickGUID  guid)

Definition at line 1541 of file SDL_joystick.c.

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

References SDL_JoystickGUID::data, SDL_FALSE, and SDL_TRUE.

Referenced by SDL_GetJoystickGameControllerTypeFromGUID(), SDL_GetJoystickGUIDType(), and SDL_PrivateGetControllerMappingForGUID().

◆ SDL_JoystickGetDeviceIndexFromInstanceID()

int SDL_JoystickGetDeviceIndexFromInstanceID ( SDL_JoystickID  instance_id)

Definition at line 1899 of file SDL_joystick.c.

1900 {
1901  int i, num_joysticks, device_index = -1;
1902 
1904  num_joysticks = SDL_NumJoysticks();
1905  for (i = 0; i < num_joysticks; ++i) {
1906  if (SDL_JoystickGetDeviceInstanceID(i) == instance_id) {
1907  device_index = i;
1908  break;
1909  }
1910  }
1912 
1913  return device_index;
1914 }

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

Referenced by SDL_PrivateJoystickAdded(), and SDL_SetJoystickIDForPlayerIndex().

◆ SDL_JoystickInit()

int SDL_JoystickInit ( void  )

Definition at line 201 of file SDL_joystick.c.

202 {
203  int i, status;
204 
206 
207  /* Create the joystick list lock */
208  if (!SDL_joystick_lock) {
210  }
211 
212  /* See if we should allow joystick events while in the background */
215 
216 #if !SDL_EVENTS_DISABLED
218  return -1;
219  }
220 #endif /* !SDL_EVENTS_DISABLED */
221 
222  status = -1;
223  for (i = 0; i < SDL_arraysize(SDL_joystick_drivers); ++i) {
224  if (SDL_joystick_drivers[i]->Init() >= 0) {
225  status = 0;
226  }
227  }
228  return status;
229 }

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 858 of file SDL_joystick.c.

859 {
860  int i;
861 
862  /* Make sure we're not getting called in the middle of updating joysticks */
864  while (SDL_updating_joystick) {
866  SDL_Delay(1);
868  }
869 
870  /* Stop the event polling */
871  while (SDL_joysticks) {
872  SDL_joysticks->ref_count = 1;
874  }
875 
876  /* Quit the joystick setup */
877  for (i = 0; i < SDL_arraysize(SDL_joystick_drivers); ++i) {
879  }
880 
881  if (SDL_joystick_players) {
885  }
887 
888 #if !SDL_EVENTS_DISABLED
890 #endif
891 
894 
895  if (SDL_joystick_lock) {
899  }
900 
902 }

References i, mutex, NULL, SDL_JoystickDriver::Quit, SDL_arraysize, SDL_Delay, SDL_DelHintCallback, SDL_DestroyMutex, SDL_free, SDL_GameControllerQuitMappings(), SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, SDL_INIT_EVENTS, SDL_joystick_drivers, SDL_joystick_lock, SDL_joystick_player_count, SDL_joystick_players, 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 921 of file SDL_joystick.c.

922 {
923  SDL_JoystickDriver *driver;
924  int driver_device_index;
925  int player_index = -1;
926  int device_index = SDL_JoystickGetDeviceIndexFromInstanceID(device_instance);
927  if (device_index < 0) {
928  return;
929  }
930 
932  if (SDL_GetDriverAndJoystickIndex(device_index, &driver, &driver_device_index)) {
933  player_index = driver->GetDevicePlayerIndex(driver_device_index);
934  }
935  if (player_index < 0 && SDL_IsGameController(device_index)) {
936  player_index = SDL_FindFreePlayerIndex();
937  }
938  if (player_index >= 0) {
939  SDL_SetJoystickIDForPlayerIndex(player_index, device_instance);
940  }
942 
943 #if !SDL_EVENTS_DISABLED
944  {
946 
947  event.type = SDL_JOYDEVICEADDED;
948 
949  if (SDL_GetEventState(event.type) == SDL_ENABLE) {
950  event.jdevice.which = device_index;
952  }
953  }
954 #endif /* !SDL_EVENTS_DISABLED */
955 }

References SDL_JoystickDriver::GetDevicePlayerIndex, SDL_ENABLE, SDL_FindFreePlayerIndex(), SDL_GetDriverAndJoystickIndex(), SDL_GetEventState, SDL_IsGameController, SDL_JOYDEVICEADDED, SDL_JoystickGetDeviceIndexFromInstanceID(), SDL_LockJoysticks(), SDL_PushEvent, SDL_SetJoystickIDForPlayerIndex(), and SDL_UnlockJoysticks().

Referenced by IOS_AddJoystickDevice().

◆ SDL_PrivateJoystickAxis()

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

Definition at line 1023 of file SDL_joystick.c.

1024 {
1025  int posted;
1026  SDL_JoystickAxisInfo *info;
1027 
1028  /* Make sure we're not getting garbage or duplicate events */
1029  if (axis >= joystick->naxes) {
1030  return 0;
1031  }
1032 
1033  info = &joystick->axes[axis];
1034  if (!info->has_initial_value ||
1035  (!info->has_second_value && (info->initial_value == -32768 || info->initial_value == 32767) && SDL_abs(value) < (SDL_JOYSTICK_AXIS_MAX / 4))) {
1036  info->initial_value = value;
1037  info->value = value;
1038  info->zero = value;
1039  info->has_initial_value = SDL_TRUE;
1040  } else {
1041  info->has_second_value = SDL_TRUE;
1042  }
1043  if (value == info->value) {
1044  return 0;
1045  }
1046  if (!info->sent_initial_value) {
1047  /* Make sure we don't send motion until there's real activity on this axis */
1048  const int MAX_ALLOWED_JITTER = SDL_JOYSTICK_AXIS_MAX / 80; /* ShanWan PS3 controller needed 96 */
1049  if (SDL_abs(value - info->value) <= MAX_ALLOWED_JITTER) {
1050  return 0;
1051  }
1052  info->sent_initial_value = SDL_TRUE;
1053  info->value = value; /* Just so we pass the check above */
1054  SDL_PrivateJoystickAxis(joystick, axis, info->initial_value);
1055  }
1056 
1057  /* We ignore events if we don't have keyboard focus, except for centering
1058  * events.
1059  */
1061  if ((value > info->zero && value >= info->value) ||
1063  return 0;
1064  }
1065  }
1066 
1067  /* Update internal joystick state */
1068  info->value = value;
1069 
1070  /* Post the event, if desired */
1071  posted = 0;
1072 #if !SDL_EVENTS_DISABLED
1074  SDL_Event event;
1075  event.type = SDL_JOYAXISMOTION;
1076  event.jaxis.which = joystick->instance_id;
1077  event.jaxis.axis = axis;
1078  event.jaxis.value = value;
1079  posted = SDL_PushEvent(&event) == 1;
1080  }
1081 #endif /* !SDL_EVENTS_DISABLED */
1082  return posted;
1083 }

References axis, SDL_JoystickAxisInfo::has_initial_value, SDL_JoystickAxisInfo::has_second_value, SDL_JoystickAxisInfo::initial_value, SDL_abs, SDL_ENABLE, SDL_GetEventState, SDL_JOYAXISMOTION, SDL_JOYSTICK_AXIS_MAX, SDL_PrivateJoystickAxis(), SDL_PrivateJoystickShouldIgnoreEvent(), SDL_PushEvent, SDL_TRUE, SDL_JoystickAxisInfo::sent_initial_value, SDL_JoystickAxisInfo::value, SDL_JoystickAxisInfo::zero, and zero.

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 1126 of file SDL_joystick.c.

1128 {
1129  int posted;
1130 
1131  /* Make sure we're not getting garbage events */
1132  if (ball >= joystick->nballs) {
1133  return 0;
1134  }
1135 
1136  /* We ignore events if we don't have keyboard focus. */
1138  return 0;
1139  }
1140 
1141  /* Update internal mouse state */
1142  joystick->balls[ball].dx += xrel;
1143  joystick->balls[ball].dy += yrel;
1144 
1145  /* Post the event, if desired */
1146  posted = 0;
1147 #if !SDL_EVENTS_DISABLED
1149  SDL_Event event;
1150  event.jball.type = SDL_JOYBALLMOTION;
1151  event.jball.which = joystick->instance_id;
1152  event.jball.ball = ball;
1153  event.jball.xrel = xrel;
1154  event.jball.yrel = yrel;
1155  posted = SDL_PushEvent(&event) == 1;
1156  }
1157 #endif /* !SDL_EVENTS_DISABLED */
1158  return posted;
1159 }

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 2035 of file SDL_joystick.c.

2036 {
2037  joystick->epowerlevel = ePowerLevel;
2038 }

◆ SDL_PrivateJoystickButton()

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

Definition at line 1162 of file SDL_joystick.c.

1163 {
1164  int posted;
1165 #if !SDL_EVENTS_DISABLED
1166  SDL_Event event;
1167 
1168  switch (state) {
1169  case SDL_PRESSED:
1170  event.type = SDL_JOYBUTTONDOWN;
1171  break;
1172  case SDL_RELEASED:
1173  event.type = SDL_JOYBUTTONUP;
1174  break;
1175  default:
1176  /* Invalid state -- bail */
1177  return 0;
1178  }
1179 #endif /* !SDL_EVENTS_DISABLED */
1180 
1181  /* Make sure we're not getting garbage or duplicate events */
1182  if (button >= joystick->nbuttons) {
1183  return 0;
1184  }
1185  if (state == joystick->buttons[button]) {
1186  return 0;
1187  }
1188 
1189  /* We ignore events if we don't have keyboard focus, except for button
1190  * release. */
1192  if (state == SDL_PRESSED) {
1193  return 0;
1194  }
1195  }
1196 
1197  /* Update internal joystick state */
1198  joystick->buttons[button] = state;
1199 
1200  /* Post the event, if desired */
1201  posted = 0;
1202 #if !SDL_EVENTS_DISABLED
1203  if (SDL_GetEventState(event.type) == SDL_ENABLE) {
1204  event.jbutton.which = joystick->instance_id;
1205  event.jbutton.button = button;
1206  event.jbutton.state = state;
1207  posted = SDL_PushEvent(&event) == 1;
1208  }
1209 #endif /* !SDL_EVENTS_DISABLED */
1210  return posted;
1211 }

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 1086 of file SDL_joystick.c.

1087 {
1088  int posted;
1089 
1090  /* Make sure we're not getting garbage or duplicate events */
1091  if (hat >= joystick->nhats) {
1092  return 0;
1093  }
1094  if (value == joystick->hats[hat]) {
1095  return 0;
1096  }
1097 
1098  /* We ignore events if we don't have keyboard focus, except for centering
1099  * events.
1100  */
1102  if (value != SDL_HAT_CENTERED) {
1103  return 0;
1104  }
1105  }
1106 
1107  /* Update internal joystick state */
1108  joystick->hats[hat] = value;
1109 
1110  /* Post the event, if desired */
1111  posted = 0;
1112 #if !SDL_EVENTS_DISABLED
1114  SDL_Event event;
1115  event.jhat.type = SDL_JOYHATMOTION;
1116  event.jhat.which = joystick->instance_id;
1117  event.jhat.hat = hat;
1118  event.jhat.value = value;
1119  posted = SDL_PushEvent(&event) == 1;
1120  }
1121 #endif /* !SDL_EVENTS_DISABLED */
1122  return posted;
1123 }

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 987 of file SDL_joystick.c.

988 {
989  SDL_Joystick *joystick;
990  int player_index;
991 
992 #if !SDL_EVENTS_DISABLED
994 
995  event.type = SDL_JOYDEVICEREMOVED;
996 
997  if (SDL_GetEventState(event.type) == SDL_ENABLE) {
998  event.jdevice.which = device_instance;
1000  }
1001 
1003 #endif /* !SDL_EVENTS_DISABLED */
1004 
1005  /* Mark this joystick as no longer attached */
1006  for (joystick = SDL_joysticks; joystick; joystick = joystick->next) {
1007  if (joystick->instance_id == device_instance) {
1008  joystick->attached = SDL_FALSE;
1009  joystick->force_recentering = SDL_TRUE;
1010  break;
1011  }
1012  }
1013 
1015  player_index = SDL_GetPlayerIndexForJoystickID(device_instance);
1016  if (player_index >= 0) {
1017  SDL_joystick_players[player_index] = -1;
1018  }
1020 }

References SDL_ENABLE, SDL_FALSE, SDL_GetEventState, SDL_GetPlayerIndexForJoystickID(), SDL_JOYDEVICEREMOVED, SDL_joystick_players, SDL_joysticks, SDL_LockJoysticks(), SDL_PushEvent, SDL_TRUE, SDL_UnlockJoysticks(), and UpdateEventsForDeviceRemoval().

Referenced by IOS_RemoveJoystickDevice().

◆ SDL_PrivateJoystickValid()

◆ SDL_ShouldIgnoreGameController()

SDL_bool SDL_ShouldIgnoreGameController ( const char *  name,
SDL_JoystickGUID  guid 
)

Definition at line 1511 of file SDL_gamecontroller.c.

1512 {
1513  int i;
1514  Uint16 vendor;
1515  Uint16 product;
1516  Uint16 version;
1517  Uint32 vidpid;
1518 
1519 #if defined(__LINUX__)
1520  if (name && SDL_strstr(name, "Controller Motion Sensors")) {
1521  /* Don't treat the PS3 and PS4 motion controls as a separate game controller */
1522  return SDL_TRUE;
1523  }
1524 #endif
1525 
1528  return SDL_FALSE;
1529  }
1530 
1531  SDL_GetJoystickGUIDInfo(guid, &vendor, &product, &version);
1532 
1533  if (SDL_GetHintBoolean("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD", SDL_FALSE)) {
1534  /* 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 */
1535  SDL_bool bSteamVirtualGamepad = SDL_FALSE;
1536 #if defined(__LINUX__)
1537  bSteamVirtualGamepad = (vendor == 0x28DE && product == 0x11FF);
1538 #elif defined(__MACOSX__)
1539  bSteamVirtualGamepad = (vendor == 0x045E && product == 0x028E && version == 1);
1540 #elif defined(__WIN32__)
1541  /* We can't tell on Windows, but Steam will block others in input hooks */
1542  bSteamVirtualGamepad = SDL_TRUE;
1543 #endif
1544  if (bSteamVirtualGamepad) {
1545  return SDL_FALSE;
1546  }
1547  }
1548 
1549  vidpid = MAKE_VIDPID(vendor, product);
1550 
1552  for (i = 0; i < SDL_allowed_controllers.num_entries; ++i) {
1553  if (vidpid == SDL_allowed_controllers.entries[i]) {
1554  return SDL_FALSE;
1555  }
1556  }
1557  return SDL_TRUE;
1558  } else {
1559  for (i = 0; i < SDL_ignored_controllers.num_entries; ++i) {
1560  if (vidpid == SDL_ignored_controllers.entries[i]) {
1561  return SDL_TRUE;
1562  }
1563  }
1564  return SDL_FALSE;
1565  }
1566 }

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 1698 of file SDL_joystick.c.

1699 {
1700  /* This list is taken from:
1701  https://raw.githubusercontent.com/denilsonsa/udev-joystick-blacklist/master/generate_rules.py
1702  */
1703  static Uint32 joystick_blacklist[] = {
1704  /* Microsoft Microsoft Wireless Optical Desktop® 2.10 */
1705  /* Microsoft Wireless Desktop - Comfort Edition */
1706  MAKE_VIDPID(0x045e, 0x009d),
1707 
1708  /* Microsoft Microsoft® Digital Media Pro Keyboard */
1709  /* Microsoft Corp. Digital Media Pro Keyboard */
1710  MAKE_VIDPID(0x045e, 0x00b0),
1711 
1712  /* Microsoft Microsoft® Digital Media Keyboard */
1713  /* Microsoft Corp. Digital Media Keyboard 1.0A */
1714  MAKE_VIDPID(0x045e, 0x00b4),
1715 
1716  /* Microsoft Microsoft® Digital Media Keyboard 3000 */
1717  MAKE_VIDPID(0x045e, 0x0730),
1718 
1719  /* Microsoft Microsoft® 2.4GHz Transceiver v6.0 */
1720  /* Microsoft Microsoft® 2.4GHz Transceiver v8.0 */
1721  /* Microsoft Corp. Nano Transceiver v1.0 for Bluetooth */
1722  /* Microsoft Wireless Mobile Mouse 1000 */
1723  /* Microsoft Wireless Desktop 3000 */
1724  MAKE_VIDPID(0x045e, 0x0745),
1725 
1726  /* Microsoft® SideWinder(TM) 2.4GHz Transceiver */
1727  MAKE_VIDPID(0x045e, 0x0748),
1728 
1729  /* Microsoft Corp. Wired Keyboard 600 */
1730  MAKE_VIDPID(0x045e, 0x0750),
1731 
1732  /* Microsoft Corp. Sidewinder X4 keyboard */
1733  MAKE_VIDPID(0x045e, 0x0768),
1734 
1735  /* Microsoft Corp. Arc Touch Mouse Transceiver */
1736  MAKE_VIDPID(0x045e, 0x0773),
1737 
1738  /* Microsoft® 2.4GHz Transceiver v9.0 */
1739  /* Microsoft® Nano Transceiver v2.1 */
1740  /* Microsoft Sculpt Ergonomic Keyboard (5KV-00001) */
1741  MAKE_VIDPID(0x045e, 0x07a5),
1742 
1743  /* Microsoft® Nano Transceiver v1.0 */
1744  /* Microsoft Wireless Keyboard 800 */
1745  MAKE_VIDPID(0x045e, 0x07b2),
1746 
1747  /* Microsoft® Nano Transceiver v2.0 */
1748  MAKE_VIDPID(0x045e, 0x0800),
1749 
1750  MAKE_VIDPID(0x046d, 0xc30a), /* Logitech, Inc. iTouch Composite keboard */
1751 
1752  MAKE_VIDPID(0x04d9, 0xa0df), /* Tek Syndicate Mouse (E-Signal USB Gaming Mouse) */
1753 
1754  /* List of Wacom devices at: http://linuxwacom.sourceforge.net/wiki/index.php/Device_IDs */
1755  MAKE_VIDPID(0x056a, 0x0010), /* Wacom ET-0405 Graphire */
1756  MAKE_VIDPID(0x056a, 0x0011), /* Wacom ET-0405A Graphire2 (4x5) */
1757  MAKE_VIDPID(0x056a, 0x0012), /* Wacom ET-0507A Graphire2 (5x7) */
1758  MAKE_VIDPID(0x056a, 0x0013), /* Wacom CTE-430 Graphire3 (4x5) */
1759  MAKE_VIDPID(0x056a, 0x0014), /* Wacom CTE-630 Graphire3 (6x8) */
1760  MAKE_VIDPID(0x056a, 0x0015), /* Wacom CTE-440 Graphire4 (4x5) */
1761  MAKE_VIDPID(0x056a, 0x0016), /* Wacom CTE-640 Graphire4 (6x8) */
1762  MAKE_VIDPID(0x056a, 0x0017), /* Wacom CTE-450 Bamboo Fun (4x5) */
1763  MAKE_VIDPID(0x056a, 0x0018), /* Wacom CTE-650 Bamboo Fun 6x8 */
1764  MAKE_VIDPID(0x056a, 0x0019), /* Wacom CTE-631 Bamboo One */
1765  MAKE_VIDPID(0x056a, 0x00d1), /* Wacom Bamboo Pen and Touch CTH-460 */
1766  MAKE_VIDPID(0x056a, 0x030e), /* Wacom Intuos Pen (S) CTL-480 */
1767 
1768  MAKE_VIDPID(0x09da, 0x054f), /* A4 Tech Co., G7 750 mouse */
1769  MAKE_VIDPID(0x09da, 0x1410), /* A4 Tech Co., Ltd Bloody AL9 mouse */
1770  MAKE_VIDPID(0x09da, 0x3043), /* A4 Tech Co., Ltd Bloody R8A Gaming Mouse */
1771  MAKE_VIDPID(0x09da, 0x31b5), /* A4 Tech Co., Ltd Bloody TL80 Terminator Laser Gaming Mouse */
1772  MAKE_VIDPID(0x09da, 0x3997), /* A4 Tech Co., Ltd Bloody RT7 Terminator Wireless */
1773  MAKE_VIDPID(0x09da, 0x3f8b), /* A4 Tech Co., Ltd Bloody V8 mouse */
1774  MAKE_VIDPID(0x09da, 0x51f4), /* Modecom MC-5006 Keyboard */
1775  MAKE_VIDPID(0x09da, 0x5589), /* A4 Tech Co., Ltd Terminator TL9 Laser Gaming Mouse */
1776  MAKE_VIDPID(0x09da, 0x7b22), /* A4 Tech Co., Ltd Bloody V5 */
1777  MAKE_VIDPID(0x09da, 0x7f2d), /* A4 Tech Co., Ltd Bloody R3 mouse */
1778  MAKE_VIDPID(0x09da, 0x8090), /* A4 Tech Co., Ltd X-718BK Oscar Optical Gaming Mouse */
1779  MAKE_VIDPID(0x09da, 0x9033), /* A4 Tech Co., X7 X-705K */
1780  MAKE_VIDPID(0x09da, 0x9066), /* A4 Tech Co., Sharkoon Fireglider Optical */
1781  MAKE_VIDPID(0x09da, 0x9090), /* A4 Tech Co., Ltd XL-730K / XL-750BK / XL-755BK Laser Mouse */
1782  MAKE_VIDPID(0x09da, 0x90c0), /* A4 Tech Co., Ltd X7 G800V keyboard */
1783  MAKE_VIDPID(0x09da, 0xf012), /* A4 Tech Co., Ltd Bloody V7 mouse */
1784  MAKE_VIDPID(0x09da, 0xf32a), /* A4 Tech Co., Ltd Bloody B540 keyboard */
1785  MAKE_VIDPID(0x09da, 0xf613), /* A4 Tech Co., Ltd Bloody V2 mouse */
1786  MAKE_VIDPID(0x09da, 0xf624), /* A4 Tech Co., Ltd Bloody B120 Keyboard */
1787 
1788  MAKE_VIDPID(0x1b1c, 0x1b3c), /* Corsair Harpoon RGB gaming mouse */
1789 
1790  MAKE_VIDPID(0x1d57, 0xad03), /* [T3] 2.4GHz and IR Air Mouse Remote Control */
1791 
1792  MAKE_VIDPID(0x1e7d, 0x2e4a), /* Roccat Tyon Mouse */
1793 
1794  MAKE_VIDPID(0x20a0, 0x422d), /* Winkeyless.kr Keyboards */
1795 
1796  MAKE_VIDPID(0x2516, 0x001f), /* Cooler Master Storm Mizar Mouse */
1797  MAKE_VIDPID(0x2516, 0x0028), /* Cooler Master Storm Alcor Mouse */
1798  };
1799 
1800  unsigned int i;
1801  Uint32 id;
1802  Uint16 vendor;
1803  Uint16 product;
1804 
1805  SDL_GetJoystickGUIDInfo(guid, &vendor, &product, NULL);
1806 
1807  /* Check the joystick blacklist */
1808  id = MAKE_VIDPID(vendor, product);
1809  for (i = 0; i < SDL_arraysize(joystick_blacklist); ++i) {
1810  if (id == joystick_blacklist[i]) {
1811  return SDL_TRUE;
1812  }
1813  }
1814 
1815  if (SDL_GetJoystickGameControllerType(name, vendor, product, -1, 0, 0, 0) == SDL_CONTROLLER_TYPE_PS4 && SDL_IsPS4RemapperRunning()) {
1816  return SDL_TRUE;
1817  }
1818 
1821  return SDL_TRUE;
1822  }
1823 
1824  return SDL_FALSE;
1825 }

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

SDL_zero
#define SDL_zero(x)
Definition: SDL_stdinc.h:418
SDL_Event::type
Uint32 type
Definition: SDL_events.h:560
k_eControllerType_SteamController
@ k_eControllerType_SteamController
Definition: controller_type.h:38
k_eControllerType_SwitchInputOnlyController
@ k_eControllerType_SwitchInputOnlyController
Definition: controller_type.h:54
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:569
SDL_IsGameController
SDL_bool SDL_IsGameController(int device_index)
Definition: SDL_gamecontroller.c:1499
SDL_GameControllerEventWatcher
static int SDL_GameControllerEventWatcher(void *userdata, SDL_Event *event)
Definition: SDL_gamecontroller.c:349
GuessControllerType
static SDL_INLINE EControllerType GuessControllerType(int nVID, int nPID)
Definition: controller_type.h:567
Uint16
uint16_t Uint16
Definition: SDL_stdinc.h:191
SDL_IsGameController
#define SDL_IsGameController
Definition: SDL_dynapi_overrides.h:138
SDL_gamecontrollers
static SDL_GameController * SDL_gamecontrollers
Definition: SDL_gamecontroller.c:50
SDL_abs
#define SDL_abs
Definition: SDL_dynapi_overrides.h:381
SDL_UnlockJoysticks
#define SDL_UnlockJoysticks
Definition: SDL_dynapi_overrides.h:639
if
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro pixld1_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl else error unsupported endif endm macro pixld2_s mem_operand if mov asr add asl add asl mov asr sub UNIT_X add asl mov asr add asl add asl mov asr add UNIT_X add asl else pixld1_s mem_operand pixld1_s mem_operand endif endm macro pixld0_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl endif endm macro pixld_s_internal mem_operand if mem_operand pixld2_s mem_operand pixdeinterleave basereg elseif mem_operand elseif mem_operand elseif mem_operand elseif mem_operand pixld0_s mem_operand else pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else error unsupported mem_operand if bpp mem_operand endif endm macro vuzp8 reg2 vuzp d d &reg2 endm macro vzip8 reg2 vzip d d &reg2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld if[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro fetch_mask_pixblock pixld mask_basereg pixblock_size MASK endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1(dst_w_bpp<=(lowbit *8)) &&((lowbit *8)<(pixblock_size *dst_w_bpp)) .if lowbit< 16 tst DST_R
Definition: pixman-arm-neon-asm.h:469
SDL_HAT_CENTERED
#define SDL_HAT_CENTERED
Definition: SDL_joystick.h:339
NULL
#define NULL
Definition: begin_code.h:167
k_eControllerType_SwitchProController
@ k_eControllerType_SwitchProController
Definition: controller_type.h:50
SDL_JoystickGetDeviceIndexFromInstanceID
int SDL_JoystickGetDeviceIndexFromInstanceID(SDL_JoystickID instance_id)
Definition: SDL_joystick.c:1899
SDL_IsPS4RemapperRunning
static SDL_bool SDL_IsPS4RemapperRunning(void)
Definition: SDL_joystick.c:1665
SDL_INIT_EVENTS
#define SDL_INIT_EVENTS
Definition: SDL.h:84
SDL_mutex
Definition: SDL_sysmutex.c:30
SDL_CONTROLLER_TYPE_UNKNOWN
@ SDL_CONTROLLER_TYPE_UNKNOWN
Definition: SDL_gamecontroller.h:62
mutex
static SDL_mutex * mutex
Definition: testlock.c:23
SDL_GameControllerIgnoreDevicesChanged
static void SDL_GameControllerIgnoreDevicesChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
Definition: SDL_gamecontroller.c:184
SDL_NumJoysticks
#define SDL_NumJoysticks
Definition: SDL_dynapi_overrides.h:195
SDL_SetJoystickIDForPlayerIndex
static SDL_bool SDL_SetJoystickIDForPlayerIndex(int player_index, SDL_JoystickID instance_id)
Definition: SDL_joystick.c:144
ControllerMapping_t
Definition: SDL_gamecontroller.c:96
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:131
SDL_ControllerDeviceEvent::which
Sint32 which
Definition: SDL_events.h:413
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:203
SDL_ENABLE
#define SDL_ENABLE
Definition: SDL_events.h:760
SDL_NumJoysticks
int SDL_NumJoysticks(void)
Definition: SDL_joystick.c:235
SDL_UnlockJoysticks
void SDL_UnlockJoysticks(void)
Definition: SDL_joystick.c:98
SDL_JoystickGUID::data
Uint8 data[16]
Definition: SDL_joystick.h:71
SDL_JOYDEVICEREMOVED
@ SDL_JOYDEVICEREMOVED
Definition: SDL_events.h:117
SDL_GetJoystickGameControllerType
SDL_GameControllerType SDL_GetJoystickGameControllerType(const char *name, Uint16 vendor, Uint16 product, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
Definition: SDL_joystick.c:1409
SDL_RELEASED
#define SDL_RELEASED
Definition: SDL_events.h:49
ControllerMapping_t::next
struct _ControllerMapping_t * next
Definition: SDL_gamecontroller.c:101
SDL_JoystickGetDeviceInstanceID
SDL_JoystickID SDL_JoystickGetDeviceInstanceID(int device_index)
Definition: SDL_joystick.c:1885
SDL_InitSubSystem
#define SDL_InitSubSystem
Definition: SDL_dynapi_overrides.h:55
s_pSupportedControllers
static ControllerMapping_t * s_pSupportedControllers
Definition: SDL_gamecontroller.c:105
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:1511
SDL_JoystickAxisInfo::has_initial_value
SDL_bool has_initial_value
Definition: SDL_sysjoystick.h:37
SDL_PrivateJoystickAxis
int SDL_PrivateJoystickAxis(SDL_Joystick *joystick, Uint8 axis, Sint16 value)
Definition: SDL_joystick.c:1023
SDL_vidpid_list::num_entries
int num_entries
Definition: SDL_gamecontroller.c:129
k_eControllerType_PS4Controller
@ k_eControllerType_PS4Controller
Definition: controller_type.h:46
SDL_CONTROLLER_TYPE_PS3
@ SDL_CONTROLLER_TYPE_PS3
Definition: SDL_gamecontroller.h:65
GuessControllerName
static SDL_INLINE const char * GuessControllerName(int nVID, int nPID)
Definition: controller_type.h:635
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:2652
SDL_CONTROLLER_TYPE_PS4
@ SDL_CONTROLLER_TYPE_PS4
Definition: SDL_gamecontroller.h:66
SDL_IsJoystickXInput
SDL_bool SDL_IsJoystickXInput(SDL_JoystickGUID guid)
Definition: SDL_joystick.c:1541
SDL_GetEventState
#define SDL_GetEventState(type)
Definition: SDL_events.h:773
k_eControllerType_XBox360Controller
@ k_eControllerType_XBox360Controller
Definition: controller_type.h:43
SDL_GetJoystickGUIDInfo
void SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint16 *vendor, Uint16 *product, Uint16 *version)
Definition: SDL_joystick.c:1337
SDL_free
#define SDL_free
Definition: SDL_dynapi_overrides.h:377
SDL_updating_joystick
static SDL_bool SDL_updating_joystick
Definition: SDL_joystick.c:83
UpdateEventsForDeviceRemoval
static void UpdateEventsForDeviceRemoval()
Definition: SDL_joystick.c:962
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:533
SDL_ignored_controllers
static SDL_vidpid_list SDL_ignored_controllers
Definition: SDL_gamecontroller.c:135
ControllerMapping_t::name
char * name
Definition: SDL_gamecontroller.c:98
SDL_PrivateJoystickShouldIgnoreEvent
static SDL_bool SDL_PrivateJoystickShouldIgnoreEvent()
Definition: SDL_joystick.c:906
SDL_JoystickDriver::Quit
void(* Quit)(void)
Definition: SDL_sysjoystick.h:138
name
GLuint const GLchar * name
Definition: SDL_opengl_glext.h:663
SDL_JoystickAxisInfo
Definition: SDL_sysjoystick.h:33
s_ControllerMappings
static const char * s_ControllerMappings[]
Definition: SDL_gamecontrollerdb.h:32
SDL_GameControllerInitMappings
int SDL_GameControllerInitMappings(void)
Definition: SDL_gamecontroller.c:1370
k_eControllerType_SteamControllerV2
@ k_eControllerType_SteamControllerV2
Definition: controller_type.h:39
SDL_JoystickAxisInfo::value
Sint16 value
Definition: SDL_sysjoystick.h:35
SDL_GetDriverAndJoystickIndex
SDL_bool SDL_GetDriverAndJoystickIndex(int device_index, SDL_JoystickDriver **driver, int *driver_index)
Definition: SDL_joystick.c:260
MAKE_VIDPID
#define MAKE_VIDPID(VID, PID)
Definition: SDL_sysjoystick.h:86
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:85
SDL_JoystickAllowBackgroundEventsChanged
static void SDL_JoystickAllowBackgroundEventsChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
Definition: SDL_joystick.c:191
SDL_GameControllerLoadHints
static void SDL_GameControllerLoadHints()
Definition: SDL_gamecontroller.c:1319
SDL_TRUE
@ SDL_TRUE
Definition: SDL_stdinc.h:164
SDL_Delay
#define SDL_Delay
Definition: SDL_dynapi_overrides.h:486
SDL_joystick_lock
static SDL_mutex * SDL_joystick_lock
Definition: SDL_joystick.c:84
SDL_JOYSTICK_AXIS_MAX
#define SDL_JOYSTICK_AXIS_MAX
Definition: SDL_joystick.h:311
SDL_joystick_player_count
static int SDL_joystick_player_count
Definition: SDL_joystick.c:86
SDL_LockJoysticks
void SDL_LockJoysticks(void)
Definition: SDL_joystick.c:90
SDL_joystick_drivers
static SDL_JoystickDriver * SDL_joystick_drivers[]
Definition: SDL_joystick.c:49
axis
SDL_Texture * axis
Definition: testgamecontroller.c:67
SDL_JoystickDriver
Definition: SDL_sysjoystick.h:89
id
GLuint id
Definition: SDL_opengl_glext.h:531
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:1153
SDL_GameControllerQuitMappings
void SDL_GameControllerQuitMappings(void)
Definition: SDL_gamecontroller.c:2005
SDL_JoystickAxisInfo::initial_value
Sint16 initial_value
Definition: SDL_sysjoystick.h:34
SDL_AddHintCallback
#define SDL_AddHintCallback
Definition: SDL_dynapi_overrides.h:192
ControllerMapping_t::mapping
char * mapping
Definition: SDL_gamecontroller.c:99
SDL_JoystickClose
void SDL_JoystickClose(SDL_Joystick *joystick)
Definition: SDL_joystick.c:800
SDL_allowed_controllers
static SDL_vidpid_list SDL_allowed_controllers
Definition: SDL_gamecontroller.c:134
value
GLsizei const GLfloat * value
Definition: SDL_opengl_glext.h:701
SDL_PrivateGetControllerMappingForNameAndGUID
static ControllerMapping_t * SDL_PrivateGetControllerMappingForNameAndGUID(const char *name, SDL_JoystickGUID guid)
Definition: SDL_gamecontroller.c:1024
SDL_SetError
#define SDL_SetError
Definition: SDL_dynapi_overrides.h:30
SDL_GameControllerClose
void SDL_GameControllerClose(SDL_GameController *gamecontroller)
Definition: SDL_gamecontroller.c:1948
SDL_GameControllerType
SDL_GameControllerType
Definition: SDL_gamecontroller.h:61
k_eControllerType_PS3Controller
@ k_eControllerType_PS3Controller
Definition: controller_type.h:45
SDL_JoystickAxisInfo::sent_initial_value
SDL_bool sent_initial_value
Definition: SDL_sysjoystick.h:39
SDL_JoystickAxisInfo::zero
Sint16 zero
Definition: SDL_sysjoystick.h:36
SDL_IsGameControllerNameAndGUID
SDL_bool SDL_IsGameControllerNameAndGUID(const char *name, SDL_JoystickGUID guid)
Definition: SDL_gamecontroller.c:1486
SDL_JOYBUTTONUP
@ SDL_JOYBUTTONUP
Definition: SDL_events.h:115
SDL_DestroyMutex
#define SDL_DestroyMutex
Definition: SDL_dynapi_overrides.h:263
zero
static const double zero
Definition: e_atan2.c:44
EControllerType
EControllerType
Definition: controller_type.h:32
SDL_AddEventWatch
#define SDL_AddEventWatch
Definition: SDL_dynapi_overrides.h:128
SDL_joystick_players
static SDL_JoystickID * SDL_joystick_players
Definition: SDL_joystick.c:87
SDL_joysticks
static SDL_Joystick * SDL_joysticks
Definition: SDL_joystick.c:82
SDL_GetPlayerIndexForJoystickID
static int SDL_GetPlayerIndexForJoystickID(SDL_JoystickID instance_id)
Definition: SDL_joystick.c:119
SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT
@ SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT
Definition: SDL_gamecontroller.c:90
SDL_JOYDEVICEADDED
@ SDL_JOYDEVICEADDED
Definition: SDL_events.h:116
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:162
SDL_CONTROLLER_TYPE_XBOX360
@ SDL_CONTROLLER_TYPE_XBOX360
Definition: SDL_gamecontroller.h:63
SDL_JoystickAxisInfo::has_second_value
SDL_bool has_second_value
Definition: SDL_sysjoystick.h:38
SDL_Event
General event structure.
Definition: SDL_events.h:559
SDL_PrivateGameControllerButton
static int SDL_PrivateGameControllerButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button, Uint8 state)
Definition: SDL_gamecontroller.c:2062
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:520
SDL_FALSE
@ SDL_FALSE
Definition: SDL_stdinc.h:163
SDL_JOYBUTTONDOWN
@ SDL_JOYBUTTONDOWN
Definition: SDL_events.h:114
SDL_strcmp
#define SDL_strcmp
Definition: SDL_dynapi_overrides.h:417
SDL_strstr
#define SDL_strstr
Definition: SDL_dynapi_overrides.h:403
SDL_JoystickDriver::GetDevicePlayerIndex
int(* GetDevicePlayerIndex)(int device_index)
Definition: SDL_sysjoystick.h:106
SDL_Event::cdevice
SDL_ControllerDeviceEvent cdevice
Definition: SDL_events.h:577
SDL_CONTROLLER_TYPE_XBOXONE
@ SDL_CONTROLLER_TYPE_XBOXONE
Definition: SDL_gamecontroller.h:64
type
GLuint GLuint GLsizei GLenum type
Definition: SDL_opengl.h:1571
state
struct xkb_state * state
Definition: SDL_waylandsym.h:114
SDL_GameControllerAddMappingsFromFile
#define SDL_GameControllerAddMappingsFromFile(file)
Definition: SDL_gamecontroller.h:138
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:44
SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO
@ SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO
Definition: SDL_gamecontroller.h:67
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_FindFreePlayerIndex
static int SDL_FindFreePlayerIndex()
Definition: SDL_joystick.c:106
SDL_GetControllerMappingFilePath
static SDL_bool SDL_GetControllerMappingFilePath(char *path, size_t size)
Definition: SDL_gamecontroller.c:1352
SDL_JOYBALLMOTION
@ SDL_JOYBALLMOTION
Definition: SDL_events.h:112
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:190
SDL_CONTROLLER_BUTTON_GUIDE
@ SDL_CONTROLLER_BUTTON_GUIDE
Definition: SDL_gamecontroller.h:354