GameInput: keep 256 readings per device, not 32 (input lost at low frame rates) #2216

Closed
desplmfao wants to merge 1 commit from upstream-pr/2218 into main
desplmfao commented 2026-11-25 08:08:49 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by desplmfao on 2026-11-25T08:08:49Z.


Problem

GameInput keeps the last 32 readings per device (HISTORY in crates/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 / GetPreviousReading from a reference) gets REFERENCE_TOO_OLD whenever 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

HISTORY goes from 32 to 256: about 2 s of readings per device. Nothing is sized by the constant. history is a VecDeque that 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 gameinput on Windows x64 (under Proton here): 9 passed.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:6600065034 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2218). Originally posted by [desplmfao](https://github.com/desplmfao) on 2026-11-25T08:08:49Z. --- ## Problem GameInput keeps the last 32 readings per device (`HISTORY` in `crates/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` / `GetPreviousReading` from a reference) gets `REFERENCE_TOO_OLD` whenever 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 `HISTORY` goes from 32 to 256: about 2 s of readings per device. Nothing is sized by the constant. `history` is a `VecDeque` that 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 gameinput` on Windows x64 (under Proton here): 9 passed. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
DenRakEiw commented 2026-11-25 09:05:48 +00:00 (Migrated from github.com)

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 failed
  • cargo clippy -p victory-hle --all-targets — 0 warnings
  • cargo 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).

<!-- greyfinch-sync:Marvisak/VIctory:review:6054066620 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2218#pullrequestreview-6054066620). Originally posted by [DenRakEiw](https://github.com/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 failed - `cargo clippy -p victory-hle --all-targets` — 0 warnings - `cargo 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).
catminou4 commented 2026-11-25 09:05:48 +00:00 (Migrated from github.com)

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.

<!-- greyfinch-sync:Marvisak/VIctory:review:6054379023 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2218#pullrequestreview-6054379023). Originally posted by [catminou4](https://github.com/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.
desplmfao commented 2026-11-25 09:06:23 +00:00 (Migrated from github.com)

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 merged gameinput.rs has HISTORY = 256. #2230 doesn't touch the constant, it only shows 32 because it's based on main. So either merge order works without a reconcile step.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7157595773 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2218#issuecomment-7157595773). Originally posted by [desplmfao](https://github.com/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 merged `gameinput.rs` has `HISTORY = 256`. #2230 doesn't touch the constant, it only shows 32 because it's based on `main`. So either merge order works without a reconcile step.
Marvisak commented 2026-11-25 13:02:54 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T12:42:58Z.


Automated triage for the maintainers.

Merge candidate. HISTORY in crates/victory-hle/src/modules/gameinput.rs (readings kept per device for the next/previous-reading lookups) goes from 32 to 256. With the 8 ms POLL, 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 check passes, and the branch merges cleanly. It also combines cleanly with #2230 (see the note above).


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7162755567 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2218#issuecomment-7162755567). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T12:42:58Z. --- <!-- victory-triage v1 head=42dd7a374e30261eb79d2f3aff44dafec1abeba5 verdict=merge-candidate at=2026-11-25T12:46:00Z --> Automated triage for the maintainers. **Merge candidate.** `HISTORY` in `crates/victory-hle/src/modules/gameinput.rs` (readings kept per device for the next/previous-reading lookups) goes from 32 to 256. With the 8 ms `POLL`, 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 `check` passes, and the branch merges cleanly. It also combines cleanly with #2230 (see the note above). --- _Generated by [Claude Code](https://claude.ai/code)_
upstream-sync closed this pull request 2026-11-25 23:04:04 +00:00
Marvisak commented 2026-11-25 23:05:57 +00:00 (Migrated from github.com)

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 GetCurrentReading and then GetNextReading starting from that reading, and its pad code calls GetPreviousReading of 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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7175946206 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2218#issuecomment-7175946206). Originally posted by [Marvisak](https://github.com/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 `GetCurrentReading` and then `GetNextReading` starting from that reading, and its pad code calls `GetPreviousReading` of 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

Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!2216
No description provided.