HLE/gameinput: a pad an all-zero receiver answers for is not a device #839
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/839"
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?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by CwWwWwW on 2026-11-28T07:34:45Z.
Ported to trustno1-coder/VIctory-NVIDIA from the same change submitted to fxceless/victory-fork as PR #1464 (head
8b883b5bf7, author CwWwWwW). The fork's own line was dropped when it rebased onto959dcaf(5dbf5ce), so this is submitted here directly. The description below is the original one; its 'Verification' numbers refer to the fork tree. Rebased onto main63b902f.The problem
Some XInput wireless receivers answer
XInputGetStatewith success and an all-zeroXINPUT_STATEwhile their pad is switched off. The HLE'sHost::pad(crates/victory-hle/src/modules/gameinput.rs:1136-1162) returns that state as a pad, andState::poll(:457) counted anySomepad as present:any_padbecame true, so the keyboard's stand-in pad (FALLBACK) was disconnected (:461);KEYBOARD), which gameplay does not poll.Result on an affected setup: the title ignores the keyboard entirely (its start screen waits for a pad press that never comes), with nothing telling the user why.
Evidence for the receiver behaviour: this is a documented XInput class (the base project's input layer has a report for exactly it). The code-level path is confirmed by the new test, which on the old code turns a single all-zero pad report into two device events 鈥?device 0 connects and the stand-in disconnects.
The change
Statekeeps, per host slot, whether that slot has ever shown input (shown_input). Inpolla reported pad is a device only once it has shown some input; a pad at rest after it was used stays connected; a slot the host no longer answers for forgets it.any_padcounts only these devices, so the stand-in stays while only phantom pads are reported.No code is taken from anywhere; the rule is implemented in this tree's poll/state model.
Evidence
New test
gameinput::tests::an_all_zero_pad_is_not_a_device_the_title_can_use:[(4, 3, 0), (0, 3, 0), (4, 0, 3)]鈥?the stand-in (4) is connected, then the all-zero pad connects (0) and the stand-in disconnects;The existing
unregistering_waits_for_a_running_callbacktest used an all-zero pad to make a device appear; it now gives the pad input (it needs a connect callback to run).Verification (base
9a9091d):cargo test -p victory-hle --lib --locked -- --test-threads=1鈥?104 passed, 0 failedcargo clippy -p victory-hle --all-targets --locked -- -D warnings鈥?cleancargo clippy -p victory-hle --all-targets --locked --all-features -- -D warnings鈥?cleangit diff --checkclean; no new fmt diff (pre-existing crate fmt diffs only).Scope, overlap, residual risk
One file,
crates/victory-hle/src/modules/gameinput.rs(+70/-2). Open PRs in this area do not cover the zero-state rule: #74 supplements the keyboard onto the first connected pad but leavesany_padas it is, #359 is an env override, #1175 moves where the stand-in is reported. They touch the samepollfunction, so textual conflicts are possible; the defect is distinct.Residual: a receiver that keeps answering all-zero after the pad is switched off mid-run keeps that slot connected (at rest) as before; this change fixes the boot case (no device until real input) and does not add a disconnect heuristic for a permanently-zero answering slot.
Limitation: no XInput hardware in this environment; hardware confirmation of the receiver behaviour was not possible here. The platform behaviour is documented externally; the code-level behaviour is covered by the unit test.
Verification on this tree (base
63b902f, 2026-11-27)63b902ffailed on those before this change.Hardware verification suggested
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Dukestar69 on 2026-11-28T07:47:33Z.
Review: APPROVED
Tested locally merged onto
main(63b902f).cargo xtask policypassed (294 files ok).cargo test -p victory-hle --lib gameinputpassed (27 passed; 0 failed; 1 ignored, including the newan_all_zero_pad_is_not_a_device_the_title_can_usetest) with 0 compiler warnings.Good guard preventing phantom/all-zero wireless receiver devices from being exposed to titles. LGTM.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).