Update for SDL3 coding style (#6717)
I updated .clang-format and ran clang-format 14 over the src and test directories to standardize the code base.
In general I let clang-format have it's way, and added markup to prevent formatting of code that would break or be completely unreadable if formatted.
The script I ran for the src directory is added as build-scripts/clang-format-src.sh
This fixes:
#6592
#6593
#6594
(cherry picked from commit 5750bcb174
)
This commit is contained in:
parent
5c4bc807f7
commit
b8d85c6939
764 changed files with 50598 additions and 54407 deletions
|
@ -97,17 +97,16 @@ static SDL_bool SDL_HIDAPI_combine_joycons = SDL_TRUE;
|
|||
static SDL_bool initialized = SDL_FALSE;
|
||||
static SDL_bool shutting_down = SDL_FALSE;
|
||||
|
||||
void
|
||||
HIDAPI_DumpPacket(const char *prefix, const Uint8 *data, int size)
|
||||
void HIDAPI_DumpPacket(const char *prefix, const Uint8 *data, int size)
|
||||
{
|
||||
int i;
|
||||
char *buffer;
|
||||
size_t length = SDL_strlen(prefix) + 11*(USB_PACKET_LENGTH/8) + (5*USB_PACKET_LENGTH*2) + 1 + 1;
|
||||
size_t length = SDL_strlen(prefix) + 11 * (USB_PACKET_LENGTH / 8) + (5 * USB_PACKET_LENGTH * 2) + 1 + 1;
|
||||
int start = 0, amount = size;
|
||||
|
||||
buffer = (char *)SDL_malloc(length);
|
||||
SDL_snprintf(buffer, length, prefix, size);
|
||||
for (i = start; i < start+amount; ++i) {
|
||||
for (i = start; i < start + amount; ++i) {
|
||||
if ((i % 8) == 0) {
|
||||
SDL_snprintf(&buffer[SDL_strlen(buffer)], length - SDL_strlen(buffer), "\n%.2d: ", i);
|
||||
}
|
||||
|
@ -118,8 +117,7 @@ HIDAPI_DumpPacket(const char *prefix, const Uint8 *data, int size)
|
|||
SDL_free(buffer);
|
||||
}
|
||||
|
||||
float
|
||||
HIDAPI_RemapVal(float val, float val_min, float val_max, float output_min, float output_max)
|
||||
float HIDAPI_RemapVal(float val, float val_min, float val_max, float output_min, float output_max)
|
||||
{
|
||||
return output_min + (output_max - output_min) * (val - val_min) / (val_max - val_min);
|
||||
}
|
||||
|
@ -127,12 +125,11 @@ HIDAPI_RemapVal(float val, float val_min, float val_max, float output_min, float
|
|||
static void HIDAPI_UpdateDeviceList(void);
|
||||
static void HIDAPI_JoystickClose(SDL_Joystick *joystick);
|
||||
|
||||
static SDL_GameControllerType
|
||||
SDL_GetJoystickGameControllerProtocol(const char *name, Uint16 vendor, Uint16 product, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
static SDL_GameControllerType SDL_GetJoystickGameControllerProtocol(const char *name, Uint16 vendor, Uint16 product, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
{
|
||||
static const int LIBUSB_CLASS_VENDOR_SPEC = 0xFF;
|
||||
static const int XB360_IFACE_SUBCLASS = 93;
|
||||
static const int XB360_IFACE_PROTOCOL = 1; /* Wired */
|
||||
static const int XB360_IFACE_PROTOCOL = 1; /* Wired */
|
||||
static const int XB360W_IFACE_PROTOCOL = 129; /* Wireless */
|
||||
static const int XBONE_IFACE_SUBCLASS = 71;
|
||||
static const int XBONE_IFACE_PROTOCOL = 208;
|
||||
|
@ -214,8 +211,7 @@ SDL_GetJoystickGameControllerProtocol(const char *name, Uint16 vendor, Uint16 pr
|
|||
return type;
|
||||
}
|
||||
|
||||
static SDL_bool
|
||||
HIDAPI_IsDeviceSupported(Uint16 vendor_id, Uint16 product_id, Uint16 version, const char *name)
|
||||
static SDL_bool HIDAPI_IsDeviceSupported(Uint16 vendor_id, Uint16 product_id, Uint16 version, const char *name)
|
||||
{
|
||||
int i;
|
||||
SDL_GameControllerType type = SDL_GetJoystickGameControllerProtocol(name, vendor_id, product_id, -1, 0, 0, 0);
|
||||
|
@ -229,8 +225,7 @@ HIDAPI_IsDeviceSupported(Uint16 vendor_id, Uint16 product_id, Uint16 version, co
|
|||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
static SDL_HIDAPI_DeviceDriver *
|
||||
HIDAPI_GetDeviceDriver(SDL_HIDAPI_Device *device)
|
||||
static SDL_HIDAPI_DeviceDriver *HIDAPI_GetDeviceDriver(SDL_HIDAPI_Device *device)
|
||||
{
|
||||
const Uint16 USAGE_PAGE_GENERIC_DESKTOP = 0x0001;
|
||||
const Uint16 USAGE_JOYSTICK = 0x0004;
|
||||
|
@ -264,8 +259,7 @@ HIDAPI_GetDeviceDriver(SDL_HIDAPI_Device *device)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static SDL_HIDAPI_Device *
|
||||
HIDAPI_GetDeviceByIndex(int device_index, SDL_JoystickID *pJoystickID)
|
||||
static SDL_HIDAPI_Device *HIDAPI_GetDeviceByIndex(int device_index, SDL_JoystickID *pJoystickID)
|
||||
{
|
||||
SDL_HIDAPI_Device *device;
|
||||
|
||||
|
@ -286,8 +280,7 @@ HIDAPI_GetDeviceByIndex(int device_index, SDL_JoystickID *pJoystickID)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static SDL_HIDAPI_Device *
|
||||
HIDAPI_GetJoystickByInfo(const char *path, Uint16 vendor_id, Uint16 product_id)
|
||||
static SDL_HIDAPI_Device *HIDAPI_GetJoystickByInfo(const char *path, Uint16 vendor_id, Uint16 product_id)
|
||||
{
|
||||
SDL_HIDAPI_Device *device;
|
||||
|
||||
|
@ -300,8 +293,7 @@ HIDAPI_GetJoystickByInfo(const char *path, Uint16 vendor_id, Uint16 product_id)
|
|||
return device;
|
||||
}
|
||||
|
||||
static void
|
||||
HIDAPI_CleanupDeviceDriver(SDL_HIDAPI_Device *device)
|
||||
static void HIDAPI_CleanupDeviceDriver(SDL_HIDAPI_Device *device)
|
||||
{
|
||||
if (!device->driver) {
|
||||
return; /* Already cleaned up */
|
||||
|
@ -330,8 +322,7 @@ HIDAPI_CleanupDeviceDriver(SDL_HIDAPI_Device *device)
|
|||
SDL_UnlockMutex(device->dev_lock);
|
||||
}
|
||||
|
||||
static void
|
||||
HIDAPI_SetupDeviceDriver(SDL_HIDAPI_Device *device, SDL_bool *removed)
|
||||
static void HIDAPI_SetupDeviceDriver(SDL_HIDAPI_Device *device, SDL_bool *removed)
|
||||
{
|
||||
*removed = SDL_FALSE;
|
||||
|
||||
|
@ -429,8 +420,7 @@ HIDAPI_SetupDeviceDriver(SDL_HIDAPI_Device *device, SDL_bool *removed)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
SDL_HIDAPI_UpdateDrivers(void)
|
||||
static void SDL_HIDAPI_UpdateDrivers(void)
|
||||
{
|
||||
int i;
|
||||
SDL_HIDAPI_Device *device;
|
||||
|
@ -456,8 +446,7 @@ SDL_HIDAPI_UpdateDrivers(void)
|
|||
} while (removed);
|
||||
}
|
||||
|
||||
static void SDLCALL
|
||||
SDL_HIDAPIDriverHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
|
||||
static void SDLCALL SDL_HIDAPIDriverHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
|
||||
{
|
||||
if (SDL_strcmp(name, SDL_HINT_JOYSTICK_HIDAPI_COMBINE_JOY_CONS) == 0) {
|
||||
SDL_HIDAPI_combine_joycons = SDL_GetStringBoolean(hint, SDL_TRUE);
|
||||
|
@ -466,8 +455,7 @@ SDL_HIDAPIDriverHintChanged(void *userdata, const char *name, const char *oldVal
|
|||
SDL_HIDAPI_change_count = 0;
|
||||
}
|
||||
|
||||
static int
|
||||
HIDAPI_JoystickInit(void)
|
||||
static int HIDAPI_JoystickInit(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -515,10 +503,9 @@ HIDAPI_JoystickInit(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static SDL_bool
|
||||
HIDAPI_AddJoystickInstanceToDevice(SDL_HIDAPI_Device *device, SDL_JoystickID joystickID)
|
||||
static SDL_bool HIDAPI_AddJoystickInstanceToDevice(SDL_HIDAPI_Device *device, SDL_JoystickID joystickID)
|
||||
{
|
||||
SDL_JoystickID *joysticks = (SDL_JoystickID *)SDL_realloc(device->joysticks, (device->num_joysticks + 1)*sizeof(*device->joysticks));
|
||||
SDL_JoystickID *joysticks = (SDL_JoystickID *)SDL_realloc(device->joysticks, (device->num_joysticks + 1) * sizeof(*device->joysticks));
|
||||
if (joysticks == NULL) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
@ -528,15 +515,14 @@ HIDAPI_AddJoystickInstanceToDevice(SDL_HIDAPI_Device *device, SDL_JoystickID joy
|
|||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
static SDL_bool
|
||||
HIDAPI_DelJoystickInstanceFromDevice(SDL_HIDAPI_Device *device, SDL_JoystickID joystickID)
|
||||
static SDL_bool HIDAPI_DelJoystickInstanceFromDevice(SDL_HIDAPI_Device *device, SDL_JoystickID joystickID)
|
||||
{
|
||||
int i, size;
|
||||
|
||||
for (i = 0; i < device->num_joysticks; ++i) {
|
||||
if (device->joysticks[i] == joystickID) {
|
||||
size = (device->num_joysticks - i - 1) * sizeof(SDL_JoystickID);
|
||||
SDL_memmove(&device->joysticks[i], &device->joysticks[i+1], size);
|
||||
SDL_memmove(&device->joysticks[i], &device->joysticks[i + 1], size);
|
||||
--device->num_joysticks;
|
||||
if (device->num_joysticks == 0) {
|
||||
SDL_free(device->joysticks);
|
||||
|
@ -548,8 +534,7 @@ HIDAPI_DelJoystickInstanceFromDevice(SDL_HIDAPI_Device *device, SDL_JoystickID j
|
|||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
static SDL_bool
|
||||
HIDAPI_JoystickInstanceIsUnique(SDL_HIDAPI_Device *device, SDL_JoystickID joystickID)
|
||||
static SDL_bool HIDAPI_JoystickInstanceIsUnique(SDL_HIDAPI_Device *device, SDL_JoystickID joystickID)
|
||||
{
|
||||
if (device->parent && device->num_joysticks == 1 && device->parent->num_joysticks == 1 &&
|
||||
device->joysticks[0] == device->parent->joysticks[0]) {
|
||||
|
@ -558,8 +543,7 @@ HIDAPI_JoystickInstanceIsUnique(SDL_HIDAPI_Device *device, SDL_JoystickID joysti
|
|||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
HIDAPI_SetDeviceName(SDL_HIDAPI_Device *device, const char *name)
|
||||
void HIDAPI_SetDeviceName(SDL_HIDAPI_Device *device, const char *name)
|
||||
{
|
||||
if (name && *name && SDL_strcmp(name, device->name) != 0) {
|
||||
SDL_free(device->name);
|
||||
|
@ -568,15 +552,13 @@ HIDAPI_SetDeviceName(SDL_HIDAPI_Device *device, const char *name)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
HIDAPI_SetDeviceProduct(SDL_HIDAPI_Device *device, Uint16 product_id)
|
||||
void HIDAPI_SetDeviceProduct(SDL_HIDAPI_Device *device, Uint16 product_id)
|
||||
{
|
||||
/* Don't set the device product ID directly, or we'll constantly re-enumerate this device */
|
||||
SDL_SetJoystickGUIDProduct(&device->guid, product_id);
|
||||
}
|
||||
|
||||
void
|
||||
HIDAPI_SetDeviceSerial(SDL_HIDAPI_Device *device, const char *serial)
|
||||
void HIDAPI_SetDeviceSerial(SDL_HIDAPI_Device *device, const char *serial)
|
||||
{
|
||||
if (serial && *serial && (!device->serial || SDL_strcmp(serial, device->serial) != 0)) {
|
||||
SDL_free(device->serial);
|
||||
|
@ -609,8 +591,7 @@ HIDAPI_HasConnectedUSBDevice(const char *serial)
|
|||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
HIDAPI_DisconnectBluetoothDevice(const char *serial)
|
||||
void HIDAPI_DisconnectBluetoothDevice(const char *serial)
|
||||
{
|
||||
SDL_HIDAPI_Device *device;
|
||||
|
||||
|
@ -643,7 +624,7 @@ HIDAPI_JoystickConnected(SDL_HIDAPI_Device *device, SDL_JoystickID *pJoystickID)
|
|||
|
||||
for (i = 0; i < device->num_children; ++i) {
|
||||
SDL_HIDAPI_Device *child = device->children[i];
|
||||
for (j = child->num_joysticks; j--; ) {
|
||||
for (j = child->num_joysticks; j--;) {
|
||||
HIDAPI_JoystickDisconnected(child, child->joysticks[j]);
|
||||
}
|
||||
}
|
||||
|
@ -666,11 +647,10 @@ HIDAPI_JoystickConnected(SDL_HIDAPI_Device *device, SDL_JoystickID *pJoystickID)
|
|||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
HIDAPI_JoystickDisconnected(SDL_HIDAPI_Device *device, SDL_JoystickID joystickID)
|
||||
void HIDAPI_JoystickDisconnected(SDL_HIDAPI_Device *device, SDL_JoystickID joystickID)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
|
||||
SDL_LockJoysticks();
|
||||
|
||||
if (!HIDAPI_JoystickInstanceIsUnique(device, joystickID)) {
|
||||
|
@ -706,26 +686,24 @@ HIDAPI_JoystickDisconnected(SDL_HIDAPI_Device *device, SDL_JoystickID joystickID
|
|||
SDL_UnlockJoysticks();
|
||||
}
|
||||
|
||||
static int
|
||||
HIDAPI_JoystickGetCount(void)
|
||||
static int HIDAPI_JoystickGetCount(void)
|
||||
{
|
||||
return SDL_HIDAPI_numjoysticks;
|
||||
}
|
||||
|
||||
static char *
|
||||
HIDAPI_ConvertString(const wchar_t *wide_string)
|
||||
static char *HIDAPI_ConvertString(const wchar_t *wide_string)
|
||||
{
|
||||
char *string = NULL;
|
||||
|
||||
if (wide_string) {
|
||||
string = SDL_iconv_string("UTF-8", "WCHAR_T", (char*)wide_string, (SDL_wcslen(wide_string)+1)*sizeof(wchar_t));
|
||||
string = SDL_iconv_string("UTF-8", "WCHAR_T", (char *)wide_string, (SDL_wcslen(wide_string) + 1) * sizeof(wchar_t));
|
||||
if (string == NULL) {
|
||||
switch (sizeof(wchar_t)) {
|
||||
case 2:
|
||||
string = SDL_iconv_string("UTF-8", "UCS-2-INTERNAL", (char*)wide_string, (SDL_wcslen(wide_string)+1)*sizeof(wchar_t));
|
||||
string = SDL_iconv_string("UTF-8", "UCS-2-INTERNAL", (char *)wide_string, (SDL_wcslen(wide_string) + 1) * sizeof(wchar_t));
|
||||
break;
|
||||
case 4:
|
||||
string = SDL_iconv_string("UTF-8", "UCS-4-INTERNAL", (char*)wide_string, (SDL_wcslen(wide_string)+1)*sizeof(wchar_t));
|
||||
string = SDL_iconv_string("UTF-8", "UCS-4-INTERNAL", (char *)wide_string, (SDL_wcslen(wide_string) + 1) * sizeof(wchar_t));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -733,8 +711,7 @@ HIDAPI_ConvertString(const wchar_t *wide_string)
|
|||
return string;
|
||||
}
|
||||
|
||||
static SDL_HIDAPI_Device *
|
||||
HIDAPI_AddDevice(const struct SDL_hid_device_info *info, int num_children, SDL_HIDAPI_Device **children)
|
||||
static SDL_HIDAPI_Device *HIDAPI_AddDevice(const struct SDL_hid_device_info *info, int num_children, SDL_HIDAPI_Device **children)
|
||||
{
|
||||
SDL_HIDAPI_Device *device;
|
||||
SDL_HIDAPI_Device *curr, *last = NULL;
|
||||
|
@ -829,9 +806,7 @@ HIDAPI_AddDevice(const struct SDL_hid_device_info *info, int num_children, SDL_H
|
|||
return device;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
HIDAPI_DelDevice(SDL_HIDAPI_Device *device)
|
||||
static void HIDAPI_DelDevice(SDL_HIDAPI_Device *device)
|
||||
{
|
||||
SDL_HIDAPI_Device *curr, *last;
|
||||
int i;
|
||||
|
@ -870,8 +845,7 @@ HIDAPI_DelDevice(SDL_HIDAPI_Device *device)
|
|||
}
|
||||
}
|
||||
|
||||
static SDL_bool
|
||||
HIDAPI_CreateCombinedJoyCons()
|
||||
static SDL_bool HIDAPI_CreateCombinedJoyCons()
|
||||
{
|
||||
SDL_HIDAPI_Device *device, *combined;
|
||||
SDL_HIDAPI_Device *joycons[2] = { NULL, NULL };
|
||||
|
@ -941,8 +915,7 @@ HIDAPI_CreateCombinedJoyCons()
|
|||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
HIDAPI_UpdateDeviceList(void)
|
||||
static void HIDAPI_UpdateDeviceList(void)
|
||||
{
|
||||
SDL_HIDAPI_Device *device;
|
||||
struct SDL_hid_device_info *devs, *info;
|
||||
|
@ -1018,8 +991,7 @@ check_removed:
|
|||
SDL_UnlockJoysticks();
|
||||
}
|
||||
|
||||
static SDL_bool
|
||||
HIDAPI_IsEquivalentToDevice(Uint16 vendor_id, Uint16 product_id, SDL_HIDAPI_Device *device)
|
||||
static SDL_bool HIDAPI_IsEquivalentToDevice(Uint16 vendor_id, Uint16 product_id, SDL_HIDAPI_Device *device)
|
||||
{
|
||||
if (vendor_id == device->vendor_id && product_id == device->product_id) {
|
||||
return SDL_TRUE;
|
||||
|
@ -1099,8 +1071,8 @@ HIDAPI_IsDevicePresent(Uint16 vendor_id, Uint16 product_id, Uint16 version, cons
|
|||
}
|
||||
|
||||
/* Only update the device list for devices we know might be supported.
|
||||
If we did this for every device, it would hit the USB driver too hard and potentially
|
||||
lock up the system. This won't catch devices that we support but can only detect using
|
||||
If we did this for every device, it would hit the USB driver too hard and potentially
|
||||
lock up the system. This won't catch devices that we support but can only detect using
|
||||
USB interface details, like Xbox controllers, but hopefully the device list update is
|
||||
responsive enough to catch those.
|
||||
*/
|
||||
|
@ -1174,8 +1146,7 @@ HIDAPI_GetGameControllerTypeFromGUID(SDL_JoystickGUID guid)
|
|||
return type;
|
||||
}
|
||||
|
||||
static void
|
||||
HIDAPI_JoystickDetect(void)
|
||||
static void HIDAPI_JoystickDetect(void)
|
||||
{
|
||||
if (SDL_AtomicTryLock(&SDL_HIDAPI_spinlock)) {
|
||||
Uint32 count = SDL_hid_device_change_count();
|
||||
|
@ -1187,8 +1158,7 @@ HIDAPI_JoystickDetect(void)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
HIDAPI_UpdateDevices(void)
|
||||
void HIDAPI_UpdateDevices(void)
|
||||
{
|
||||
SDL_HIDAPI_Device *device;
|
||||
|
||||
|
@ -1213,8 +1183,7 @@ HIDAPI_UpdateDevices(void)
|
|||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
HIDAPI_JoystickGetDeviceName(int device_index)
|
||||
static const char *HIDAPI_JoystickGetDeviceName(int device_index)
|
||||
{
|
||||
SDL_HIDAPI_Device *device;
|
||||
const char *name = NULL;
|
||||
|
@ -1228,8 +1197,7 @@ HIDAPI_JoystickGetDeviceName(int device_index)
|
|||
return name;
|
||||
}
|
||||
|
||||
static const char *
|
||||
HIDAPI_JoystickGetDevicePath(int device_index)
|
||||
static const char *HIDAPI_JoystickGetDevicePath(int device_index)
|
||||
{
|
||||
SDL_HIDAPI_Device *device;
|
||||
const char *path = NULL;
|
||||
|
@ -1243,8 +1211,7 @@ HIDAPI_JoystickGetDevicePath(int device_index)
|
|||
return path;
|
||||
}
|
||||
|
||||
static int
|
||||
HIDAPI_JoystickGetDevicePlayerIndex(int device_index)
|
||||
static int HIDAPI_JoystickGetDevicePlayerIndex(int device_index)
|
||||
{
|
||||
SDL_HIDAPI_Device *device;
|
||||
SDL_JoystickID instance_id;
|
||||
|
@ -1258,8 +1225,7 @@ HIDAPI_JoystickGetDevicePlayerIndex(int device_index)
|
|||
return player_index;
|
||||
}
|
||||
|
||||
static void
|
||||
HIDAPI_JoystickSetDevicePlayerIndex(int device_index, int player_index)
|
||||
static void HIDAPI_JoystickSetDevicePlayerIndex(int device_index, int player_index)
|
||||
{
|
||||
SDL_HIDAPI_Device *device;
|
||||
SDL_JoystickID instance_id;
|
||||
|
@ -1270,8 +1236,7 @@ HIDAPI_JoystickSetDevicePlayerIndex(int device_index, int player_index)
|
|||
}
|
||||
}
|
||||
|
||||
static SDL_JoystickGUID
|
||||
HIDAPI_JoystickGetDeviceGUID(int device_index)
|
||||
static SDL_JoystickGUID HIDAPI_JoystickGetDeviceGUID(int device_index)
|
||||
{
|
||||
SDL_HIDAPI_Device *device;
|
||||
SDL_JoystickGUID guid;
|
||||
|
@ -1286,16 +1251,14 @@ HIDAPI_JoystickGetDeviceGUID(int device_index)
|
|||
return guid;
|
||||
}
|
||||
|
||||
static SDL_JoystickID
|
||||
HIDAPI_JoystickGetDeviceInstanceID(int device_index)
|
||||
static SDL_JoystickID HIDAPI_JoystickGetDeviceInstanceID(int device_index)
|
||||
{
|
||||
SDL_JoystickID joystickID = -1;
|
||||
HIDAPI_GetDeviceByIndex(device_index, &joystickID);
|
||||
return joystickID;
|
||||
}
|
||||
|
||||
static int
|
||||
HIDAPI_JoystickOpen(SDL_Joystick *joystick, int device_index)
|
||||
static int HIDAPI_JoystickOpen(SDL_Joystick *joystick, int device_index)
|
||||
{
|
||||
SDL_JoystickID joystickID = -1;
|
||||
SDL_HIDAPI_Device *device = HIDAPI_GetDeviceByIndex(device_index, &joystickID);
|
||||
|
@ -1334,8 +1297,7 @@ HIDAPI_JoystickOpen(SDL_Joystick *joystick, int device_index)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
HIDAPI_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)
|
||||
static int HIDAPI_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)
|
||||
{
|
||||
int result;
|
||||
|
||||
|
@ -1350,8 +1312,7 @@ HIDAPI_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint1
|
|||
return result;
|
||||
}
|
||||
|
||||
static int
|
||||
HIDAPI_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble)
|
||||
static int HIDAPI_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble)
|
||||
{
|
||||
int result;
|
||||
|
||||
|
@ -1366,8 +1327,7 @@ HIDAPI_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16
|
|||
return result;
|
||||
}
|
||||
|
||||
static Uint32
|
||||
HIDAPI_JoystickGetCapabilities(SDL_Joystick *joystick)
|
||||
static Uint32 HIDAPI_JoystickGetCapabilities(SDL_Joystick *joystick)
|
||||
{
|
||||
Uint32 result = 0;
|
||||
|
||||
|
@ -1380,8 +1340,7 @@ HIDAPI_JoystickGetCapabilities(SDL_Joystick *joystick)
|
|||
return result;
|
||||
}
|
||||
|
||||
static int
|
||||
HIDAPI_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue)
|
||||
static int HIDAPI_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue)
|
||||
{
|
||||
int result;
|
||||
|
||||
|
@ -1396,8 +1355,7 @@ HIDAPI_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue
|
|||
return result;
|
||||
}
|
||||
|
||||
static int
|
||||
HIDAPI_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size)
|
||||
static int HIDAPI_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size)
|
||||
{
|
||||
int result;
|
||||
|
||||
|
@ -1412,8 +1370,7 @@ HIDAPI_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size)
|
|||
return result;
|
||||
}
|
||||
|
||||
static int
|
||||
HIDAPI_JoystickSetSensorsEnabled(SDL_Joystick *joystick, SDL_bool enabled)
|
||||
static int HIDAPI_JoystickSetSensorsEnabled(SDL_Joystick *joystick, SDL_bool enabled)
|
||||
{
|
||||
int result;
|
||||
|
||||
|
@ -1428,14 +1385,12 @@ HIDAPI_JoystickSetSensorsEnabled(SDL_Joystick *joystick, SDL_bool enabled)
|
|||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
HIDAPI_JoystickUpdate(SDL_Joystick *joystick)
|
||||
static void HIDAPI_JoystickUpdate(SDL_Joystick *joystick)
|
||||
{
|
||||
/* This is handled in SDL_HIDAPI_UpdateDevices() */
|
||||
}
|
||||
|
||||
static void
|
||||
HIDAPI_JoystickClose(SDL_Joystick *joystick)
|
||||
static void HIDAPI_JoystickClose(SDL_Joystick *joystick)
|
||||
{
|
||||
if (joystick->hwdata) {
|
||||
SDL_HIDAPI_Device *device = joystick->hwdata->device;
|
||||
|
@ -1463,8 +1418,7 @@ HIDAPI_JoystickClose(SDL_Joystick *joystick)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
HIDAPI_JoystickQuit(void)
|
||||
static void HIDAPI_JoystickQuit(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -1505,14 +1459,12 @@ HIDAPI_JoystickQuit(void)
|
|||
initialized = SDL_FALSE;
|
||||
}
|
||||
|
||||
static SDL_bool
|
||||
HIDAPI_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out)
|
||||
static SDL_bool HIDAPI_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out)
|
||||
{
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
SDL_JoystickDriver SDL_HIDAPI_JoystickDriver =
|
||||
{
|
||||
SDL_JoystickDriver SDL_HIDAPI_JoystickDriver = {
|
||||
HIDAPI_JoystickInit,
|
||||
HIDAPI_JoystickGetCount,
|
||||
HIDAPI_JoystickDetect,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue