Commit graph

12553 commits

Author SHA1 Message Date
QwertyChouskie
1414dbf29d SDL_hidapi_xbox360.c: Fix Y axis inversion on macOS (#15792)
Some checks failed
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
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.

Backport of 157c839139 (https://github.com/libsdl-org/SDL/pull/15792) to SDL2
2026-06-11 16:12:15 -07:00
QwertyChouskie
77d2f62c23 Respect SDL_HINT_JOYSTICK_MFI
Backport of 0bd95b0430 (https://github.com/libsdl-org/SDL/pull/15791) to SDL2
2026-06-11 16:12:15 -07:00
tmkk
27e5c2e9a5 Bring back support for 360Controller driver on macOS
Backport 50d0e2ede2 (https://github.com/libsdl-org/SDL/pull/14880) to SDL2
2026-06-11 16:12:15 -07:00
Frank Praznik
819f6ae75b
EGL: Ensure the platform extensions exist before using them
The EXT and KHR variants use the same constant values, but the EXT versions are available a bit further back.
2026-06-11 13:16:25 -04:00
Frank Praznik
fea9b348c3
wayland: Explicitly specify EGL platform
Some checks are pending
Build (All) / level1 (push) Blocked by required conditions
Build (All) / level2 (push) Blocked by required conditions
Build (All) / Create test plan (push) Waiting to run
2026-06-11 12:55:49 -04:00
Akihiko Odaki
b3aa7083e2 x11: Explicitly specify EGL platform
Mesa's eglGetDisplay() chooses the native EGL platform from
EGL_PLATFORM, limited autodetection, or the build-time default. If that
selects Wayland while SDL is using the X11 video backend, Mesa can treat
the X11 Display pointer as a wl_display and crash during
eglInitialize().

See: https://gitlab.com/qemu-project/qemu/-/work_items/3540
2026-06-11 12:50:22 -04:00
Anonymous Maarten
a0c31c3afc ci: run GDK on older Windows environment 2026-06-11 16:32:27 +02:00
Frank Praznik
79de30a345 wayland: Don't apply display orientation on Sailfish
Some checks failed
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
2026-06-04 18:24:30 -04:00
Ryan C. Gordon
5f25ce9282
x11: SetupWindowData shouldn't add to videodata->windowlist until success.
Fixes #15676.

(cherry picked from commit 22fb9edd5c)
2026-05-27 11:47:51 -04:00
Anonymous Maarten
430cacdb44 _uitoa does not exist
(manual backport of commit 08e338f45c)
2026-05-25 18:47:32 +03:00
Mark Jonas
1df9ae4338 directfb: Fix CreateRenderer callback signature
Update DirectFB_CreateRenderer() to use the current SDL_RenderDriver
API.

Signed-off-by: Mark Jonas <toertel@gmail.com>
2026-05-21 11:34:15 -07:00
Cameron Gutman
f0d1101920 atomic: Implement loads on MSVC without RMW operations
This fixes faults when loading from read-only memory and avoids
cache line bouncing across cores which reduces performance.
2026-05-11 19:52:54 -05:00
Majjcom
4b69833bc5
Windows: Fix window caption drawing on borderless windows 2026-05-04 08:31:28 -07:00
Stanislav Aleksandrov
039a60c527 video: NULL-check display in SDL_DestroyWindow 2026-04-28 07:59:47 -04:00
Cameron Gutman
d07d39b0da atomic: Fix infinite recursion in SDL_CompilerBarrier() fallback
On some platforms, SDL_MemoryBarrierRelease() is defined to
SDL_CompilerBarrier(). If SDL_CompilerBarrier() is also defined to
the fallback spinlock acquire/release, then we will infinitely
recurse in SDL_UnlockSpinlock(). Avoid this by not unlocking the
temporary spinlock we create.
2026-04-27 19:53:10 -05:00
Cameron Gutman
3ebdcc5b1c atomic: Fix and cleanup SDL_UnlockSpinlock()
- Add missing SDL_MemoryBarrierRelease() in the generic codepath
- Remove Watcom and MSVC x86/x64 cases which are now identical to the generic codepath
- Fix Solaris barrier to ensure prior stores are visible before unlocking
2026-04-27 19:50:19 -05:00
Cameron Gutman
dd1e04eedf atomic: Use __atomic_signal_fence() for SDL_CompilerBarrier()
This is the (slightly) more standard way to accomplish it.
2026-04-26 22:07:57 -05:00
Cameron Gutman
26616cd653 atomic: Fix memory barriers on MSVC ARM32/ARM64 2026-04-24 20:22:25 -05:00
Cameron Gutman
15275898f0 atomic: Use acquire/release InterlockedExchange intrinsics on ARM64EC 2026-04-24 19:07:17 -05:00
Cameron Gutman
157ca95985 Fix UWP build 2026-04-24 18:54:30 -05:00
Cameron Gutman
7751494160 atomic: Use DMB ISHLD for aarch64 acquire barrier
This is a little more efficient than a DMB ISH and matches what
GCC, Clang, and MSVC generate for a C++11 acquire fence.
2026-04-23 21:18:05 -05:00
Cameron Gutman
c3b0e62850 atomic: Use __atomic_thread_fence() when available
This avoids requiring inline assembly for each architecture.

It also fixes some weakly ordered architectures which lacked
said inline assembly (RISC-V, MIPS, LoongArch, etc) and were
thus disasterously broken.
2026-04-23 18:59:40 -05:00
atirado.net
c8ebb1456e Backport VIRPIL Controls device IDs to SDL2
Backport of SDL3 fix (libsdl-org/SDL#15418).

VIRPIL Controls (VID 0x3344) flight sticks are
misclassified as gamepads by SDL's axis-count
heuristic because they report exactly 6 axes,
matching SDL_GAMEPAD_AXIS_COUNT. Adding them to
the appropriate device lists ensures correct
classification.

Tested on Linux (Fedora 43, kernel 6.19) with:
- R-VPC Stick MT-50CM3 (PID 0x4391)
- L-VPC Stick MT-50CM3 (PID 0x8390)
- VPC VMAX Prime Throttle (PID 0x0196)
2026-04-21 05:24:27 -10:00
Cameron Gutman
30de669b32 atomic: Fix missing full memory barrier on GCC/Clang
__sync_lock_test_and_set() is designed for creating locks, not as
a general atomic exchange function. As a result, it only provides
an acquire memory barrier and isn't guaranteed to actually store
the provided value (though it does on architectures we care about).

__atomic_exchange_n() is supported on GCC/Clang for the last ~10
years, so let's use that instead if available. We will keep the
__sync_lock_test_and_set() fallback around for ancient platforms,
but add a full memory barrier to match the documented behavior.
2026-04-20 06:17:49 -04:00
Ryan C. Gordon
2d28ee6eb7
CLAUDE.md: Just copy the text from AGENTS.md in here for now.
Someone mentioned that Claude sees this file's previous text and adds "look at
AGENTS.md" to it's TODO list instead of treating it as the thing it should do
first.

If everything decides to prefer AGENTS.md at some point, we'll delete this
file.

A symlink would apparently also work, but it would be the only symlink in the
SDL git repo, so it seemed less disruptive to just copy the file over for now.

(cherry picked from commit 847fc72b1b)
2026-04-16 13:55:59 -04:00
Ryan C. Gordon
5a9caa7432
CLAUDE.md: added.
Apparently Claude Code won't read AGENTS.md by default at this moment, but
since that's the direction we're moving, let's just add the file Claude
currently looks for and tell it that the actual instructions are in AGENTS.md.

I thought these things were supposed to be less complicated that interacting
with humans, lol.

(cherry picked from commit 1124e44e4c)
2026-04-16 12:23:03 -04:00
Ryan C. Gordon
9cab8fb595
AGENTS.md: Change "may not" to "must not".
(Hat tip to Sean Barrett on the stronger wording here.)

(cherry picked from commit 5bda0ccfb0)
2026-04-15 17:27:57 -04:00
Ryan C. Gordon
de3b6143c5
policy: Clarify that "AI" means specific things.
(cherry picked from commit 954e2f3354)
2026-04-15 15:42:38 -04:00
Ryan C. Gordon
e9603fe4f9
policy: Updated AI-related text based on excellent feedback.
(cherry picked from commit 4711119605)
2026-04-15 15:42:35 -04:00
Ryan C. Gordon
4e9c6ec24c
policy: Added to the PR template, and an AGENTS.md, refusing AI contributions.
Fixes #15350.

(cherry picked from commit 08285d828e)
2026-04-15 15:42:30 -04:00
Cameron Gutman
725db83c23 atomic: Use __atomic_load_n on Android 2026-04-14 18:13:15 -05:00
Cameron Gutman
cf5f7965df atomic: Switch to _SDL_HAS_BUILTIN to detect __atomic_load_n 2026-04-14 18:13:15 -05:00
MAJigsaw77
6587c12e17
Use singleTop launchMode for SDLActivity on Android 2026-04-13 09:28:58 +02:00
Cameron Gutman
9cc2f248f5 kmsdrm: Fix order of GBM and EGL teardown
All locked front buffers must be released prior to destroying
the EGL surface to avoid causing a UAF in libnvidia-egl-gbm.so.
2026-04-10 19:26:43 -05:00
Craig Chandler
88017f5023 Android: use RECEIVER_NOT_EXPORTED for receivers on API 33+ 2026-04-06 23:13:02 -07:00
Sam Lantinga
dd01e096e9 Added a hint "SDL_SURFACE_MALLOC" to disable aligned surface allocation
This is needed for sdl12-compat, where all surfaces were not aligned.
2026-04-02 10:36:56 -07:00
Regan Green
f9e82031f4 Limit DirectSound maximum sample rate 2026-03-25 23:11:28 -04:00
Anonymous Maarten
3debb9e2bb cmake: bump CMake policy compatibilty version 2026-03-25 19:06:10 +01:00
Anonymous Maarten
70584e55a1 ci: clang-tidy is not used 2026-03-25 18:59:26 +01:00
Ozkan Sezer
738b1e4f47 cmake: add OS2 to OPT_DEF_LIBC enable list. 2026-03-20 07:32:50 +03:00
Ozkan Sezer
e107aece34 libtool.m4: remove old_archive_from_new_cmds on os2
Fixes the static library and 'make install' issues.
From https://github.com/komh/libtool-os2
2026-03-19 10:55:20 +03:00
Ozkan Sezer
e0307aa05e apply issue/#13952 fix to SDL_cpuinfo.h, too. 2026-03-17 17:01:10 +03:00
Ozkan Sezer
a7d4b1996f minor os/2 emx build fix. 2026-03-17 05:02:50 +03:00
Ozkan Sezer
1e1e982ae7 libtool.m4: Use echo in archive_cmds and archive_expsym_cmds on OS/2
Fixes that building DLLs fails because $ECHO does not work when it's
set to "printf %s\n".
From https://github.com/komh/libtool-os2
2026-03-17 04:55:00 +03:00
Ozkan Sezer
e7e24a1ee5 SDL_dynapi.c, os/2: remove unnecessary include. 2026-03-17 00:20:20 +03:00
Ozkan Sezer
3c28e8ecc0 add new SDL_hidapi_8bitdo.c source to Xcode project 2026-03-15 02:40:14 +03:00
Kushagra Shukla
650aceb609
Backport 8BitDo HIDAPI Driver to SDL2 (#15207) 2026-03-14 15:20:29 -07:00
Tobiasz Laskowski
22a6d76f22 Backport android api 30+ fix for backspace to SDL2 2026-03-03 22:50:31 -08:00
hexnet1234
99ecc409cf Fix Wayland_DestroyWindow SEGFAULT
Check if the wind pointer is NULL, to avoid SEGFAULT.
Already implemented in SDL3, but not yet backported.
2026-02-20 13:04:11 -05:00
Alexandre Derumier
cf5dabd6ea Correct the sensor axis ordering with the Linux Nintendo driver
Fixes https://github.com/libsdl-org/SDL/issues/14552

Manual cherry-pick of 5e9163592f by Sam Lantinga <slouken@libsdl.org>
2026-02-12 11:32:59 -08:00