Repository navigation
GameInput: next and previous readings of a disconnected device fail - #428
marquezinii wants to merge 1 commit into
Conversation
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.
|
Verified
Not covered: a physical pad disconnect during polling, and title behaviour (no game data on this machine). |
mercuryVM
left a comment
There was a problem hiding this comment.
Tested a312333 on Windows 11, RTX 5070, MSVC: cargo test --workspace --no-fail-fast passes (265 passed, 0 failed).
- The new check runs after the
device == reference.devicecheck, soindexis the filtered device's slot. TheDEVICE_DISCONNECTEDresult matches whatcurrent_readingalready returns for a disconnected filter device. - Unfiltered walks (
devicenull) are unchanged and can still walk the history of an unplugged device, which seems right since the docs only describe the filtered case.
No issues found.
AI-assisted (Claude Code).
… of a disconnected device fail Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Automated triage for the maintainers. Needs rebase. This pull request conflicts with Generated by Claude Code |
|
I rebased your disconnected-device fix on current main ( 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, The combined branch passes all 10 GameInput tests and all 145 |
GetNextReadingandGetPreviousReadingwith a device filter kept walking a device's history after it was unplugged. Both reference pages say the call "Returns aNULLvalue and failureHRESULTif [...] a device filter is provided for a disconnected device", andGetCurrentReadinghere already returnsGAMEINPUT_E_DEVICE_DISCONNECTEDin that case.With the old code, Next returned
GAMEINPUT_E_READING_NOT_FOUNDand Previous an old reading. The polling loop on those pages keeps going onREADING_NOT_FOUNDand resets only on another failure, so a title written that way never noticed the pad was gone.relativenow fails withDEVICE_DISCONNECTEDwhen a device is given and its slot is not connected, ascurrent_readingdoes. 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, nowDEVICE_DISCONNECTEDboth ways.cargo test -p victory-hlepasses 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