mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:35:53 +01:00
[GH-ISSUE #1900] windows-boot: input scripts are absolute-time, so a press lands in a different game state across runs (BOOT-INPUT-STATE-RELATIVE) #50
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#50
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?
Originally created by @BubsMcgee on GitHub (Nov 25, 2026).
Original GitHub issue: https://github.com/ubiquitarianism/leonida/issues/1900
What
LEONIDA_INPUT_SCRIPT(-InputScript) schedules presses at absolute seconds since the keyboard pad's first update (a@45,a@60,a@75,a@90). The title reaches the same states at different times from run to run, so the same script lands presses in different game states. In A/B runs an A at 75/90 s can advance to gameplay in one build and back out to the menu (session d -> 0) in another, which changes the presents, PSO counts and even the game path being compared.Evidence
Same 200 s boot,
a@45,a@60,a@75,a@90, RTX 3080 Ti / Windows 11 / NVIDIA 616.64:d0so-statistics-on-1236The state arrival differs by 15-20 s; the script does not.
Proposal
Add a state-relative form while keeping
name@seconds:boot.ps1already parses theLEONIDA_PEEKstates (0x7446510game, low dword of0x98f828csession;runtime/src/main.cppprints them). Add an-InputScriptform such asa@session=d+5/a@game=3+5: the harness waits for the peek to match, then injects the key (SendInput) into the focused window withLEONIDA_KEYBOARD_PAD=1(the focus mode from #1790).rt::gameinput::script(runtime/shims/gameinput_script.h) so a press can name a state (a@session=d+5) andupdate_keyboard_padgates it on the same peek RVAs; the peek thread inruntime/src/main.cppalready reads them.Either way the absolute form stays for compatibility.
Needs
A full test needs the retail package (the states come from the title). The parser/state matcher can be unit-tested without game files or a GPU (
runtime/test/gameinput_test.cpp/ a synthetic state watcher test).Related: #1790 (focus mode; this is about timing, not the live-key leak), #1612 (first-run pad focus),
scripts/windows-boot/README.md.AI-assisted.
@Tyrannys commented on GitHub (Nov 26, 2026):
Data from a second machine for the design here: presses are not only landing in the wrong state, but most never reach the title at all once frames get slow. A state-relative form helps only if the press also lasts until the title reads it.
Setup: RTX 4070 SUPER, NVIDIA 621.01. A build without SDL3, so the script drives the scripted pad of
runtime/shims/gameinput_no_sdl.cpp. Four 1,200 s boots of the same tree (with and without other PRs that do not touch input), a 21-press script from 150 s to 435 s, and a fresh save folder each run.What happened: 3 of 21 presses were logged in each of the four runs, and which 3 differed:
All four runs went through the same states at the same times (peek: game 3 / session 3 from ~55 s, session
dat 155 s, session0from 170 s to the end).Why: the scripted pad takes a reading only when the title calls
GetCurrentReadingorGetNextReading(update(now_us())atgameinput_no_sdl.cpp:505and:548).held_at()(gameinput_script.h:102) holds a press only forkHoldSeconds = 0.3from its scheduled time. So a press exists for the title only if the title polls inside that 0.3 s window. Presents per minute in the same runs:From about 200 s the frame interval is several seconds. A 0.3 s window then catches a poll about one time in seven, which matches 3 of 21. (Line numbers are for
main3abb99cad. I did not check the SDL3 path on currentmain.) On this machine, the slow frames are the runtime's own (pipeline builds and stalls), not the title's.Suggestion for the state-relative form: keep a press held until the title has read it at least once, or for at least N polls, as well as for 0.3 s. Otherwise
a@session=d+5still loses the press whenever the frame interval is longer than the hold. Testing the timing needs the retail package. The rule can be unit-tested onheld_at()with a fake poll clock.AI-assisted (Claude Code).