HLE GameInput: expand per-device reading history to 256 #3103
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3105"
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?
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T08:12:08Z.
Summary
HISTORYincrates/victory-hle/src/modules/gameinput.rsfrom32to256(~2 seconds at the 8 msPOLLinterval) so low-FPS titles (2–5 FPS) do not lose intermediate readings before walking history withGetPreviousReading/GetNextReading.Slot::historyis a heap-allocatedVecDeque<Ref>, avoiding fixed-size stack growth.HISTORY + 10changes (FIFO eviction andGAMEINPUT_E_READING_NOT_FOUNDpast the oldest retained reading).(Motivated by the low-FPS history-depth fix in
fxceless/victory-fork04512df4; 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.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T08:24:45Z.
Automated triage for the maintainers.
Needs work: evidence for the new depth. Raising
HISTORYfrom 32 to 256 incrates/victory-hle/src/modules/gameinput.rschanges whatGetPreviousReading,GetNextReadingandGetTemporalReadingreturn. A reference older than 32 changes ago now resolves instead of failing withREFERENCE_TOO_OLDor not-found. That is emulation behaviour, and the PR gives no evidence for 256: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:
relativewith 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
Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-26T08:28:29Z.
Independent Windows CPU verification of PR #3105 at
161b283dba(single commit, parent63bcca43c6= main). Claim: https://github.com/Marvisak/VIctory/issues/1633#issuecomment-7186472185 . Windows 11 x64, no GPU, no gamepad,cargo test --locked -j 4 -p victory-hle --lib gameinput, synthetic pad states only.HISTORYset back to 32 fail the 100-change bidirectional walk (previous lookup returns an error); the eviction test is written againstHISTORYso it passes at either size.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).
Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-26T10:53:37Z.
Independent local verification of head
161b283on Windows 11, Rust 1.100.0/MSVC:cargo test --locked -p victory-hle --lib modules::gameinput::— 12 passed, 0 failed (including the new history tests).git diff --check origin/main HEAD— clean.Used a worktree-local
CARGO_TARGET_DIRto avoid stale shared-target binaries. Synthetic input only; no game assets, extracted data or DRM material used. AI-assisted (Hy4 flash).Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T06:22:07Z.
The full-history scan mentioned in triage is addressed in #3684. I combined this PR at
161b283with #3684 atd10b61ein 6fb2440. The 256-entry capacity and both of this PR's history tests are retained.All 13 GameInput tests passed on Windows, including the wrapped-history test with tied timestamps. Strict HLE Clippy and the asset policy passed. The extracted search matched all 49,872 synthetic queries. At 256 retained entries per device the median was 3,535 ns for the old scan and 166 ns for the binary search. This measures lookup only, outside host polling and the mutex.
For sizing, Microsoft documents a half-second history window. If every 8 ms poll records a change, 32 entries span 248 ms and 64 span 504 ms. Those spans depend on how often state changes. This measurement addresses lookup cost. The author and maintainer can decide what retention behavior to target based on the public API and any gameplay evidence.
Please retain the Git authors on cherry-pick or rebase, or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>if folding this resolution into another commit.AI-assisted with OpenAI Codex.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.