Sam Lantinga
b28d304b23
Only include controller_type.h in SDL_joystick.c
...
It has a huge array of controllers and we only want it instantiated once
2022-05-24 17:24:54 -07:00
Sam Lantinga
b1cf322971
Fixed HIDAPI PS4 controller being picked up when running under Steam
...
Input with PS4 configuration enabled
2022-05-19 16:50:59 -07:00
Sam Lantinga
47f1cb550d
Fixed picking up the correct mapping for virtual controllers on Android
...
Fixes https://github.com/libsdl-org/SDL/issues/5662
2022-05-18 23:48:15 -07:00
Sam Lantinga
f7b774a7e0
Fixed build error on Linux if HAVE_INOTIFY isn't defined
...
Fixes https://github.com/libsdl-org/SDL/issues/5682
2022-05-18 17:59:17 -07:00
Cameron Cawley
0cca71a846
Use SDLCALL for callbacks in public APIs
2022-05-18 15:01:27 -07:00
Sam Lantinga
1f2a241688
Add new virtual joysticks to the end of the list
...
This guarantees that the device index that's returned is stable, as long as no joystick hotplug events occur.
2022-05-16 09:02:35 -07:00
Sam Lantinga
3c3ccb1d48
Fixed crash if a virtual joystick was disconnected
2022-05-16 08:56:17 -07:00
Sam Lantinga
48b6cd8bc2
Fixed whitespace
2022-05-16 07:23:30 -07:00
Sam Lantinga
f0bc5c9cbf
Added effects support for virtual controllers
2022-05-16 07:21:28 -07:00
Sam Lantinga
b3a18706ee
Removed unused variables
2022-05-16 06:37:38 -07:00
Sam Lantinga
7e005bd843
Fixed mapping the paddle buttons with the virtual controller
2022-05-16 06:22:18 -07:00
Sam Lantinga
bfac54b59c
Added the ability to specify which buttons and axes are present for virtual controllers
2022-05-15 20:34:44 -07:00
Sam Lantinga
94eeb587c1
First pass at extending virtual controller functionality
...
Added the ability to specify a name and the product VID/PID for a virtual controller
Also added a test case to testgamecontroller, if you pass --virtual as a parameter
2022-05-15 20:01:12 -07:00
Sam Lantinga
7ad15c5b8f
Added game controller support for virtual joysticks
...
Fixes https://github.com/libsdl-org/SDL/issues/5662
2022-05-15 09:35:52 -07:00
Sam Lantinga
a3c1ca1fa1
Added support for the Backbone One guide button
...
The guide button is activated on a long press (> 400ms)
2022-05-06 09:07:36 -07:00
Ozkan Sezer
3f813cf1ef
SDL_rawinputjoystick.c: fixed -Werror=declaration-after-statement
2022-05-04 10:05:56 +03:00
atfrase
db9e14e504
disabled linux joystick debugging outputs and reverted unnecessary comment edit
2022-05-03 10:44:09 -07:00
atfrase
3b53555bcf
copied default Steam Controller mapping for wired and wireless-dongle USB pids
2022-05-03 10:44:09 -07:00
atfrase
13b1bf4f21
added default gamepad mapping for Steam Controller with new GUID (possibly caused by the firmware update to enable BLE?)
2022-05-03 10:44:09 -07:00
atfrase
f7a19f9ea8
relaxed the digital hat deadzone slightly, and fixed typo in DEBUG_GAMEPAD_MAPPING define
2022-05-03 10:44:09 -07:00
atfrase
3696e23d09
added hints SDL_HINT_LINUX_DIGITAL_HATS and SDL_HINT_LINUX_HAT_DEADZONES to control the new Linux hat handling; added define DEBUG_GAMEPAD_MAPPINGS to log messages when generating default gamepad mapings for Linux joysticks
2022-05-03 10:44:09 -07:00
atfrase
0b8e796e2c
added hueristic to differentiate digital vs analog 'hat' input axes and expose the latter as regular axes; added automatic deadzones to hat outputs, in case analog axes are still mapped to digital hats; updated automatic gamepad control mapping to more completely follow the spec
2022-05-03 10:44:09 -07:00
Daniel Brookman
d1a3981bf8
Fix crash when reading background events for MFi controllers on macOS
...
Enabling GCController.shouldMonitorBackgroundEvents to read background events
for MFi controllers before receiving the first GCControllerDidConnectNotification
is apparently a no-go on macOS (12.3.1 for me), and would crash on attempt.
Apple's documentation is... not great, and doesn't point this out.
This waits for IOS_AddMFIJoystickDevice() to get called down the chain from GCControllerDidConnectNotification, and enables GCController.shouldMonitorBackgroundEvents
if it hadn't been already.
On iOS and tvOS, GCController.shouldMonitorBackgroundEvents is ignored, so
there's no need to check their versions.
2022-05-02 15:31:28 -07:00
Jan200101
bb0b6dd42e
Fixed using WGI without XInput
2022-05-02 11:33:55 -07:00
Carl Friess
2ccb0dfd16
Check for macOS 10.16 to support apps built with older macOS SDKs
2022-04-29 00:24:23 -07:00
Sam Lantinga
e551384a99
Added functions to get the platform dependent name for a joystick or game controller
2022-04-26 14:54:14 -07:00
Jibb Smart
d7c07d6b09
Read motion sensor scale from Switch controllers ( #5555 )
...
* Read IMU scale data from Switch controllers. Up until now, SDL has used hard-coded scaling which isn't correct with some supported controllers.
* Moved declarations to beginning of code blocks to better fit with SDL style requirements
2022-04-26 09:57:17 -07:00
Dimitriy Ryazantcev
c39df2fb0c
joystick: get HID top-level collection preparsed data directly from RawInput API.
2022-04-26 09:48:35 -07:00
Mathieu Eyraud
0b2a55ea7d
Fix typo
2022-04-25 15:46:17 -07:00
meyraud705
3dcfe86082
Add joystick battery event
2022-04-25 15:46:17 -07:00
meyraud705
0964c84d77
Always use SDL_PrivateJoystickBatteryLevel to update battery level
...
But do not use it for initialisation.
2022-04-25 15:46:17 -07:00
Sam Lantinga
8986efd643
Added support for the Backbone One controller on iOS
2022-04-22 14:21:46 -07:00
Sam Lantinga
2ca0837888
SDL: sometimes the PS5 controller doesn't report having to power even when connected over USB. Possibly related to being completely charged? Either way we already know that it's USB or BT so let's use the driver's knowledge instead.
2022-04-22 14:21:41 -07:00
Sam Lantinga
04bf7c9434
Fixed build
2022-04-22 09:36:39 -07:00
Sam Lantinga
d9b5805ba5
Return a correlation error when trigger rumble is attempted without correlation
2022-04-22 09:13:40 -07:00
Cameron Gutman
145824f6ab
WGI: Only call RoUninitialize() if RoInitialize() succeeded
2022-04-21 08:47:22 -07:00
Cameron Gutman
00b2e10a7a
WGI: Keep a reference to the MTA to avoid crashing on COM teardown
...
Fixes #5552
Fixes #5270
2022-04-21 08:47:22 -07:00
Sam Lantinga
57927a2458
Don't call scandir() inside of scandir()
...
This works around a crash in address sanitizer
2022-04-18 12:57:28 -07:00
Jan Beich
7c140429a8
Enable evdev-based gamecontrollerdb on FreeBSD
2022-04-18 09:57:49 -07:00
Sam Lantinga
e7b01ee745
Added controller mapping for the Thrustmaster Dual Analog 3.2 on Linux
2022-04-18 09:55:52 -07:00
Mathieu Eyraud
99ae6395b1
Initialise scandir argument
...
'scandir' does not initialise 'entries' on error
2022-04-12 11:14:07 -04:00
Sam Lantinga
7ea1b69dd4
Sort controllers by the js* index on Linux
...
Also fixed the initial scan to directly scan devices instead of using
udev so they can be sorted, as intended.
Fixes https://github.com/libsdl-org/SDL/issues/4688
2022-04-05 21:02:52 -07:00
Sam Lantinga
eb660e862c
Cache the fact that a device didn't look like a joystick
...
Fixes https://github.com/libsdl-org/SDL/issues/5211
2022-04-05 19:47:42 -07:00
Ozkan Sezer
312c899f4f
attempt to fix uwp build
2022-04-02 03:32:10 +03:00
Sam Lantinga
8ebef12d31
Use RoInitialize/RoUninitialize for Windows.Gaming.Input
...
Thanks @walbourn!
Fixes https://github.com/libsdl-org/SDL/issues/5270
2022-04-01 14:59:45 -07:00
Cameron Gutman
2c04df8d65
joystick: Fix rumble issues on PS5 HIDAPI controllers
...
We were returning the report size from HIDAPI_DriverPS5_RumbleJoystick() rather
than 0 upon success, causing SDL_JoystickRumble() (and callers) to think that
rumbling failed.
This didn't cause major problems until 1868c5b
, when it started preventing
rumble state from being persisted in the joystick core, even though it was
successfully sent to the hardware.
This led to all sorts of strangeness, including broken rumble duration and
attempts to stop rumble being discarded.
2022-03-30 18:33:38 -05:00
Kimplul
2398c43be2
add some Thrustmaster wheels
2022-03-24 08:33:37 -07:00
Ryan C. Gordon
4fe7b2cbd1
static analysis: Fixed several complaints from codechecker.
...
There are still some pending Objective-C specific issues.
Reference issue #4600 .
2022-03-24 11:00:43 -04:00
Sam Lantinga
006aafabcf
Fixed freeing a constant string (thanks @gnrlwart)
2022-03-22 20:24:17 -07:00
Egor
2302b2d5e5
Add mapping for Logitech Precision Gamepad
2022-03-22 10:04:03 -07:00
Sam Lantinga
1868c5b521
Start rumbling once a raw input controller has been correlated
...
Fixes https://github.com/libsdl-org/SDL/issues/5351
2022-03-17 18:25:50 -07:00
Sam Lantinga
b22ce2b5a8
Workaround for bug in Microsoft WGI support
...
Fixes https://github.com/libsdl-org/SDL/issues/5270
2022-03-17 17:10:40 -07:00
Sam Lantinga
bcb0f1de23
Fixed build when events are disabled
...
Fixes https://github.com/libsdl-org/SDL/issues/5413
2022-03-17 08:52:31 -07:00
Cameron Gutman
677dc1015c
rawinput: Fix double detection of gamepads on some 3rd party X360 wireless receivers
...
The name that the Raw Input joystick driver pulls from the HID stack comes
from USB string descriptors contained on the device. For official wireless
receivers, this always contains "Xbox 360 Wireless Receiver for Windows"
which matches the friendly name that WGI provides.
3rd party Xbox 360 wireless receivers may have different strings in their
USB string descriptors (one uses "XBOX 360 For Windows" instead). This
fails to match WGI's name and causes Raw Input and WGI to both report the
same gamepad.
Since wireless Xbox 360 controllers seem to have a consistent VID/PID
regardless of the adapter enumerating them, we can also match on that to
catch these.
The duplicate case reported to me was:
Controller (XBOX 360 For Windows) - 030000005e040000a102000000007200
Xbox 360 Wireless Receiver for Windows - 030000005e0400000000000000007701
2022-03-09 21:19:53 -08:00
Sam Lantinga
6a787619e6
Allow reading background events for MFi controllers
2022-03-08 18:42:13 -08:00
Sam Lantinga
1b7669374e
Fixed the SDL controller type for USB_PRODUCT_XBOX_ONE_XINPUT_CONTROLLER
2022-03-08 09:58:24 -08:00
Sam Lantinga
af40cb6f00
Added support for the Razer Huntsman Analog keyboard in controller mode
2022-02-23 15:49:10 -08:00
Phillip Stephens
94d43186f2
GameCubeAdapter: Add suppport for all rumble modes
...
This adds support for all 3 of the gamecube controller's rumble modes
Rumble: 1
Stop: 0
StopHard: 2
This is useful for applications that need the full range of support
This also adds a hint to control rumble behavior, defaults 0 to maintain compatibility
2022-02-23 07:03:02 -08:00
Sam Lantinga
9299a3e796
Workaround for crash in CoUninitialize()
2022-02-21 16:24:45 -08:00
Sam Lantinga
18032979d8
Added the hint SDL_HINT_JOYSTICK_ROG_CHAKRAM to control whether ROG Chakram mice show up as joysticks
...
This hint defaults off, but when it is enabled the mice will have a game controller mapping set up for Profile 3 (set in the Armoury Crate software)
2022-02-15 13:07:51 -08:00
Sam Lantinga
f97a29f6e1
Use the real device VID/PID when seeing the Steam virtual controller
2022-02-11 22:10:33 -08:00
Ozkan Sezer
7935cfacc5
SDL_mfijoystick.m: use __typeof instead of typeof.
...
Fixes https://github.com/libsdl-org/SDL/issues/5319
2022-02-08 18:55:10 +03:00
Joshua Ashton
86b7a0642f
Add additional VID/PIDs for Anne Pro II
...
This thing changes its VID/PID on firmware revisions...
2022-02-04 08:45:19 -08:00
Sam Lantinga
dd69c28d6f
Added a mapping for the Xbox Series X controller, firmware version 5.11.3118.0, connected to Linux via Bluetooth
2022-02-03 18:01:34 -08:00
Temdog007
b59e75c259
Handle menu button press from controller
2022-02-02 21:21:44 -08:00
Ryan C. Gordon
43f0271b4e
Revert "fix compiler warnings in SDL_windows_gaming_input.c"
...
This reverts commit ca36cdb185f2f26241598068927821896f36b904.
The older Windows SDK's headers are wrong, and this change would crash if
you hotplug a device.
2022-01-28 20:40:19 -05:00
pionere
60deadba59
re-use return value of SDL_SetError/WIN_SetErrorFromHRESULT/SDL_OutOfMemory
2022-01-28 20:40:19 -05:00
pionere
d7110b4490
fix compiler warnings in SDL_windows_gaming_input.c
2022-01-28 20:40:19 -05:00
Vitaliy Zhmurikov
5b74459255
Update SDL_joystick.c
...
Add Logitech Momo Racing Wheel VID & PID to SDL_IsJoystickProductWheel function
2022-01-27 12:30:41 -08:00
Ivan Epifanov
d7e0c54dde
PSVita: send initial SDL_JOYDEVICEADDED events
2022-01-27 08:47:53 -08:00
Sam Lantinga
67cb548bef
Fixed build error with C90 compilers
2022-01-20 19:31:54 -08:00
Carl Glave
a23b3c767f
Add support for correlating trigger input
2022-01-20 17:43:35 -08:00
Sam Lantinga
b06866ef97
Entirely remove Xbox axis filtering, we don't want this at all.
2022-01-16 09:44:28 -08:00
Sam Lantinga
09aed1020b
Don't send output reports to the Victrix Pro FS v2
...
It'll hang on reboot if it gets output reports, and it doesn't have functionality that requires them, so skip it.
2022-01-16 09:23:58 -08:00
Sam Lantinga
85961b61a1
Disable Xbox axis deadzone handling by default
...
Fixes https://github.com/libsdl-org/SDL/issues/5227
2022-01-16 09:01:56 -08:00
Sam Lantinga
1a50334c46
Fixed Xbox One trigger axis zero point
2022-01-14 15:04:26 -08:00
Ozkan Sezer
b9d98331c5
os2joystick: fix uninitialized use of local var 'maxdevs'
2022-01-09 20:33:32 +03:00
Ozkan Sezer
17da60068d
os2joystick: fix -Wsequence-point issues.
2022-01-09 20:33:32 +03:00
Sam Lantinga
16f5b9e3c3
Filter jitter on Xbox One controllers when using raw input reports
2022-01-05 11:07:52 -08:00
Cameron Gutman
419ae29d90
joystick: Move WGI driver initialization after Windows driver
...
WGI calls SDL_DINPUT_JoystickPresent() so we need to be sure DInput remains
initialized for the lifetime of the WGI driver to avoid a crash or duplicated
joysticks between DInput and WGI.
2022-01-04 15:53:39 -08:00
Cameron Gutman
d73bd0d2f6
dinput: Don't crash in SDL_DINPUT_JoystickPresent if DInput init failed
...
The WGI driver will call this regardless of whether our init succeeded.
2022-01-04 15:53:39 -08:00
Sam Lantinga
120c76c84b
Updated copyright for 2022
2022-01-03 09:40:21 -08:00
Ozkan Sezer
82fc67ae4d
SDL_joystick.c: cast the arguments to nibble() to unsigned char.
2021-12-18 14:01:02 +03:00
Ozkan Sezer
47d3e96b43
SDL_joystick.c: (unsigned char) cast to SDL_tolower() parameters.
2021-12-18 14:01:02 +03:00
Ozkan Sezer
61107494a1
SDL_gamecontroller.c: (unsigned char) cast to SDL_isdigit() parameters.
2021-12-17 07:40:02 +03:00
Sergio Padrino
6f6382f8d0
Fix SDL_GameController API for PSP ( #3 )
...
- Add missing mapping
- Make sure the only window has the keyboard focus (so no `SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS` is needed)
2021-12-07 09:04:05 -08:00
Ozkan Sezer
f266d92286
psp/SDL_sysjoystick.c: fix -Wshadow warnings.
2021-12-07 14:04:32 +03:00
Sam Lantinga
a4c04ad230
Fixed building with iOS SDK prior to 13.0
...
Fixes https://github.com/libsdl-org/SDL/pull/5045
2021-11-30 10:32:39 -08:00
Sam Lantinga
b6bc3a6b0e
Added a mapping for the PS4 touchpad button on Windows
...
Fixes https://github.com/libsdl-org/SDL/issues/5035
2021-11-29 09:00:54 -08:00
Sam Lantinga
dd2f91118e
Fixed warnings with Windows SDK 10.0.19041
...
Fixes https://github.com/libsdl-org/SDL/issues/4998
Also breaks https://github.com/libsdl-org/SDL/issues/4998 for older SDKs, but we're going to ignore them, they're just incorrect.
2021-11-27 20:18:29 -08:00
Sam Lantinga
c2904c8ce7
Fixed compile warnings and errors
...
Fixes https://github.com/libsdl-org/SDL/issues/4998
2021-11-27 11:16:15 -08:00
Sam Lantinga
a6cbe0ab87
Controllers are always centered at zero using XInput and WGI
2021-11-27 10:58:12 -08:00
Sam Lantinga
09b7ca27d6
Get the current WGI controller list at startup
...
On Win32 this list is empty and we always get controller added events. On UWP, this list is populated and we don't get controlle added events for currently connected controllers.
2021-11-27 10:53:20 -08:00
Sam Lantinga
12895eca1a
Fixed WGI initialization on Win32
2021-11-27 10:52:58 -08:00
Sam Lantinga
110e4e1334
Use WGI instead of XInput for Windows 10 UWP apps
...
Fixes https://github.com/libsdl-org/SDL/issues/5017
2021-11-27 10:24:32 -08:00
Mathieu Eyraud
02021ae753
Return capabitlities from RawInput joystick
2021-11-27 07:26:10 -05:00
Sam Lantinga
a2e8565230
The Google Pixel fingerprint sensor isn't actually a joystick
...
Fixes https://github.com/libsdl-org/SDL/issues/4971
2021-11-26 11:04:15 -08:00
Sam Lantinga
67b5de5b41
Fixed build warnings
2021-11-26 10:18:08 -08:00
Sam Lantinga
2ca2ad76da
Fixed build warnings
2021-11-26 10:13:45 -08:00
Sam Lantinga
f90164a62f
Fixed mapping for the G-Shark GS-GP702
...
Fixes https://github.com/libsdl-org/SDL/issues/5006
2021-11-26 09:02:12 -08:00
Sam Lantinga
d861820465
SDL_JoystickGetAttached() doesn't need to be noisy for NULL joystick
...
Fixes https://github.com/libsdl-org/SDL/issues/5008
2021-11-26 07:57:48 -08:00
Cameron Gutman
b99510836e
SDL_mfijoystick.m: Fix -Wshadow warning
2021-11-24 13:04:50 -06:00
Ozkan Sezer
f8900583e5
removed windows winmm joystick driver
2021-11-23 17:04:40 +03:00
Sylvain
cb9f85e8d0
Don't use "round", so that it's doesn't show up while searching for the function
2021-11-22 08:38:46 -08:00
Sylvain
6fb50bd0a6
Don't use "exp" as a name so that it's doesn´t show up with searching for the function
2021-11-22 08:38:46 -08:00
Sylvain
d31251b014
use SDL's functions version inplace of libc version
2021-11-22 08:38:46 -08:00
Ozkan Sezer
ee2afa00ba
SDL_mfijoystick.m: fix build using older toolchains
...
Fixes https://github.com/libsdl-org/SDL/issues/4992
Fixes https://github.com/libsdl-org/SDL/issues/4958
2021-11-22 05:11:10 +03:00
Sam Lantinga
6828955ddf
Trim any extra platform strings from mappings when they're returned to the application
2021-11-19 09:58:11 -08:00
Cameron Gutman
881a674926
rawinput: Only access SDL_RAWINPUT_mutex if initialized
...
We can also ditch the lock in RAWINPUT_JoystickQuit() now that the joystick
subsystem quits drivers in reverse order. There's no chance of a racing call
to RAWINPUT_WindowProc() anymore.
2021-11-19 08:19:30 -06:00
Cameron Gutman
1237142be3
joystick: Quit drivers in reverse order to ensure dependencies are not broken
...
SDL_WINDOWS_JoystickDriver depends on callbacks in SDL_RAWINPUT_JoystickDriver
and SDL_HIDAPI_JoystickDriver being available. It also manages the common
WindowProc used for joystick detection in both WINDOWS and RAWINPUT drivers.
If we don't tear them down backwards, there's a window of time where we could
invoke RAWINPUT_WindowProc() after RAWINPUT_JoystickQuit() was called.
2021-11-19 08:19:30 -06:00
Sam Lantinga
40d808620d
SDL_classic_joysticks defaults off
2021-11-15 20:17:14 -08:00
Sam Lantinga
66058bbbd5
Fixed exception accessing Bluetooth devices on Android 12
...
Since accessing Bluetooth prompts the user for permission on both Android and iOS, and we only need it for Steam Controller support, we'll leave it off by default. You can enable it by setting the hint SDL_HINT_JOYSTICK_HIDAPI_STEAM to "1" before calling SDL_Init()
Fixes https://github.com/libsdl-org/SDL/issues/4952
2021-11-15 16:52:56 -08:00
Ozkan Sezer
3eb9bfac7a
win32 rawinput & wgi joystick: avoid -Werror=declaration-after-statement
2021-11-14 22:22:50 +03:00
Ozkan Sezer
a2c27d39cf
SDL_hidapi_switch.c (ConstructSubcommand): lose use of '&' on rumbleData
...
SwitchCommonOutputPacket_t->rumbleData is an array.
2021-11-13 17:56:28 +03:00
Ozkan Sezer
6ad0fb8462
SDL_hidapi_ps4.c, SDL_hidapi_ps5.c: use SDL_zeroa()
2021-11-13 17:55:10 +03:00
Ozkan Sezer
a948ff8494
SDL_hidapijoystick.c: worked around a bogus 'unreachable code' warning.
2021-11-13 11:50:02 +03:00
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
Shawn Ellis
0ae2a9f8c3
Fixed the Atari gamecontroller mappings and added Atari Xbox 360
...
This change corrects the mappings for the Atari gamecontroller and
adds support for the Atari Xbox 360 compatible gamecontroller. The Atari
game controller can switch between Atari and Xbox 360 mappings.
2021-08-24 13:06:27 -10:00
David Gow
fbc364908a
Use the new SDL_clamp() macro where sensible
...
There were a few places throughout the SDL code where values were
clamped using SDL_min() and SDL_max(). Now that we have an SDL_clamp()
macro, use this instead.
2021-08-14 09:01:14 -07:00
Sam Lantinga
dcc5eef0e2
Clarify that one of the PIDs of the Xbox Elite Series 2 controller is used in Bluetooth mode
2021-08-14 00:31:46 -07:00
Sam Lantinga
e42e9a12de
Fixed build
2021-08-13 20:48:56 -07:00
Sam Lantinga
441fbcaa3d
Added HIDAPI support for the Xbox Adaptive Controller
2021-08-13 20:48:54 -07:00
Sam Lantinga
907943a236
Added support for the Xbox One S Controller with 5.x series firmware
2021-08-12 17:51:08 -07:00
Ozkan Sezer
7aec0b90ee
SDL_hidapi_xboxone.c: fix bogus 'uninitialized' warning from clang.
...
The last 'size == 50' check is always true anyway.
2021-08-13 01:56:56 +03:00
Sam Lantinga
cec5a129f5
Fixed libudev hotplug notifications in the HIDAPI driver
2021-08-12 15:49:33 -07:00
Sam Lantinga
6eb4ebb502
Simplified the HIDAPI Xbox One controller initialization
2021-08-12 15:49:33 -07:00
Sam Lantinga
584b89abe6
Added support for the color LED on the Xbox Elite Series 2 controller
2021-08-12 08:17:10 -07:00
Sam Lantinga
64882b2466
Added support for the Xbox One Elite 2 Controller with 5.x series firmware
2021-08-12 08:17:08 -07:00
Andrei Alexeyev
e9179314c4
joystick/linux: fix memleaks; streamline joylist item removal
2021-08-11 14:11:52 -07:00
Sam Lantinga
de6ba40d9e
Added support for the Flydigi Vader 2 controller in 2.4G Android mode
2021-08-09 11:38:22 -07:00
Sam Lantinga
3f440daad9
Added support for the Flydigi Vader 2 controller in Bluetooth mode
2021-08-09 10:40:36 -07:00
Cameron Gutman
791d9d3ff6
Fixed DInput mapping for NVIDIA Virtual Gamepad
2021-08-07 14:20:43 -07:00
Ryan C. Gordon
dd683073bb
hidapi: Patched to compile on QNX.
...
Fixes #4591 .
2021-08-06 15:13:40 -04:00
Sam Lantinga
9fdb06450d
Added support for the Joy-Con Charging Grip when SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS is enabled
2021-08-04 11:34:06 -07:00
Sam Lantinga
9b4884d58a
Warn if you're building a partially functional RAWINPUT driver without device notifications
2021-08-03 09:25:14 -07:00
Sam Lantinga
886eb02eba
Fixed detection of Steam Virtual Gamepad with the WGI driver
2021-08-03 09:25:14 -07:00
Sam Lantinga
7c63e1d37a
Added WGI mappings for the Amazon Luna and Google Stadia controllers
2021-08-03 09:25:14 -07:00
Sam Lantinga
99c8972b25
Added WGI mappings for PS4 and PS5 controllers
2021-08-03 09:25:14 -07:00
Sam Lantinga
2dfc92ca1e
Added default mapping for WGI game controllers
2021-08-03 09:25:13 -07:00
Sam Lantinga
993a56766d
Only use the default Xbox mapping on Linux
...
On Windows, this is already covered by XInput and is the wrong mapping if we try to use it with DirectInput/RAWINPUT/WGI controllers
2021-08-03 00:15:24 -07:00
Sam Lantinga
7edc7d5392
Added a mapping for the Steam Virtual Gamepad when it's detected in DirectInput mode
2021-08-02 22:45:07 -07:00
Ryan C. Gordon
834a84fabb
winrt: Don't use LoadLibraryA on WinRT.
...
This removes the CM_Register_Notification code on WinRT. Note
that this API _is_ available to UWP apps as of Windows 10.0.17763
(version 1809, released October 2018), according to:
https://docs.microsoft.com/en-us/uwp/win32-and-com/win32-apis#apis-from-api-ms-win-devices-config-l1-1-1dll
So it might be worth readding with some sort of preprocessor check
for minimum targeted version, or whatever is appropriate for WinRT
development.
2021-08-03 05:07:39 -04:00
Sam Lantinga
022235012c
Fixed crash if WGI didn't give us the name for a controller
2021-08-02 16:40:58 -07:00
Sam Lantinga
2d0075eff8
Updated comments for third party Nintendo Switch controllers
2021-07-30 18:23:43 -07:00
Sam Lantinga
16010f7561
Added support for the PowerA Nintendo Switch Fusion Arcade Stick
2021-07-30 18:23:43 -07:00
Sam Lantinga
b33f470901
Fixed detection of the PDP Afterglow Wireless Switch Controller over Bluetooth
2021-07-30 18:23:42 -07:00
Sam Lantinga
6af6950dbc
Added support for the Victrix Gambit Tournament Controller
2021-07-30 18:23:42 -07:00
Sam Lantinga
243a8836af
The PowerA Nintendo Switch Fusion Pro Controller has a working USB mode, enabled via the switch on the underside of the controller.
2021-07-30 18:23:41 -07:00
Sam Lantinga
9d457aa446
Don't uninitialize COM because of what appears to be a bug in Microsoft WGI reference counting.
...
This fixes https://github.com/libsdl-org/SDL/issues/4488
2021-07-29 14:25:13 -07:00
Sam Lantinga
b3a0174b26
Scale the values correctly based on the sensor type (thanks @meyraud705)
2021-07-29 14:25:13 -07:00
Sam Lantinga
a186a503e7
Added SDL_GameControllerGetSensorDataRate() to get the sensor update rate for a controller.
2021-07-29 06:43:39 -07:00