Commit Graph

13264 Commits

Author SHA1 Message Date
Ryan C. Gordon
6a854e035f audio: Split device "zombie" status into multiple stages.
Otherwise, a device that is disconnected in the standard audio device thread
might keep failing WaitDevice() in a tight loop, each one generating a new
main thread callback. In normal situations, this is wasteful, but if the
app isn't pumping the event loop quickly (or at all!), this will quickly eat
up all the memory in a machine.

Now we note that the device is zombified right away, and device thread
iteration will use this to replace the implementation with the Zombie
equivalents once it owns the device lock.

The main thread callback will progress to device->zombie==2, which it uses to
decide if this is a duplicate disconnect notification. Since it also owns the
lock at this point, it takes the moment to set the Zombie implementation up,
too.

This allows things (like the WASAPI backend) to check for a non-zero zombie
state immediately without having to worry if the main thread callback ran, and
for the standard audio threads to also move to the Zombie implementation
without waiting on that callback.

(The Zombie implementation is used to make a dead device keep processing, so
things that need the audio device to make progress to function will keep
working, and things blindly pushing to an audio stream won't queue up endless
data that isn't being consumed.)

Fixes #15745.

(cherry picked from commit 6136358840)
2026-06-09 20:58:04 -04:00
Sam Lantinga
7cb03cfdc5 Fixed a hang reading the Xbox report descriptor on macOS
(cherry picked from commit 64998d2bc8)
2026-06-09 11:13:20 -07:00
Sam Lantinga
94ba53758f Fixed the Xbox 360 Controller showing as a Steam Virtual Gamepad on macOS
(cherry picked from commit c62cc657a2)
2026-06-09 10:34:15 -07:00
QwertyChouskie
c3fda242fd SDL_hidapi_xbox360.c: Fix Y axis inversion on macOS (#15792)
Originally, macOS had opposite Y axis inversion as every other platform, likely to correct for an issue with the virtual gamepad reported by the old 360Controller driver.

Wired Xbox 360 controllers using native macOS drivers were first reported to be broken in https://github.com/libsdl-org/SDL/issues/11002.  The inversion was removed in 7da728a642, presumably breaking 360Controller usage, but fixing wired 360 controller using the new native support in macOS 15 and above.  However, this change was reverted without explanation in d7b1ba1bfc which added explicit support for the Steam Virtual Gamepad.  Presumably, Steam on macOS reports inverted Y axes to match what SDL expected on the platform.  However, this reversion broke the native macOS controller support.  The incorrect inversion also breaks using off-brand 360-class gamepads via the libusb backend of HIDRAW.

(cherry picked from commit 157c839139)
2026-06-09 10:15:20 -07:00
QwertyChouskie
3ca28ce521 Respect SDL_HINT_JOYSTICK_MFI
(cherry picked from commit 0bd95b0430)
2026-06-09 07:34:40 -07:00
Sanjay Govind
43fa2bdcad Add GIP vids and pids for stage tour instruments (#15788)
(cherry picked from commit 3f80c0b82a)
2026-06-08 22:08:53 -07:00
Sanjay Govind
218522e123 Add PID for red octane games, as they support sony detection
(cherry picked from commit 205777210e)
2026-06-08 20:24:23 -07:00
Nintorch
0ccd792a5d Add mappings for NES Switch controllers on Linux
(cherry picked from commit 2fd15d9e0d)
2026-06-05 08:56:45 -07:00
Zizin13
3b6f122830 Fix DirectInput POV handling for devices with extra hats
(cherry picked from commit 7341f04a12)
2026-06-04 12:23:49 -07:00
Thad House
b152feee3f Enable extra player LED sets for PS5 Controllers
(cherry picked from commit 0c8feecce6)
2026-06-04 08:05:59 -07:00
Nintorch
c2567e5db5 Fix web joystick vibration (again)
(cherry picked from commit 96c03dc66e)
2026-05-31 14:28:04 -07:00
Nintorch
825d6f8232 Fix web joystick vibration on Safari
(cherry picked from commit e0eb40f65f)
2026-05-31 14:27:52 -07:00
Sam Lantinga
48045fae0b Updated to version 3.4.11 for development 2026-05-31 10:48:34 -07:00
Sam Lantinga
8e37db5e79 Updated to version 3.4.10 for release 2026-05-31 10:38:41 -07:00
Cameron Gutman
6dbdb94cae joystick: Fix conflicting rumble and LED on Sony PS4 gamepads
(cherry picked from commit 189877b1d3)
2026-05-30 17:21:03 -07:00
Vicki Pfau
30c2648fbe joystick: Fix underflow with 0 delta timestamp
Some sensors will occasionally report two identical timestamps in a row.
This leads to the timestamp wrapping calculation to underflow, subtracting
0x80000000 from the timestamp whenever it happens. By adjusting the wrap
test, we can just directly add zero to the timestamp, fixing the underflow.

(cherry picked from commit 687a59f277)
2026-05-29 21:48:44 -07:00
replicacoil
11cb97888b Added rumble to Gamecube Adapter PC_Mode (#15431)
(cherry picked from commit c43ab978fd)
2026-05-29 17:29:19 -07:00
Sam Lantinga
149fce547f Send SDL_EVENT_WINDOW_EXPOSED when the GPU renderer swap chain is resized
In this case the current frame being rendered doesn't match the swapchain size and the application should re-render the frame.

Fixes https://github.com/libsdl-org/SDL/issues/15550

(cherry picked from commit 2b0df96f25)
2026-05-29 14:37:38 -07:00
Sam Lantinga
1289fdded2 render: an empty clip rect should clip all drawing
Added a test to validate this and fixed the Metal renderer

Fixes https://github.com/libsdl-org/SDL/issues/15434

(cherry picked from commit e04bfb4c6e)
2026-05-29 13:59:23 -07:00
Sam Lantinga
f38994c15c Fixed Steam Controller not detected on macOS under Steam
(cherry picked from commit 8a701808a6)
2026-05-29 12:13:54 -07:00
tmkk
5e55c12d78 Detect steam virtual gamepads more accurately on macOS
(cherry picked from commit bbcc205de9)
2026-05-29 12:13:49 -07:00
tmkk
cefdc61f5e Bring back support for 360Controller driver on macOS
(cherry picked from commit 50d0e2ede2)
2026-05-29 12:13:10 -07:00
Sam Lantinga
bfdd7ee8b4 Fixed detecting the Steam virtual gamepad when HIDAPI is disabled
(cherry picked from commit ec0066aa0b)
2026-05-29 10:56:38 -07:00
Sam Lantinga
45c28b2eb9 Added HIDAPI support for the PDP Afterglow Wave Wireless Controller for Switch
(cherry picked from commit ed6e03436e)
2026-05-29 09:56:21 -07:00
Sam Lantinga
6675ea9147 Added DEBUG_STEAM_PROTOCOL for the new Steam Controller
(cherry picked from commit 634dff3725)
2026-05-28 19:51:56 -07:00
Sam Lantinga
53ae9c9370 metal: fixed reading textures with format SDL_PIXELFORMAT_RGBA128_FLOAT
(cherry picked from commit 113e97e193)
2026-05-28 11:51:30 -07:00
Cameron Cawley
011f1c2340 Support 16-bit packed texture formats with the Metal renderer
(cherry picked from commit 4af4c97e44)
2026-05-28 11:51:01 -07:00
Sam Lantinga
05d140a128 Add support for new Steam Controller input report on mobile devices
(cherry picked from commit f6ffa69890)
2026-05-28 11:46:05 -07:00
Sam Lantinga
8d5ee8b38c Removed unnecessary log message
(cherry picked from commit f1dd6db701)
2026-05-28 11:45:54 -07:00
Sam Lantinga
d960a2279a Fixed Steam Controller BLE report size
(cherry picked from commit 7b27056ea0)
2026-05-28 11:45:50 -07:00
Sam Lantinga
c6a81a0e4c Make sure we report ID_TRITON_CONTROLLER_STATE_BLE on iOS
(cherry picked from commit 9b7f55be89)
2026-05-28 11:45:44 -07:00
Rachel Blackman
8c12ce1760 Add support for new Steam Controller on Android (#15044)
(cherry picked from commit 46e553a44c)
2026-05-28 11:41:57 -07:00
Sam Lantinga
463d8ddf85 Fix mistyped output report message for Steam Controller
This caused hiccups in BlueZ BT driver for Linux

(cherry picked from commit bb3c61390a)
2026-05-27 18:21:13 -07:00
Sam Lantinga
385f7db161 Add support for new Steam Controller input report
(cherry picked from commit f7a8801227)
2026-05-27 18:21:13 -07:00
Rachel Blackman
f6f1376cbd OpenVR: Actually quit correctly if we get a close/quit message.
(cherry picked from commit a7ecd5f777)
2026-05-27 17:40:58 -07:00
Sam Lantinga
9fe4e5cc87 Revert "android: fixed a possible joystick-related deadlock on application termination"
This reverts commit 6b4ae68460.

It turns out this deadlock is possible for any joystick event delivery combined with an event watcher that locks joysticks. I'm reverting this change for now, and will be working on a better global solution for this problem.

(cherry picked from commit 76560f9e47)
2026-05-27 13:08:45 -07:00
Ryan C. Gordon
b8601dc8a7 filesystem: Implement SDL_GetExeName() for all platforms.
(cherry picked from commit d7ba3efe6b)
2026-05-27 15:42:41 -04:00
Ryan C. Gordon
11e13dc4a5 gdk: Just use WIN_GetModulePath().
There's no need to use the "A" version of GetModuleFileName on GDK; it returns
a UTF-8 string directly on this platform, but we can still use the UTF-16 "W"
version and cut down on code duplication.

This code runs once and caches the results, so we can take the one-time string
conversion overhead.

(cherry picked from commit 6b780c5ff9)
2026-05-27 15:42:20 -04:00
Frank Praznik
5dc7a5daed x11: Fix boolean/enum comparison
This could set the pending flag even if there was no state change requested, which would cause errant sync timeouts in certain situations.

(cherry picked from commit 6a3b0413dc)
2026-05-27 12:16:01 -04:00
Ryan C. Gordon
eee7164d9d x11: SetupWindowData shouldn't add to videodata->windowlist until success.
Fixes #15676.

(cherry picked from commit 22fb9edd5c)
2026-05-27 11:45:31 -04:00
zanadoman
a21c31aea1 GPU: Return early in SDL_WaitForGPUFences if num_fences is 0
(cherry picked from commit d7b1255484)
2026-05-27 08:24:53 -07:00
Ryan C. Gordon
58c2de8e25 metadata: SDL_GetAppMetadataProperty() now uses SDL_GetExeName().
(for SDL_PROP_APP_METADATA_NAME_STRING if unset. If SDL_GetExeName() returns
NULL, it'll fallback to good ol' "SDL Application", as usual.)

Fixes #15692.

(cherry picked from commit a49ba90257)
2026-05-26 20:34:28 -04:00
Ryan C. Gordon
2621d7aab2 filesystem: Added SDL_GetExeName().
core/unix had a more-limited copy of filesystem/unix's implementation, called
SDL_GetExeName(). Replace that with a real implementation in filesystem, and
allow each platform to implement it as appropriate.

Implemented for Unix and Windows; most implementations are currently FIXME
stubs at the moment.

Reference Issue #15692.

(cherry picked from commit 7d29ce8e31)
2026-05-26 20:33:44 -04:00
Frank Praznik
483d86588c video: Only ignore modes with a lower color depth in SDL_GetClosestFullscreenDisplayMode()
If a mode with a closer refresh was found, but it had the same color depth as the current best match, it was being dropped. Only ignore the new mode if the color depth is below the current best match.

(cherry picked from commit cd0b796a6e)
2026-05-26 18:28:41 -04:00
Sam Lantinga
33ea9c3e63 Don't use the HIDAPI driver with Backbone One PlayStation Edition Gen 2
This product doesn't appear to use the DualSense protocol. On Android this shows up as two interfaces that don't send reports that we can parse.

(cherry picked from commit a84dafd5b9)
2026-05-26 14:17:19 -07:00
Anonymous Maarten
452348acf8 _uitoa does not exist
(cherry picked from commit 08e338f45c)
2026-05-25 18:40:43 +03:00
Sam Lantinga
5720f54059 Fixed building with older versions of GameInput
(cherry picked from commit f8d5628163)
2026-05-22 16:07:46 -07:00
Jason Millard
efe6062cf4 iOS: Fix SDL_EVENT_DROP_FILE lost on cold start from URL open
(cherry picked from commit 290f0c831f)
2026-05-22 07:17:06 -07:00
Bitwolf
386be0070b Update Famicom controllers to a more user friendly name.
(cherry picked from commit 2f13731d23)
2026-05-22 07:15:35 -07:00
Vittorio Romeo
e8eba4a406 emscripten: dedupe keyboard event listeners across multiple windows
(cherry picked from commit 7f03da9588)
2026-05-22 07:11:44 -07:00