mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-26 14:55:39 +00:00
sdl 2.0.8 update
This commit is contained in:
parent
7f674a59c6
commit
bfb08f9482
894 changed files with 66879 additions and 43299 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
@ -38,8 +38,10 @@
|
|||
#include "SDL_assert.h"
|
||||
#include "SDL_joystick.h"
|
||||
#include "SDL_endian.h"
|
||||
#include "../../events/SDL_events_c.h"
|
||||
#include "../SDL_sysjoystick.h"
|
||||
#include "../SDL_joystick_c.h"
|
||||
#include "../steam/SDL_steamcontroller.h"
|
||||
#include "SDL_sysjoystick_c.h"
|
||||
|
||||
/* This isn't defined in older Linux kernel headers */
|
||||
|
|
@ -52,7 +54,7 @@
|
|||
static int MaybeAddDevice(const char *path);
|
||||
#if SDL_USE_LIBUDEV
|
||||
static int MaybeRemoveDevice(const char *path);
|
||||
void joystick_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath);
|
||||
static void joystick_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath);
|
||||
#endif /* SDL_USE_LIBUDEV */
|
||||
|
||||
|
||||
|
|
@ -66,6 +68,9 @@ typedef struct SDL_joylist_item
|
|||
dev_t devnum;
|
||||
struct joystick_hwdata *hwdata;
|
||||
struct SDL_joylist_item *next;
|
||||
|
||||
/* Steam Controller support */
|
||||
SDL_bool m_bSteamController;
|
||||
} SDL_joylist_item;
|
||||
|
||||
static SDL_joylist_item *SDL_joylist = NULL;
|
||||
|
|
@ -73,6 +78,7 @@ static SDL_joylist_item *SDL_joylist_tail = NULL;
|
|||
static int numjoysticks = 0;
|
||||
static int instance_counter = 0;
|
||||
|
||||
|
||||
#define test_bit(nr, addr) \
|
||||
(((1UL << ((nr) % (sizeof(long) * 8))) & ((addr)[(nr) / (sizeof(long) * 8)])) != 0)
|
||||
#define NBITS(x) ((((x)-1)/(sizeof(long) * 8))+1)
|
||||
|
|
@ -80,8 +86,102 @@ static int instance_counter = 0;
|
|||
static int
|
||||
IsJoystick(int fd, char *namebuf, const size_t namebuflen, SDL_JoystickGUID *guid)
|
||||
{
|
||||
/* This list is taken from:
|
||||
https://raw.githubusercontent.com/denilsonsa/udev-joystick-blacklist/master/generate_rules.py
|
||||
*/
|
||||
static Uint32 joystick_blacklist[] = {
|
||||
/* Microsoft Microsoft Wireless Optical Desktop® 2.10 */
|
||||
/* Microsoft Wireless Desktop - Comfort Edition */
|
||||
MAKE_VIDPID(0x045e, 0x009d),
|
||||
|
||||
/* Microsoft Microsoft® Digital Media Pro Keyboard */
|
||||
/* Microsoft Corp. Digital Media Pro Keyboard */
|
||||
MAKE_VIDPID(0x045e, 0x00b0),
|
||||
|
||||
/* Microsoft Microsoft® Digital Media Keyboard */
|
||||
/* Microsoft Corp. Digital Media Keyboard 1.0A */
|
||||
MAKE_VIDPID(0x045e, 0x00b4),
|
||||
|
||||
/* Microsoft Microsoft® Digital Media Keyboard 3000 */
|
||||
MAKE_VIDPID(0x045e, 0x0730),
|
||||
|
||||
/* Microsoft Microsoft® 2.4GHz Transceiver v6.0 */
|
||||
/* Microsoft Microsoft® 2.4GHz Transceiver v8.0 */
|
||||
/* Microsoft Corp. Nano Transceiver v1.0 for Bluetooth */
|
||||
/* Microsoft Wireless Mobile Mouse 1000 */
|
||||
/* Microsoft Wireless Desktop 3000 */
|
||||
MAKE_VIDPID(0x045e, 0x0745),
|
||||
|
||||
/* Microsoft® SideWinder(TM) 2.4GHz Transceiver */
|
||||
MAKE_VIDPID(0x045e, 0x0748),
|
||||
|
||||
/* Microsoft Corp. Wired Keyboard 600 */
|
||||
MAKE_VIDPID(0x045e, 0x0750),
|
||||
|
||||
/* Microsoft Corp. Sidewinder X4 keyboard */
|
||||
MAKE_VIDPID(0x045e, 0x0768),
|
||||
|
||||
/* Microsoft Corp. Arc Touch Mouse Transceiver */
|
||||
MAKE_VIDPID(0x045e, 0x0773),
|
||||
|
||||
/* Microsoft® 2.4GHz Transceiver v9.0 */
|
||||
/* Microsoft® Nano Transceiver v2.1 */
|
||||
/* Microsoft Sculpt Ergonomic Keyboard (5KV-00001) */
|
||||
MAKE_VIDPID(0x045e, 0x07a5),
|
||||
|
||||
/* Microsoft® Nano Transceiver v1.0 */
|
||||
/* Microsoft Wireless Keyboard 800 */
|
||||
MAKE_VIDPID(0x045e, 0x07b2),
|
||||
|
||||
/* Microsoft® Nano Transceiver v2.0 */
|
||||
MAKE_VIDPID(0x045e, 0x0800),
|
||||
|
||||
/* List of Wacom devices at: http://linuxwacom.sourceforge.net/wiki/index.php/Device_IDs */
|
||||
MAKE_VIDPID(0x056a, 0x0010), /* Wacom ET-0405 Graphire */
|
||||
MAKE_VIDPID(0x056a, 0x0011), /* Wacom ET-0405A Graphire2 (4x5) */
|
||||
MAKE_VIDPID(0x056a, 0x0012), /* Wacom ET-0507A Graphire2 (5x7) */
|
||||
MAKE_VIDPID(0x056a, 0x0013), /* Wacom CTE-430 Graphire3 (4x5) */
|
||||
MAKE_VIDPID(0x056a, 0x0014), /* Wacom CTE-630 Graphire3 (6x8) */
|
||||
MAKE_VIDPID(0x056a, 0x0015), /* Wacom CTE-440 Graphire4 (4x5) */
|
||||
MAKE_VIDPID(0x056a, 0x0016), /* Wacom CTE-640 Graphire4 (6x8) */
|
||||
MAKE_VIDPID(0x056a, 0x0017), /* Wacom CTE-450 Bamboo Fun (4x5) */
|
||||
MAKE_VIDPID(0x056a, 0x0016), /* Wacom CTE-640 Graphire 4 6x8 */
|
||||
MAKE_VIDPID(0x056a, 0x0017), /* Wacom CTE-450 Bamboo Fun 4x5 */
|
||||
MAKE_VIDPID(0x056a, 0x0018), /* Wacom CTE-650 Bamboo Fun 6x8 */
|
||||
MAKE_VIDPID(0x056a, 0x0019), /* Wacom CTE-631 Bamboo One */
|
||||
MAKE_VIDPID(0x056a, 0x00d1), /* Wacom Bamboo Pen and Touch CTH-460 */
|
||||
|
||||
MAKE_VIDPID(0x09da, 0x054f), /* A4 Tech Co., G7 750 mouse */
|
||||
MAKE_VIDPID(0x09da, 0x3043), /* A4 Tech Co., Ltd Bloody R8A Gaming Mouse */
|
||||
MAKE_VIDPID(0x09da, 0x31b5), /* A4 Tech Co., Ltd Bloody TL80 Terminator Laser Gaming Mouse */
|
||||
MAKE_VIDPID(0x09da, 0x3997), /* A4 Tech Co., Ltd Bloody RT7 Terminator Wireless */
|
||||
MAKE_VIDPID(0x09da, 0x3f8b), /* A4 Tech Co., Ltd Bloody V8 mouse */
|
||||
MAKE_VIDPID(0x09da, 0x51f4), /* Modecom MC-5006 Keyboard */
|
||||
MAKE_VIDPID(0x09da, 0x5589), /* A4 Tech Co., Ltd Terminator TL9 Laser Gaming Mouse */
|
||||
MAKE_VIDPID(0x09da, 0x7b22), /* A4 Tech Co., Ltd Bloody V5 */
|
||||
MAKE_VIDPID(0x09da, 0x7f2d), /* A4 Tech Co., Ltd Bloody R3 mouse */
|
||||
MAKE_VIDPID(0x09da, 0x8090), /* A4 Tech Co., Ltd X-718BK Oscar Optical Gaming Mouse */
|
||||
MAKE_VIDPID(0x09da, 0x9066), /* A4 Tech Co., Sharkoon Fireglider Optical */
|
||||
MAKE_VIDPID(0x09da, 0x9090), /* A4 Tech Co., Ltd XL-730K / XL-750BK / XL-755BK Laser Mouse */
|
||||
MAKE_VIDPID(0x09da, 0x90c0), /* A4 Tech Co., Ltd X7 G800V keyboard */
|
||||
MAKE_VIDPID(0x09da, 0xf012), /* A4 Tech Co., Ltd Bloody V7 mouse */
|
||||
MAKE_VIDPID(0x09da, 0xf32a), /* A4 Tech Co., Ltd Bloody B540 keyboard */
|
||||
MAKE_VIDPID(0x09da, 0xf613), /* A4 Tech Co., Ltd Bloody V2 mouse */
|
||||
MAKE_VIDPID(0x09da, 0xf624), /* A4 Tech Co., Ltd Bloody B120 Keyboard */
|
||||
|
||||
MAKE_VIDPID(0x1d57, 0xad03), /* [T3] 2.4GHz and IR Air Mouse Remote Control */
|
||||
|
||||
MAKE_VIDPID(0x1e7d, 0x2e4a), /* Roccat Tyon Mouse */
|
||||
|
||||
MAKE_VIDPID(0x20a0, 0x422d), /* Winkeyless.kr Keyboards */
|
||||
|
||||
MAKE_VIDPID(0x2516, 0x001f), /* Cooler Master Storm Mizar Mouse */
|
||||
MAKE_VIDPID(0x2516, 0x0028), /* Cooler Master Storm Alcor Mouse */
|
||||
};
|
||||
struct input_id inpid;
|
||||
Uint16 *guid16 = (Uint16 *) ((char *) &guid->data);
|
||||
int i;
|
||||
Uint32 id;
|
||||
Uint16 *guid16 = (Uint16 *)guid->data;
|
||||
|
||||
#if !SDL_USE_LIBUDEV
|
||||
/* When udev is enabled we only get joystick devices here, so there's no need to test them */
|
||||
|
|
@ -109,33 +209,45 @@ IsJoystick(int fd, char *namebuf, const size_t namebuflen, SDL_JoystickGUID *gui
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Check the joystick blacklist */
|
||||
id = MAKE_VIDPID(inpid.vendor, inpid.product);
|
||||
for (i = 0; i < SDL_arraysize(joystick_blacklist); ++i) {
|
||||
if (id == joystick_blacklist[i]) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG_JOYSTICK
|
||||
printf("Joystick: %s, bustype = %d, vendor = 0x%x, product = 0x%x, version = %d\n", namebuf, inpid.bustype, inpid.vendor, inpid.product, inpid.version);
|
||||
printf("Joystick: %s, bustype = %d, vendor = 0x%.4x, product = 0x%.4x, version = %d\n", namebuf, inpid.bustype, inpid.vendor, inpid.product, inpid.version);
|
||||
#endif
|
||||
|
||||
SDL_memset(guid->data, 0, sizeof(guid->data));
|
||||
|
||||
/* We only need 16 bits for each of these; space them out to fill 128. */
|
||||
/* Byteswap so devices get same GUID on little/big endian platforms. */
|
||||
*(guid16++) = SDL_SwapLE16(inpid.bustype);
|
||||
*(guid16++) = 0;
|
||||
*guid16++ = SDL_SwapLE16(inpid.bustype);
|
||||
*guid16++ = 0;
|
||||
|
||||
if (inpid.vendor && inpid.product && inpid.version) {
|
||||
*(guid16++) = SDL_SwapLE16(inpid.vendor);
|
||||
*(guid16++) = 0;
|
||||
*(guid16++) = SDL_SwapLE16(inpid.product);
|
||||
*(guid16++) = 0;
|
||||
*(guid16++) = SDL_SwapLE16(inpid.version);
|
||||
*(guid16++) = 0;
|
||||
if (inpid.vendor && inpid.product) {
|
||||
*guid16++ = SDL_SwapLE16(inpid.vendor);
|
||||
*guid16++ = 0;
|
||||
*guid16++ = SDL_SwapLE16(inpid.product);
|
||||
*guid16++ = 0;
|
||||
*guid16++ = SDL_SwapLE16(inpid.version);
|
||||
*guid16++ = 0;
|
||||
} else {
|
||||
SDL_strlcpy((char*)guid16, namebuf, sizeof(guid->data) - 4);
|
||||
}
|
||||
|
||||
if (SDL_IsGameControllerNameAndGUID(namebuf, *guid) &&
|
||||
SDL_ShouldIgnoreGameController(namebuf, *guid)) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if SDL_USE_LIBUDEV
|
||||
void joystick_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath)
|
||||
static void joystick_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath)
|
||||
{
|
||||
if (devpath == NULL) {
|
||||
return;
|
||||
|
|
@ -282,6 +394,7 @@ MaybeRemoveDevice(const char *path)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if ! SDL_USE_LIBUDEV
|
||||
static int
|
||||
JoystickInitWithoutUdev(void)
|
||||
{
|
||||
|
|
@ -298,7 +411,7 @@ JoystickInitWithoutUdev(void)
|
|||
|
||||
return numjoysticks;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if SDL_USE_LIBUDEV
|
||||
static int
|
||||
|
|
@ -321,6 +434,77 @@ JoystickInitWithUdev(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
static SDL_bool SteamControllerConnectedCallback(const char *name, SDL_JoystickGUID guid, int *device_instance)
|
||||
{
|
||||
SDL_joylist_item *item;
|
||||
|
||||
item = (SDL_joylist_item *) SDL_calloc(1, sizeof (SDL_joylist_item));
|
||||
if (item == NULL) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
item->path = SDL_strdup("");
|
||||
item->name = SDL_strdup(name);
|
||||
item->guid = guid;
|
||||
item->m_bSteamController = SDL_TRUE;
|
||||
|
||||
if ((item->path == NULL) || (item->name == NULL)) {
|
||||
SDL_free(item->path);
|
||||
SDL_free(item->name);
|
||||
SDL_free(item);
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
*device_instance = item->device_instance = instance_counter++;
|
||||
if (SDL_joylist_tail == NULL) {
|
||||
SDL_joylist = SDL_joylist_tail = item;
|
||||
} else {
|
||||
SDL_joylist_tail->next = item;
|
||||
SDL_joylist_tail = item;
|
||||
}
|
||||
|
||||
/* Need to increment the joystick count before we post the event */
|
||||
++numjoysticks;
|
||||
|
||||
SDL_PrivateJoystickAdded(numjoysticks - 1);
|
||||
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
static void SteamControllerDisconnectedCallback(int device_instance)
|
||||
{
|
||||
SDL_joylist_item *item;
|
||||
SDL_joylist_item *prev = NULL;
|
||||
|
||||
for (item = SDL_joylist; item != NULL; item = item->next) {
|
||||
/* found it, remove it. */
|
||||
if (item->device_instance == device_instance) {
|
||||
if (item->hwdata) {
|
||||
item->hwdata->item = NULL;
|
||||
}
|
||||
if (prev != NULL) {
|
||||
prev->next = item->next;
|
||||
} else {
|
||||
SDL_assert(SDL_joylist == item);
|
||||
SDL_joylist = item->next;
|
||||
}
|
||||
if (item == SDL_joylist_tail) {
|
||||
SDL_joylist_tail = prev;
|
||||
}
|
||||
|
||||
/* Need to decrement the joystick count before we post the event */
|
||||
--numjoysticks;
|
||||
|
||||
SDL_PrivateJoystickRemoved(item->device_instance);
|
||||
|
||||
SDL_free(item->name);
|
||||
SDL_free(item);
|
||||
return;
|
||||
}
|
||||
prev = item;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
SDL_SYS_JoystickInit(void)
|
||||
{
|
||||
|
|
@ -340,24 +524,30 @@ SDL_SYS_JoystickInit(void)
|
|||
SDL_free(envcopy);
|
||||
}
|
||||
|
||||
SDL_InitSteamControllers(SteamControllerConnectedCallback,
|
||||
SteamControllerDisconnectedCallback);
|
||||
|
||||
#if SDL_USE_LIBUDEV
|
||||
return JoystickInitWithUdev();
|
||||
#endif
|
||||
|
||||
#else
|
||||
return JoystickInitWithoutUdev();
|
||||
#endif
|
||||
}
|
||||
|
||||
int SDL_SYS_NumJoysticks()
|
||||
int
|
||||
SDL_SYS_NumJoysticks(void)
|
||||
{
|
||||
return numjoysticks;
|
||||
}
|
||||
|
||||
void SDL_SYS_JoystickDetect()
|
||||
void
|
||||
SDL_SYS_JoystickDetect(void)
|
||||
{
|
||||
#if SDL_USE_LIBUDEV
|
||||
SDL_UDEV_Poll();
|
||||
#endif
|
||||
|
||||
|
||||
SDL_UpdateSteamControllers();
|
||||
}
|
||||
|
||||
static SDL_joylist_item *
|
||||
|
|
@ -446,16 +636,16 @@ ConfigJoystick(SDL_Joystick * joystick, int fd)
|
|||
#ifdef DEBUG_INPUT_EVENTS
|
||||
printf("Joystick has button: 0x%x\n", i);
|
||||
#endif
|
||||
joystick->hwdata->key_map[i - BTN_MISC] = joystick->nbuttons;
|
||||
joystick->hwdata->key_map[i] = joystick->nbuttons;
|
||||
++joystick->nbuttons;
|
||||
}
|
||||
}
|
||||
for (i = BTN_MISC; i < BTN_JOYSTICK; ++i) {
|
||||
for (i = 0; i < BTN_JOYSTICK; ++i) {
|
||||
if (test_bit(i, keybit)) {
|
||||
#ifdef DEBUG_INPUT_EVENTS
|
||||
printf("Joystick has button: 0x%x\n", i);
|
||||
#endif
|
||||
joystick->hwdata->key_map[i - BTN_MISC] = joystick->nbuttons;
|
||||
joystick->hwdata->key_map[i] = joystick->nbuttons;
|
||||
++joystick->nbuttons;
|
||||
}
|
||||
}
|
||||
|
|
@ -541,47 +731,53 @@ int
|
|||
SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
|
||||
{
|
||||
SDL_joylist_item *item = JoystickByDevIndex(device_index);
|
||||
char *fname = NULL;
|
||||
int fd = -1;
|
||||
|
||||
if (item == NULL) {
|
||||
return SDL_SetError("No such device");
|
||||
}
|
||||
|
||||
fname = item->path;
|
||||
fd = open(fname, O_RDONLY, 0);
|
||||
if (fd < 0) {
|
||||
return SDL_SetError("Unable to open %s", fname);
|
||||
}
|
||||
|
||||
joystick->instance_id = item->device_instance;
|
||||
joystick->hwdata = (struct joystick_hwdata *)
|
||||
SDL_malloc(sizeof(*joystick->hwdata));
|
||||
SDL_calloc(1, sizeof(*joystick->hwdata));
|
||||
if (joystick->hwdata == NULL) {
|
||||
close(fd);
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_memset(joystick->hwdata, 0, sizeof(*joystick->hwdata));
|
||||
joystick->hwdata->item = item;
|
||||
joystick->hwdata->guid = item->guid;
|
||||
joystick->hwdata->fd = fd;
|
||||
joystick->hwdata->fname = SDL_strdup(item->path);
|
||||
if (joystick->hwdata->fname == NULL) {
|
||||
SDL_free(joystick->hwdata);
|
||||
joystick->hwdata = NULL;
|
||||
close(fd);
|
||||
return SDL_OutOfMemory();
|
||||
joystick->hwdata->m_bSteamController = item->m_bSteamController;
|
||||
|
||||
if (item->m_bSteamController) {
|
||||
joystick->hwdata->fd = -1;
|
||||
SDL_GetSteamControllerInputs(&joystick->nbuttons,
|
||||
&joystick->naxes,
|
||||
&joystick->nhats);
|
||||
} else {
|
||||
int fd = open(item->path, O_RDONLY, 0);
|
||||
if (fd < 0) {
|
||||
SDL_free(joystick->hwdata);
|
||||
joystick->hwdata = NULL;
|
||||
return SDL_SetError("Unable to open %s", item->path);
|
||||
}
|
||||
|
||||
joystick->hwdata->fd = fd;
|
||||
joystick->hwdata->fname = SDL_strdup(item->path);
|
||||
if (joystick->hwdata->fname == NULL) {
|
||||
SDL_free(joystick->hwdata);
|
||||
joystick->hwdata = NULL;
|
||||
close(fd);
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
/* Set the joystick to non-blocking read mode */
|
||||
fcntl(fd, F_SETFL, O_NONBLOCK);
|
||||
|
||||
/* Get the number of buttons and axes on the joystick */
|
||||
ConfigJoystick(joystick, fd);
|
||||
}
|
||||
|
||||
SDL_assert(item->hwdata == NULL);
|
||||
item->hwdata = joystick->hwdata;
|
||||
|
||||
/* Set the joystick to non-blocking read mode */
|
||||
fcntl(fd, F_SETFL, O_NONBLOCK);
|
||||
|
||||
/* Get the number of buttons and axes on the joystick */
|
||||
ConfigJoystick(joystick, fd);
|
||||
|
||||
/* mark joystick as fresh and ready */
|
||||
joystick->hwdata->fresh = 1;
|
||||
|
||||
|
|
@ -712,12 +908,9 @@ HandleInputEvents(SDL_Joystick * joystick)
|
|||
code = events[i].code;
|
||||
switch (events[i].type) {
|
||||
case EV_KEY:
|
||||
if (code >= BTN_MISC) {
|
||||
code -= BTN_MISC;
|
||||
SDL_PrivateJoystickButton(joystick,
|
||||
joystick->hwdata->key_map[code],
|
||||
events[i].value);
|
||||
}
|
||||
SDL_PrivateJoystickButton(joystick,
|
||||
joystick->hwdata->key_map[code],
|
||||
events[i].value);
|
||||
break;
|
||||
case EV_ABS:
|
||||
switch (code) {
|
||||
|
|
@ -775,6 +968,11 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
|
|||
{
|
||||
int i;
|
||||
|
||||
if (joystick->hwdata->m_bSteamController) {
|
||||
SDL_UpdateSteamController(joystick);
|
||||
return;
|
||||
}
|
||||
|
||||
HandleInputEvents(joystick);
|
||||
|
||||
/* Deliver ball motion updates */
|
||||
|
|
@ -796,7 +994,9 @@ void
|
|||
SDL_SYS_JoystickClose(SDL_Joystick * joystick)
|
||||
{
|
||||
if (joystick->hwdata) {
|
||||
close(joystick->hwdata->fd);
|
||||
if (joystick->hwdata->fd >= 0) {
|
||||
close(joystick->hwdata->fd);
|
||||
}
|
||||
if (joystick->hwdata->item) {
|
||||
joystick->hwdata->item->hwdata = NULL;
|
||||
}
|
||||
|
|
@ -830,6 +1030,8 @@ SDL_SYS_JoystickQuit(void)
|
|||
SDL_UDEV_DelCallback(joystick_udev_callback);
|
||||
SDL_UDEV_Quit();
|
||||
#endif
|
||||
|
||||
SDL_QuitSteamControllers();
|
||||
}
|
||||
|
||||
SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
@ -43,7 +43,7 @@ struct joystick_hwdata
|
|||
} *balls;
|
||||
|
||||
/* Support for the Linux 2.4 unified input interface */
|
||||
Uint8 key_map[KEY_MAX - BTN_MISC];
|
||||
Uint8 key_map[KEY_MAX];
|
||||
Uint8 abs_map[ABS_MAX];
|
||||
struct axis_correct
|
||||
{
|
||||
|
|
@ -52,6 +52,9 @@ struct joystick_hwdata
|
|||
} abs_correct[ABS_MAX];
|
||||
|
||||
int fresh;
|
||||
|
||||
/* Steam Controller support */
|
||||
SDL_bool m_bSteamController;
|
||||
};
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue