GameInput: next and previous readings of a disconnected device fail #428

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

@⁠marquezinii on GitHub · 2026-11-24 03:15 UTC · original
marquezinii:fix/gameinput-walk-disconnected → main · +25 −0 · 1 files · 1 commits · open

GetNextReading and GetPreviousReading with a device filter kept walking a device's history after it was unplugged. Both reference pages say the call "Returns a NULL value and failure HRESULT if [...] a device filter is provided for a disconnected device", and GetCurrentReading here already returns GAMEINPUT_E_DEVICE_DISCONNECTED in that case.

With the old code, Next returned GAMEINPUT_E_READING_NOT_FOUND and Previous an old reading. The polling loop on those pages keeps going on READING_NOT_FOUND and resets only on another failure, so a title written that way never noticed the pad was gone.

relative now fails with DEVICE_DISCONNECTED when a device is given and its slot is not connected, as current_reading does. Without a device filter nothing changes.

Tested with a new test that walks forward and back from a pad's reading after the fake host drops the pad: before the change it gets READING_NOT_FOUND, now DEVICE_DISCONNECTED both ways. cargo test -p victory-hle passes and clippy reports nothing new. Not tried with a real pad being unplugged.

https://learn.microsoft.com/gaming/gdk/docs/reference/input/gameinput/interfaces/igameinput/methods/igameinput_getnextreading

**@⁠marquezinii** on GitHub · 2026-11-24 03:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/428) `marquezinii:fix/gameinput-walk-disconnected` → `main` · +25 −0 · 1 files · 1 commits · open `GetNextReading` and `GetPreviousReading` with a device filter kept walking a device's history after it was unplugged. Both reference pages say the call "Returns a `NULL` value and failure `HRESULT` if [...] a device filter is provided for a disconnected device", and `GetCurrentReading` here already returns `GAMEINPUT_E_DEVICE_DISCONNECTED` in that case. With the old code, Next returned `GAMEINPUT_E_READING_NOT_FOUND` and Previous an old reading. The polling loop on those pages keeps going on `READING_NOT_FOUND` and resets only on another failure, so a title written that way never noticed the pad was gone. `relative` now fails with `DEVICE_DISCONNECTED` when a device is given and its slot is not connected, as `current_reading` does. Without a device filter nothing changes. Tested with a new test that walks forward and back from a pad's reading after the fake host drops the pad: before the change it gets `READING_NOT_FOUND`, now `DEVICE_DISCONNECTED` both ways. `cargo test -p victory-hle` passes and clippy reports nothing new. Not tried with a real pad being unplugged. https://learn.microsoft.com/gaming/gdk/docs/reference/input/gameinput/interfaces/igameinput/methods/igameinput_getnextreading
GetNextReading and GetPreviousReading document a failure when a device
filter names a disconnected device, as GetCurrentReading already gives.
Walking from such a device's reading returned READING_NOT_FOUND (or an
old reading), so a title following the documented polling loop kept
waiting on a pad that was gone.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:03:31 +00:00
Author
Owner

@⁠DaviTostes on GitHub · 2026-11-24 03:32 UTC · original

Verified a312333 on Arch Linux x86_64 with the Windows build under Wine 11.22 (cargo xwin, x86_64-pc-windows-msvc, release, rustc 1.98.1):

  • victory-hle: 86 passed, 1 failed. The failure is modules::net::tests::only_loopback_is_reachable — the known Wine WSAConnectByList environment gap (#217), not this change.
  • The new walks_filtered_by_a_disconnected_pad_fail passes.
  • no_dll_planting: 1 passed.
  • No conflict with #312 (also edits gameinput.rs): git merge-tree --write-tree 191e335 a312333 merges cleanly.

Not covered: a physical pad disconnect during polling, and title behaviour (no game data on this machine).

**@⁠DaviTostes** on GitHub · 2026-11-24 03:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/428#issuecomment-7121199000) Verified `a312333` on **Arch Linux x86_64** with the Windows build under **Wine 11.22** (`cargo xwin`, `x86_64-pc-windows-msvc`, release, rustc 1.98.1): - `victory-hle`: **86 passed, 1 failed**. The failure is `modules::net::tests::only_loopback_is_reachable` — the known Wine `WSAConnectByList` environment gap (#217), not this change. - The new `walks_filtered_by_a_disconnected_pad_fail` passes. - `no_dll_planting`: **1 passed**. - No conflict with #312 (also edits `gameinput.rs`): `git merge-tree --write-tree 191e335 a312333` merges cleanly. Not covered: a physical pad disconnect during polling, and title behaviour (no game data on this machine).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:29 UTC · original · edited 2026-11-25 01:16 UTC

Automated triage for the maintainers.

Needs rebase. This pull request conflicts with main (conflicting: crates/victory-hle/src/modules/gameinput.rs). It will be reviewed once it is rebased onto the current main.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 00:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/428#issuecomment-7148562927) · edited 2026-11-25 01:16 UTC <!-- victory-triage v1 head=a312333c28ebfd4944d2943b8cb642f4a306469c verdict=needs-rebase at=2026-11-25T01:16:00Z --> Automated triage for the maintainers. **Needs rebase.** This pull request conflicts with `main` (conflicting: `crates/victory-hle/src/modules/gameinput.rs`). It will be reviewed once it is rebased onto the current `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 10:01 UTC · original

I rebased your disconnected-device fix on current main (940d32f) in f023c6c. The conflict was around the history scan changed by #361. Your guard and regression are preserved, along with your Git author. The disconnected-pad test passes on Windows.

The rebase also exposed a separate case. A reference reading marks a position in the stream. A caller can filter the returned readings to a device, as documented in GameInput readings. With two synthetic pads sampled in one poll, 940d32f and f023c6c both return E_INVALIDARG when the filter names the other pad. The separate 366ca98 selects readings from the requested pad in both directions. The original disconnected-pad test still passes.

The combined branch passes all 10 GameInput tests and all 145 victory-hle library tests on native Windows, plus strict Clippy and staged asset policy. You can take f023c6c by itself if you want to keep this PR focused on disconnects. If you fold in the separate filter change, please retain Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.

Filter coordination claim

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 10:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/428#issuecomment-7159122819) I rebased your disconnected-device fix on current main (`940d32f`) in [`f023c6c`](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/f023c6ceb63b0425272cfc8c9f7ceaef7a70a5ce). The conflict was around the history scan changed by #361. Your guard and regression are preserved, along with your Git author. The disconnected-pad test passes on Windows. The rebase also exposed a separate case. A reference reading marks a position in the stream. A caller can filter the returned readings to a device, as documented in [GameInput readings](https://learn.microsoft.com/en-us/gaming/gdk/docs/features/common/input/overviews/input-readings?view=gdk-2610). With two synthetic pads sampled in one poll, `940d32f` and `f023c6c` both return `E_INVALIDARG` when the filter names the other pad. The separate [`366ca98`](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/366ca983c0f8a71b753dc6edd512acd8f172ba17) selects readings from the requested pad in both directions. The original disconnected-pad test still passes. The combined branch passes all 10 GameInput tests and all 145 `victory-hle` library tests on native Windows, plus strict Clippy and staged asset policy. You can take `f023c6c` by itself if you want to keep this PR focused on disconnects. If you fold in the separate filter change, please retain `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>`. [Filter coordination claim](https://git.gtahub.st/github/Marvisak--VIctory/issues/1633)
This pull request has changes conflicting with the target branch.
  • crates/victory-hle/src/modules/gameinput.rs
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/428/head:github-bot/gh-428'
git switch 'github-bot/gh-428'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-428'
git switch 'github-bot/gh-428'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-428'
git switch 'github-bot/gh-428'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-428'
git switch 'main'
git merge --squash 'github-bot/gh-428'
git switch 'main'
git merge --ff-only 'github-bot/gh-428'
git switch 'main'
git merge 'github-bot/gh-428'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!428
No description provided.