21 #include "../SDL_internal.h"
31 #if !SDL_EVENTS_DISABLED
32 #include "../events/SDL_events_c.h"
34 #include "../video/SDL_sysvideo.h"
42 #include "../core/windows/SDL_windows.h"
48 #if SDL_JOYSTICK_VIRTUAL
53 #ifdef SDL_JOYSTICK_HIDAPI
56 #ifdef SDL_JOYSTICK_RAWINPUT
59 #if defined(SDL_JOYSTICK_WGI)
62 #if defined(SDL_JOYSTICK_DINPUT) || defined(SDL_JOYSTICK_XINPUT)
65 #ifdef SDL_JOYSTICK_LINUX
68 #ifdef SDL_JOYSTICK_IOKIT
71 #if (defined(__MACOSX__) || defined(__IPHONEOS__) || defined(__TVOS__)) && !defined(SDL_JOYSTICK_DISABLED)
74 #ifdef SDL_JOYSTICK_ANDROID
77 #ifdef SDL_JOYSTICK_EMSCRIPTEN
80 #ifdef SDL_JOYSTICK_HAIKU
83 #ifdef SDL_JOYSTICK_USBHID
86 #ifdef SDL_JOYSTICK_VIRTUAL
89 #if defined(SDL_JOYSTICK_DUMMY) || defined(SDL_JOYSTICK_DISABLED)
161 int existing_player_index;
163 if (player_index < 0) {
183 if (existing_player_index >= 0) {
196 if (existing_instance >= 0) {
205 if (hint && *hint ==
'1') {
228 #if !SDL_EVENTS_DISABLED
249 int i, total_joysticks = 0;
255 return total_joysticks;
274 int i, num_joysticks, total_joysticks = 0;
276 if (device_index >= 0) {
279 if (device_index < num_joysticks) {
281 *driver_index = device_index;
284 device_index -= num_joysticks;
285 total_joysticks += num_joysticks;
289 SDL_SetError(
"There are %d joysticks available", total_joysticks);
335 static Uint32 zero_centered_joysticks[] = {
352 if (
id == zero_centered_joysticks[
i]) {
372 SDL_Joystick *joysticklist;
373 const char *joystickname =
NULL;
387 while (joysticklist) {
388 if (instance_id == joysticklist->instance_id) {
394 joysticklist = joysticklist->next;
405 joystick->instance_id = instance_id;
472 int naxes,
int nbuttons,
int nhats)
474 #if SDL_JOYSTICK_VIRTUAL
475 return SDL_JoystickAttachVirtualInner(
type, naxes, nbuttons, nhats);
477 return SDL_SetError(
"SDL not built with virtual-joystick support");
484 #if SDL_JOYSTICK_VIRTUAL
490 const int result = SDL_JoystickDetachVirtualInner(device_index);
497 return SDL_SetError(
"Virtual joystick not found at provided index");
499 return SDL_SetError(
"SDL not built with virtual-joystick support");
506 #if SDL_JOYSTICK_VIRTUAL
508 int driver_device_index;
528 #if SDL_JOYSTICK_VIRTUAL
531 return SDL_SetError(
"SDL not built with virtual-joystick support");
538 #if SDL_JOYSTICK_VIRTUAL
541 return SDL_SetError(
"SDL not built with virtual-joystick support");
548 #if SDL_JOYSTICK_VIRTUAL
551 return SDL_SetError(
"SDL not built with virtual-joystick support");
647 if (axis < joystick->naxes) {
686 if (hat < joystick->nhats) {
708 if (ball < joystick->nballs) {
734 if (button < joystick->nbuttons) {
780 if (
joystick->instance_id == instance_id) {
800 if (
joystick->instance_id == instance_id) {
865 if (low_frequency_rumble ==
joystick->low_frequency_rumble &&
866 high_frequency_rumble ==
joystick->high_frequency_rumble) {
874 joystick->low_frequency_rumble = low_frequency_rumble;
875 joystick->high_frequency_rumble = high_frequency_rumble;
877 if ((low_frequency_rumble || high_frequency_rumble) && duration_ms) {
900 if (left_rumble ==
joystick->left_trigger_rumble && right_rumble ==
joystick->right_trigger_rumble) {
908 joystick->left_trigger_rumble = left_rumble;
909 joystick->right_trigger_rumble = right_rumble;
911 if ((left_rumble || right_rumble) && duration_ms) {
913 if (!
joystick->trigger_rumble_expiration) {
914 joystick->trigger_rumble_expiration = 1;
917 joystick->trigger_rumble_expiration = 0;
978 SDL_Joystick *joysticklist;
979 SDL_Joystick *joysticklistprev;
1002 if (
joystick->trigger_rumble_expiration) {
1010 joysticklistprev =
NULL;
1011 while (joysticklist) {
1013 if (joysticklistprev) {
1015 joysticklistprev->next = joysticklist->next;
1021 joysticklistprev = joysticklist;
1022 joysticklist = joysticklist->next;
1075 #if !SDL_EVENTS_DISABLED
1110 int ntouchpads =
joystick->ntouchpads + 1;
1132 int nsensors =
joystick->nsensors + 1;
1148 int driver_device_index;
1149 int player_index = -1;
1151 if (device_index < 0) {
1162 if (player_index >= 0) {
1167 #if !SDL_EVENTS_DISABLED
1174 event.jdevice.which = device_index;
1193 if (num_events <= 0) {
1203 for (
i = 0;
i < num_events; ++
i) {
1204 if (
events[
i].cdevice.which < device_index) {
1207 else if (
events[
i].cdevice.which == device_index) {
1230 if (
joystick->axes[
i].has_initial_value) {
1258 #if !SDL_EVENTS_DISABLED
1265 if (
joystick->instance_id == device_instance) {
1274 #if !SDL_EVENTS_DISABLED
1279 event.jdevice.which = device_instance;
1288 if (player_index >= 0) {
1343 #if !SDL_EVENTS_DISABLED
1347 event.jaxis.which =
joystick->instance_id;
1348 event.jaxis.axis =
axis;
1349 event.jaxis.value =
value;
1383 #if !SDL_EVENTS_DISABLED
1387 event.jhat.which =
joystick->instance_id;
1388 event.jhat.hat = hat;
1389 event.jhat.value =
value;
1418 #if !SDL_EVENTS_DISABLED
1422 event.jball.which =
joystick->instance_id;
1423 event.jball.ball = ball;
1424 event.jball.xrel = xrel;
1425 event.jball.yrel = yrel;
1436 #if !SDL_EVENTS_DISABLED
1473 #if !SDL_EVENTS_DISABLED
1475 event.jbutton.which =
joystick->instance_id;
1476 event.jbutton.button =
button;
1477 event.jbutton.state =
state;
1507 #ifdef SDL_JOYSTICK_HIDAPI
1519 if (
joystick->delayed_guide_button) {
1534 if (
joystick->trigger_rumble_expiration) {
1537 if (
joystick->trigger_rumble_expiration &&
1570 #if SDL_EVENTS_DISABLED
1573 const Uint32 event_list[] = {
1605 guid16[1] == 0x0000 &&
1607 guid16[3] == 0x0000 &&
1613 *vendor = guid16[2];
1616 *product = guid16[4];
1619 *version = guid16[6];
1653 const char *replacement;
1654 } replacements[] = {
1655 {
"NVIDIA Corporation ",
"" },
1656 {
"Performance Designed Products",
"PDP" },
1657 {
"HORI CO.,LTD.",
"HORI" },
1658 {
"HORI CO.,LTD",
"HORI" },
1660 const char *custom_name;
1672 if (!product_name) {
1676 while (*vendor_name ==
' ') {
1679 while (*product_name ==
' ') {
1683 if (*vendor_name && *product_name) {
1690 }
else if (*product_name) {
1692 }
else if (vendor || product) {
1693 len = (6 + 1 + 6 + 1);
1710 for (
i = 0;
i < (
len - 1); ) {
1720 for (
i = 1;
i < (
len - 1); ++
i) {
1722 if (matchlen > 0 &&
name[matchlen-1] ==
' ') {
1726 }
else if (matchlen > 0 &&
name[matchlen] ==
' ') {
1728 len -= (matchlen + 1);
1735 size_t prefixlen =
SDL_strlen(replacements[
i].prefix);
1737 size_t replacementlen =
SDL_strlen(replacements[
i].replacement);
1773 static const int LIBUSB_CLASS_VENDOR_SPEC = 0xFF;
1774 static const int XB360_IFACE_SUBCLASS = 93;
1775 static const int XB360_IFACE_PROTOCOL = 1;
1776 static const int XB360W_IFACE_PROTOCOL = 129;
1777 static const int XBONE_IFACE_SUBCLASS = 71;
1778 static const int XBONE_IFACE_PROTOCOL = 208;
1783 if (interface_class == LIBUSB_CLASS_VENDOR_SPEC &&
1784 interface_subclass == XB360_IFACE_SUBCLASS &&
1785 (interface_protocol == XB360_IFACE_PROTOCOL ||
1786 interface_protocol == XB360W_IFACE_PROTOCOL)) {
1788 static const int SUPPORTED_VENDORS[] = {
1814 if (vendor == SUPPORTED_VENDORS[
i]) {
1821 if (interface_number == 0 &&
1822 interface_class == LIBUSB_CLASS_VENDOR_SPEC &&
1823 interface_subclass == XBONE_IFACE_SUBCLASS &&
1824 interface_protocol == XBONE_IFACE_PROTOCOL) {
1826 static const int SUPPORTED_VENDORS[] = {
1838 if (vendor == SUPPORTED_VENDORS[
i]) {
1846 if (vendor == 0x0000 && product == 0x0000) {
1860 }
else if (vendor == 0x0001 && product == 0x0001) {
1987 static Uint32 wheel_joysticks[] = {
2006 if (vidpid == wheel_joysticks[
i]) {
2015 static Uint32 flightstick_joysticks[] = {
2022 if (vidpid == flightstick_joysticks[
i]) {
2031 static Uint32 throttle_joysticks[] = {
2038 if (vidpid == throttle_joysticks[
i]) {
2053 switch (guid.
data[15]) {
2110 const char *mapper_processes[] = {
2115 PROCESSENTRY32 pe32;
2119 HANDLE hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
2120 if (hProcessSnap != INVALID_HANDLE_VALUE) {
2121 pe32.dwSize =
sizeof(PROCESSENTRY32);
2122 if (Process32First(hProcessSnap, &pe32)) {
2130 }
while (Process32Next(hProcessSnap, &pe32) && !found);
2132 CloseHandle(hProcessSnap);
2145 static Uint32 joystick_blacklist[] = {
2253 if (
id == joystick_blacklist[
i]) {
2345 int i, num_joysticks, device_index = -1;
2349 for (
i = 0;
i < num_joysticks; ++
i) {
2357 return device_index;
2422 static const char k_rgchHexToASCII[] =
"0123456789abcdef";
2425 if ((pszGUID ==
NULL) || (cbGUID <= 0)) {
2429 for (
i = 0;
i <
sizeof(guid.
data) &&
i < (cbGUID-1)/2;
i++) {
2432 unsigned char c = guid.
data[
i];
2434 *pszGUID++ = k_rgchHexToASCII[
c >> 4];
2435 *pszGUID++ = k_rgchHexToASCII[
c & 0x0F];
2447 if ((
c >=
'0') && (
c <=
'9')) {
2448 return (
unsigned char)(
c -
'0');
2451 if ((
c >=
'A') && (
c <=
'F')) {
2452 return (
unsigned char)(
c -
'A' + 0x0a);
2455 if ((
c >=
'a') && (
c <=
'f')) {
2456 return (
unsigned char)(
c -
'a' + 0x0a);
2468 int maxoutputbytes=
sizeof(guid);
2479 for (
i = 0; (
i <
len) && ((
p - (
Uint8 *)&guid) < maxoutputbytes);
i+=2,
p++) {
2489 joystick->epowerlevel = ePowerLevel;
2506 #if !SDL_EVENTS_DISABLED
2510 if (touchpad < 0 || touchpad >=
joystick->ntouchpads) {
2514 touchpad_info = &
joystick->touchpads[touchpad];
2515 if (finger < 0 || finger >= touchpad_info->
nfingers) {
2519 finger_info = &touchpad_info->
fingers[finger];
2522 if (
x == 0.0f &&
y == 0.0f) {
2531 }
else if (
x > 1.0f) {
2536 }
else if (
y > 1.0f) {
2539 if (pressure < 0.0f) {
2541 }
else if (pressure > 1.0f) {
2547 (
x == finger_info->
x &&
y == finger_info->
y && pressure == finger_info->
pressure)) {
2552 #if !SDL_EVENTS_DISABLED
2570 #if !SDL_EVENTS_DISABLED
2573 event.type = event_type;
2574 event.ctouchpad.which =
joystick->instance_id;
2575 event.ctouchpad.touchpad = touchpad;
2576 event.ctouchpad.finger = finger;
2577 event.ctouchpad.x =
x;
2578 event.ctouchpad.y =
y;
2579 event.ctouchpad.pressure = pressure;
2603 #if !SDL_EVENTS_DISABLED
2607 event.csensor.which =
joystick->instance_id;
2608 event.csensor.sensor =
type;
#define SDL_INIT_JOYSTICK
#define SDL_AtomicIncRef(a)
Increment an atomic variable used as a reference count.
#define SDL_InitSubSystem
#define SDL_DelHintCallback
#define SDL_GetKeyboardFocus
#define SDL_AddHintCallback
#define SDL_QuitSubSystem
#define SDL_IsGameController
#define SDL_OutOfMemory()
@ SDL_CONTROLLERTOUCHPADDOWN
@ SDL_CONTROLLERTOUCHPADMOTION
@ SDL_CONTROLLERTOUCHPADUP
@ SDL_CONTROLLERSENSORUPDATE
#define SDL_GetEventState(type)
void SDL_GameControllerHandleDelayedGuideButton(SDL_Joystick *joystick)
void SDL_GameControllerQuitMappings(void)
SDL_bool SDL_IsGameControllerNameAndGUID(const char *name, SDL_JoystickGUID guid)
SDL_bool SDL_ShouldIgnoreGameController(const char *name, SDL_JoystickGUID guid)
int SDL_GameControllerInitMappings(void)
@ SDL_CONTROLLER_TYPE_VIRTUAL
@ SDL_CONTROLLER_TYPE_XBOX360
@ SDL_CONTROLLER_TYPE_PS4
@ SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO
@ SDL_CONTROLLER_TYPE_PS3
@ SDL_CONTROLLER_TYPE_PS5
@ SDL_CONTROLLER_TYPE_XBOXONE
@ SDL_CONTROLLER_TYPE_UNKNOWN
void HIDAPI_UpdateDevices(void)
#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...
#define SDL_small_alloc(type, count, pisstack)
#define SDL_small_free(ptr, isstack)
SDL_bool SDL_JoystickGetAxisInitialState(SDL_Joystick *joystick, int axis, Sint16 *state)
static void UpdateEventsForDeviceRemoval(int device_index)
SDL_JoystickID SDL_JoystickGetDeviceInstanceID(int device_index)
Uint16 SDL_JoystickGetProductVersion(SDL_Joystick *joystick)
int SDL_PrivateJoystickTouchpad(SDL_Joystick *joystick, int touchpad, int finger, Uint8 state, float x, float y, float pressure)
static int SDL_FindFreePlayerIndex()
int SDL_JoystickGetPlayerIndex(SDL_Joystick *joystick)
static int SDL_GetPlayerIndexForJoystickID(SDL_JoystickID instance_id)
int SDL_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms)
static int PrefixMatch(const char *a, const char *b)
SDL_JoystickGUID SDL_JoystickGetDeviceGUID(int device_index)
SDL_GameControllerType SDL_GetJoystickGameControllerTypeFromVIDPID(Uint16 vendor, Uint16 product)
Uint8 SDL_JoystickGetButton(SDL_Joystick *joystick, int button)
static SDL_JoystickDriver * SDL_joystick_drivers[]
static SDL_bool SDL_JoystickAxesCenteredAtZero(SDL_Joystick *joystick)
SDL_JoystickID SDL_JoystickInstanceID(SDL_Joystick *joystick)
int SDL_JoystickSetVirtualAxis(SDL_Joystick *joystick, int axis, Sint16 value)
int SDL_PrivateJoystickBall(SDL_Joystick *joystick, Uint8 ball, Sint16 xrel, Sint16 yrel)
const char * SDL_JoystickName(SDL_Joystick *joystick)
static int SDL_joystick_player_count
SDL_bool SDL_JoystickHasLED(SDL_Joystick *joystick)
int SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy)
SDL_bool SDL_IsJoystickVirtual(SDL_JoystickGUID guid)
SDL_JoystickPowerLevel SDL_JoystickCurrentPowerLevel(SDL_Joystick *joystick)
static SDL_bool SDL_PrivateJoystickShouldIgnoreEvent()
void SDL_PrivateJoystickBatteryLevel(SDL_Joystick *joystick, SDL_JoystickPowerLevel ePowerLevel)
SDL_bool SDL_JoystickIsVirtual(int device_index)
static unsigned char nibble(char c)
int SDL_JoystickSetVirtualButton(SDL_Joystick *joystick, int button, Uint8 value)
static SDL_JoystickID SDL_GetJoystickIDForPlayerIndex(int player_index)
int SDL_NumJoysticks(void)
static SDL_bool SDL_IsJoystickProductFlightStick(Uint32 vidpid)
void SDL_JoystickSetPlayerIndex(SDL_Joystick *joystick, int player_index)
int SDL_PrivateJoystickHat(SDL_Joystick *joystick, Uint8 hat, Uint8 value)
Uint16 SDL_JoystickGetDeviceProduct(int device_index)
Uint16 SDL_JoystickGetDeviceProductVersion(int device_index)
SDL_JoystickGUID SDL_JoystickGetGUIDFromString(const char *pchGUID)
void SDL_PrivateJoystickRemoved(SDL_JoystickID device_instance)
int SDL_JoystickInit(void)
SDL_bool SDL_GetDriverAndJoystickIndex(int device_index, SDL_JoystickDriver **driver, int *driver_index)
SDL_bool SDL_IsJoystickPS5(Uint16 vendor_id, Uint16 product_id)
Uint16 SDL_JoystickGetDeviceVendor(int device_index)
SDL_bool SDL_IsJoystickXboxOneElite(Uint16 vendor_id, Uint16 product_id)
SDL_bool SDL_IsJoystickHIDAPI(SDL_JoystickGUID guid)
static void SDL_JoystickAllowBackgroundEventsChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
int SDL_JoystickNumBalls(SDL_Joystick *joystick)
int SDL_JoystickNumHats(SDL_Joystick *joystick)
int SDL_PrivateJoystickAxis(SDL_Joystick *joystick, Uint8 axis, Sint16 value)
SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_JoystickGUID guid)
void SDL_JoystickQuit(void)
SDL_bool SDL_IsJoystickWGI(SDL_JoystickGUID guid)
int SDL_JoystickSetVirtualHat(SDL_Joystick *joystick, int hat, Uint8 value)
void SDL_JoystickClose(SDL_Joystick *joystick)
static SDL_JoystickID * SDL_joystick_players
SDL_JoystickGUID SDL_JoystickGetGUID(SDL_Joystick *joystick)
SDL_bool SDL_IsJoystickRAWINPUT(SDL_JoystickGUID guid)
int SDL_JoystickGetDevicePlayerIndex(int device_index)
SDL_bool SDL_PrivateJoystickGetAutoGamepadMapping(int device_index, SDL_GamepadMapping *out)
int SDL_JoystickDetachVirtual(int device_index)
void SDL_PrivateJoystickAddTouchpad(SDL_Joystick *joystick, int nfingers)
SDL_bool SDL_JoystickGetAttached(SDL_Joystick *joystick)
SDL_GameControllerType SDL_GetJoystickGameControllerTypeFromGUID(SDL_JoystickGUID guid, const char *name)
Uint16 SDL_JoystickGetProduct(SDL_Joystick *joystick)
static SDL_bool SDL_IsJoystickProductWheel(Uint32 vidpid)
void SDL_PrivateJoystickAdded(SDL_JoystickID device_instance)
SDL_GameControllerType SDL_GetJoystickGameControllerType(const char *name, Uint16 vendor, Uint16 product, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
void SDL_LockJoysticks(void)
void SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint16 *vendor, Uint16 *product, Uint16 *version)
static SDL_bool SDL_IsJoystickProductThrottle(Uint32 vidpid)
static SDL_bool SDL_joystick_allows_background_events
const char * SDL_JoystickGetSerial(SDL_Joystick *joystick)
static SDL_mutex * SDL_joystick_lock
SDL_Joystick * SDL_JoystickOpen(int device_index)
int SDL_PrivateJoystickSensor(SDL_Joystick *joystick, SDL_SensorType type, const float *data, int num_values)
static void SDL_PrivateJoystickForceRecentering(SDL_Joystick *joystick)
Uint16 SDL_JoystickGetVendor(SDL_Joystick *joystick)
SDL_JoystickType SDL_JoystickGetType(SDL_Joystick *joystick)
static SDL_bool SDL_updating_joystick
int SDL_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms)
void SDL_PrivateJoystickAddSensor(SDL_Joystick *joystick, SDL_SensorType type)
void SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID)
int SDL_JoystickAttachVirtual(SDL_JoystickType type, int naxes, int nbuttons, int nhats)
void SDL_UnlockJoysticks(void)
Uint8 SDL_JoystickGetHat(SDL_Joystick *joystick, int hat)
static SDL_bool SDL_IsPS4RemapperRunning(void)
void SDL_JoystickUpdate(void)
int SDL_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue)
int SDL_JoystickEventState(int state)
static SDL_Joystick * SDL_joysticks
static SDL_bool SDL_SetJoystickIDForPlayerIndex(int player_index, SDL_JoystickID instance_id)
SDL_JoystickType SDL_JoystickGetDeviceType(int device_index)
static SDL_atomic_t SDL_next_joystick_instance_id
int SDL_JoystickNumAxes(SDL_Joystick *joystick)
SDL_bool SDL_IsJoystickXboxOneSeriesX(Uint16 vendor_id, Uint16 product_id)
SDL_bool SDL_IsJoystickNintendoSwitchPro(Uint16 vendor_id, Uint16 product_id)
SDL_Joystick * SDL_JoystickFromInstanceID(SDL_JoystickID instance_id)
static SDL_JoystickType SDL_GetJoystickGUIDType(SDL_JoystickGUID guid)
SDL_JoystickID SDL_GetNextJoystickInstanceID()
Sint16 SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis)
const char * SDL_JoystickNameForIndex(int device_index)
int SDL_JoystickGetDeviceIndexFromInstanceID(SDL_JoystickID instance_id)
SDL_bool SDL_IsJoystickXInput(SDL_JoystickGUID guid)
SDL_bool SDL_IsJoystickPS4(Uint16 vendor_id, Uint16 product_id)
SDL_bool SDL_PrivateJoystickValid(SDL_Joystick *joystick)
SDL_bool SDL_IsJoystickNintendoSwitchProInputOnly(Uint16 vendor_id, Uint16 product_id)
int SDL_PrivateJoystickButton(SDL_Joystick *joystick, Uint8 button, Uint8 state)
int SDL_JoystickNumButtons(SDL_Joystick *joystick)
SDL_bool SDL_IsJoystickSteamController(Uint16 vendor_id, Uint16 product_id)
char * SDL_CreateJoystickName(Uint16 vendor, Uint16 product, const char *vendor_name, const char *product_name)
SDL_Joystick * SDL_JoystickFromPlayerIndex(int player_index)
@ SDL_JOYSTICK_TYPE_DANCE_PAD
@ SDL_JOYSTICK_TYPE_ARCADE_PAD
@ SDL_JOYSTICK_TYPE_UNKNOWN
@ SDL_JOYSTICK_TYPE_ARCADE_STICK
@ SDL_JOYSTICK_TYPE_WHEEL
@ SDL_JOYSTICK_TYPE_THROTTLE
@ SDL_JOYSTICK_TYPE_GUITAR
@ SDL_JOYSTICK_TYPE_FLIGHT_STICK
@ SDL_JOYSTICK_TYPE_GAMECONTROLLER
@ SDL_JOYSTICK_TYPE_DRUM_KIT
@ SDL_JOYSTICK_POWER_UNKNOWN
#define SDL_JOYSTICK_AXIS_MAX
SDL_JoystickDriver SDL_IOS_JoystickDriver
GLint GLint GLint GLint GLint GLint y
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLint GLint GLint GLint GLint x
GLuint GLuint GLsizei GLenum type
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
GLuint const GLchar * name
GLsizei const GLfloat * value
#define SDL_arraysize(array)
SDL_JoystickDriver SDL_BSD_JoystickDriver
SDL_JoystickDriver SDL_WGI_JoystickDriver
SDL_JoystickDriver SDL_EMSCRIPTEN_JoystickDriver
SDL_JoystickDriver SDL_ANDROID_JoystickDriver
#define SDL_MAX_RUMBLE_DURATION_MS
SDL_JoystickDriver SDL_RAWINPUT_JoystickDriver
SDL_JoystickDriver SDL_DUMMY_JoystickDriver
SDL_JoystickDriver SDL_LINUX_JoystickDriver
SDL_JoystickDriver SDL_HIDAPI_JoystickDriver
SDL_JoystickDriver SDL_VIRTUAL_JoystickDriver
SDL_JoystickDriver SDL_DARWIN_JoystickDriver
#define MAKE_VIDPID(VID, PID)
SDL_JoystickDriver SDL_WINDOWS_JoystickDriver
SDL_JoystickDriver SDL_HAIKU_JoystickDriver
SDL_bool SDL_HasWindows(void)
Uint32 SDL_GetTicks(void)
Get the number of milliseconds since the SDL library initialization.
#define SDL_TICKS_PASSED(A, B)
Compare SDL ticks values, and return true if A has passed B.
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)
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 int in j)
@ k_eControllerType_SteamController
@ k_eControllerType_PS3Controller
@ k_eControllerType_SteamControllerV2
@ k_eControllerType_PS5Controller
@ k_eControllerType_SwitchProController
@ k_eControllerType_PS4Controller
@ k_eControllerType_XBox360Controller
@ k_eControllerType_XBoxOneController
@ k_eControllerType_UnknownNonSteamController
@ k_eControllerType_SwitchInputOnlyController
static SDL_INLINE EControllerType GuessControllerType(int nVID, int nPID)
static SDL_INLINE const char * GuessControllerName(int nVID, int nPID)
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 ®2 endm macro vzip8 reg2 vzip d d ®2 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
SDL_bool has_initial_value
SDL_bool has_second_value
SDL_bool sent_initial_value
SDL_JoystickGUID(* GetDeviceGUID)(int device_index)
void(* SetDevicePlayerIndex)(int device_index, int player_index)
SDL_bool(* GetGamepadMapping)(int device_index, SDL_GamepadMapping *out)
SDL_JoystickID(* GetDeviceInstanceID)(int device_index)
void(* Update)(SDL_Joystick *joystick)
int(* GetDevicePlayerIndex)(int device_index)
int(* Open)(SDL_Joystick *joystick, int device_index)
const char *(* GetDeviceName)(int device_index)
SDL_JoystickTouchpadFingerInfo * fingers
A type representing an atomic integer value. It is a struct so people don't accidentally use numeric ...
static SDL_Event events[EVENT_BUF_SIZE]
static SDL_Joystick * joystick
SDL_ControllerDeviceEvent cdevice
#define USB_PRODUCT_XBOX_ONE_ELITE_SERIES_2
#define USB_PRODUCT_XBOX_ONE_SERIES_X_BLUETOOTH
#define USB_VENDOR_MICROSOFT
#define USB_PRODUCT_XBOX_ONE_ELITE_SERIES_2_BLUETOOTH
#define USB_PRODUCT_XBOX_ONE_ELITE_SERIES_1
#define USB_PRODUCT_XBOX_ONE_SERIES_X