[PR #2144] [MERGED] gameinput: a scripted press can be held longer, button@seconds:hold (INPUT-SCRIPT-HOLD) #2149

Closed
opened 2026-11-26 21:20:12 +01:00 by 4ld0 · 0 comments
Owner

📋 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)

  • f0e7914 gameinput: a scripted press can be held longer (button@seconds:hold)
  • 1ce6055 gameinput: the SDL keyboard pad honours a scripted hold too
  • 7bd4cec gameinput: 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_SCRIPT press 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:

  • three b presses at 1080, 1140 and 1200 s did nothing in 30 minutes (run r11);
  • 120 presses 0.5 s apart dismissed it (run r12).

An entry can now give its own hold, button@seconds:hold: b@1100:4 holds B for 4 s. Without :hold a 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 as b@10:1100 from 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 :hold it behaves exactly as before. (Found by AndreiKocherzhinskiiA on #1608.)

Tested

Windows 11 26200, MSVC 19.44, main a73a57e13 plus the two commits.

  • gameinput_test --input-script (SDL3 build): 12 checks, 0 failures. New: y@0:0.6 is 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 in gameinput.cpp reverted 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.8 holds 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_test and gameinput_no_sdl_test without the script argument: 364 checks and 0 failures respectively, unchanged.
  • Retail boot with this branch's runtime (run r13, my own 1.0.2.1, RTX 3060 Ti 8 GB, NVIDIA 621.14, scripts/windows-boot/boot.ps1 from a save, script a@120:2,a@150:2,a@180:2,b@1100:4,b@1130:4,b@1160:4):
    • all 6 entries are parsed (0 rejected);
    • the prompt is on screen at 1,075 s and gone by 1,145 s;
    • the run continues into the prologue at about one frame every 25 s.
      Three 4 s presses do what took 120 short ones.
  • python -I scripts/check_no_game_data.py on 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

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of 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.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/2144 **Author:** [@klikso](https://github.com/klikso) **Created:** 11/26/2026 **Status:** ✅ Merged **Merged:** 11/26/2026 **Merged by:** [@aslan2142](https://github.com/aslan2142) **Base:** `main` ← **Head:** `input/script-hold` --- ### 📝 Commits (3) - [`f0e7914`](https://github.com/ubiquitarianism/leonida/commit/f0e79141a41b63e737560fbd4a051e3ab34dad7d) gameinput: a scripted press can be held longer (button@seconds:hold) - [`1ce6055`](https://github.com/ubiquitarianism/leonida/commit/1ce60558c72770e881a4ef458e125f587b66022e) gameinput: the SDL keyboard pad honours a scripted hold too - [`7bd4cec`](https://github.com/ubiquitarianism/leonida/commit/7bd4cec0262e3cb4268f8b8b14299bae4d47b039) gameinput: boot.ps1 names the :hold form; rewrap the script header comment ### 📊 Changes **7 files changed** (+58 additions, -31 deletions) <details> <summary>View changed files</summary> 📝 `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) </details> ### 📄 Description Claimed in the coordination issue as: INPUT-SCRIPT-HOLD ([claim](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7176410686)) ### What and why A `LEONIDA_INPUT_SCRIPT` press 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: - three `b` presses at 1080, 1140 and 1200 s did nothing in 30 minutes (run r11); - 120 presses 0.5 s apart dismissed it (run r12). An entry can now give its own hold, `button@seconds:hold`: `b@1100:4` holds B for 4 s. Without `:hold` a 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 as `b@10:1100` from 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 `:hold` it behaves exactly as before. (Found by AndreiKocherzhinskiiA on #1608.) ### Tested Windows 11 26200, MSVC 19.44, `main` `a73a57e13` plus the two commits. - `gameinput_test --input-script` (SDL3 build): 12 checks, 0 failures. New: `y@0:0.6` is 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 in `gameinput.cpp` reverted 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.8` holds 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_test` and `gameinput_no_sdl_test` without the script argument: 364 checks and 0 failures respectively, unchanged. - **Retail boot with this branch's runtime** (run r13, my own 1.0.2.1, RTX 3060 Ti 8 GB, NVIDIA 621.14, `scripts/windows-boot/boot.ps1` from a save, script `a@120:2,a@150:2,a@180:2,b@1100:4,b@1130:4,b@1160:4`): - all 6 entries are parsed (0 rejected); - the prompt is on screen at 1,075 s and gone by 1,145 s; - the run continues into the prologue at about one frame every 25 s. Three 4 s presses do what took 120 short ones. - `python -I scripts/check_no_game_data.py` on 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 - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed: n/a (input shim, no translator change). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 21:20:12 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#2149
No description provided.