GameInput: look up only devices already seen by the process #2510
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2512"
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 Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-25T15:04:10Z.
FindDeviceFromId currently searches every preallocated pad slot. An ID saved by the application can therefore resolve at startup before any pad has appeared in that slot.
Only resolve IDs for slots that have produced an input reading. The history keeps the ID usable for a device this process has already seen after it disconnects.
The synthetic GameInput test gets S_OK for a never-connected pad on the original base,
940d32f. With this fix and #1430 from current main, a never-seen pad and a slot with only an initial all-zero report both return DEVICE_NOT_FOUND and a null output. A button report establishes the ID, which remains usable through idle and disconnect. The existing rumble test now starts with a button report as well.Both focused tests and all 153 HLE library tests passed on current main
63bcca43, in both default and diagnostics builds. Strict HLE Clippy in both builds and staged asset policy passed.GameInput lookup behavior · Coordination claim
Please retain the Git author when cherry-picking or rebasing. If you fold the change into another commit, please add:
Co-authored-by: andrewpozdnakov7-jpg [email protected]
AI-assisted with Codex.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T15:53:30Z.
Automated triage for the maintainers.
Verdict: merge candidate (unchanged). The new head merges
main(with #1430) and changes only the tests. #1430 keeps a host pad disconnected until it reports non-rest input. Sofind_by_idincrates/victory-hle/src/modules/gameinput.rs, which requires a non-empty slot history, now finds a pad from its first real input. That is the same point at which the title sees it connect, so the lookup and the connection events agree.lookup_by_id_only_finds_devices_that_have_been_seencovers four cases: never seen, an all-zero first report (still not found), a button report, and then the ID staying found through idle, disconnect and reconnect. The rumble test now starts with a button report, as it needs to under #1430. The lock is held only for the lookup; callbacks are delivered afterpolldrops it.CI: passing (
check).Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-25T16:01:45Z.
Following up on the documentation check. The reference page explicitly says that an identifier with no matching known GameInput device object yields a null output pointer. Microsoft Learn —
IGameInput::FindDeviceFromIdThe device overview documents stable IDs across reconnects, and the interface reference says a device object already held by an application stays valid after disconnect. Returning
DEVICE_NOT_FOUNDfor a never-seen slot and keeping a previously seen slot findable are VIctory's choices; the synthetic test at42dae70covers both. GameInput device IDs · GameInput device lifetimeImported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T02:05:43Z.
Review: COMMENTED
Reviewed and tested merged against current
main(63bcca43) on Windows 11. Althoughgit merge-treereports zero text conflicts, merging into currentmaincauses 2 unit tests invictory-hleto fail due to a semantic interaction withfd94726e(#1430, which now ignores all-zero XInputPadStateslots inState::polluntil they report non-zero input):find_by_id(crates/victory-hle/src/modules/gameinput.rs:924-926) now requires!state.slots[device.index].history.is_empty(), any test that connects a pad withSome(PadState::default())leaveshistoryempty and receivesDEVICE_NOT_FOUND(-2088108030) instead ofS_OK(0):modules::gameinput::tests::lookup_by_id_only_finds_devices_that_have_been_seen(gameinput.rs:1756-1759) fails (left: -2088108030, right: 0).modules::gameinput::tests::devices_are_found_by_id_and_rumble_reaches_the_host(gameinput.rs:1767, 1778) fails with the same error.mainand feed a non-default initialPadState(e.g., with a button bit set) when first connecting the test pads in those two tests, then assertfind_by_idstill finds the device after returning to idle / disconnect.(Local verification on merged
63bcca43:cargo test --locked -p victory-hle: 151 passed, 2 failed;clippydefault &--all-featuresandxtask policypassed.)Imported from Marvisak/VIctory. Originally posted by futurepro62 on 2026-11-26T01:42:58Z.
Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head
42dae70(on its base940d32f).Tested
dxil.dllfrom Windows SDK 10.0.26100 (the loader's default), debug.cargo build --workspace --locked, thencargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 697 passed, 0 failed, 10 ignored.lookup_by_id_only_finds_devices_that_have_been_seen.--skipleaves out tests that fail on main63bcca4on this card too, not because of this PR:heap_direct_texture_reads_mark_their_heap_indexends thevictory-shadertest process with0xc0000005(#2571), so without the skip the rest of that crate never reports;dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_viewsand the twostride_testshit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317);gathers_at_a_level_match_the_hardwarefails on lane 0 (#1744).Not tested
AI use
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-26T02:17:46Z.
I reproduced both failures with
42dae70merged into63bcca43. 12986bb gives both fixtures a button report before expecting a known ID. The lookup test also checks the initial all-zero report is ignored, then checks the ID remains known through idle and disconnect.Both focused tests passed. All 153 victory-hle library tests passed in each of the default and diagnostics builds. Strict Clippy with both feature sets and asset policy passed.
Review
Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-26T22:58:19Z.
Independent local verification (Windows, Rust 1.100.0/MSVC,
cargo test --locked,CARGO_BUILD_JOBS=2, per-worktreeCARGO_TARGET_DIR):cargo test --locked -p victory-hle --lib -- --exact modules::gameinput::tests::lookup_by_id_only_finds_devices_that_have_been_seen-> 1 passed, 0 failed, 152 filtered.git diff --check origin/main HEAD-> clean.origin/main(git grepexit 1).No game data or DRM involved; synthetic Windows host scenario only. AI-assisted (Hy4 flash). GPU/driver: N/A (CPU-only HLE test).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.