HLE/gameinput: a reading-callback registration is refused like the platform #840

Manually merged
github merged 1 commit from github-bot/gh-840 into main 2026-11-29 08:22:29 +00:00 AGit
Owner

@⁠CwWwWwW on GitHub · 2026-11-28 07:34 UTC · original
CwWwWwW:fix/gameinput-reading-callback → main · +43 −4 · 1 files · 1 commits · merged 2026-11-29 08:16 UTC

Ported to trustno1-coder/VIctory-NVIDIA from the same change submitted to fxceless/victory-fork as PR #1465 (head 18c04f6765, author CwWwWwW). The fork's own line was dropped when it rebased onto 959dcaf (5dbf5ce), so this is submitted here directly. The description below is the original one; its 'Verification' numbers refer to the fork tree. Rebased onto main 63b902f.

The problem

register_reading (IInput slot 0x40, RegisterReadingCallback) returned S_OK and a fabricated token while it never registers anything and the poll thread never calls reading callbacks (crates/victory-hle/src/modules/gameinput.rs:715-728).

The platform refuses the registration. A title that checks the HRESULT (the normal pattern) falls back to polling when refused; the HLE told it success, so such a title can go event-driven and receive no input at all 鈥?silent total input loss. The current title polls and does not call slot 0x40, so it is unaffected.

Measured platform behaviour (offline, no game)

The host's C:\Windows\System32\GameInput.dll was called directly (Python ctypes; GameInputCreate returned S_OK, then IInput vtable slot 0x40):

  • null callback: hr=0x80004001 (E_NOTIMPL), the token was cleared from 0xDEADBEEFDEADBEEF to 0;
  • real callback: same;
  • GameInputKind gamepad (0x40000): same;
  • null token pointer: E_NOTIMPL as well.

The change

Slot 0x40 clears a non-null token and returns E_NOTIMPL, exactly like the platform. Nothing else changes: reading callbacks are still not implemented, polling still drives the devices, and a caller that ignores the HRESULT sees an empty token (0) instead of a bogus one.

Evidence

New test gameinput::tests::a_reading_callback_registration_is_refused_like_the_platform_does: old code returns S_OK and writes token 1; new code returns E_NOTIMPL and clears the token to 0.

Verification (base 9a9091d):

  • cargo test -p victory-hle --lib --locked -- --test-threads=1 鈥?104 passed, 0 failed
  • cargo clippy -p victory-hle --all-targets --locked -- -D warnings 鈥?clean
  • cargo clippy -p victory-hle --all-targets --locked --all-features -- -D warnings 鈥?clean
  • git diff --check clean; no new fmt diff (pre-existing crate fmt diffs only).

Scope and overlap

One file, crates/victory-hle/src/modules/gameinput.rs (+43/-4). No open PR covers it: #653 keeps the old shortcut unchanged, #534/#485 are registration ordering, #680 is xstore. CI's check may be red from main's own clippy and asset-policy failures (#1440/#1322), which this diff does not touch.

Verification on this tree (base 63b902f, 2026-11-27)

  • cargo check --workspace --all-targets --locked: pass (Rust 1.98.1, the version pinned in rust-toolchain.toml)
  • cargo check --workspace --all-targets --all-features --locked: pass
  • cargo clippy --workspace --all-targets --locked -- -D warnings (and --all-features): this change adds no clippy finding. The only failures are on unmodified lines of main (clippy::manual_is_multiple_of at crates/victory-gpu/src/shadow.rs:1708 and crates/victory-gpu/src/descriptor.rs:1234, clippy::let_and_return at crates/victory-shader/src/emit/mod.rs:2768); CI run 46104876336 on 63b902f failed on those before this change.
  • cargo test was not run in the author's environment (Windows VM without an MSVC toolchain; test binaries could not be linked there). CI on Windows and a run on the card should confirm.
**@⁠CwWwWwW** on GitHub · 2026-11-28 07:34 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/840) `CwWwWwW:fix/gameinput-reading-callback` → `main` · +43 −4 · 1 files · 1 commits · merged 2026-11-29 08:16 UTC Ported to trustno1-coder/VIctory-NVIDIA from the same change submitted to fxceless/victory-fork as PR #1465 (head 18c04f67655b19027d6f9a2f8feb33719937bf3a, author CwWwWwW). The fork's own line was dropped when it rebased onto 959dcaf (5dbf5ce), so this is submitted here directly. The description below is the original one; its 'Verification' numbers refer to the fork tree. Rebased onto main 63b902f. ## The problem `register_reading` (`IInput` slot 0x40, RegisterReadingCallback) returned S_OK and a fabricated token while it never registers anything and the poll thread never calls reading callbacks (`crates/victory-hle/src/modules/gameinput.rs:715-728`). The platform refuses the registration. A title that checks the HRESULT (the normal pattern) falls back to polling when refused; the HLE told it success, so such a title can go event-driven and receive no input at all 鈥?silent total input loss. The current title polls and does not call slot 0x40, so it is unaffected. ## Measured platform behaviour (offline, no game) The host's `C:\Windows\System32\GameInput.dll` was called directly (Python ctypes; `GameInputCreate` returned S_OK, then `IInput` vtable slot 0x40): - null callback: `hr=0x80004001` (E_NOTIMPL), the token was cleared from `0xDEADBEEFDEADBEEF` to 0; - real callback: same; - `GameInputKind` gamepad (0x40000): same; - null token pointer: E_NOTIMPL as well. ## The change Slot 0x40 clears a non-null token and returns E_NOTIMPL, exactly like the platform. Nothing else changes: reading callbacks are still not implemented, polling still drives the devices, and a caller that ignores the HRESULT sees an empty token (0) instead of a bogus one. ## Evidence New test `gameinput::tests::a_reading_callback_registration_is_refused_like_the_platform_does`: old code returns S_OK and writes token 1; new code returns E_NOTIMPL and clears the token to 0. Verification (base `9a9091d`): - `cargo test -p victory-hle --lib --locked -- --test-threads=1` 鈥?104 passed, 0 failed - `cargo clippy -p victory-hle --all-targets --locked -- -D warnings` 鈥?clean - `cargo clippy -p victory-hle --all-targets --locked --all-features -- -D warnings` 鈥?clean - `git diff --check` clean; no new fmt diff (pre-existing crate fmt diffs only). ## Scope and overlap One file, `crates/victory-hle/src/modules/gameinput.rs` (+43/-4). No open PR covers it: #653 keeps the old shortcut unchanged, #534/#485 are registration ordering, #680 is xstore. CI's `check` may be red from main's own clippy and asset-policy failures (#1440/#1322), which this diff does not touch. ## Verification on this tree (base 63b902f, 2026-11-27) - cargo check --workspace --all-targets --locked: pass (Rust 1.98.1, the version pinned in rust-toolchain.toml) - cargo check --workspace --all-targets --all-features --locked: pass - cargo clippy --workspace --all-targets --locked -- -D warnings (and --all-features): this change adds no clippy finding. The only failures are on unmodified lines of main (clippy::manual_is_multiple_of at crates/victory-gpu/src/shadow.rs:1708 and crates/victory-gpu/src/descriptor.rs:1234, clippy::let_and_return at crates/victory-shader/src/emit/mod.rs:2768); CI run 46104876336 on 63b902f failed on those before this change. - cargo test was not run in the author's environment (Windows VM without an MSVC toolchain; test binaries could not be linked there). CI on Windows and a run on the card should confirm.
IInput slot 0x40 (RegisterReadingCallback) returned S_OK and a fabricated token while registering nothing and never calling reading callbacks; the platform refuses it (measured: E_NOTIMPL, token cleared), and a title that checks the HRESULT falls back to polling only when refused. Clear a non-null token and return E_NOTIMPL.

Ported from fxceless/victory-fork PR #1465 (head 99f5bcff53ce32346b73cef2762da1882cb00592).
Original author: CwWwWwW <[email protected]>.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 14:28:43 +00:00
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-28 07:47 UTC · original · approved these changes

Tested locally merged onto main (63b902f).

  • Merge & Policy: Clean merge; cargo xtask policy passed (294 files ok).
  • Tests: cargo test -p victory-hle --lib gameinput passed (27 passed; 0 failed; 1 ignored, including the new a_reading_callback_registration_is_refused_like_the_platform_does test) with 0 compiler warnings.

Clean platform-parity fix for reading-callback registration. LGTM.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-28 07:47 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/840#pullrequestreview-6096613388) · **approved these changes** Tested locally merged onto `main` (`63b902f`). - **Merge & Policy**: Clean merge; `cargo xtask policy` passed (`294 files ok`). - **Tests**: `cargo test -p victory-hle --lib gameinput` passed (`27 passed; 0 failed; 1 ignored`, including the new `a_reading_callback_registration_is_refused_like_the_platform_does` test) with 0 compiler warnings. Clean platform-parity fix for reading-callback registration. LGTM. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
github manually merged commit 6c1da78f8f into main 2026-11-29 08:22:29 +00:00
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/trustno1-coder--VIctory-NVIDIA!840
No description provided.