make_game, gameinput: controller, keyboard and mouse input out of the box (INPUT-OUT-OF-THE-BOX) #1528

Merged
kawaii-shakal merged 7 commits from upstream-pr/1528 into main 2026-11-29 03:36:04 +00:00
kawaii-shakal commented 2026-11-25 03:31:54 +00:00 (Migrated from github.com)

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 ran scripts/build_runtime.ps1 -Jobs N without -FetchSdl3. So on a machine without an installed SDL3, the GameInput shim was not built, and gta6rt logged gameinput: 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=ON and setting LEONIDA_KEYBOARD_PAD=1 made 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 in runtime/CMakeLists.txt once and checks its SHA-256. An installed SDL3 is still preferred. --no-sdl3 leaves the download out. The module docstring's sentence about what the script downloads now names SDL3.
  • runtime/shims/gameinput.cpp: LEONIDA_KEYBOARD_PAD defaults 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. off or 0 removes the pad, always is unchanged, and an unknown value still turns it off with a message.
  • runtime/test/gameinput_test.cpp: main sets LEONIDA_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 that off removes the pad.
  • docs/gameinput.md: the default and what make_game.py does.

Tested (Windows 11 Pro 26300, MSVC 19.50, VS 2026 generator, native)

  • ctest -R '^gameinput$' and gameinput_script pass 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 1 with sdl3=False; run_build_stages(..., sdl3=False) reaches runtime(). tests/test_make_game_argparse.py (38 OK) and tests/test_leonida_tui.py (25 OK).
  • Retail boot on an RTX 5070 Ti (driver 617.42), main f78385646 built with SDL3. I ran it with LEONIDA_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

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5484628252 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1528). Originally posted by [kawaii-shakal](https://github.com/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 ran `scripts/build_runtime.ps1 -Jobs N` without `-FetchSdl3`. So on a machine without an installed SDL3, the GameInput shim was not built, and `gta6rt` logged `gameinput: 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=ON` and setting `LEONIDA_KEYBOARD_PAD=1` made 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 in `runtime/CMakeLists.txt` once and checks its SHA-256. An installed SDL3 is still preferred. `--no-sdl3` leaves the download out. The module docstring's sentence about what the script downloads now names SDL3. - `runtime/shims/gameinput.cpp`: `LEONIDA_KEYBOARD_PAD` defaults 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. `off` or `0` removes the pad, `always` is unchanged, and an unknown value still turns it off with a message. - `runtime/test/gameinput_test.cpp`: `main` sets `LEONIDA_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 that `off` removes the pad. - `docs/gameinput.md`: the default and what `make_game.py` does. ### Tested (Windows 11 Pro 26300, MSVC 19.50, VS 2026 generator, native) - `ctest -R '^gameinput$'` and `gameinput_script` pass 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 1` with `sdl3=False`; `run_build_stages(..., sdl3=False)` reaches `runtime()`. `tests/test_make_game_argparse.py` (38 OK) and `tests/test_leonida_tui.py` (25 OK). - Retail boot on an RTX 5070 Ti (driver 617.42), main `f78385646` built with SDL3. I ran it with `LEONIDA_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](https://claude.com/claude-code)
ytsodacan commented 2026-11-25 03:34:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ytsodacan on 2026-11-25T03:34:12Z.


[KEEP]

  • Scope is coherent (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.
  • Two defaults change at once: LEONIDA_KEYBOARD_PAD goes from off to focused, and make_game.py now downloads SDL3 on Windows unless --no-sdl3 is 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.
  • #1510 also edits runtime/shims/gameinput.cpp and gameinput_test.cpp; hunks do not currently overlap, but whichever lands second should be rebased and re-checked.
  • Minor: the rewritten paragraphs in docs/gameinput.md (Keyboard pad section and the "By default (or with ...)" line) exceed the file's ~120-column wrap.
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7152036795 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1528#issuecomment-7152036795). Originally posted by [ytsodacan](https://github.com/ytsodacan) on 2026-11-25T03:34:12Z. --- **[KEEP]** - Scope is coherent (`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. - Two defaults change at once: `LEONIDA_KEYBOARD_PAD` goes from off to focused, and `make_game.py` now downloads SDL3 on Windows unless `--no-sdl3` is 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. - #1510 also edits `runtime/shims/gameinput.cpp` and `gameinput_test.cpp`; hunks do not currently overlap, but whichever lands second should be rebased and re-checked. - Minor: the rewritten paragraphs in `docs/gameinput.md` (Keyboard pad section and the "By default (or with ...)" line) exceed the file's ~120-column wrap.
zmasi commented 2026-11-28 23:25:42 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T23:25:42Z.


Windows 11 Native Verification Report (ab95ff8427 merged onto origin/main adfb3821a2)

  • Merge Status: Clean merge onto origin/main (adfb3821a2) and clean 3-way runtime/shims/gameinput.cpp merge alongside #1790 and #1831.
  • Environment: Windows 11 (10.0.26200, x64), MSVC 19.44.35228, prebuilt SDL 3.4.20 (SDL3-static.lib), Python 3.12.10.

Diff Audit (7 files, +54/-23)

  • make_game.py: runtime(..., sdl3: bool = True) now passes -FetchSdl3 by default when invoking scripts/build_runtime.ps1 on Windows, with --no-sdl3 wired through main() and run_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() defaults LEONIDA_KEYBOARD_PAD (when unset/empty) to KeyboardPadMode::Focused, accepts "0" or "off" to disable the virtual keyboard pad, keeps "always" for unfocused physical input, and logs unknown values as Off.
  • 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

  1. Red (origin/main adfb3821a2):
    • #1528's runtime/test/gameinput_test.cpp compiled against origin/main gameinput.{h,cpp} exited 1: FAIL keyboard pad: the focused mode by default.
    • #1528's tests/test_make_game_platform.py run against origin/main make_game.py exited 1: TypeError: runtime() got an unexpected keyword argument 'sdl3' (FAILED (errors=2, skipped=4)).
  2. Green (#1528 + origin/main):
    • gameinput_test.exe (/O2 /MD /EHsc /W4 /permissive- /utf-8, SDL 3.4.20, 0 new warnings): 390 checks, 0 failures (4.31 s, rc=0).
    • Combined merge (#1790 + #1528 + #1831 + origin/main) gameinput_test.exe: 393 checks, 0 failures (4.06 s, rc=0).
    • Python & documentation gates:
      • 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 -> all OK (rc=0).

Verdict: PASS — ready to merge.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7247423804 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1528#issuecomment-7247423804). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T23:25:42Z. --- ### Windows 11 Native Verification Report (`ab95ff8427` merged onto `origin/main` `adfb3821a2`) - **Merge Status**: Clean merge onto `origin/main` (`adfb3821a2`) and clean 3-way `runtime/shims/gameinput.cpp` merge alongside `#1790` and `#1831`. - **Environment**: Windows 11 (`10.0.26200`, x64), MSVC `19.44.35228`, prebuilt SDL `3.4.20` (`SDL3-static.lib`), Python `3.12.10`. #### Diff Audit (`7` files, `+54/-23`) - `make_game.py`: `runtime(..., sdl3: bool = True)` now passes `-FetchSdl3` by default when invoking `scripts/build_runtime.ps1` on Windows, with `--no-sdl3` wired through `main()` and `run_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()` defaults `LEONIDA_KEYBOARD_PAD` (when unset/empty) to `KeyboardPadMode::Focused`, accepts `"0"` or `"off"` to disable the virtual keyboard pad, keeps `"always"` for unfocused physical input, and logs unknown values as `Off`. - `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 1. **Red (`origin/main` `adfb3821a2`)**: - `#1528`'s `runtime/test/gameinput_test.cpp` compiled against `origin/main` `gameinput.{h,cpp}` exited `1`: `FAIL keyboard pad: the focused mode by default`. - `#1528`'s `tests/test_make_game_platform.py` run against `origin/main` `make_game.py` exited `1`: `TypeError: runtime() got an unexpected keyword argument 'sdl3'` (`FAILED (errors=2, skipped=4)`). 2. **Green (`#1528` + `origin/main`)**: - `gameinput_test.exe` (`/O2 /MD /EHsc /W4 /permissive- /utf-8`, SDL `3.4.20`, `0` new warnings): **`390 checks, 0 failures`** (`4.31 s`, `rc=0`). - Combined merge (`#1790 + #1528 + #1831 + origin/main`) `gameinput_test.exe`: **`393 checks, 0 failures`** (`4.06 s`, `rc=0`). - Python & documentation gates: - `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` -> all `OK` (`rc=0`). **Verdict**: **PASS** — ready to merge. AI-assisted.
OreoFR commented 2026-11-29 01:34:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T01:34:12Z.


Verified by OreoFR

  • Base: main 5825b02ff + PR head ab95ff842 (tested as a merge; same result earlier on 48bae6cad)
  • Test: ctest -R "^gameinput(_script)?$"; python -I tests/test_make_game_argparse.py; python -I tests/test_make_game_platform.py
  • Red on main: gameinput fails (1 of 390 checks: keyboard pad: the focused mode by default); test_make_game_argparse 1 FAIL (test_independent_stages_all_run_when_listed_out_of_order); test_make_game_platform 2 ERROR (run_build_stages() / runtime() take no sdl3 argument)
  • Green with the PR: gameinput and gameinput_script pass; 38 OK; 49 OK (4 skips)
  • gta6rt link: OK (gta6rt.exe builds and links; dumpbin /dependents shows the same DLLs as main, no network DLL)
  • Verdict: READY (main changed gameinput.cpp, gameinput_test.cpp and make_game.py after the PR was opened; the merge is clean and the result holds)
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248869440 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1528#issuecomment-7248869440). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-29T01:34:12Z. --- **Verified by OreoFR** - Base: main `5825b02ff` + PR head `ab95ff842` (tested as a merge; same result earlier on `48bae6cad`) - Test: `ctest -R "^gameinput(_script)?$"`; `python -I tests/test_make_game_argparse.py`; `python -I tests/test_make_game_platform.py` - Red on main: `gameinput` fails (1 of 390 checks: `keyboard pad: the focused mode by default`); `test_make_game_argparse` 1 FAIL (`test_independent_stages_all_run_when_listed_out_of_order`); `test_make_game_platform` 2 ERROR (`run_build_stages()` / `runtime()` take no `sdl3` argument) - Green with the PR: `gameinput` and `gameinput_script` pass; 38 OK; 49 OK (4 skips) - gta6rt link: OK (`gta6rt.exe` builds and links; `dumpbin /dependents` shows the same DLLs as main, no network DLL) - Verdict: READY (main changed `gameinput.cpp`, `gameinput_test.cpp` and `make_game.py` after the PR was opened; the merge is clean and the result holds) - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
DadaCap commented 2026-11-29 03:36:01 +00:00 (Migrated from github.com)

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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7250145723 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1528#issuecomment-7250145723). Originally posted by [DadaCap](https://github.com/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.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!1528
No description provided.