Commit Graph

1007 Commits

Author SHA1 Message Date
Sam Lantinga
c2dd50a9a0 Fixed whitespace 2021-11-12 08:28:02 -08:00
Cameron Gutman
50971577e4 dinput: Fix memory leak when SDL_DINPUT_JoystickPresent() returns true 2021-11-11 22:35:41 -06:00
Cameron Gutman
fe09a4930a joystick: Add APIs to query rumble support 2021-11-11 15:10:08 -08:00
Cameron Gutman
afccabb881 joystick: Add capability flags for rumble and trigger rumble
When API limitations force us to guess, we favor a false positive (reporting
support when it doesn't exist) compared to a false negative.
2021-11-11 15:10:08 -08:00
Cameron Gutman
1ccfbf963e joystick: Convert HasLED() into a generic GetCapabilities() function 2021-11-11 15:10:08 -08:00
Sam Lantinga
b9b0df40bf Fixed Linux build 2021-11-11 12:52:40 -08:00
Sam Lantinga
c9ada1c142 Made HIDAPI device change notifications available via SDL_hid_device_change_count() 2021-11-11 12:46:10 -08:00
Sam Lantinga
ebed961cb2 Fixed build with older Linux kernel headers 2021-11-11 09:51:39 -08:00
Sam Lantinga
828a0a4a10 Fixed mapping for PS4 controller when using the classic Joystick
interface on Linux
2021-11-11 07:13:29 -08:00
Sam Lantinga
dc9de1e2bd Get the correct USB VID/PID information for /dev/input/js* devices 2021-11-11 07:03:30 -08:00
Sam Lantinga
bd92a95f22 Cleanup for the /dev/js* support (thanks @meyraud705) 2021-11-11 06:30:36 -08:00
Sam Lantinga
1c78b08007 Added support for /dev/input/js* on Linux
Added the hint SDL_HINT_LINUX_JOYSTICK_CLASSIC to control whether /dev/input/js* or /dev/input/event* are used as joystick devices

Added the hint SDL_HINT_JOYSTICK_DEVICE to allow the user to specify devices t
hat will be opened in addition to the normal joystick detection

Fixes https://github.com/libsdl-org/SDL/issues/1314
Fixes https://github.com/libsdl-org/SDL/issues/1727
Fixes https://github.com/libsdl-org/SDL/issues/1981
Closes https://github.com/libsdl-org/SDL/pull/4727
2021-11-10 20:02:25 -08:00
Sam Lantinga
65a50b2430 Re-enable udev joystick enumeration by default 2021-11-10 16:15:22 -08:00
Sam Lantinga
7681929cb4 Don't send the initial joystick axis event if the application is in the background 2021-11-09 12:30:37 -08:00
Sam Lantinga
d31f90d9e1 Don't send game controller touchpad or sensor events unless the application has focus
Fixes https://github.com/libsdl-org/SDL/issues/4891
2021-11-09 12:09:01 -08:00
Sam Lantinga
2a6feb5011 Removed accidental debugging commit (thanks @DomGries!) 2021-11-08 07:10:38 -08:00
Sam Lantinga
5b646cd19e Build hidapi code into SDL as a new public API
This prevents conflicts with hidapi linked with applications, as well as allowing applications to make use of HIDAPI on Android and other platforms that might not normally have an implementation available.
2021-11-07 23:00:59 -08:00
Cameron Gutman
f6dc47caef WGI/DInput: Fix SDL_IsXInputDevice() checks when RawInput is enabled
Enabling the RawInput backend causes SDL_XINPUT_Enabled() to return false.
That causes WGI and DInput backends to take ownership of XInput-compatible
controllers, because they think there's no XInput-specific backend enabled.

In WGI's case, it will actually race with RawInput to open the device. By
properly excluding XInput devices from WGI, we can ensure that the sets of
devices managed by WGI and RawInput don't intersect. This makes the race
harmless, since they'll never both go after the same device.
2021-11-07 16:14:33 -06:00
Sam Lantinga
301389cecc Fixed iOS build 2021-11-07 13:53:12 -08:00
Cameron Gutman
b3e909dc41 WGI: Fix SDL_IsXInputDevice() for Xbox One controllers
The Xbox One driver stack doesn't propagate the VID/PID down to the
HID devices that end up in the GetRawInputDeviceList() output. This
means we end up matching against the wrong VID/PID and can't properly
exclude Xbox One controllers from WGI.

Fortunately, it is possible to walk back up the device tree to find
the parent with the matching VID/PID.
2021-11-07 13:33:18 -08:00
Sam Lantinga
b8c00bf914 Allow opening joysticks that are read-only on Linux
Fixes https://github.com/libsdl-org/SDL/issues/4713
2021-11-07 13:11:29 -08:00
Sam Lantinga
0323d983c6 Add the platform to the game controller mapping so it can be read back in without changes
Fixes https://github.com/libsdl-org/SDL/issues/4848
2021-11-07 12:52:48 -08:00
Sam Lantinga
fe2fe29049 Backed out accidentally committed PR https://github.com/libsdl-org/SDL/pull/4849 2021-11-07 11:48:16 -08:00
Sam Lantinga
86bc65a741 Fixed non-Apple builds 2021-11-07 11:35:12 -08:00
Sam Lantinga
637bcd0b72 Fixed build warnings 2021-11-07 11:19:07 -08:00
Sam Lantinga
e14358265e Cleanup sfSymbolName support and add them to the dynamic API functions 2021-11-07 11:16:48 -08:00
Patrick Hogan
149e5c656a Support returning sfSymbolsName for gamepad controls on macOS / iOS / tvOS 2021-11-07 10:58:37 -08:00
Cameron Gutman
6312aaea0f WGI: Add workaround for delayed callbacks after WGI_JoystickQuit() 2021-11-06 21:35:01 -07:00
Cameron Gutman
2371b247ff windows: improve feature detection consistency between CMake and non-CMake builds 2021-11-03 08:41:36 -07:00
Sam Lantinga
26706319d7 Ignore the ASRock LED controller, it's not a joystick 2021-10-30 05:53:12 -07:00
Tanuj Bagaria
1f0eb03a76
Fix PS5 mapping with HID-PLAYSTATION driver (#4675)
* add missing PS5 Linux GUID for Bluetooth

* Fix PS5 Mapping to work with HID-Playstation driver
2021-10-24 17:54:26 -05:00
Sam Lantinga
f3fd1ffb99 Fixed crash if SDL API functions are called on a disconnected controller on iOS 2021-10-20 15:18:03 -07:00
Sam Lantinga
a43d3f6931 Don't detect the ROG Chakram mouse as a joystick 2021-10-20 15:19:22 -07:00
Ozkan Sezer
8e9ea2e362 SDL_os2joystick.c: missed replacing a use of libc function 2021-10-18 14:10:37 +03:00
shaquan-omari
ea97ab6164 Add mapping for HORI Fighting Commander OCTA controller on Linux 2021-10-16 15:25:38 -07:00
Ozkan Sezer
e92a639b23 replaced many uses of libc calls with SDL_ counterparts in os2 sources.
TODO: core/os2 and geniconv sources _must_ be updated, as well..
2021-10-04 23:00:28 +03:00
Sam Lantinga
c501d159a9 Fixed range for Steam Controller sensor values 2021-10-03 14:10:21 -07:00
Sam Lantinga
ea1a2b94f2 Use the correct update rate for Steam Controller sensors 2021-10-02 09:13:29 -07:00
Sam Lantinga
8b74575267 Added support for the gyro and accelerometer on Steam Controllers
Fixes https://github.com/libsdl-org/SDL/issues/4577
2021-10-01 21:32:21 -07:00
Sam Lantinga
9706feacae Update length after shortening string (thanks mayraud705!)
Closes https://github.com/libsdl-org/SDL/pull/4698
2021-10-01 15:11:25 -07:00
Cameron Cawley
08ae790497 Replace calls to asprintf with SDL_asprintf 2021-09-22 11:53:46 -07:00
Sam Lantinga
345c161feb Fixed some accidental uses of external C runtime functions 2021-09-22 09:06:45 -07:00
Sam Lantinga
ff85d4fbe5 Fixed Xbox Series X controller being detected by both IOKit and GCController on macOS 2021-09-08 17:51:47 -07:00
Sam Lantinga
9f8552588d Added mapping for Xbox One S controller with newer firmware on macOS 2021-09-08 17:50:17 -07:00
Sam Lantinga
bf97c5a22f Make sure SDL file descriptors don't leak into child processes 2021-09-08 14:47:40 -07:00
Sam Lantinga
7ed7644a26 Fixed compiling HIDAPI Steam Controller support with C89 compiler 2021-09-07 17:37:47 -07:00
Sam Lantinga
27a48b142b Check the pathname first, as that's a faster check for XInput devices 2021-09-07 15:50:21 -07:00
Sam Lantinga
503ea8e89f Don't modify the Nintendo Switch home LED state by default 2021-08-25 14:42:16 -07:00
Sam Lantinga
130b6bebae Manually scan for Linux joysticks before udev scan runs
This allows us to have joysticks sorted by insert time at startup, fixing https://github.com/libsdl-org/SDL/issues/4688
2021-08-24 17:03:19 -07:00
Sam Lantinga
cbccf5bb50 Use SDL_GetHint() instead of SDL_getenv() for Linux joystick hints 2021-08-24 17:03:19 -07:00