mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:00:52 +01:00
[PR #2144] [MERGED] gameinput: a scripted press can be held longer, button@seconds:hold (INPUT-SCRIPT-HOLD) #2149
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#2149
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/2144
Author: @klikso
Created: 11/26/2026
Status: ✅ Merged
Merged: 11/26/2026
Merged by: @aslan2142
Base:
main← Head:input/script-hold📝 Commits (3)
f0e7914gameinput: a scripted press can be held longer (button@seconds:hold)1ce6055gameinput: the SDL keyboard pad honours a scripted hold too7bd4cecgameinput: boot.ps1 names the :hold form; rewrap the script header comment📊 Changes
7 files changed (+58 additions, -31 deletions)
View changed files
📝
docs/gameinput.md(+3 -2)📝
runtime/README.md(+1 -1)📝
runtime/shims/gameinput.cpp(+5 -3)📝
runtime/shims/gameinput_script.h(+20 -10)📝
runtime/test/gameinput_no_sdl_test.cpp(+8 -2)📝
runtime/test/gameinput_test.cpp(+19 -12)📝
scripts/windows-boot/boot.ps1(+2 -1)📄 Description
Claimed 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
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.