Skip to content

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

Open
CwWwWwW wants to merge 1 commit into
trustno1-coder:mainfrom
CwWwWwW:fix/gameinput-reading-callback
Open

CwWwWwW wants to merge 1 commit into
trustno1-coder:mainfrom
CwWwWwW:fix/gameinput-reading-callback

Conversation

@CwWwWwW

@CwWwWwW CwWwWwW commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Ported to trustno1-coder/VIctory-NVIDIA from the same change submitted to fxceless/victory-fork as PR #1465 (head 18c04f6, 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.

…atform

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 <66506837+CwWwWwW@users.noreply.github.com>.

@Dukestar69 Dukestar69 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

MystifiedSky added a commit to MystifiedSky/VIctory-NVIDIA-Improved that referenced this pull request Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants