gameinput: add opt-in periodic combined-pad reports #179

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

@⁠DecayingEagle on GitHub · 2026-12-02 11:28 UTC · original
DecayingEagle:codex/periodic-combined-pad-reports → main · +80 −1 · 3 files · 1 commits · draft

Adds an off-by-default compatibility option for unchanged combined-gamepad readings:

VICTORY_ONE_PAD=1 VICTORY_PAD_REPORT_MS=8 ./run.sh

With the option enabled, the combined pad receives a fresh immutable reading at the chosen interval even when its state has not changed. State changes and releases still publish immediately. The default (0/unset), individual host-pad slots, keyboard readings and device connection callbacks keep their existing behavior. Intervals are bounded to 1000 ms.

Motivation: automated testing with an evdev virtual Xbox 360 pad on Wine 11.22 reproduced very little camera movement during long constant stick holds. XInput probing confirmed full stick values and correct button masks. Varying the right-stick value by 32/32767 every 15 ms restored continuous movement; enabling periodic combined-pad reports allowed constant holds to move continuously without that variation. This is a compatibility experiment based on that reproduction, not a claim that every GameInput device requires periodic duplicate readings.

Validation:

  • All 10 modules::gameinput::tests passed under Wine, including the new deterministic COM-reading regression. It checks the interval boundary, sequence/timestamp advancement, preserved held state, immutable older readings, GetNextReading traversal, and immediate release.
  • Fake-source tests explicitly used VICTORY_NATIVE_INPUT=0 VICTORY_PC_CONTROLS=0 VICTORY_KBM_PC=0; the live native keyboard bridge otherwise replaces their fake keyboard/mouse values on Windows.
  • Real gameplay on RX 7900 XT / Ryzen 9 9900X / Linux, Series X, full-resolution 1440p FSR 4 Native AA, RT/FG off, frozen isolated save: steady-stick movement and menu navigation observed with the option enabled and no input variation.
  • The gameplay build also includes #163, #164, #173 and #178. A 4K UI plane was composited into 1440p output for the menu check. No performance improvement is claimed for this input change.
  • git diff --check passed.

Only a virtual Xbox pad under Wine has been checked for this option. Physical controllers and Windows need independent testing; the option remains disabled by default.

AI assistance: Codex investigated, implemented and tested this change on the hardware above.

**@⁠DecayingEagle** on GitHub · 2026-12-02 11:28 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/179) `DecayingEagle:codex/periodic-combined-pad-reports` → `main` · +80 −1 · 3 files · 1 commits · draft Adds an **off-by-default** compatibility option for unchanged combined-gamepad readings: ```sh VICTORY_ONE_PAD=1 VICTORY_PAD_REPORT_MS=8 ./run.sh ``` With the option enabled, the combined pad receives a fresh immutable reading at the chosen interval even when its state has not changed. State changes and releases still publish immediately. The default (`0`/unset), individual host-pad slots, keyboard readings and device connection callbacks keep their existing behavior. Intervals are bounded to 1000 ms. Motivation: automated testing with an evdev virtual Xbox 360 pad on Wine 11.22 reproduced very little camera movement during long constant stick holds. XInput probing confirmed full stick values and correct button masks. Varying the right-stick value by 32/32767 every 15 ms restored continuous movement; enabling periodic combined-pad reports allowed constant holds to move continuously without that variation. This is a compatibility experiment based on that reproduction, not a claim that every GameInput device requires periodic duplicate readings. Validation: - All 10 `modules::gameinput::tests` passed under Wine, including the new deterministic COM-reading regression. It checks the interval boundary, sequence/timestamp advancement, preserved held state, immutable older readings, GetNextReading traversal, and immediate release. - Fake-source tests explicitly used `VICTORY_NATIVE_INPUT=0 VICTORY_PC_CONTROLS=0 VICTORY_KBM_PC=0`; the live native keyboard bridge otherwise replaces their fake keyboard/mouse values on Windows. - Real gameplay on RX 7900 XT / Ryzen 9 9900X / Linux, Series X, full-resolution 1440p FSR 4 Native AA, RT/FG off, frozen isolated save: steady-stick movement and menu navigation observed with the option enabled and no input variation. - The gameplay build also includes #163, #164, #173 and #178. A 4K UI plane was composited into 1440p output for the menu check. No performance improvement is claimed for this input change. - `git diff --check` passed. Only a virtual Xbox pad under Wine has been checked for this option. Physical controllers and Windows need independent testing; the option remains disabled by default. AI assistance: Codex investigated, implemented and tested this change on the hardware above.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 11:32:30 +00:00
Author
Owner

@⁠DecayingEagle on GitHub · 2026-12-02 11:36 UTC · original

Follow-up: the opt-in mode completed an 8-minute monitored gameplay/menu run with steady virtual-pad inputs and no input dither. No runtime fault, device loss, kernel GPU reset/timeout or frame-stat stall was recorded. The menu was entered, navigated and exited back into the world. This remains a virtual-Xbox-under-Wine result; I left the option disabled in the normal local launch pending physical-controller testing.

Separately, VICTORY_UI_PLANE=3840x2160 corrected the controller-settings overlap at 2560×1440 output; this uses the existing compositor and is not a change in this PR. The title's GPU rendering stayed at native 1440p FSR 4 Native AA.

**@⁠DecayingEagle** on GitHub · 2026-12-02 11:36 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/179#issuecomment-7344156917) Follow-up: the opt-in mode completed an 8-minute monitored gameplay/menu run with steady virtual-pad inputs and no input dither. No runtime fault, device loss, kernel GPU reset/timeout or frame-stat stall was recorded. The menu was entered, navigated and exited back into the world. This remains a virtual-Xbox-under-Wine result; I left the option disabled in the normal local launch pending physical-controller testing. Separately, `VICTORY_UI_PLANE=3840x2160` corrected the controller-settings overlap at 2560×1440 output; this uses the existing compositor and is not a change in this PR. The title's GPU rendering stayed at native 1440p FSR 4 Native AA.
Author
Owner

@⁠Kal0s-design on GitHub · 2026-12-03 20:40 UTC · original

I had a look at this on native Windows (msvc target, not Wine), merged locally onto current main 0b652f8. Short version, the code change is small and looks safe, the conflicts are only in the docs.

Merge. git merge-tree against main reports conflicts in README.md and run.conf.default only, gameinput.rs merges cleanly. The README settings table this adds a row to has since moved to docs/SETTINGS.md, and run.conf.default now carries # group:, # label: and # choices: lines that the menu reads, so the new entry probably wants a label and a place in a group. One more doc thing, VICTORY_ONE_PAD is now on unless it's 0 (parse_one_pad), so after a rebase VICTORY_PAD_REPORT_MS alone turns this on and the "Requires VICTORY_ONE_PAD=1" wording in the README row and run.conf.default would be out of date.

Switched off. With the variable unset or 0, pad_report_us is 0, the extra clause in update() is false, and the condition is the same as before. With one-pad off it's forced to 0 too, so separate host pads and the keyboard device can't be touched by it. I don't see any way for the default path to change.

Timing. There's no new thread or timer, the check runs inside the existing 8 ms poll, so there's nothing to start, stop or tear down on disconnect. The FALLBACK slot never disconnects in one-pad mode anyway, and the new clause sits inside if let Some(value), so a disconnected slot gets no report. Everything runs under the state mutex like the rest of update(). One consequence is that the interval snaps to poll ticks, so any value from 1 to 8 means every poll and 10 means every other poll. That might be worth saying in the docs, or clamping the lower bound to the poll period. I timed std::thread::sleep(8 ms) on this machine and it lands around 8.0 to 9.1 ms, so the coarse 15.6 ms Windows timer isn't in play and 8 does give a report each poll.

Other bits I checked. Old readings are refcounted, so when history (256 deep) rolls over at about 2 s of held input, readings the title still holds stay valid, and your test covers the immutability. On Windows with mouse controls on, GetCurrentReading also calls update() for FALLBACK when the per-frame mouse sample differs. That path only fires on a real change, so the new clause doesn't affect it, and a sampled reading just restarts the interval. The cfg!(test) in Hub::new works but puts test knowledge in the constructor. Reading the variable in a small helper the way one_pad() does would keep that out, but it's minor.

Tests. On the merged tree cargo test -p victory-hle --lib gives 158 passed, 3 failed, 1 ignored. The new held_one_pad_gets_periodic_readings_without_changing_its_state passes, three runs out of three. The 3 failures are the same ones main has on Windows (keys_feed_the_keyboard_and_the_stand_in_pad, a_host_pad_feeds_the_one_pad_which_never_goes, pc_kbm_maps_pc_style_keys_and_smooths_mouse_look), same asserts, just shifted down by the lines this adds. They come from native input being on by default, which is what you worked around with VICTORY_NATIVE_INPUT=0, so this PR doesn't change them either way. With that variable set all 25 gameinput tests pass. Clippy on victory-hle with all targets shows the same warnings as main, nothing new.

I haven't tried the option with a real controller on Windows, so I can't say anything about the motivating behaviour, only that the plumbing looks right.

AI-assisted: yes

**@⁠Kal0s-design** on GitHub · 2026-12-03 20:40 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/179#issuecomment-7391619224) I had a look at this on native Windows (msvc target, not Wine), merged locally onto current main 0b652f8. Short version, the code change is small and looks safe, the conflicts are only in the docs. Merge. `git merge-tree` against main reports conflicts in README.md and run.conf.default only, gameinput.rs merges cleanly. The README settings table this adds a row to has since moved to docs/SETTINGS.md, and run.conf.default now carries `# group:`, `# label:` and `# choices:` lines that the menu reads, so the new entry probably wants a label and a place in a group. One more doc thing, `VICTORY_ONE_PAD` is now on unless it's `0` (`parse_one_pad`), so after a rebase `VICTORY_PAD_REPORT_MS` alone turns this on and the "Requires VICTORY_ONE_PAD=1" wording in the README row and run.conf.default would be out of date. Switched off. With the variable unset or 0, `pad_report_us` is 0, the extra clause in `update()` is false, and the condition is the same as before. With one-pad off it's forced to 0 too, so separate host pads and the keyboard device can't be touched by it. I don't see any way for the default path to change. Timing. There's no new thread or timer, the check runs inside the existing 8 ms poll, so there's nothing to start, stop or tear down on disconnect. The FALLBACK slot never disconnects in one-pad mode anyway, and the new clause sits inside `if let Some(value)`, so a disconnected slot gets no report. Everything runs under the state mutex like the rest of `update()`. One consequence is that the interval snaps to poll ticks, so any value from 1 to 8 means every poll and 10 means every other poll. That might be worth saying in the docs, or clamping the lower bound to the poll period. I timed `std::thread::sleep(8 ms)` on this machine and it lands around 8.0 to 9.1 ms, so the coarse 15.6 ms Windows timer isn't in play and 8 does give a report each poll. Other bits I checked. Old readings are refcounted, so when history (256 deep) rolls over at about 2 s of held input, readings the title still holds stay valid, and your test covers the immutability. On Windows with mouse controls on, `GetCurrentReading` also calls `update()` for FALLBACK when the per-frame mouse sample differs. That path only fires on a real change, so the new clause doesn't affect it, and a sampled reading just restarts the interval. The `cfg!(test)` in `Hub::new` works but puts test knowledge in the constructor. Reading the variable in a small helper the way `one_pad()` does would keep that out, but it's minor. Tests. On the merged tree `cargo test -p victory-hle --lib` gives 158 passed, 3 failed, 1 ignored. The new `held_one_pad_gets_periodic_readings_without_changing_its_state` passes, three runs out of three. The 3 failures are the same ones main has on Windows (`keys_feed_the_keyboard_and_the_stand_in_pad`, `a_host_pad_feeds_the_one_pad_which_never_goes`, `pc_kbm_maps_pc_style_keys_and_smooths_mouse_look`), same asserts, just shifted down by the lines this adds. They come from native input being on by default, which is what you worked around with `VICTORY_NATIVE_INPUT=0`, so this PR doesn't change them either way. With that variable set all 25 gameinput tests pass. Clippy on victory-hle with all targets shows the same warnings as main, nothing new. I haven't tried the option with a real controller on Windows, so I can't say anything about the motivating behaviour, only that the plumbing looks right. AI-assisted: yes
Author
Owner

@⁠Luxuride on GitHub · 2026-12-04 12:01 UTC · original

This is a guess about a title behaviour with no measurement behind it, and an off-by-default guess costs the maintainer a documented switch each. Nothing here shows a title that discards stale held readings; the test proves the mechanism works, not that anything improves.

If you keep it:

  • VICTORY_PAD_REPORT_MS gets four lines at the end of run.conf.default with no # label:, so the F1 menu shows an unnamed row, and there is no docs/SETTINGS.md row. README.md:52 also crams two switches into one row (VICTORY_ONE_PAD=1 VICTORY_PAD_REPORT_MS=8), which reads as one variable.
  • Periodic readings turn the 256-entry history over in about two seconds (gameinput.rs:66-67), so anything walking back further sees a much shallower past than before. Worth a sentence.

No defect found in the code: pad_report_us is parsed once at Hub construction and the FALLBACK slot's update() is genuinely called every poll, so the branch is reachable.

Park it until you can show the dropped-input title; with that reproduction and one switch it becomes a ten-line review.

**@⁠Luxuride** on GitHub · 2026-12-04 12:01 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/179#issuecomment-7410870021) This is a guess about a title behaviour with no measurement behind it, and an off-by-default guess costs the maintainer a documented switch each. Nothing here shows a title that discards stale held readings; the test proves the mechanism works, not that anything improves. If you keep it: - `VICTORY_PAD_REPORT_MS` gets four lines at the end of `run.conf.default` with no `# label:`, so the F1 menu shows an unnamed row, and there is no `docs/SETTINGS.md` row. `README.md:52` also crams two switches into one row (`VICTORY_ONE_PAD=1 VICTORY_PAD_REPORT_MS=8`), which reads as one variable. - Periodic readings turn the 256-entry history over in about two seconds (`gameinput.rs:66-67`), so anything walking back further sees a much shallower past than before. Worth a sentence. No defect found in the code: `pad_report_us` is parsed once at Hub construction and the FALLBACK slot's `update()` is genuinely called every poll, so the branch is reachable. Park it until you can show the dropped-input title; with that reproduction and one switch it becomes a ten-line review.
This pull request has changes conflicting with the target branch.
  • README.md
  • crates/victory-hle/src/modules/gameinput.rs
  • run.conf.default
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-179'
git switch 'github-bot/gh-179'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-179'
git switch 'github-bot/gh-179'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-179'
git switch 'main'
git merge --squash 'github-bot/gh-179'
git switch 'main'
git merge --ff-only 'github-bot/gh-179'
git switch 'main'
git merge 'github-bot/gh-179'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.