From b0ccb9ef0fb3ee86aee690535ed232b81af776f0 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Fri, 30 Oct 2026 04:54:18 -0700
Subject: [PATCH] Removed stub functions for unsupported joystick functionality
---
src/joystick/SDL_joystick.c | 138 ++++++++------
src/joystick/SDL_sysjoystick.h | 14 +-
src/joystick/android/SDL_sysjoystick.c | 61 ++----
src/joystick/apple/SDL_mfijoystick.m | 46 ++---
src/joystick/bsd/SDL_bsdjoystick.c | 73 ++-----
src/joystick/darwin/SDL_iokitjoystick.c | 69 ++-----
src/joystick/dos/SDL_sysjoystick.c | 73 ++-----
src/joystick/dummy/SDL_sysjoystick.c | 73 ++-----
src/joystick/emscripten/SDL_sysjoystick.c | 65 ++-----
src/joystick/gdk/SDL_gameinputjoystick.cpp | 13 +-
src/joystick/haiku/SDL_haikujoystick.cc | 57 +-----
src/joystick/hidapi/SDL_hidapi_8bitdo.c | 59 ++----
src/joystick/hidapi/SDL_hidapi_combined.c | 112 ++++++-----
src/joystick/hidapi/SDL_hidapi_flydigi.c | 60 ++----
src/joystick/hidapi/SDL_hidapi_gamecube.c | 57 ++----
src/joystick/hidapi/SDL_hidapi_gamesir.c | 60 ++----
src/joystick/hidapi/SDL_hidapi_gip.c | 56 ++----
src/joystick/hidapi/SDL_hidapi_lg4ff.c | 53 ++----
src/joystick/hidapi/SDL_hidapi_luna.c | 67 ++-----
src/joystick/hidapi/SDL_hidapi_ps3.c | 178 ++++--------------
src/joystick/hidapi/SDL_hidapi_ps4.c | 49 ++---
src/joystick/hidapi/SDL_hidapi_ps5.c | 49 ++---
src/joystick/hidapi/SDL_hidapi_shield.c | 63 ++-----
src/joystick/hidapi/SDL_hidapi_sinput.c | 56 ++----
src/joystick/hidapi/SDL_hidapi_stadia.c | 67 ++-----
src/joystick/hidapi/SDL_hidapi_steam.c | 49 ++---
src/joystick/hidapi/SDL_hidapi_steam_hori.c | 67 ++-----
src/joystick/hidapi/SDL_hidapi_steam_triton.c | 56 ++----
src/joystick/hidapi/SDL_hidapi_steamdeck.c | 60 ++----
src/joystick/hidapi/SDL_hidapi_switch.c | 119 +++++-------
src/joystick/hidapi/SDL_hidapi_switch2.c | 54 ++----
src/joystick/hidapi/SDL_hidapi_wii.c | 57 ++----
src/joystick/hidapi/SDL_hidapi_xbox360.c | 61 ++----
src/joystick/hidapi/SDL_hidapi_xbox360bb.c | 75 +-------
src/joystick/hidapi/SDL_hidapi_xbox360w.c | 61 ++----
src/joystick/hidapi/SDL_hidapi_xboxone.c | 53 ++----
src/joystick/hidapi/SDL_hidapi_zuiki.c | 59 ++----
src/joystick/hidapi/SDL_hidapijoystick.c | 94 +++++----
src/joystick/linux/SDL_sysjoystick.c | 61 ++----
src/joystick/n3ds/SDL_sysjoystick.c | 69 ++-----
src/joystick/ps2/SDL_sysjoystick.c | 75 ++------
src/joystick/psp/SDL_sysjoystick.c | 73 ++-----
src/joystick/virtual/SDL_virtualjoystick.c | 46 ++---
src/joystick/vita/SDL_sysjoystick.c | 65 ++-----
src/joystick/windows/SDL_windowsjoystick.c | 65 ++-----
45 files changed, 830 insertions(+), 2157 deletions(-)
diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c
index cfa23496470dc..1a0a11adf778f 100644
--- a/src/joystick/SDL_joystick.c
+++ b/src/joystick/SDL_joystick.c
@@ -831,7 +831,9 @@ static bool SDL_SetJoystickIDForPlayerIndex(int player_index, SDL_JoystickID ins
// Update the driver with the new index
if (SDL_GetDriverAndJoystickIndex(instance_id, &driver, &device_index)) {
- driver->SetDevicePlayerIndex(device_index, player_index);
+ if (driver->SetDevicePlayerIndex) {
+ driver->SetDevicePlayerIndex(device_index, player_index);
+ }
}
// Move any existing joystick to another slot
@@ -1679,7 +1681,9 @@ bool SDL_PrivateJoystickGetAutoGamepadMapping(SDL_JoystickID instance_id, SDL_Ga
SDL_LockJoysticks();
if (SDL_GetDriverAndJoystickIndex(instance_id, &driver, &device_index)) {
- is_ok = driver->GetGamepadMapping(device_index, out);
+ if (driver->GetGamepadMapping) {
+ is_ok = driver->GetGamepadMapping(device_index, out);
+ }
}
SDL_UnlockJoysticks();
@@ -1914,68 +1918,78 @@ bool SDL_JoystickHasSensor(SDL_Joystick *joystick, SDL_SensorType type)
*/
bool SDL_SetJoystickSensorEnabled(SDL_Joystick *joystick, SDL_SensorType type, bool enabled)
{
+ // In case someone passes non bool value
+ enabled = (enabled != false);
+
SDL_LockJoysticks();
{
CHECK_JOYSTICK_MAGIC(joystick, false);
for (int i = 0; i < joystick->nsensors; ++i) {
SDL_JoystickSensorInfo *sensor = &joystick->sensors[i];
- if (sensor->type == type) {
- if (sensor->enabled == (enabled != false)) {
- SDL_UnlockJoysticks();
- return true;
- }
+ if (sensor->type != type) {
+ continue;
+ }
- if (type == SDL_SENSOR_ACCEL && joystick->accel_sensor) {
- if (enabled) {
- joystick->accel = SDL_OpenSensor(joystick->accel_sensor);
- if (!joystick->accel) {
- SDL_UnlockJoysticks();
- return false;
- }
- } else {
- if (joystick->accel) {
- SDL_CloseSensor(joystick->accel);
- joystick->accel = NULL;
- }
+ if (sensor->enabled == enabled) {
+ SDL_UnlockJoysticks();
+ return true;
+ }
+
+ bool result = true;
+ if (type == SDL_SENSOR_ACCEL && joystick->accel_sensor) {
+ if (enabled) {
+ joystick->accel = SDL_OpenSensor(joystick->accel_sensor);
+ if (!joystick->accel) {
+ result = false;
}
- } else if (type == SDL_SENSOR_GYRO && joystick->gyro_sensor) {
- if (enabled) {
- joystick->gyro = SDL_OpenSensor(joystick->gyro_sensor);
- if (!joystick->gyro) {
- SDL_UnlockJoysticks();
- return false;
- }
- } else {
- if (joystick->gyro) {
- SDL_CloseSensor(joystick->gyro);
- joystick->gyro = NULL;
- }
+ } else {
+ if (joystick->accel) {
+ SDL_CloseSensor(joystick->accel);
+ joystick->accel = NULL;
+ }
+ }
+ } else if (type == SDL_SENSOR_GYRO && joystick->gyro_sensor) {
+ if (enabled) {
+ joystick->gyro = SDL_OpenSensor(joystick->gyro_sensor);
+ if (!joystick->gyro) {
+ result = false;
}
} else {
- if (enabled) {
- if (joystick->nsensors_enabled == 0) {
- if (!joystick->driver->SetSensorsEnabled(joystick, true)) {
- SDL_UnlockJoysticks();
- return false;
- }
+ if (joystick->gyro) {
+ SDL_CloseSensor(joystick->gyro);
+ joystick->gyro = NULL;
+ }
+ }
+ } else if (joystick->driver->SetSensorsEnabled) {
+ if (enabled) {
+ if (joystick->nsensors_enabled == 0) {
+ if (!joystick->driver->SetSensorsEnabled(joystick, true)) {
+ result = false;
}
+ }
+ if (result) {
++joystick->nsensors_enabled;
- } else {
- if (joystick->nsensors_enabled == 1) {
- if (!joystick->driver->SetSensorsEnabled(joystick, false)) {
- SDL_UnlockJoysticks();
- return false;
- }
+ }
+ } else {
+ if (joystick->nsensors_enabled == 1) {
+ if (!joystick->driver->SetSensorsEnabled(joystick, false)) {
+ result = false;
}
+ }
+ if (result) {
--joystick->nsensors_enabled;
}
}
+ } else {
+ result = SDL_Unsupported();
+ }
+ if (result) {
sensor->enabled = enabled;
- SDL_UnlockJoysticks();
- return true;
}
+ SDL_UnlockJoysticks();
+ return result;
}
}
SDL_UnlockJoysticks();
@@ -2242,7 +2256,7 @@ bool SDL_RumbleJoystick(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uin
high_frequency_rumble == joystick->high_frequency_rumble) {
// Just update the expiration
result = true;
- } else {
+ } else if (joystick->driver->Rumble) {
result = joystick->driver->Rumble(joystick, low_frequency_rumble, high_frequency_rumble);
if (result) {
joystick->rumble_resend = SDL_GetTicks() + SDL_RUMBLE_RESEND_MS;
@@ -2252,6 +2266,8 @@ bool SDL_RumbleJoystick(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uin
} else {
joystick->rumble_resend = 0;
}
+ } else {
+ result = SDL_Unsupported();
}
if (result) {
@@ -2285,7 +2301,7 @@ bool SDL_RumbleJoystickTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint
if (left_rumble == joystick->left_trigger_rumble && right_rumble == joystick->right_trigger_rumble) {
// Just update the expiration
result = true;
- } else {
+ } else if (joystick->driver->RumbleTriggers) {
result = joystick->driver->RumbleTriggers(joystick, left_rumble, right_rumble);
if (result) {
joystick->trigger_rumble_resend = SDL_GetTicks() + SDL_RUMBLE_RESEND_MS;
@@ -2295,6 +2311,8 @@ bool SDL_RumbleJoystickTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint
} else {
joystick->trigger_rumble_resend = 0;
}
+ } else {
+ result = SDL_Unsupported();
}
if (result) {
@@ -2317,19 +2335,22 @@ bool SDL_RumbleJoystickTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint
bool SDL_SetJoystickLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue)
{
bool result;
- bool isfreshvalue;
SDL_LockJoysticks();
{
CHECK_JOYSTICK_MAGIC(joystick, false);
- isfreshvalue = red != joystick->led_red ||
- green != joystick->led_green ||
- blue != joystick->led_blue;
+ bool isfreshvalue = red != joystick->led_red ||
+ green != joystick->led_green ||
+ blue != joystick->led_blue;
if (isfreshvalue || SDL_GetTicks() >= joystick->led_expiration) {
- result = joystick->driver->SetLED(joystick, red, green, blue);
- joystick->led_expiration = SDL_GetTicks() + SDL_LED_MIN_REPEAT_MS;
+ if (joystick->driver->SetLED) {
+ result = joystick->driver->SetLED(joystick, red, green, blue);
+ joystick->led_expiration = SDL_GetTicks() + SDL_LED_MIN_REPEAT_MS;
+ } else {
+ result = SDL_Unsupported();
+ }
} else {
// Avoid spamming the driver
result = true;
@@ -2353,7 +2374,11 @@ bool SDL_SendJoystickEffect(SDL_Joystick *joystick, const void *data, int size)
{
CHECK_JOYSTICK_MAGIC(joystick, false);
- result = joystick->driver->SendEffect(joystick, data, size);
+ if (joystick->driver->SendEffect) {
+ result = joystick->driver->SendEffect(joystick, data, size);
+ } else {
+ result = SDL_Unsupported();
+ }
}
SDL_UnlockJoysticks();
@@ -2544,6 +2569,9 @@ void SDL_PrivateJoystickAddSensor(SDL_Joystick *joystick, SDL_SensorType type, f
SDL_AssertJoysticksLocked();
+ // Make sure we can actually enable this sensor
+ SDL_assert(joystick->driver->SetSensorsEnabled);
+
nsensors = joystick->nsensors + 1;
sensors = (SDL_JoystickSensorInfo *)SDL_realloc(joystick->sensors, (nsensors * sizeof(SDL_JoystickSensorInfo)));
if (sensors) {
@@ -2607,7 +2635,7 @@ void SDL_PrivateJoystickAdded(SDL_JoystickID instance_id)
if (SDL_GetDriverAndJoystickIndex(instance_id, &driver, &device_index)) {
player_index = driver->GetDeviceSteamVirtualGamepadSlot(device_index);
- if (player_index < 0) {
+ if (player_index < 0 && driver->GetDevicePlayerIndex) {
player_index = driver->GetDevicePlayerIndex(device_index);
}
}
diff --git a/src/joystick/SDL_sysjoystick.h b/src/joystick/SDL_sysjoystick.h
index 61dc89ceea016..7adcc9408e2c3 100644
--- a/src/joystick/SDL_sysjoystick.h
+++ b/src/joystick/SDL_sysjoystick.h
@@ -193,10 +193,10 @@ typedef struct SDL_JoystickDriver
// Function to get the Steam virtual gamepad slot of a joystick
int (*GetDeviceSteamVirtualGamepadSlot)(int device_index);
- // Function to get the player index of a joystick
+ // Optional function to get the player index of a joystick
int (*GetDevicePlayerIndex)(int device_index);
- // Function to set the player index of a joystick
+ // Optional function to set the player index of a joystick
void (*SetDevicePlayerIndex)(int device_index, int player_index);
// Function to return the stable GUID for a plugged in device
@@ -212,17 +212,17 @@ typedef struct SDL_JoystickDriver
*/
bool (*Open)(SDL_Joystick *joystick, int device_index);
- // Rumble functionality
+ // Optional rumble functionality
bool (*Rumble)(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble);
bool (*RumbleTriggers)(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble);
- // LED functionality
+ // Optional LED functionality
bool (*SetLED)(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue);
- // General effects
+ // Optional general effects
bool (*SendEffect)(SDL_Joystick *joystick, const void *data, int size);
- // Sensor functionality
+ // Optional sensor functionality
bool (*SetSensorsEnabled)(SDL_Joystick *joystick, bool enabled);
/* Function to update the state of a joystick - called as a device poll.
@@ -238,7 +238,7 @@ typedef struct SDL_JoystickDriver
// Function to perform any system-specific joystick related cleanup
void (*Quit)(void);
- // Function to get the autodetected controller mapping; returns false if there isn't any.
+ // Optional function to get the autodetected controller mapping
bool (*GetGamepadMapping)(int device_index, SDL_GamepadMapping *out);
} SDL_JoystickDriver;
diff --git a/src/joystick/android/SDL_sysjoystick.c b/src/joystick/android/SDL_sysjoystick.c
index 5ec05095515f5..a71b1da145bde 100644
--- a/src/joystick/android/SDL_sysjoystick.c
+++ b/src/joystick/android/SDL_sysjoystick.c
@@ -618,15 +618,6 @@ static int ANDROID_JoystickGetDeviceSteamVirtualGamepadSlot(int device_index)
return -1;
}
-static int ANDROID_JoystickGetDevicePlayerIndex(int device_index)
-{
- return -1;
-}
-
-static void ANDROID_JoystickSetDevicePlayerIndex(int device_index, int player_index)
-{
-}
-
static SDL_GUID ANDROID_JoystickGetDeviceGUID(int device_index)
{
return GetJoystickByDevIndex(device_index)->guid;
@@ -693,11 +684,6 @@ static bool ANDROID_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_
#endif
}
-static bool ANDROID_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble)
-{
- return SDL_Unsupported();
-}
-
static bool ANDROID_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue)
{
SDL_joylist_item *item = (SDL_joylist_item *)joystick->hwdata;
@@ -711,11 +697,6 @@ static bool ANDROID_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 gree
return true;
}
-static bool ANDROID_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size)
-{
- return SDL_Unsupported();
-}
-
static bool ANDROID_JoystickSetSensorsEnabled(SDL_Joystick *joystick, bool enabled)
{
SDL_joylist_item *item = (SDL_joylist_item *)joystick->hwdata;
@@ -757,33 +738,23 @@ static void ANDROID_JoystickQuit(void)
numjoysticks = 0;
}
-static bool ANDROID_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out)
-{
- return false;
-}
-
SDL_JoystickDriver SDL_ANDROID_JoystickDriver = {
- ANDROID_JoystickInit,
- ANDROID_JoystickGetCount,
- ANDROID_JoystickDetect,
- ANDROID_JoystickIsDevicePresent,
- ANDROID_JoystickGetDeviceName,
- ANDROID_JoystickGetDevicePath,
- ANDROID_JoystickGetDeviceSteamVirtualGamepadSlot,
- ANDROID_JoystickGetDevicePlayerIndex,
- ANDROID_JoystickSetDevicePlayerIndex,
- ANDROID_JoystickGetDeviceGUID,
- ANDROID_JoystickGetDeviceInstanceID,
- ANDROID_JoystickOpen,
- ANDROID_JoystickRumble,
- ANDROID_JoystickRumbleTriggers,
- ANDROID_JoystickSetLED,
- ANDROID_JoystickSendEffect,
- ANDROID_JoystickSetSensorsEnabled,
- ANDROID_JoystickUpdate,
- ANDROID_JoystickClose,
- ANDROID_JoystickQuit,
- ANDROID_JoystickGetGamepadMapping
+ .Init = ANDROID_JoystickInit,
+ .GetCount = ANDROID_JoystickGetCount,
+ .Detect = ANDROID_JoystickDetect,
+ .IsDevicePresent = ANDROID_JoystickIsDevicePresent,
+ .GetDeviceName = ANDROID_JoystickGetDeviceName,
+ .GetDevicePath = ANDROID_JoystickGetDevicePath,
+ .GetDeviceSteamVirtualGamepadSlot = ANDROID_JoystickGetDeviceSteamVirtualGamepadSlot,
+ .GetDeviceGUID = ANDROID_JoystickGetDeviceGUID,
+ .GetDeviceInstanceID = ANDROID_JoystickGetDeviceInstanceID,
+ .Open = ANDROID_JoystickOpen,
+ .Rumble = ANDROID_JoystickRumble,
+ .SetLED = ANDROID_JoystickSetLED,
+ .SetSensorsEnabled = ANDROID_JoystickSetSensorsEnabled,
+ .Update = ANDROID_JoystickUpdate,
+ .Close = ANDROID_JoystickClose,
+ .Quit = ANDROID_JoystickQuit
};
#endif // SDL_JOYSTICK_ANDROID
diff --git a/src/joystick/apple/SDL_mfijoystick.m b/src/joystick/apple/SDL_mfijoystick.m
index 8f67162181f8b..799f8cf4f40f7 100644
--- a/src/joystick/apple/SDL_mfijoystick.m
+++ b/src/joystick/apple/SDL_mfijoystick.m
@@ -1511,11 +1511,6 @@ static bool IOS_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, U
return SDL_Unsupported();
}
-static bool IOS_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size)
-{
- return SDL_Unsupported();
-}
-
static bool IOS_JoystickSetSensorsEnabled(SDL_Joystick *joystick, bool enabled)
{
@autoreleasepool {
@@ -1979,25 +1974,24 @@ static void GetAppleSFSymbolsNameForElement(GCControllerElement *element, char *
}
SDL_JoystickDriver SDL_IOS_JoystickDriver = {
- IOS_JoystickInit,
- IOS_JoystickGetCount,
- IOS_JoystickDetect,
- IOS_JoystickIsDevicePresent,
- IOS_JoystickGetDeviceName,
- IOS_JoystickGetDevicePath,
- IOS_JoystickGetDeviceSteamVirtualGamepadSlot,
- IOS_JoystickGetDevicePlayerIndex,
- IOS_JoystickSetDevicePlayerIndex,
- IOS_JoystickGetDeviceGUID,
- IOS_JoystickGetDeviceInstanceID,
- IOS_JoystickOpen,
- IOS_JoystickRumble,
- IOS_JoystickRumbleTriggers,
- IOS_JoystickSetLED,
- IOS_JoystickSendEffect,
- IOS_JoystickSetSensorsEnabled,
- IOS_JoystickUpdate,
- IOS_JoystickClose,
- IOS_JoystickQuit,
- IOS_JoystickGetGamepadMapping
+ .Init = IOS_JoystickInit,
+ .GetCount = IOS_JoystickGetCount,
+ .Detect = IOS_JoystickDetect,
+ .IsDevicePresent = IOS_JoystickIsDevicePresent,
+ .GetDeviceName = IOS_JoystickGetDeviceName,
+ .GetDevicePath = IOS_JoystickGetDevicePath,
+ .GetDeviceSteamVirtualGamepadSlot = IOS_JoystickGetDeviceSteamVirtualGamepadSlot,
+ .GetDevicePlayerIndex = IOS_JoystickGetDevicePlayerIndex,
+ .SetDevicePlayerIndex = IOS_JoystickSetDevicePlayerIndex,
+ .GetDeviceGUID = IOS_JoystickGetDeviceGUID,
+ .GetDeviceInstanceID = IOS_JoystickGetDeviceInstanceID,
+ .Open = IOS_JoystickOpen,
+ .Rumble = IOS_JoystickRumble,
+ .RumbleTriggers = IOS_JoystickRumbleTriggers,
+ .SetLED = IOS_JoystickSetLED,
+ .SetSensorsEnabled = IOS_JoystickSetSensorsEnabled,
+ .Update = IOS_JoystickUpdate,
+ .Close = IOS_JoystickClose,
+ .Quit = IOS_JoystickQuit,
+ .GetGamepadMapping = IOS_JoystickGetGamepadMapping
};
diff --git a/src/joystick/bsd/SDL_bsdjoystick.c b/src/joystick/bsd/SDL_bsdjoystick.c
index 75716e3b43f48..a2df14a619b7b 100644
--- a/src/joystick/bsd/SDL_bsdjoystick.c
+++ b/src/joystick/bsd/SDL_bsdjoystick.c
@@ -546,15 +546,6 @@ static int BSD_JoystickGetDeviceSteamVirtualGamepadSlot(int device_index)
return -1;
}
-static int BSD_JoystickGetDevicePlayerIndex(int device_index)
-{
- return -1;
-}
-
-static void BSD_JoystickSetDevicePlayerIndex(int device_index, int player_index)
-{
-}
-
static SDL_GUID BSD_JoystickGetDeviceGUID(int device_index)
{
return GetJoystickByDevIndex(device_index)->guid;
@@ -811,58 +802,20 @@ static void report_free(struct report *r)
r->status = SREPORT_UNINIT;
}
-static bool BSD_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)
-{
- return SDL_Unsupported();
-}
-
-static bool BSD_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble)
-{
- return SDL_Unsupported();
-}
-
-static bool BSD_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out)
-{
- return false;
-}
-
-static bool BSD_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue)
-{
- return SDL_Unsupported();
-}
-
-static bool BSD_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size)
-{
- return SDL_Unsupported();
-}
-
-static bool BSD_JoystickSetSensorsEnabled(SDL_Joystick *joystick, bool enabled)
-{
- return SDL_Unsupported();
-}
-
SDL_JoystickDriver SDL_BSD_JoystickDriver = {
- BSD_JoystickInit,
- BSD_JoystickGetCount,
- BSD_JoystickDetect,
- BSD_JoystickIsDevicePresent,
- BSD_JoystickGetDeviceName,
- BSD_JoystickGetDevicePath,
- BSD_JoystickGetDeviceSteamVirtualGamepadSlot,
- BSD_JoystickGetDevicePlayerIndex,
- BSD_JoystickSetDevicePlayerIndex,
- BSD_JoystickGetDeviceGUID,
- BSD_JoystickGetDeviceInstanceID,
- BSD_JoystickOpen,
- BSD_JoystickRumble,
- BSD_JoystickRumbleTriggers,
- BSD_JoystickSetLED,
- BSD_JoystickSendEffect,
- BSD_JoystickSetSensorsEnabled,
- BSD_JoystickUpdate,
- BSD_JoystickClose,
- BSD_JoystickQuit,
- BSD_JoystickGetGamepadMapping
+ .Init = BSD_JoystickInit,
+ .GetCount = BSD_JoystickGetCount,
+ .Detect = BSD_JoystickDetect,
+ .IsDevicePresent = BSD_JoystickIsDevicePresent,
+ .GetDeviceName = BSD_JoystickGetDeviceName,
+ .GetDevicePath = BSD_JoystickGetDevicePath,
+ .GetDeviceSteamVirtualGamepadSlot = BSD_JoystickGetDeviceSteamVirtualGamepadSlot,
+ .GetDeviceGUID = BSD_JoystickGetDeviceGUID,
+ .GetDeviceInstanceID = BSD_JoystickGetDeviceInstanceID,
+ .Open = BSD_JoystickOpen,
+ .Update = BSD_JoystickUpdate,
+ .Close = BSD_JoystickClose,
+ .Quit = BSD_JoystickQuit
};
#endif // SDL_JOYSTICK_USBHID
diff --git a/src/joystick/darwin/SDL_iokitjoystick.c b/src/joystick/darwin/SDL_iokitjoystick.c
index b88258f18da40..46ca567fad3cb 100644
--- a/src/joystick/darwin/SDL_iokitjoystick.c
+++ b/src/joystick/darwin/SDL_iokitjoystick.c
@@ -786,15 +786,6 @@ static int DARWIN_JoystickGetDeviceSteamVirtualGamepadSlot(int device_index)
return device ? device->steam_virtual_gamepad_slot : -1;
}
-static int DARWIN_JoystickGetDevicePlayerIndex(int device_index)
-{
- return -1;
-}
-
-static void DARWIN_JoystickSetDevicePlayerIndex(int device_index, int player_index)
-{
-}
-
static SDL_GUID DARWIN_JoystickGetDeviceGUID(int device_index)
{
recDevice *device = GetDeviceForIndex(device_index);
@@ -962,26 +953,6 @@ static bool DARWIN_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_r
return true;
}
-static bool DARWIN_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble)
-{
- return SDL_Unsupported();
-}
-
-static bool DARWIN_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue)
-{
- return SDL_Unsupported();
-}
-
-static bool DARWIN_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size)
-{
- return SDL_Unsupported();
-}
-
-static bool DARWIN_JoystickSetSensorsEnabled(SDL_Joystick *joystick, bool enabled)
-{
- return SDL_Unsupported();
-}
-
static void DARWIN_JoystickUpdate(SDL_Joystick *joystick)
{
recDevice *device = joystick->hwdata;
@@ -1109,33 +1080,21 @@ static void DARWIN_JoystickQuit(void)
}
}
-static bool DARWIN_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out)
-{
- return false;
-}
-
SDL_JoystickDriver SDL_DARWIN_JoystickDriver = {
- DARWIN_JoystickInit,
- DARWIN_JoystickGetCount,
- DARWIN_JoystickDetect,
- DARWIN_JoystickIsDevicePresent,
- DARWIN_JoystickGetDeviceName,
- DARWIN_JoystickGetDevicePath,
- DARWIN_JoystickGetDeviceSteamVirtualGamepadSlot,
- DARWIN_JoystickGetDevicePlayerIndex,
- DARWIN_JoystickSetDevicePlayerIndex,
- DARWIN_JoystickGetDeviceGUID,
- DARWIN_JoystickGetDeviceInstanceID,
- DARWIN_JoystickOpen,
- DARWIN_JoystickRumble,
- DARWIN_JoystickRumbleTriggers,
- DARWIN_JoystickSetLED,
- DARWIN_JoystickSendEffect,
- DARWIN_JoystickSetSensorsEnabled,
- DARWIN_JoystickUpdate,
- DARWIN_JoystickClose,
- DARWIN_JoystickQuit,
- DARWIN_JoystickGetGamepadMapping
+ .Init = DARWIN_JoystickInit,
+ .GetCount = DARWIN_JoystickGetCount,
+ .Detect = DARWIN_JoystickDetect,
+ .IsDevicePresent = DARWIN_JoystickIsDevicePresent,
+ .GetDeviceName = DARWIN_JoystickGetDeviceName,
+ .GetDevicePath = DARWIN_JoystickGetDevicePath,
+ .GetDeviceSteamVirtualGamepadSlot = DARWIN_JoystickGetDeviceSteamVirtualGamepadSlot,
+ .GetDeviceGUID = DARWIN_JoystickGetDeviceGUID,
+ .GetDeviceInstanceID = DARWIN_JoystickGetDeviceInstanceID,
+ .Open = DARWIN_JoystickOpen,
+ .Rumble = DARWIN_JoystickRumble,
+ .Update = DARWIN_JoystickUpdate,
+ .Close = DARWIN_JoystickClose,
+ .Quit = DARWIN_JoystickQuit
};
#endif // SDL_JOYSTICK_IOKIT
diff --git a/src/joystick/dos/SDL_sysjoystick.c b/src/joystick/dos/SDL_sysjoystick.c
index 6908be4b7e7cc..c69fc08e5d534 100644
--- a/src/joystick/dos/SDL_sysjoystick.c
+++ b/src/joystick/dos/SDL_sysjoystick.c
@@ -179,15 +179,6 @@ static int DOS_JoystickGetDeviceSteamVirtualGamepadSlot(int device_index)
return -1;
}
-static int DOS_JoystickGetDevicePlayerIndex(int device_index)
-{
- return -1;
-}
-
-static void DOS_JoystickSetDevicePlayerIndex(int device_index, int player_index)
-{
-}
-
static SDL_GUID DOS_JoystickGetDeviceGUID(int device_index)
{
return SDL_CreateJoystickGUID(
@@ -236,31 +227,6 @@ static bool DOS_JoystickOpen(SDL_Joystick *joystick, int device_index)
return true;
}
-static bool DOS_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)
-{
- return SDL_Unsupported();
-}
-
-static bool DOS_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble)
-{
- return SDL_Unsupported();
-}
-
-static bool DOS_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue)
-{
- return SDL_Unsupported();
-}
-
-static bool DOS_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size)
-{
- return SDL_Unsupported();
-}
-
-static bool DOS_JoystickSetSensorsEnabled(SDL_Joystick *joystick, bool enabled)
-{
- return SDL_Unsupported();
-}
-
static void DOS_JoystickUpdate(SDL_Joystick *joystick)
{
struct joystick_hwdata *hwdata = joystick->hwdata;
@@ -313,33 +279,20 @@ static void DOS_JoystickQuit(void)
dos_joystick_id = 0;
}
-static bool DOS_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out)
-{
- return false;
-}
-
SDL_JoystickDriver SDL_DOS_JoystickDriver = {
- DOS_JoystickInit,
- DOS_JoystickGetCount,
- DOS_JoystickDetect,
- DOS_JoystickIsDevicePresent,
- DOS_JoystickGetDeviceName,
- DOS_JoystickGetDevicePath,
- DOS_JoystickGetDeviceSteamVirtualGamepadSlot,
- DOS_JoystickGetDevicePlayerIndex,
- DOS_JoystickSetDevicePlayerIndex,
- DOS_JoystickGetDeviceGUID,
- DOS_JoystickGetDeviceInstanceID,
- DOS_JoystickOpen,
- DOS_JoystickRumble,
- DOS_JoystickRumbleTriggers,
- DOS_JoystickSetLED,
- DOS_JoystickSendEffect,
- DOS_JoystickSetSensorsEnabled,
- DOS_JoystickUpdate,
- DOS_JoystickClose,
- DOS_JoystickQuit,
- DOS_JoystickGetGamepadMapping
+ .Init = DOS_JoystickInit,
+ .GetCount = DOS_JoystickGetCount,
+ .Detect = DOS_JoystickDetect,
+ .IsDevicePresent = DOS_JoystickIsDevicePresent,
+ .GetDeviceName = DOS_JoystickGetDeviceName,
+ .GetDevicePath = DOS_JoystickGetDevicePath,
+ .GetDeviceSteamVirtualGamepadSlot = DOS_JoystickGetDeviceSteamVirtualGamepadSlot,
+ .GetDeviceGUID = DOS_JoystickGetDeviceGUID,
+ .GetDeviceInstanceID = DOS_JoystickGetDeviceInstanceID,
+ .Open = DOS_JoystickOpen,
+ .Update = DOS_JoystickUpdate,
+ .Close = DOS_JoystickClose,
+ .Quit = DOS_JoystickQuit
};
#endif /* SDL_JOYSTICK_DOS */
diff --git a/src/joystick/dummy/SDL_sysjoystick.c b/src/joystick/dummy/SDL_sysjoystick.c
index 113df7a46031a..1442483589b37 100644
--- a/src/joystick/dummy/SDL_sysjoystick.c
+++ b/src/joystick/dummy/SDL_sysjoystick.c
@@ -61,15 +61,6 @@ static int DUMMY_JoystickGetDeviceSteamVirtualGamepadSlot(int device_index)
return -1;
}
-static int DUMMY_JoystickGetDevicePlayerIndex(int device_index)
-{
- return -1;
-}
-
-static void DUMMY_JoystickSetDevicePlayerIndex(int device_index, int player_index)
-{
-}
-
static SDL_GUID DUMMY_JoystickGetDeviceGUID(int device_index)
{
SDL_GUID guid;
@@ -87,31 +78,6 @@ static bool DUMMY_JoystickOpen(SDL_Joystick *joystick, int device_index)
return SDL_SetError("Logic error: No joysticks available");
}
-static bool DUMMY_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)
-{
- return SDL_Unsupported();
-}
-
-static bool DUMMY_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble)
-{
- return SDL_Unsupported();
-}
-
-static bool DUMMY_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue)
-{
- return SDL_Unsupported();
-}
-
-static bool DUMMY_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size)
-{
- return SDL_Unsupported();
-}
-
-static bool DUMMY_JoystickSetSensorsEnabled(SDL_Joystick *joystick, bool enabled)
-{
- return SDL_Unsupported();
-}
-
static void DUMMY_JoystickUpdate(SDL_Joystick *joystick)
{
}
@@ -124,33 +90,20 @@ static void DUMMY_JoystickQuit(void)
{
}
-static bool DUMMY_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out)
-{
-
(Patch may be truncated, please check the link at the top of this post.)