[PR #1074] [MERGED] gameinput: keyboard pad input scripts of any length (RT-INPUT-SCRIPT-LENGTH) #1112

Closed
opened 2026-11-26 20:20:08 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1074
Author: @Moriz82
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @QemmHD

Base: main ← Head: split/rt-input-script-length


📝 Commits (1)

  • f9ba70b gameinput: keyboard pad input scripts of any length (RT-INPUT-SCRIPT-LENGTH)

📊 Changes

4 files changed (+115 additions, -11 deletions)

View changed files

📝 docs/gameinput.md (+4 -3)
📝 runtime/CMakeLists.txt (+3 -1)
📝 runtime/shims/gameinput.cpp (+73 -6)
📝 runtime/test/gameinput_test.cpp (+35 -1)

📄 Description

Claimed in the coordination issue as: RT-INPUT-SCRIPT-LENGTH (claim).

Part of the split of #984 into small pull requests.

Depends on: none
Overlaps: #984 contains the integration. #955 changes physical
right-stick keys and controller hotplug in the same shim.

What and why

Main had no scheduler for keyboard pad input scripts. This change reads
LEONIDA_INPUT_SCRIPT and schedules comma-separated button@seconds
entries. The shared environment reader now reads every LEONIDA_*
setting used by this shim at full length. Previously, values of 64
characters or more read as unset.

The first keyboard pad update reads the script and starts its clock.
Each scheduled press lasts 300 ms and works with or without focus. A
physical key or another active scheduled press can keep a button held.
reload_config() leaves the startup script in effect.

Spaces around an entry are allowed. Empty entries, unknown buttons and
missing, malformed, negative or non-finite times are ignored. The shim
logs the accepted and rejected counts for each nonempty script. Leave
the variable unset to disable scheduling.

Tested

Release cross-build with clang-cl 23.1.5 and an xwin SDK on CachyOS,
kernel 7.3.5. The tests used Proton Experimental (Wine 11), a Ryzen 5
5600X, 16 GB RAM and SDL virtual joysticks. The host had an RTX 4070
12 GB with NVIDIA 620.73.04. CMake omitted the optional XMA2 decoder
because the Rust Windows target was unavailable.

build=runtime/build/boot
for target in gameinput_test gta6rt; do
  cmake --build "$build" --target "$target" -j6
done
wine "$build/gameinput_test.exe"
wine "$build/gameinput_test.exe" --input-script
python3 -I tests/test_docs_env_vars.py
python3 -I scripts/run_semantic_tests.py tests/semantic -j 2
python3 -I scripts/check_no_game_data.py
git diff --check HEAD^ HEAD

The 135-byte fixture places X at byte offset 67, padded with whitespace,
and schedules X again later. It supplies an unknown button, missing and
invalid times, empty items and a whitespace-only item. Physical B and
scripted X are held on the first reading. After losing focus and
reloading with a different script, only X is held. Once the original
press expires and focus returns, only B is held.

The default run passed 364/364 checks. The focused run passed 10/10 and
reported eight scheduled entries and eleven rejected entries.

Both controls used the same test object and link settings. For the
reader control, restore only env() from the commit's parent. For the
parser control, restore only the pre-review parsing loop with its
unchecked time conversion. Run each control with --input-script.

Build Default Focused Result
Amended child 364/364 10/10 Only the scheduled X and physical B
Old reader — 8/10 Scripted X missing, exit 1
Old parser — 7/10 Padded X missed, unintended A held, exit 1

Each fraction counts passing checks. Only the child ran the default
suite. The old parser counted 14 entries as valid.

cmake -S runtime -B "$build" -DLEONIDA_SDL3=OFF
ctest --test-dir "$build" -N -R '^gameinput(_script)?$'
cmake -S runtime -B "$build" -DLEONIDA_SDL3=ON

Both gameinput and gameinput_script appeared disabled without SDL3
and enabled again after restoring SDL3. The documentation suite passed
4/4 tests. The semantic suite passed 6,168 tests in 470 files. The
content and whitespace checks passed.

A contributor tested the pre-review scheduler on native Windows 11.
All 14/14 runs passed at lengths from 63 to 4,096 bytes. With only the
old reader restored, both 63-byte runs passed and all 12/12 longer runs
missed the scheduled presses. Native Windows has not been rerun on this
revision. AMD, Intel, a physical controller and a game boot were not
tested on this revision.

GPUs tested: none. The GameInput tests use synthetic input.
AI-assisted: yes

Checklist

  • One commit on bd8d72bb2, verified to merge cleanly into 955d9be34.
  • One topic with its regression test and documented setting.
  • No game data. The content guard passed.
  • No translator rule changes.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1074 **Author:** [@Moriz82](https://github.com/Moriz82) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@QemmHD](https://github.com/QemmHD) **Base:** `main` ← **Head:** `split/rt-input-script-length` --- ### 📝 Commits (1) - [`f9ba70b`](https://github.com/ubiquitarianism/leonida/commit/f9ba70b4de394f803273ab60adcbef9b15849ab8) gameinput: keyboard pad input scripts of any length (RT-INPUT-SCRIPT-LENGTH) ### 📊 Changes **4 files changed** (+115 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `docs/gameinput.md` (+4 -3) 📝 `runtime/CMakeLists.txt` (+3 -1) 📝 `runtime/shims/gameinput.cpp` (+73 -6) 📝 `runtime/test/gameinput_test.cpp` (+35 -1) </details> ### 📄 Description Claimed in the coordination issue as: RT-INPUT-SCRIPT-LENGTH ([claim](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7139824543)). Part of the split of #984 into small pull requests. Depends on: none Overlaps: #984 contains the integration. #955 changes physical right-stick keys and controller hotplug in the same shim. ### What and why Main had no scheduler for keyboard pad input scripts. This change reads `LEONIDA_INPUT_SCRIPT` and schedules comma-separated `button@seconds` entries. The shared environment reader now reads every `LEONIDA_*` setting used by this shim at full length. Previously, values of 64 characters or more read as unset. The first keyboard pad update reads the script and starts its clock. Each scheduled press lasts 300 ms and works with or without focus. A physical key or another active scheduled press can keep a button held. `reload_config()` leaves the startup script in effect. Spaces around an entry are allowed. Empty entries, unknown buttons and missing, malformed, negative or non-finite times are ignored. The shim logs the accepted and rejected counts for each nonempty script. Leave the variable unset to disable scheduling. ### Tested Release cross-build with clang-cl 23.1.5 and an xwin SDK on CachyOS, kernel 7.3.5. The tests used Proton Experimental (Wine 11), a Ryzen 5 5600X, 16 GB RAM and SDL virtual joysticks. The host had an RTX 4070 12 GB with NVIDIA 620.73.04. CMake omitted the optional XMA2 decoder because the Rust Windows target was unavailable. ```sh build=runtime/build/boot for target in gameinput_test gta6rt; do cmake --build "$build" --target "$target" -j6 done wine "$build/gameinput_test.exe" wine "$build/gameinput_test.exe" --input-script python3 -I tests/test_docs_env_vars.py python3 -I scripts/run_semantic_tests.py tests/semantic -j 2 python3 -I scripts/check_no_game_data.py git diff --check HEAD^ HEAD ``` The 135-byte fixture places X at byte offset 67, padded with whitespace, and schedules X again later. It supplies an unknown button, missing and invalid times, empty items and a whitespace-only item. Physical B and scripted X are held on the first reading. After losing focus and reloading with a different script, only X is held. Once the original press expires and focus returns, only B is held. The default run passed 364/364 checks. The focused run passed 10/10 and reported eight scheduled entries and eleven rejected entries. Both controls used the same test object and link settings. For the reader control, restore only `env()` from the commit's parent. For the parser control, restore only the pre-review parsing loop with its unchecked time conversion. Run each control with `--input-script`. | Build | Default | Focused | Result | |---|---:|---:|---| | Amended child | 364/364 | 10/10 | Only the scheduled X and physical B | | Old reader | — | 8/10 | Scripted X missing, exit 1 | | Old parser | — | 7/10 | Padded X missed, unintended A held, exit 1 | Each fraction counts passing checks. Only the child ran the default suite. The old parser counted 14 entries as valid. ```sh cmake -S runtime -B "$build" -DLEONIDA_SDL3=OFF ctest --test-dir "$build" -N -R '^gameinput(_script)?$' cmake -S runtime -B "$build" -DLEONIDA_SDL3=ON ``` Both `gameinput` and `gameinput_script` appeared disabled without SDL3 and enabled again after restoring SDL3. The documentation suite passed 4/4 tests. The semantic suite passed 6,168 tests in 470 files. The content and whitespace checks passed. A contributor tested the pre-review scheduler on native Windows 11. All 14/14 runs passed at lengths from 63 to 4,096 bytes. With only the old reader restored, both 63-byte runs passed and all 12/12 longer runs missed the scheduled presses. Native Windows has not been rerun on this revision. AMD, Intel, a physical controller and a game boot were not tested on this revision. GPUs tested: none. The GameInput tests use synthetic input. AI-assisted: yes ### Checklist - [x] One commit on `bd8d72bb2`, verified to merge cleanly into `955d9be34`. - [x] One topic with its regression test and documented setting. - [x] No game data. The content guard passed. - [x] No translator rule changes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:20:08 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#1112
No description provided.