GameInput: keep 256 readings per device, not 32 (input lost at low frame rates) #2216
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2218"
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 desplmfao on 2026-11-25T08:08:49Z.
Problem
GameInput keeps the last 32 readings per device (
HISTORYincrates/victory-hle/src/modules/gameinput.rs). VIctory polls every 8 ms, so 32 readings cover about 256 ms. A title that reads input once per frame and asks for readings since its last one (GetNextReading/GetPreviousReadingfrom a reference) getsREFERENCE_TOO_OLDwhenever a frame takes longer than that. At the 1–3 fps Grand Theft Auto VI currently runs at, that's every frame, so input is lost.Change
HISTORYgoes from 32 to 256: about 2 s of readings per device. Nothing is sized by the constant.historyis aVecDequethat grows as readings arrive, and a reading is only recorded when a device's state changes. Lookups walk it linearly, as before.Memory: a reading is about 80 bytes (72 for the boxed reading plus its queue slot), so full histories for 6 devices go from about 15 KiB to about 120 KiB.
The idea comes from fxceless/victory-fork#23 by @youroot-code (credited in the commit).
Tested
cargo clippy -p victory-hle --all-targets -- -D warnings: clean.cargo test -p victory-hle gameinputon Windows x64 (under Proton here): 9 passed.AI-assisted (Claude Code).
🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T08:22:53Z.
Review: APPROVED
Verified locally merged onto
origin/main(940d32f, Windows 11 x64, Rust 1.98.1 MSVC):cargo test -p victory-hle --lib gameinput::— 9 passed, 0 failedcargo clippy -p victory-hle --all-targets— 0 warningscargo xtask policy— ok (183 files ok)Clean 1-line buffer expansion keeping 256 GameInput readings per device so inputs aren't dropped at low frame rates. Looks good.
AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T08:48:22Z.
Review: COMMENTED
GameInput HISTORY 32→256 readings per device. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Trivial one-liner; note #2230 also touches gameinput.rs and still keeps HISTORY=32 — whichever lands second should reconcile.
Imported from Marvisak/VIctory. Originally posted by desplmfao on 2026-11-25T08:53:14Z.
@catminou4 thanks. I checked the two together: #2218 and #2230 (head
d3d9cd1) merge with no conflict, and the mergedgameinput.rshasHISTORY = 256. #2230 doesn't touch the constant, it only shows 32 because it's based onmain. So either merge order works without a reconcile step.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T12:42:58Z.
Automated triage for the maintainers.
Merge candidate.
HISTORYincrates/victory-hle/src/modules/gameinput.rs(readings kept per device for the next/previous-reading lookups) goes from 32 to 256. With the 8 msPOLL, 32 readings cover only about 256 ms. A title frame longer than that, which is common at the current frame rates, finds the reading it last saw already dropped, and input between the two frames is lost. 256 readings cover about 2 s, at a small memory cost per device.CI
checkpasses, and the branch merges cleanly. It also combines cleanly with #2230 (see the note above).Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T22:06:33Z.
Automated triage for the maintainers, second look (a review against current
main, with builds and tests where they could change the verdict).Closing because the title cannot hit the case. Its keyboard reader calls
GetCurrentReadingand thenGetNextReadingstarting from that reading, and its pad code callsGetPreviousReadingof the current reading, so no reference older than the newest reading is ever passed. The figure "32 readings = 256 ms" does not hold either: a reading is recorded only when the state changes, not on every poll.If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.
Pull request closed