gameinput: a scripted press can be held longer, button@seconds:hold (INPUT-SCRIPT-HOLD) #2144
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!2144
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2144"
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?
@klikso on GitHub · 2026-11-25 23:09 UTC · original
klikso:input/script-hold→main· +58 −31 · 7 files · 3 commits · merged 2026-11-26 14:41 UTCClaimed in the coordination issue as: INPUT-SCRIPT-HOLD (claim)
What and why
A
LEONIDA_INPUT_SCRIPTpress is held for 0.3 s. The retail title reads its pad once a frame, and from the world start on a frame takes seconds here, so a 0.3 s press can start and end between two reads and never arrive. On an RTX 3060 Ti the title shows a "Couldn't autosave" prompt (Retry A / Got it B) about 1,000 s into a boot from a save:bpresses at 1080, 1140 and 1200 s did nothing in 30 minutes (run r11);An entry can now give its own hold,
button@seconds:hold:b@1100:4holds B for 4 s. Without:holda press stays 0.3 s, so every existing script means what it did.A hold of 0 or less, more than 600 s, or one that isn't a number (
a@0:,a@0:x,a@0:inf,a@0:1tail) rejects the entry and is counted like any other rejected entry. The 600 s cap keeps a typo such asb@10:1100from holding a button for the rest of the run. Right-stick throws (rsup,rsdown) take the same suffix. The parser is shared, so the SDL3 keyboard pad and the scripted pad of a build without SDL3 both get it. Since #2098 the SDL3 keyboard pad has its own loop: a press is held for 0.3 s, then until the title has read the pads six times, and never past 5 s. That loop now uses the entry's hold in place of the 0.3 s, and its 5 s limit becomes the hold when the hold is longer. Without:holdit behaves exactly as before. (Found by AndreiKocherzhinskiiA on #1608.)Tested
Windows 11 26200, MSVC 19.44,
maina73a57e13plus the two commits.gameinput_test --input-script(SDL3 build): 12 checks, 0 failures. New:y@0:0.6is held with X at the first poll. Past 0.3 s, X is still held because the title has read the pads fewer than six times. After six more reads X ends while Y is still held for its 0.6 s. Y is released 0.4 s later. Seven malformed holds hold nothing. With the SDL3 loop ingameinput.cppreverted to main's, 1 of these checks fails (Y ends with X).gameinput_no_sdl_test --input-script(build without SDL3): 0 failures. New:b@3:0.8holds B at 3.05 s and 3.7 s and releases it by 3.85 s; four malformed holds are rejected. With the header reverted, 2 fail.gameinput_testandgameinput_no_sdl_testwithout the script argument: 364 checks and 0 failures respectively, unchanged.scripts/windows-boot/boot.ps1from a save, scripta@120:2,a@150:2,a@180:2,b@1100:4,b@1130:4,b@1160:4):Three 4 s presses do what took 120 short ones.
python -I scripts/check_no_game_data.pyon the 6 changed files: no hits.git diff --check: clean.GPUs tested: NVIDIA GeForce RTX 3060 Ti (Ampere), driver 621.14, Windows 11 26200.
AI-assisted: yes (Claude Code; run and measured on the machine above)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed: n/a (input shim, no translator change).🤖 Generated with Claude Code
@JordanWebDev on GitHub · 2026-11-25 23:41 UTC · original · approved these changes
@MoonEyes on GitHub · 2026-11-26 07:24 UTC · original
Useful and mergeable, with two small documentation points. It is still needed after #2098 for any build without SDL3, and it adds a longer hold for SDL3 builds too. Its no-SDL3 test fails on main's source and passes with it. The SDL3 half of the PR was not built or run here.
Independent test report for this PR at head
1ce60558c. Maina73a57e13is already an ancestor of the head (the author merged it), so the local merge was a no-op: no conflicts, no rebase, merge SHA = head. I fetchedpull/2144/headagain before concluding. It is still open, 2 commits, 6 files, no comments. The one review is an approval, given on an earlier commit (c85ed709), before the current head.Configuration: Windows 11 Pro 10.0.26300, MSVC 19.44 (VS 2022), CMake + Ninja, RelWithDebInfo. Only the
gameinput_no_sdl_testtarget was built. The build has no SDL3, sogameinput_test(ctestgameinputandgameinput_script) does not exist here and both are listed as Disabled. The game was not run.Counts
ctest -R gameinput_no_sdl: 2/2 passed (gameinput_no_sdlandgameinput_no_sdl_script), 0 failures in each.gameinputandgameinput_script(SDL3 keyboard pad). The PR's changes togameinput_test.cpp, including the Y held 0.6 s, the malformed holds and thestd::max(hold, kMaxHold)window, were read but never compiled or run.check_no_game_data.pyon the 6 modified files: exit 0.Mutation (the PR's tests against main's source)
shims/gameinput_script.hback under the PR'sgameinput_no_sdl_test.cppand rebuilt.--input-scriptthen reports 2 failures (the test prints the check names; the line numbers are where they sit in the source):b@3:0.8as trailing text, which gives 4 presses and 8 rejected.Reading
kReads,kMaxHold) lives only inupdate_keyboard_pad()ingameinput.cpp, the SDL3 path.gameinput_no_sdl.cpp:379) is purely time-based, viaheld_at(). It has no read counting.:holdis the only remedy. With SDL3, it adds a floor, so a long:holdalso covers a title that stops reading.button@seconds[:hold]is accepted, and:is parsed only right after the time.a@2:,a@2:x,a@2:0,a@2:-1,a@2:601,a@2:1tail, anda@2 :3(space before the colon).a@2:0.0001.0 < hold <= kMaxHoldSeconds(600), andnan/infare rejected throughisfinite.a@2:0x10parses as 16, same as the existing time field. This is not a regression.held_atORs the presses, so the button stays down until the later press ends. This is covered by the existinga@1and[email protected]test. In the SDL path each press has its ownstarted[i]andbegan[i], so they are independent.max(hold, kMaxHold).:holdlonger than 5 s the press is held at least that long. The PR documents this.kReadsrule still applies untilkMaxHold.Suggestions (non-blocking)
scripts/windows-boot/boot.ps1(.PARAMETER InputScript, header lines 51-54) is not touched. It still describes onlybutton@seconds. A one-line mention of:holdis missing there.gameinput_script.hhas one line of 180 characters, where the rest of the file wraps near 120. This is cosmetic.Not covered: the SDL3 keyboard-pad path (see Counts). No retail boot with this PR, and no check that
b@1100:3clears the autosave prompt; the docs sentence "three 300 ms b presses did nothing" is the author's. No full suite and no sanitizers.AI-assisted: yes (Claude Code, Claude Sonnet 5.5, built and ran the tests; a second agent checked this text)
@klikso on GitHub · 2026-11-26 13:09 UTC · original
Thanks @MoonEyes for the independent run and the mutation check. Both suggestions are in
7bd4cec02(comments only, no code change):boot.ps1'sInputScripthelp now says each press is held 300 ms and thatbutton@seconds:holdholds it longer (e.g.b@1100:3).gameinput_script.his rewrapped at 120 like the rest of the file.The SDL3 path (
gameinputandgameinput_script) was built and run here before the push: 12 checks, 0 failures, and 1 failure with main's loop.AI-assisted (Claude Code).
@aslan2142 on GitHub · 2026-11-26 14:42 UTC · original
Thank you, @klikso. This went into
mainthrough #2350 (RT-LINUX-AMD-WORLD), merged at your head7bd4cec02with your commits and authorship kept. GitHub shows this PR as merged for that reason, so nothing needs closing.AI-assisted (Claude Code, Claude Opus 5.5 and Claude Fable 5.2)