HLE GameInput: expand per-device reading history to 256 #3105

Open
github-bot wants to merge 1 commit from github-bot/gh-3105 into main AGit
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 08:12 UTC · original
fuzeofficlal:fix/hle-gameinput-history-depth → main · +68 −2 · 1 files · 1 commits · open

Summary

  • Increase HISTORY in crates/victory-hle/src/modules/gameinput.rs from 32 to 256 (~2 seconds at the 8 ms POLL interval) so low-FPS titles (2–5 FPS) do not lose intermediate readings before walking history with GetPreviousReading / GetNextReading.
  • Confirmed Slot::history is a heap-allocated VecDeque<Ref>, avoiding fixed-size stack growth.
  • Added unit tests covering >32 consecutive state changes (bidirectional traversal) and HISTORY + 10 changes (FIFO eviction and GAMEINPUT_E_READING_NOT_FOUND past the oldest retained reading).

(Motivated by the low-FPS history-depth fix in fxceless/victory-fork 04512df4; orthogonal to #2230.)

Verification

  • cargo test -p victory-hle --locked -- modules::gameinput::: 12 passed, 0 failed.
  • cargo clippy -p victory-hle --all-targets --locked -- -D warnings: clean.
  • cargo clippy -p victory-hle --all-targets --all-features --locked -- -D warnings: clean.
  • cargo test -p xtask --locked policy::tests::repository_passes_policy: 1 passed, 0 failed.
**@⁠fuzeofficlal** on GitHub · 2026-11-26 08:12 UTC · [original](https://github.com/Marvisak/VIctory/pull/3105) `fuzeofficlal:fix/hle-gameinput-history-depth` → `main` · +68 −2 · 1 files · 1 commits · open ## Summary - Increase `HISTORY` in `crates/victory-hle/src/modules/gameinput.rs` from `32` to `256` (~2 seconds at the 8 ms `POLL` interval) so low-FPS titles (2–5 FPS) do not lose intermediate readings before walking history with `GetPreviousReading` / `GetNextReading`. - Confirmed `Slot::history` is a heap-allocated `VecDeque<Ref>`, avoiding fixed-size stack growth. - Added unit tests covering >32 consecutive state changes (bidirectional traversal) and `HISTORY + 10` changes (FIFO eviction and `GAMEINPUT_E_READING_NOT_FOUND` past the oldest retained reading). (Motivated by the low-FPS history-depth fix in `fxceless/victory-fork` `04512df4`; orthogonal to #2230.) ## Verification - `cargo test -p victory-hle --locked -- modules::gameinput::`: 12 passed, 0 failed. - `cargo clippy -p victory-hle --all-targets --locked -- -D warnings`: clean. - `cargo clippy -p victory-hle --all-targets --all-features --locked -- -D warnings`: clean. - `cargo test -p xtask --locked policy::tests::repository_passes_policy`: 1 passed, 0 failed.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:24:42 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-26 08:24 UTC · original

Automated triage for the maintainers.

Needs work: evidence for the new depth. Raising HISTORY from 32 to 256 in crates/victory-hle/src/modules/gameinput.rs changes what GetPreviousReading, GetNextReading and GetTemporalReading return. A reference older than 32 changes ago now resolves instead of failing with REFERENCE_TOO_OLD or not-found. That is emulation behaviour, and the PR gives no evidence for 256:

  • whether the title walks reading history at all, and how far back (the title's own code calling these functions);
  • or how deep the real runtime's history is (public GameInput documentation).

Readings are only kept when the state changes (Hub::update). So 32 entries already covers 32 distinct changes between two frames, not 32 polls, and the "2 seconds at 8 ms" sizing in the comment does not hold.

The new tests cover the traversal and eviction logic well. If evidence shows the title needs more depth, the same tests can back a value that matches it. One cost to keep in mind: relative with no device scans every slot's history under the hub lock, so the depth also costs time per call. CI was still running when this was written.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-26 08:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/3105#issuecomment-7186561966) <!-- victory-triage v1 head=161b283dba3c29d856e10fdf6b0e2db7f72ef98c verdict=needs-work at=2026-11-26T08:18:11Z --> Automated triage for the maintainers. **Needs work: evidence for the new depth.** Raising `HISTORY` from 32 to 256 in `crates/victory-hle/src/modules/gameinput.rs` changes what `GetPreviousReading`, `GetNextReading` and `GetTemporalReading` return. A reference older than 32 changes ago now resolves instead of failing with `REFERENCE_TOO_OLD` or not-found. That is emulation behaviour, and the PR gives no evidence for 256: - whether the title walks reading history at all, and how far back (the title's own code calling these functions); - or how deep the real runtime's history is (public GameInput documentation). Readings are only kept when the state changes (`Hub::update`). So 32 entries already covers 32 distinct changes between two frames, not 32 polls, and the "2 seconds at 8 ms" sizing in the comment does not hold. The new tests cover the traversal and eviction logic well. If evidence shows the title needs more depth, the same tests can back a value that matches it. One cost to keep in mind: `relative` with no device scans every slot's history under the hub lock, so the depth also costs time per call. CI was still running when this was written. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠oni-swr on GitHub · 2026-11-26 08:28 UTC · original

Independent Windows CPU verification of PR #3105 at 161b283dba (single commit, parent 63bcca43c6 = main). Claim: #1633 . Windows 11 x64, no GPU, no gamepad, cargo test --locked -j 4 -p victory-hle --lib gameinput, synthetic pad states only.

  • Head: 12/12 pass, including the two new tests (walk both ways over 101 readings; FIFO eviction at capacity).
  • Parent: 10/10 pass, so the existing API tests are unchanged in outcome.
  • Control: head tests with HISTORY set back to 32 fail the 100-change bidirectional walk (previous lookup returns an error); the eviction test is written against HISTORY so it passes at either size.
  • Extra scratch test (not committed): after 255, 256, 257 and 515 changes the backward walk from the newest reading takes 254, 255, 255 and 255 steps, then returns READING_NOT_FOUND (exactly 256 retained, oldest evicted first). A reading held by the caller stays valid after it is evicted, and the sequence number keeps counting.

Not checked: source review, real devices, frame timing, other platforms. Test report only; no source changes and no PR from me.

AI use: Claude Code (Claude Sonnet 5.5) ran the checks, coordinated by Codex (gpt-6.2-sol).

**@⁠oni-swr** on GitHub · 2026-11-26 08:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/3105#issuecomment-7186637388) Independent Windows CPU verification of PR #3105 at 161b283dba3c29d856e10fdf6b0e2db7f72ef98c (single commit, parent 63bcca43c6a00a758510398fa43096ce7e4f7df0 = main). Claim: https://git.gtahub.st/github/Marvisak--VIctory/issues/1633 . Windows 11 x64, no GPU, no gamepad, `cargo test --locked -j 4 -p victory-hle --lib gameinput`, synthetic pad states only. - Head: 12/12 pass, including the two new tests (walk both ways over 101 readings; FIFO eviction at capacity). - Parent: 10/10 pass, so the existing API tests are unchanged in outcome. - Control: head tests with `HISTORY` set back to 32 fail the 100-change bidirectional walk (previous lookup returns an error); the eviction test is written against `HISTORY` so it passes at either size. - Extra scratch test (not committed): after 255, 256, 257 and 515 changes the backward walk from the newest reading takes 254, 255, 255 and 255 steps, then returns READING_NOT_FOUND (exactly 256 retained, oldest evicted first). A reading held by the caller stays valid after it is evicted, and the sequence number keeps counting. Not checked: source review, real devices, frame timing, other platforms. Test report only; no source changes and no PR from me. AI use: Claude Code (Claude Sonnet 5.5) ran the checks, coordinated by Codex (gpt-6.2-sol).
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3105/head:github-bot/gh-3105'
git switch 'github-bot/gh-3105'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3105'
git switch 'github-bot/gh-3105'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3105'
git switch 'github-bot/gh-3105'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3105'
git switch 'main'
git merge --squash 'github-bot/gh-3105'
git switch 'main'
git merge --ff-only 'github-bot/gh-3105'
git switch 'main'
git merge 'github-bot/gh-3105'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!3105
No description provided.