Commit Graph

12938 Commits

Author SHA1 Message Date
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 ca492dff18 Renamed testgamepad to testcontroller
The program does more than just test gamepads, and will eventually map them as well.
2023-07-16 04:32:12 -07:00
Sam Lantinga d2d26c7b1e testgamepad replaces testjoystick 2023-07-16 04:32:12 -07:00
Sam Lantinga 34876c390f testgamepad works for joysticks as well as gamepads 2023-07-16 04:32:12 -07:00
Anonymous Maarten eda2824e6f ci: move 'set -eu' to after source_cmd 2023-07-14 15:00:52 +02: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 6aef14fb2d
pulseaudio: We should be using libpulse, not libpulse-simple.
This probably worked by a quirk of the dynamic loader...?
2023-07-12 16:40:42 -04: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 fdff3b16d6 Fixed build 2023-07-11 10:44:57 -07:00
Sam Lantinga 45cd4b8038 Added button background 2023-07-11 10:26:22 -07:00
Sam Lantinga 4feb2f4b1a Added a button to copy the gamepad mapping to the clipboard 2023-07-11 10:20:08 -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 9885f4d245 Reduced the size of the gamepad front and back images 2023-07-11 10:20:08 -07:00
Sam Lantinga 30a9fffbd4 Fixed array out of bounds access 2023-07-10 22:08:12 -07:00
Sam Lantinga 8ba850bef2 Show battery status on screen in testgamepad 2023-07-10 20:29:09 -07:00
Sam Lantinga 5b9f2d0942 Fixed build 2023-07-10 19:41:45 -07:00
Sam Lantinga e425fdd416 Added the controller name and info to the testgamepad window
Also added instructions for using the Virtual Controller
2023-07-10 19:13:51 -07:00
Sam Lantinga 3cbf16b944 Added SDL_GetGamepadInstanceID() 2023-07-10 19:13:42 -07:00
Sam Lantinga 50277a0355 Show touchpad and sensor output on screen in testgamepad 2023-07-10 18:05:31 -07:00
Sam Lantinga d44ada59fb Added joystick and gamepad element display in testgamepad 2023-07-10 17:06:42 -07:00
Sam Lantinga 4a53dc5b8d Added touchpad visualization for testgamepad 2023-07-10 11:36:32 -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 5ce967a579 Apply the display content scale to the gamepad test window 2023-07-10 09:37:20 -07:00
Simon McVittie 8b12585e1d testevdev: Add some examples of PDP third-party Switch controllers
Thanks: Ravi Kanodia
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-07-10 08:59:18 -07:00
Sam Lantinga efd530827a Return from main() instead of calling exit() 2023-07-09 20:42:00 -07:00
Sam Lantinga 8f5ec2f596 Added shared code between testgamepad and gamepadmap
The goal is to eventually create a single program that can do mapping and testing of game controllers.
2023-07-09 19:24:36 -07:00
SDL Wiki Bot 550c84b4df Sync SDL3 wiki -> header 2023-07-09 20:50:16 +00: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
Joshua Barnett a5f387f828 Add kernel32 to SDL_EXTRA_LIBS required for cross-compilation to Win32 native
Linking error experienced while compiling with the following toolchain
due to lack of kernel32.lib

d35e5f8dde/cmake/platforms/WinMsvc.cmake (L317-L321)
2023-07-09 09:18:04 +02: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