Commit Graph

7788 Commits

Author SHA1 Message Date
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
Ozkan Sezer
611b3dd1fd remove unused vulkan/*.hpp files. 2023-07-17 00:10:50 +03: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
f3d6320bac Added SDL_strndup() 2023-07-16 04:32:12 -07:00
Sam Lantinga
8cc3783e75 Remove extra spaces in stripped tokens 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
Ryan C. Gordon
cf46467a42 pulseaudio: Some fixes that seem to avoid an assertion in libpulse.
- Make sure the hotplug thread has hit its main loop before letting
  DetectDevices continue.
- Don't unref the context subscription operation until it completes
  (or we are shutting down).

I'm not sure which change fixed the problem, but at least one of them
appears to have done so.

Reference Issue #7971.

(cherry picked from commit b9d16dac4e)
2023-07-12 23:35:51 -04:00
Ozkan Sezer
133482a2c0 pulseaudio: eliminate <pulse/simple.h> include.
(cherry picked from commit 776a5e0d25)
2023-07-13 01:55:24 +03:00
Sam Lantinga
c45a0cd9b3 Don't divide by the scale twice
It's already been done in GetUIScreenModeSize(), in the last commit
2023-07-12 15:34:10 -07:00
Ryan C. Gordon
6fd0613ac8 pulseaudio: Require PulseAudio 5.0 or later for SDL3. 2023-07-12 16:34:55 -04:00
Ryan C. Gordon
9ebf0ed781 pulseaudio: fix WaitForPulseOperation blocking longer than necessary.
Now the operation state change we're waiting on will signal the
threaded mainloop, so this doesn't wait longer than necessary.

This requires PulseAudio 4.0 or later, so don't merge this into SDL2,
which requires PulseAudio 0.9.15.

Fixes #7971.
2023-07-12 16:09:33 -04:00
Ryan C. Gordon
956b18f50c pulseaudio: don't wait on pa_context_subscribe in hotplug thread.
This risks blocking the thread if disaster ensues, and we can wait in the
thread's main loop for subscription as well anywhere else.

Reference Issue #7971.
2023-07-12 16:00:13 -04:00
Ozkan Sezer
b3861650d3 need pulseaudio >=0.9.15. call pa_threaded_mainloop_set_name only if available. 2023-07-12 21:39:04 +03:00
Sam Lantinga
1903d7b1bf RAWINPUT_RegisterNotifications() should return int, for consistency 2023-07-11 10:50:43 -07:00
Sam Lantinga
4f122c6e39 Removed test binding for space key
This pops up at the most inconvenient times, and space is handy for other functions in various test programs.
2023-07-11 10:20:08 -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
33d025d35a Fixed loading 8-bit BMP exported by Gimp with RGB masks 2023-07-10 11:36:31 -07:00
Ozkan Sezer
1e50823a14 fixed linux build. 2023-07-10 20:35:50 +03:00
Sam Lantinga
95d17f9d2c Minor cleanup
(cherry picked from commit 92fd2938e7)
2023-07-10 10:02:57 -07:00
Andre Barata
47fd07bde6 Added support for absolute mice with evdev
(cherry picked from commit 9cd7cbe134)
2023-07-10 10:02:13 -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
bea99d48f2 Changed 'freesrc' parameter from int to SDL_bool 2023-07-09 13:49:04 -07:00
Sam Lantinga
32d529bf70 Use size_t for the size of memory RWops 2023-07-09 13:36:00 -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
Alex Maese
0e4165e54b X11: Use XFixes to detect clipboard updates
Currently, SDL_CLIPBOARDUPDATE events are only sent when an SDL window
has its selection cleared.  This change sends the event anytime the
XFixesSelectionNotify event is raised, and when the selection is either
the clipboard or the primary selection.
2023-07-08 16:26:10 -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
Sylvain
6763369f5b gendynapi.py: always check comment formatting of the public api 2023-07-07 21:55:20 +02:00
Frank Praznik
b82d6b8e4e wayland: Set the source surface of the request when raising a window
The xdg_activation token requires specifying the surface that is the source of the activation request, not the surface of the target window. Setting this to the target window was causing raise requests to be blocked by the compositor, as if the surface noted as the origin of the request didn't currently have focus, it appeared to the compositor as though it was trying to 'steal' focus.
2023-07-07 14:30:02 -04:00