make_game, gameinput: controller, keyboard and mouse input out of the box (INPUT-OUT-OF-THE-BOX) #1528
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1528"
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?
Imported from ubiquitarianism/leonida. Originally posted by kawaii-shakal on 2026-11-25T03:31:54Z.
Claim: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7151877988 (INPUT-OUT-OF-THE-BOX)
What and why
On Windows, a build made the usual way (
make_game.py/Build.bat) had no input at all. The runtime stage ranscripts/build_runtime.ps1 -Jobs Nwithout-FetchSdl3. So on a machine without an installed SDL3, the GameInput shim was not built, andgta6rtloggedgameinput: served without SDL3 (no devices; E_NOTIMPL for every other slot). I hit this on the retail boot: the title reached its account-selection screen, and a connected DualSense did nothing. Rebuilding with-DLEONIDA_SDL3_FETCH=ONand settingLEONIDA_KEYBOARD_PAD=1made both the DualSense and the keyboard work. This PR makes that the default.make_game.py: the Windows runtime stage passes-FetchSdl3. CMake then downloads the SDL3 3.4.20 release pinned inruntime/CMakeLists.txtonce and checks its SHA-256. An installed SDL3 is still preferred.--no-sdl3leaves the download out. The module docstring's sentence about what the script downloads now names SDL3.runtime/shims/gameinput.cpp:LEONIDA_KEYBOARD_PADdefaults to the focused mode. The title reads gamepads only, so before this a player without a pad could not press anything. Keys and the mouse count only while a window of the process has focus, and the cursor clip and release on focus loss work as before.offor0removes the pad,alwaysis unchanged, and an unknown value still turns it off with a message.runtime/test/gameinput_test.cpp:mainsetsLEONIDA_KEYBOARD_PAD=off, because the other cases count only their own virtual pads. The keyboard-pad case now checks that the default is the focused mode and thatoffremoves the pad.docs/gameinput.md: the default and whatmake_game.pydoes.Tested (Windows 11 Pro 26300, MSVC 19.50, VS 2026 generator, native)
ctest -R '^gameinput$'andgameinput_scriptpass with SDL3 3.4.20. With the test change reverted, the new default breaks the old expectations (no gamepads before any is attached, ...), so the test change is needed and covers the default.tests/test_make_game_platform.py(47 OK): the Windows runtime command ends in-Jobs 1 -FetchSdl3, and in-Jobs 1withsdl3=False;run_build_stages(..., sdl3=False)reachesruntime().tests/test_make_game_argparse.py(38 OK) andtests/test_leonida_tui.py(25 OK).f78385646built with SDL3. I ran it withLEONIDA_KEYBOARD_PAD=1, which is exactly the mode this PR makes the default; I have not booted this branch's own build. The DualSense came up as player 1 (connected DualSense Wireless Controller (054c:0ce6, player 1, DualSense trigger effects, gyro)) and the keyboard pad as player 2. Both moved the title past its account-selection screen to the loading screen.AI-assisted: yes (Claude Code, Claude Opus 5.5).
🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by ytsodacan on 2026-11-25T03:34:12Z.
[KEEP]
make_game.py,runtime/shims/gameinput.cpp,gameinput_test.cpp,docs/gameinput.md), the PR is mergeable, but CI is still pending (windows,macos,linux-gpu-tools,no-game-data,change-scope); the Windows leg is the one that exercises the changed gameinput test, so please wait for it to go green.LEONIDA_KEYBOARD_PADgoes from off to focused, andmake_game.pynow downloads SDL3 on Windows unless--no-sdl3is passed. Both are user-visible and the second adds a network download, so this needs an explicit maintainer decision rather than a drive-by merge.runtime/shims/gameinput.cppandgameinput_test.cpp; hunks do not currently overlap, but whichever lands second should be rebased and re-checked.docs/gameinput.md(Keyboard pad section and the "By default (or with ...)" line) exceed the file's ~120-column wrap.Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T23:25:42Z.
Windows 11 Native Verification Report (
ab95ff8427merged ontoorigin/mainadfb3821a2)origin/main(adfb3821a2) and clean 3-wayruntime/shims/gameinput.cppmerge alongside#1790and#1831.10.0.26200, x64), MSVC19.44.35228, prebuilt SDL3.4.20(SDL3-static.lib), Python3.12.10.Diff Audit (
7files,+54/-23)make_game.py:runtime(..., sdl3: bool = True)now passes-FetchSdl3by default when invokingscripts/build_runtime.ps1on Windows, with--no-sdl3wired throughmain()andrun_build_stages(..., sdl3=not a.no_sdl3)to opt out of the pinned SDL3 download.runtime/shims/gameinput.cpp&runtime/shims/gameinput.h:read_config()defaultsLEONIDA_KEYBOARD_PAD(when unset/empty) toKeyboardPadMode::Focused, accepts"0"or"off"to disable the virtual keyboard pad, keeps"always"for unfocused physical input, and logs unknown values asOff.runtime/test/gameinput_test.cpp,tests/test_make_game_argparse.py,tests/test_make_game_platform.py,docs/gameinput.md: updates unit assertions and CLI/env documentation.Red -> Green Verification
origin/mainadfb3821a2):#1528'sruntime/test/gameinput_test.cppcompiled againstorigin/maingameinput.{h,cpp}exited1:FAIL keyboard pad: the focused mode by default.#1528'stests/test_make_game_platform.pyrun againstorigin/mainmake_game.pyexited1:TypeError: runtime() got an unexpected keyword argument 'sdl3'(FAILED (errors=2, skipped=4)).#1528+origin/main):gameinput_test.exe(/O2 /MD /EHsc /W4 /permissive- /utf-8, SDL3.4.20,0new warnings):390 checks, 0 failures(4.31 s,rc=0).#1790 + #1528 + #1831 + origin/main)gameinput_test.exe:393 checks, 0 failures(4.06 s,rc=0).python -I tests/test_make_game_argparse.py->OK(rc=0)python -I tests/test_make_game_platform.py->OK (skipped=4)(rc=0)python -I tests/test_docs_cli_flags.py->OK(rc=0)python -I tests/test_docs_env_vars.py,test_docs_links.py,test_docs_table_rows.py,test_docs_encoding.py,test_text_encoding.py-> allOK(rc=0).Verdict: PASS — ready to merge.
AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T01:34:12Z.
Verified by OreoFR
5825b02ff+ PR headab95ff842(tested as a merge; same result earlier on48bae6cad)ctest -R "^gameinput(_script)?$";python -I tests/test_make_game_argparse.py;python -I tests/test_make_game_platform.pygameinputfails (1 of 390 checks:keyboard pad: the focused mode by default);test_make_game_argparse1 FAIL (test_independent_stages_all_run_when_listed_out_of_order);test_make_game_platform2 ERROR (run_build_stages()/runtime()take nosdl3argument)gameinputandgameinput_scriptpass; 38 OK; 49 OK (4 skips)gta6rt.exebuilds and links;dumpbin /dependentsshows the same DLLs as main, no network DLL)gameinput.cpp,gameinput_test.cppandmake_game.pyafter the PR was opened; the merge is clean and the result holds)AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-29T03:36:01Z.
Merging, thank you @kawaii-shakal! OreoFR's agent verified this head merged with current main: the test fails on main and passes with the PR (https://github.com/ProjectLeonida/mandy/pull/1528#issuecomment-7248869440), and it still merges cleanly.
AI-assisted (Claude Code, Claude Opus 5.5), on behalf of DadaCap.