windows-boot: state-relative input presses (BOOT-INPUT-STATE-RELATIVE) #1917

Closed
BubsMcgee wants to merge 1 commit from upstream-pr/1917 into main
BubsMcgee commented 2026-11-25 15:47:20 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by BubsMcgee on 2026-11-25T15:47:20Z.


Claimed in the coordination issue as: BOOT-INPUT-STATE-RELATIVE (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7166666931). 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

-InputScript was 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 existing LEONIDA_PEEK values (0x7446510 game, low dword of 0x98f828c session) 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.md and --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.py on the changed files: OK.
  • -DryRun with a@session=3+5,a@session=d+5: absolute='' state=2.
  • 200 s boot on RTX 3080 Ti / Windows 11 / NVIDIA 616.64 with 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 [email protected]/69.0/69.9; -DigestOnly reads states session=3 @55 s, session=d @70 s, and the known world-start device loss (lib_cs_03426...).

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5494567312 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1917). Originally posted by [BubsMcgee](https://github.com/BubsMcgee) on 2026-11-25T15:47:20Z. --- Claimed in the coordination issue as: BOOT-INPUT-STATE-RELATIVE (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7166666931). 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 `-InputScript` was 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 existing `LEONIDA_PEEK` values (`0x7446510` game, low dword of `0x98f828c` session) 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.md` and `--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.py` on the changed files: OK. - `-DryRun` with `a@session=3+5,a@session=d+5`: `absolute='' state=2`. - 200 s boot on RTX 3080 Ti / Windows 11 / NVIDIA 616.64 with `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 [email protected]/69.0/69.9`; `-DigestOnly` reads states `session=3 @55 s`, `session=d @70 s`, and the known world-start device loss (`lib_cs_03426...`). AI-assisted.
lixonik commented 2026-11-25 19:28:00 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-25T19:28:00Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6063713410 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1917#pullrequestreview-6063713410). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-25T19:28:00Z. **Review:** COMMENTED --- 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.
lixonik commented 2026-11-25 19:28:00 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-25T19:28:00Z.

Code review location: scripts/windows-boot/boot.ps1; line 438

@@ -340,10 +373,101 @@ if (-not $DigestOnly) {
             -RedirectStandardError $LogFile -RedirectStandardOutput $StdoutFile
         $handle = $proc.Handle   # keeps the exit code readable after the process ends
         $stopped = $false
-        if (-not $proc.WaitForExit($Seconds * 1000)) {
-            $stopped = $true
-            try { Stop-Process -Id $proc.Id -Force -Confirm:$false } catch { }
-            [void]$proc.WaitForExit(20000)
+        if (-not $statePlan.Count) {
+            if (-not $proc.WaitForExit($Seconds * 1000)) {
+                $stopped = $true
+                try { Stop-Process -Id $proc.Id -Force -Confirm:$false } catch { }
+                [void]$proc.WaitForExit(20000)
+            }
+        } else {
+            # State-relative input: watch the LEONIDA_PEEK values and inject a key once a state has been seen
+            # for its delay. The key path is the keyboard pad (GetAsyncKeyState), so LEONIDA_KEYBOARD_PAD=always
+            # is set above; no window focus is needed.
+            $watchStart = Get-Date
+            $deadline = $watchStart.AddSeconds($Seconds)
+            $seen = @{ game = $null; session = $null }
+            $fired = @{}
+            $watchPeekRx = [regex]'\[rt\] peek t=(\d+)s:(.*)$'
+            $watchValRx = [regex]'0x([0-9a-f]+)=([0-9a-f?]+)'
+            $keyMap = @{ a = 0x0D; b = 0x08; x = 0x58; y = 0x59; start = 0x1B; back = 0x09
+                         lb = 0x51; rb = 0x45; up = 0x26; down = 0x28; left = 0x25; right = 0x27 }
+            if (-not ("LeonidaKeys" -as [type])) {
+                Add-Type -TypeDefinition @"
+using System;
+using System.Runtime.InteropServices;
+[StructLayout(LayoutKind.Sequential)] public struct KEYBDINPUT { public ushort wVk; public ushort wScan; public uint dwFlags; public uint time; public IntPtr dwExtraInfo; }
+[StructLayout(LayoutKind.Explicit, Size = 40)] public struct INPUT { [FieldOffset(0)] public uint type; [FieldOffset(8)] public KEYBDINPUT ki; }
+public static class LeonidaKeys {
+    [DllImport("user32.dll", SetLastError = true)] public static extern uint SendInput(uint n, INPUT[] inputs, int cb);
+    public static void Key(ushort vk, bool down) {
+        INPUT[] input = new INPUT[1];
+        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)));
+    }
+}
+"@
+            }
+            $dueArgs = @()
+            if ($inputPy.Count -gt 1) { $dueArgs += $inputPy[1..($inputPy.Count - 1)] }
+            $dueArgs += @("-I", (Join-Path $RepoRoot "tools\boot_input_script.py"), "due", "--plan", $InputPlanFile)
+            $fs = $null; $reader = $null
+            try {
+                $fs = [System.IO.File]::Open($LogFile, [System.IO.FileMode]::OpenOrCreate,
+                                             [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite)
+                $reader = New-Object System.IO.StreamReader($fs)
+                while (-not $proc.HasExited -and (Get-Date) -lt $deadline) {
+                    $line = $reader.ReadLine()
+                    if ($null -eq $line) { Start-Sleep -Milliseconds 100; continue }
+                    if (-not $line.Contains("[rt] peek t=")) { continue }
+                    $m = $watchPeekRx.Match($line)
+                    if (-not $m.Success) { continue }
+                    $game = $null; $session = $null
+                    foreach ($v in $watchValRx.Matches($m.Groups[2].Value)) {
+                        $rva = $v.Groups[1].Value; $val = $v.Groups[2].Value
+                        if ($rva -eq "7446510") { $game = $val }
+                        elseif ($rva -eq "98f828c" -and $val -ne "?") {
+                            $low = $val.PadLeft(16, '0').Substring(8).TrimStart('0')
+                            $session = $(if ($low) { $low } else { "0" })
+                        }
+                    }
+                    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 }

[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.

<!-- greyfinch-sync:ubiquitarianism/leonida:review-comment:4699836309 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1917#discussion_r4699836309). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-25T19:28:00Z. **Code review location:** `scripts/windows-boot/boot.ps1`; line 438 ~~~~diff @@ -340,10 +373,101 @@ if (-not $DigestOnly) { -RedirectStandardError $LogFile -RedirectStandardOutput $StdoutFile $handle = $proc.Handle # keeps the exit code readable after the process ends $stopped = $false - if (-not $proc.WaitForExit($Seconds * 1000)) { - $stopped = $true - try { Stop-Process -Id $proc.Id -Force -Confirm:$false } catch { } - [void]$proc.WaitForExit(20000) + if (-not $statePlan.Count) { + if (-not $proc.WaitForExit($Seconds * 1000)) { + $stopped = $true + try { Stop-Process -Id $proc.Id -Force -Confirm:$false } catch { } + [void]$proc.WaitForExit(20000) + } + } else { + # State-relative input: watch the LEONIDA_PEEK values and inject a key once a state has been seen + # for its delay. The key path is the keyboard pad (GetAsyncKeyState), so LEONIDA_KEYBOARD_PAD=always + # is set above; no window focus is needed. + $watchStart = Get-Date + $deadline = $watchStart.AddSeconds($Seconds) + $seen = @{ game = $null; session = $null } + $fired = @{} + $watchPeekRx = [regex]'\[rt\] peek t=(\d+)s:(.*)$' + $watchValRx = [regex]'0x([0-9a-f]+)=([0-9a-f?]+)' + $keyMap = @{ a = 0x0D; b = 0x08; x = 0x58; y = 0x59; start = 0x1B; back = 0x09 + lb = 0x51; rb = 0x45; up = 0x26; down = 0x28; left = 0x25; right = 0x27 } + if (-not ("LeonidaKeys" -as [type])) { + Add-Type -TypeDefinition @" +using System; +using System.Runtime.InteropServices; +[StructLayout(LayoutKind.Sequential)] public struct KEYBDINPUT { public ushort wVk; public ushort wScan; public uint dwFlags; public uint time; public IntPtr dwExtraInfo; } +[StructLayout(LayoutKind.Explicit, Size = 40)] public struct INPUT { [FieldOffset(0)] public uint type; [FieldOffset(8)] public KEYBDINPUT ki; } +public static class LeonidaKeys { + [DllImport("user32.dll", SetLastError = true)] public static extern uint SendInput(uint n, INPUT[] inputs, int cb); + public static void Key(ushort vk, bool down) { + INPUT[] input = new INPUT[1]; + 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))); + } +} +"@ + } + $dueArgs = @() + if ($inputPy.Count -gt 1) { $dueArgs += $inputPy[1..($inputPy.Count - 1)] } + $dueArgs += @("-I", (Join-Path $RepoRoot "tools\boot_input_script.py"), "due", "--plan", $InputPlanFile) + $fs = $null; $reader = $null + try { + $fs = [System.IO.File]::Open($LogFile, [System.IO.FileMode]::OpenOrCreate, + [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite) + $reader = New-Object System.IO.StreamReader($fs) + while (-not $proc.HasExited -and (Get-Date) -lt $deadline) { + $line = $reader.ReadLine() + if ($null -eq $line) { Start-Sleep -Milliseconds 100; continue } + if (-not $line.Contains("[rt] peek t=")) { continue } + $m = $watchPeekRx.Match($line) + if (-not $m.Success) { continue } + $game = $null; $session = $null + foreach ($v in $watchValRx.Matches($m.Groups[2].Value)) { + $rva = $v.Groups[1].Value; $val = $v.Groups[2].Value + if ($rva -eq "7446510") { $game = $val } + elseif ($rva -eq "98f828c" -and $val -ne "?") { + $low = $val.PadLeft(16, '0').Substring(8).TrimStart('0') + $session = $(if ($low) { $low } else { "0" }) + } + } + 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 } ~~~~ --- [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.
lixonik commented 2026-11-25 19:28:00 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-25T19:28:00Z.

Code review location: scripts/windows-boot/boot.ps1; line 235

@@ -224,6 +226,35 @@ if ($Shaders) {
     $problems.Add("no shader library: pass -Shaders <work>\shaders\spirv or set LEONIDA_SHADERS")
 }
 
+# ---------------------------------------------------------------------------------------------- input
+# Absolute entries (a@45) go to the runtime as before; state-relative ones (a@session=d+5, a@game=3+5)
+# are matched here against the LEONIDA_PEEK values and injected as keys once the state has been seen
+# 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")

[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.

<!-- greyfinch-sync:ubiquitarianism/leonida:review-comment:4699836316 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1917#discussion_r4699836316). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-25T19:28:00Z. **Code review location:** `scripts/windows-boot/boot.ps1`; line 235 ~~~~diff @@ -224,6 +226,35 @@ if ($Shaders) { $problems.Add("no shader library: pass -Shaders <work>\shaders\spirv or set LEONIDA_SHADERS") } +# ---------------------------------------------------------------------------------------------- input +# Absolute entries (a@45) go to the runtime as before; state-relative ones (a@session=d+5, a@game=3+5) +# are matched here against the LEONIDA_PEEK values and injected as keys once the state has been seen +# 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") ~~~~ --- [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.
lixonik commented 2026-11-25 19:28:00 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-25T19:28:00Z.

Code review location: scripts/windows-boot/boot.ps1; line 407

@@ -340,10 +373,101 @@ if (-not $DigestOnly) {
             -RedirectStandardError $LogFile -RedirectStandardOutput $StdoutFile
         $handle = $proc.Handle   # keeps the exit code readable after the process ends
         $stopped = $false
-        if (-not $proc.WaitForExit($Seconds * 1000)) {
-            $stopped = $true
-            try { Stop-Process -Id $proc.Id -Force -Confirm:$false } catch { }
-            [void]$proc.WaitForExit(20000)
+        if (-not $statePlan.Count) {
+            if (-not $proc.WaitForExit($Seconds * 1000)) {
+                $stopped = $true
+                try { Stop-Process -Id $proc.Id -Force -Confirm:$false } catch { }
+                [void]$proc.WaitForExit(20000)
+            }
+        } else {
+            # State-relative input: watch the LEONIDA_PEEK values and inject a key once a state has been seen
+            # for its delay. The key path is the keyboard pad (GetAsyncKeyState), so LEONIDA_KEYBOARD_PAD=always
+            # is set above; no window focus is needed.
+            $watchStart = Get-Date
+            $deadline = $watchStart.AddSeconds($Seconds)
+            $seen = @{ game = $null; session = $null }
+            $fired = @{}
+            $watchPeekRx = [regex]'\[rt\] peek t=(\d+)s:(.*)$'
+            $watchValRx = [regex]'0x([0-9a-f]+)=([0-9a-f?]+)'
+            $keyMap = @{ a = 0x0D; b = 0x08; x = 0x58; y = 0x59; start = 0x1B; back = 0x09
+                         lb = 0x51; rb = 0x45; up = 0x26; down = 0x28; left = 0x25; right = 0x27 }
+            if (-not ("LeonidaKeys" -as [type])) {
+                Add-Type -TypeDefinition @"
+using System;
+using System.Runtime.InteropServices;
+[StructLayout(LayoutKind.Sequential)] public struct KEYBDINPUT { public ushort wVk; public ushort wScan; public uint dwFlags; public uint time; public IntPtr dwExtraInfo; }
+[StructLayout(LayoutKind.Explicit, Size = 40)] public struct INPUT { [FieldOffset(0)] public uint type; [FieldOffset(8)] public KEYBDINPUT ki; }
+public static class LeonidaKeys {
+    [DllImport("user32.dll", SetLastError = true)] public static extern uint SendInput(uint n, INPUT[] inputs, int cb);
+    public static void Key(ushort vk, bool down) {
+        INPUT[] input = new INPUT[1];
+        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)));

[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.

<!-- greyfinch-sync:ubiquitarianism/leonida:review-comment:4699836327 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1917#discussion_r4699836327). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-25T19:28:00Z. **Code review location:** `scripts/windows-boot/boot.ps1`; line 407 ~~~~diff @@ -340,10 +373,101 @@ if (-not $DigestOnly) { -RedirectStandardError $LogFile -RedirectStandardOutput $StdoutFile $handle = $proc.Handle # keeps the exit code readable after the process ends $stopped = $false - if (-not $proc.WaitForExit($Seconds * 1000)) { - $stopped = $true - try { Stop-Process -Id $proc.Id -Force -Confirm:$false } catch { } - [void]$proc.WaitForExit(20000) + if (-not $statePlan.Count) { + if (-not $proc.WaitForExit($Seconds * 1000)) { + $stopped = $true + try { Stop-Process -Id $proc.Id -Force -Confirm:$false } catch { } + [void]$proc.WaitForExit(20000) + } + } else { + # State-relative input: watch the LEONIDA_PEEK values and inject a key once a state has been seen + # for its delay. The key path is the keyboard pad (GetAsyncKeyState), so LEONIDA_KEYBOARD_PAD=always + # is set above; no window focus is needed. + $watchStart = Get-Date + $deadline = $watchStart.AddSeconds($Seconds) + $seen = @{ game = $null; session = $null } + $fired = @{} + $watchPeekRx = [regex]'\[rt\] peek t=(\d+)s:(.*)$' + $watchValRx = [regex]'0x([0-9a-f]+)=([0-9a-f?]+)' + $keyMap = @{ a = 0x0D; b = 0x08; x = 0x58; y = 0x59; start = 0x1B; back = 0x09 + lb = 0x51; rb = 0x45; up = 0x26; down = 0x28; left = 0x25; right = 0x27 } + if (-not ("LeonidaKeys" -as [type])) { + Add-Type -TypeDefinition @" +using System; +using System.Runtime.InteropServices; +[StructLayout(LayoutKind.Sequential)] public struct KEYBDINPUT { public ushort wVk; public ushort wScan; public uint dwFlags; public uint time; public IntPtr dwExtraInfo; } +[StructLayout(LayoutKind.Explicit, Size = 40)] public struct INPUT { [FieldOffset(0)] public uint type; [FieldOffset(8)] public KEYBDINPUT ki; } +public static class LeonidaKeys { + [DllImport("user32.dll", SetLastError = true)] public static extern uint SendInput(uint n, INPUT[] inputs, int cb); + public static void Key(ushort vk, bool down) { + INPUT[] input = new INPUT[1]; + 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))); ~~~~ --- [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](https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-sendinput).
MoonEyes commented 2026-11-28 02:49:22 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T02:49:22Z.


Hi @BubsMcgee, thanks for this pull request. It currently conflicts with main (conflicting file(s): scripts/windows-boot/boot.ps1), so it carries the needs rebase label. CONTRIBUTING.md asks authors to rebase their branch on main; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7232616036 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1917#issuecomment-7232616036). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T02:49:22Z. --- Hi @BubsMcgee, thanks for this pull request. It currently conflicts with `main` (conflicting file(s): `scripts/windows-boot/boot.ps1`), so it carries the `needs rebase` label. CONTRIBUTING.md asks authors to rebase their branch on `main`; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here. AI-assisted (Claude Code, Claude Opus 5.5).
aslan2142 commented 2026-12-01 11:48:34 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:48:34Z.

Review: CHANGES_REQUESTED


This PR cannot merge in its current state:

  • Merge conflict with main in scripts/windows-boot/boot.ps1.
  • No CI run on current head 34da84a.
  • Unaddressed PowerShell 5.1 timing/plan-file issues reproduced in the review above.
  • Competing variant with #2749 for BOOT-INPUT-STATE-RELATIVE / #1900 (harness-side here vs runtime GameInput in #2749) — both cannot land unchanged.

Please rebase onto current main, address the PowerShell 5.1 findings, coordinate the variant decision with #2749, and obtain a green CI run.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6130634070 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1917#pullrequestreview-6130634070). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T11:48:34Z. **Review:** CHANGES_REQUESTED --- This PR cannot merge in its current state: - **Merge conflict** with `main` in `scripts/windows-boot/boot.ps1`. - **No CI run** on current head `34da84a`. - **Unaddressed PowerShell 5.1 timing/plan-file issues** reproduced in the review above. - **Competing variant with `#2749`** for `BOOT-INPUT-STATE-RELATIVE` / `#1900` (harness-side here vs runtime `GameInput` in `#2749`) — both cannot land unchanged. Please rebase onto current `main`, address the PowerShell 5.1 findings, coordinate the variant decision with `#2749`, and obtain a green CI run. *(AI-assisted review.)*
aslan2142 commented 2026-12-01 11:49:20 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:49:20Z.


Closing this PR in favor of #2749 for BOOT-INPUT-STATE-RELATIVE (#1900).

Side-by-side comparison:

  • Clean-room compliance: #1917 hardcodes title-specific RVAs (0x7446510 and 0x98f828c) in scripts/windows-boot/README.md and scripts/windows-boot/boot.ps1. main has since removed hardcoded game RVAs in favor of locally supplied LEONIDA_GAME_STATE_RVA / LEONIDA_SESSION_STATE_RVA.
  • Architecture & reliability: #1917 conflicts with main, has no CI status, and injects OS-wide SendInput keys from PowerShell (with timing and plan-file bugs reproduced in @lixonik's review). #2749 implements state-relative scripted presses (button@game=<hex>+seconds[:hold] / button@session=<hex>+seconds[:hold]) natively inside the GameInput shim using the locally supplied RVA environment variables, works with both SDL3 and no-SDL paths, supports :hold, is MERGEABLE/CLEAN, and has all CI checks green (verified under ASan).

Thanks @BubsMcgee for the initial design and specification of the @game= / @session= syntax.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7310194222 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1917#issuecomment-7310194222). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T11:49:20Z. --- Closing this PR in favor of **#2749** for `BOOT-INPUT-STATE-RELATIVE` (`#1900`). **Side-by-side comparison:** - **Clean-room compliance:** `#1917` hardcodes title-specific RVAs (`0x7446510` and `0x98f828c`) in `scripts/windows-boot/README.md` and `scripts/windows-boot/boot.ps1`. `main` has since removed hardcoded game RVAs in favor of locally supplied `LEONIDA_GAME_STATE_RVA` / `LEONIDA_SESSION_STATE_RVA`. - **Architecture & reliability:** `#1917` conflicts with `main`, has no CI status, and injects OS-wide `SendInput` keys from PowerShell (with timing and plan-file bugs reproduced in `@lixonik`'s review). `#2749` implements state-relative scripted presses (`button@game=<hex>+seconds[:hold]` / `button@session=<hex>+seconds[:hold]`) natively inside the `GameInput` shim using the locally supplied RVA environment variables, works with both SDL3 and no-SDL paths, supports `:hold`, is `MERGEABLE/CLEAN`, and has all CI checks green (verified under ASan). Thanks `@BubsMcgee` for the initial design and specification of the `@game=` / `@session=` syntax. *(AI-assisted review.)*

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!1917
No description provided.