Sam Lantinga
2ebbfe7c5b
Added an "auto" mode for PS4 and PS5 controller rumble hints
...
This allows the controllers to report that they have sensors and enhanced capabilities, but not actually switch into enhanced mode (breaking DirectInput) unless the application tries to use them.
2023-07-17 17:32:57 -07:00
Sam Lantinga
bd4f155bbb
Fixed LED pending check failing when the controller timestamp is very large
...
In this case we know the controller has been on for a while and the Bluetooth connection LED cycle is complete.
Also fixed the timestamp being zero the first time it is checked
2023-07-17 17:08:17 -07:00
Sam Lantinga
16dd5f0da4
Don't send k_EPS5FeatureReportIdCapabilities to Sony PS5 controllers
...
This report is for third party controllers only.
2023-07-17 16:45:31 -07:00
Sam Lantinga
2fef0be2f6
Don't tickle Bluetooth PS5 controllers in simple mode with an effects packet
...
That will put the PS5 controller into enhanced mode, which breaks DirectInput games
2023-07-17 16:42:58 -07:00
Sam Lantinga
b271e92c6e
Added the ability to specify a gamepad type in the mapping
...
Also renamed most cases of SDL_GAMEPAD_TYPE_UNKNOWN to SDL_GAMEPAD_TYPE_STANDARD, and SDL_GetGamepadType() will return SDL_GAMEPAD_TYPE_UNKNOWN only if the gamepad is invalid.
2023-07-17 12:59:56 -07:00
Sam Lantinga
f3fe579cf0
Sort the entries in the controller mapping
2023-07-16 15:57:32 -07:00
Sam Lantinga
5388edd549
Removed Flydigi Vader 2 mappings
...
Many of the Flydigi controllers use the same VID/PID and have different mappings, so let's revisit this once we have more data.
2023-07-16 04:32:12 -07:00
Sam Lantinga
57cfd1e106
Removed SDL_GAMEPAD_TYPE_VIRTUAL, SDL_GAMEPAD_TYPE_AMAZON_LUNA, SDL_GAMEPAD_TYPE_GOOGLE_STADIA, and SDL_GAMEPAD_TYPE_NVIDIA_SHIELD
...
Removing SDL_GAMEPAD_TYPE_VIRTUAL allows a virtual controller to emulate another gamepad type. The other controller types can be treated as generic controllers by applications without special glyph or functionality treatment.
2023-07-16 04:32:12 -07:00
Sam Lantinga
538292c1da
Revert "More than one binding might trigger a gamepad button"
...
This reverts commit 6251504ac8aeb632cba5c9bb3502ad3628bc1bb3.
This is added CPU cost for a use case that was never supported. testcontroller will explicitly clear any previous binding, so I'm backing this out until there is a good use case.
2023-07-16 04:32:12 -07:00
Sam Lantinga
0bcd9944a3
More than one binding might trigger a gamepad button
2023-07-16 04:32:12 -07:00
Sam Lantinga
b40fb5c51e
Fixed getting the CRC of virtual joysticks without a VID/PID
2023-07-16 04:32:12 -07:00
Sam Lantinga
a1615dea85
Added SDL_SetGamepadMapping() to set the mapping for a specific device
2023-07-16 04:32:12 -07:00
Sam Lantinga
eb0955ef89
Removed SDL_GamepadBinding from the API
...
The text format is more expressive and widely used than the binary structure
2023-07-16 04:32:12 -07:00
Sam Lantinga
1903d7b1bf
RAWINPUT_RegisterNotifications() should return int, for consistency
2023-07-11 10:50:43 -07:00
Sam Lantinga
41882a1acb
Improved RAWINPUT <-> XInput/WGI device correlation
...
If there is only one controller slot available, assume that's the one matching new RAWINPUt devices. This will be right most of the time, and uncorrelation will fix any bad guesses.
2023-07-11 10:20:08 -07:00
Sam Lantinga
dfc5e6964e
Fixed crash if RAWINPUT is not initialized
...
We shouldn't be doing any of this work in that case
2023-07-11 10:20:08 -07:00
Sam Lantinga
2e3404db01
Added SDL_GetGamepadPowerLevel() to get the power level directly from a gamepad
2023-07-11 10:20:08 -07:00
Sam Lantinga
3cbf16b944
Added SDL_GetGamepadInstanceID()
2023-07-10 19:13:42 -07:00
Sam Lantinga
49b9fd1843
Don't send k_ePS4FeatureReportIdSerialNumber to Bluetooth PS4 controllers
...
This isn't supported over Bluetooth and might be causing issues with fake PS4 controllers.
Note that this change should NOT be ported to SDL2, as device->is_bluetooth is not set from hidapi there and is only detected by seeing which reports are valid.
Reference https://github.com/libsdl-org/SDL/issues/7960
2023-07-10 09:37:20 -07:00
Sam Lantinga
092a4b780c
Don't send k_ePS4FeatureReportIdCapabilities to Sony PS4 controllers
...
This report is for third party controllers only, and might be causing issues with fake PS4 controllers.
Reference https://github.com/libsdl-org/SDL/issues/7960
2023-07-10 09:37:20 -07:00
Sam Lantinga
80e1c75e1c
Re-added mappings for older Xbox One controllers on Linux
...
The xpad kernel driver doesn't know about these controllers and ends up using BTN_C and BTN_Z and the automatic mapping doesn't work correctly.
It turns out VID 0x045e and PID 0x02e0 is used by the 8BitDo SN30 Pro when connecting via Bluetooth in XInput mode.
Fixes https://github.com/libsdl-org/SDL/issues/7925
2023-07-09 09:50:26 -07:00
Sam Lantinga
ea60da5b94
Fixed mapping BTN_TR2 to right trigger
2023-07-08 18:18:22 -07:00
Sam Lantinga
cd97e3a833
Fixed clang Windows build
2023-07-08 14:10:08 -07:00
Sam Lantinga
a29aac603b
Quiet warning when using older buggy WGI headers
2023-07-08 13:28:22 -07:00
Sam Lantinga
7d894dc1c9
Fixed build warnings
2023-07-08 11:16:40 -07:00
Sam Lantinga
f047e178b6
Added WGI gamepad added/removed listeners for RAWINPUT
...
This fixes WGI correlation on startup when the WGI gamepad list isn't populated yet
2023-07-08 10:24:00 -07:00
Sam Lantinga
3a654b4b1c
Added the hint SDL_HINT_JOYSTICK_WGI to control whether to use Windows.Gaming.Input for controllers
2023-07-08 09:32:24 -07:00
Mathieu Eyraud
a4f3905bb6
Fix uninitialised variable
2023-07-08 08:36:36 -07:00
Sam Lantinga
efed24850a
Don't tickle Bluetooth PS4 controllers in simple mode with an effects packet
...
That will put the PS4 controller into enhanced mode, which breaks DirectInput games
2023-07-07 15:56:54 -07:00
Sam Lantinga
785f57eb91
Lazily initialize the WGI gamepad support
...
Initializing "Windows.Gaming.Input.Gamepad" will put Bluetooth PS4 controllers into enhanced report mode, which breaks any game using DirectInput. Let's wait to do this until absolutely necessary.
2023-07-07 15:56:54 -07:00
Mathieu Eyraud
bcf239e413
Improve sensor detection for Linux gamepad v2
...
Detecting by name such as "Accelerometer and "Motion Sensor" may be too broad.
Sensors on Dualshock and Switch gamepad are correctly detected by SDL_EVDEV_GuessDeviceClass().
Use vendor and product ID for Wii extension controls.
2023-07-07 10:57:45 -07:00
Sam Lantinga
ed6dc1cc05
Prefer using XInput for rumble over WGI, as it allows rumble in the background
...
(cherry picked from commit e16a83d393 )
2023-07-07 09:48:58 -07:00
Sam Lantinga
9f19b2bd97
Continue running XInput detection while RAWINPUT is active
...
This allows us to re-enable XInput correlation for RAWINPUT devices without reintroducing the controller shutdown bug for controllers using the wireless adapter in https://github.com/libsdl-org/SDL/issues/3468 .
Fixes https://github.com/libsdl-org/SDL/issues/7940
(cherry picked from commit a0a3957eb6 )
2023-07-07 09:48:58 -07:00
luzpaz
37e567994d
Fix remaining typos ( #7921 )
...
* Fix remaining typos
Found via `codespell -q 3 -S *.hex,*.pdf,./src/libm,./src/hidapi,./src/stdlib/SDL_malloc.c,./src/video/x11/edid.h -L caf,currenty,datas,einstance,fo,hda,lod,mata,parm,parms,pevent,pevents,pixelx,requestor,ser,statics,te,texturers,thid,uscaled,windowz`
2023-07-03 12:46:47 -07:00
Sam Lantinga
69c7a49990
Fixed build warnings
2023-06-29 22:15:23 -07:00
Sam Lantinga
675fc8c38f
Added Linux mapping for the Logitech Chillstream
...
Fixes https://github.com/libsdl-org/SDL/issues/7829
2023-06-29 16:10:55 -07:00
Sam Lantinga
ba9e924e57
Added additional debug logging for Linux joysticks
2023-06-29 16:09:55 -07:00
Sam Lantinga
baa9c57581
Added support for the Nintendo Online Famicom controllers
2023-06-28 19:15:43 -07:00
Sam Lantinga
9ee1200e6f
Fixed Nintendo Switch Pro controllers that don't have readable user calibration
2023-06-27 07:48:42 -07:00
Narr the Reg
425062c123
hidapi: switch: Handle MCU input reports
2023-06-26 10:01:49 -07:00
Ozkan Sezer
02398a8f11
Allow building against old Linux kernels.
2023-06-26 18:01:50 +03:00
Sam Lantinga
fd062657dd
Fixed build
2023-06-26 07:43:44 -07:00
meyraud705
6cc21af900
Don't keep sensor file open while sensors are disabled
2023-06-26 07:32:40 -07:00
meyraud705
9cfac88054
Improve sensor detection for Linux gamepad
2023-06-26 07:32:40 -07:00
meyraud705
000277060c
Add support for sensor to joystick on Linux (evdev)
2023-06-26 07:32:40 -07:00
Sam Lantinga
87e916dd21
SDL_FindFreePlayerIndex() will always return the next available player index
...
Fixes https://github.com/libsdl-org/SDL/issues/7868
2023-06-24 15:38:38 -07:00
Sam Lantinga
267fdd7daa
Removed Bluetooth connection detection now that we get it from hidapi
2023-06-23 15:50:07 -07:00
Sam Lantinga
44bae1e8a9
Corrected the Victrix FS Pro as a PS4 controller instead of a PS3 controller
2023-06-23 14:27:21 -07:00
Sylvain
6f344f29b8
After using SDL_qsort, mark sort_entries() as SDLCALL
2023-06-23 12:52:05 +02:00
Sylvain
6cde3835f0
Remove some use of C runtime functions (strlen, qsort)
2023-06-23 10:51:15 +02:00