Repository navigation
Conversation
Absolute `button@seconds` entries still go to the runtime. `button@game=3+5` and `button@session=d+5` are matched by the harness against LEONIDA_PEEK and injected as keys once the state has been seen for the delay, so an A/B boot presses in the same game state when startup timing shifts. The parser/state matcher is tools/boot_input_script.py (unit-tested); boot.ps1 watches the log, injects through the keyboard pad (SendInput; LEONIDA_KEYBOARD_PAD=always, no focus needed), and now reads the log with a share that tolerates the redirect handle. Tested: 12/12 unit tests; dry run; 200 s boot on RTX 3080 Ti / Windows 11 / NVIDIA 616.64 with -InputScript "a@session=3+5,a@session=d+5": the harness injected a at session=3 (55.8 s) and session=d (70.9 s), the keyboard pad logged press a@54.9/69.0/69.9, and the run reached session d and the known world-start device loss (lib_cs_03426...). Claimed in the coordination issue as: BOOT-INPUT-STATE-RELATIVE. AI-assisted.
lixonik
left a comment
There was a problem hiding this comment.
Independent Windows check at 34da84a13: the 12 Python tests pass. Synthetic state transitions and two PowerShell 5.1 dry runs reproduce the timing and plan-file issues below. No game process was launched and no system input was sent.
AI-assisted.
| if ($null -eq $game -and $null -eq $session) { continue } | ||
| $now = ((Get-Date) - $watchStart).TotalSeconds | ||
| if ($null -ne $game -and $null -eq $seen.game) { $seen.game = $now } | ||
| if ($null -ne $session -and $null -eq $seen.session) { $seen.session = $now } |
There was a problem hiding this comment.
[P2] Start the delay when the observed value changes
The timer is set on the first report for the field and is never reset if its value changes. With a synthetic first report of session 0 at t=0 and the first d at t=10, the watcher code supplies seen-session=0 and button@session=d+5 is due immediately. It should first be eligible at t=15. Track the current value and its entry time for both fields, and add a transition case to the tests.
| # for the delay. The parser/state matcher is tools/boot_input_script.py (unit-tested separately). | ||
| $absoluteScript = $InputScript | ||
| $statePlan = @() | ||
| $InputPlanFile = Join-Path ([System.IO.Path]::GetTempPath()) ("leonida-input-plan-" + $Name + ".json") |
There was a problem hiding this comment.
[P2] Keep the input plan local to the run
This path is keyed only by -Name and is written before the -DryRun exit and before the run lock. Two dry runs using different output directories and the same name created and then replaced the same temporary plan. The second run can also replace a live run's plan, since the watcher opens it on each poll. Keep the plan in memory or use a unique per-run file written after validation and dry-run handling.
| input[0].type = 1; // INPUT_KEYBOARD | ||
| input[0].ki.wVk = vk; | ||
| input[0].ki.dwFlags = down ? 0u : 2u; // KEYEVENTF_KEYUP | ||
| SendInput(1, input, Marshal.SizeOf(typeof(INPUT))); |
There was a problem hiding this comment.
[P2] Keep unattended input out of the system keyboard stream
SendInput enters the system keyboard stream. LEONIDA_KEYBOARD_PAD=always lets the game observe it in the background, and the foreground app can still receive the synthesized Enter, Backspace or Escape. This makes unattended runs affect other apps. Route scripted presses through the runtime's virtual pad. Win32 SendInput docs.
|
Hi @BubsMcgee, thanks for this pull request. It currently conflicts with AI-assisted (Claude Code, Claude Opus 5.5). |
Claimed in the coordination issue as: BOOT-INPUT-STATE-RELATIVE (#1608 (comment)). No dependencies; this is the harness side and reads keys through the keyboard pad (
GetAsyncKeyState), so #1790's focus mode is orthogonal.Fixes: #1900
What and why
-InputScriptwas absolute-time only (a@45,a@60,...). 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 in one build and back out to the menu (session d -> 0) in another, changing presents, PSO counts and the path being compared.This adds
button@game=<hex>+<delay>/button@session=<hex>+<delay>: the harness watches the existingLEONIDA_PEEKvalues (0x7446510game, low dword of0x98f828csession) and injects the key once that state has been seen for the delay. Absolute entries still go to the runtime unchanged.Files
tools/boot_input_script.py: parse and due matcher (stdlib only).scripts/windows-boot/boot.ps1: split the script, watch the log, inject through the keyboard pad (SendInput,LEONIDA_KEYBOARD_PAD=always; no focus needed), and read the log in the digest with a share that tolerates the redirect handle.scripts/windows-boot/README.mdand--help: the new form and an example.tests/test_boot_input_script.py: synthetic parse/due cases.Tested
python -I tests/test_boot_input_script.py: 12/12.python -I scripts/check_no_game_data.pyon the changed files: OK.-DryRunwitha@session=3+5,a@session=d+5:absolute='' state=2.a@session=3+5,a@session=d+5: the harness injectedaat session=3 (55.8 s) and session=d (70.9 s); the keyboard pad loggedpress a@54.9/69.0/69.9;-DigestOnlyreads statessession=3 @55 s,session=d @70 s, and the known world-start device loss (lib_cs_03426...).AI-assisted.