GameInput: keep 256 readings per device, not 32 (input lost at low frame rates) #2218
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2218
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2218/head"
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?
@desplmfao on GitHub · 2026-11-25 08:08 UTC · original
desplmfao:fix/gameinput-history→main· +1 −1 · 1 files · 1 commits · closed without mergingProblem
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
@desplmfao on GitHub · 2026-11-25 08:53 UTC · original
@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.@Marvisak on GitHub · 2026-11-25 12:42 UTC · original
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
@Marvisak on GitHub · 2026-11-25 22:06 UTC · original
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