SDL3 or SDL2 behind one set of calls: SDL3 first on Linux #328
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!328
Loading…
Reference in a new issue
No description provided.
Delete branch "linux/sdl3"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of splitting #83 into small PRs. This is the first step toward SDL3. The next ones (shipping SDL3 in the AppImage and beside the Windows game, then removing SDL2) are separate PRs that build on this one.
host/hos_sdl.cholds stubs for the few SDL calls the host makes: the window and its events, the sound, and the controllers. Each stub has an SDL3 body and an SDL2 body: the same work under the other version's names and struct layouts (SDL3'sSDL_Eventis 128 bytes with other offsets, its window events are event types of their own, and it returnsbool).One SDL is loaded for the whole process: SDL3 beside the executable, else the system's, else SDL2 the same way.
HOS_SDL_VERSION=2takes SDL2 even when SDL3 is there.host/posix/display_sdl.c(the window),win32_posix.c's waveOut andhost/pad_sdl.c(controllers, on both systems) call only the stubs.SDL3.dllfor the controllers when one is beside the game,SDL2.dllotherwise, as now.GetSystemMetrics(its display mode is in screen units, so it is scaled by the pixel density).Tested
HOS_SDL_VERSION=2(SDL2): the window and the title screen render, a sound stream plays, the DualSense is found (hid: controller "DualSense Wireless Controller" connected (SDL)), and closing the window ends the game (display: window closed, exiting).host/hos_sdl.c: with onlySDL2.dllbeside it, SDL2 loaded and the DualSense opened; with SDL 3.4.18'sSDL3.dll, SDL3 did the same.tests/test_sdl_audio_library.pywas rewritten for the stubs (3 tests, they pass). The rest oftests/gives the same result as on main (the 4test_cpp_preflightchecks need Visual Studio).🤖 Generated with Claude Code
Thanks! This one conflicts with main now (main moved a lot today: the controller chain 335/343/350 and the input-in-background PR are merged, and the Windows package now ships SDL2 as sdl2-compat on SDL3 3.4.20). Could you rebase it on main? I'll merge it once it applies cleanly.
@NotRexed rebased on current main (
9e8fb5b). One conflict inhost/pad_sdl.cwith the per-controller rumble refresh from40c3f85: that logic is kept as is, now through thehos_sdl_*calls. Built and run again on Linux: SDL3 loaded, sound on, a DualSense and an Xbox 360 pad connected, and the window closes cleanly.