Skip to content

compat-common: an IGameInput with no host devices when GameInputCreate fails (Wine) - #31

Open
fffluffy-dev wants to merge 1 commit into
mainfrom
claude/gameinput-fallback
Open

fffluffy-dev wants to merge 1 commit into
mainfrom
claude/gameinput-fallback

Conversation

@fffluffy-dev

Copy link
Copy Markdown
Owner

Problem

On the third Trackmania run on the Steam Deck (Proton 10, through tombox-launch, #30), a lot came up first:

  • the D3D12 device, queues, descriptor heaps and resources;
  • 8 translated shaders and about 40 compute PSOs.

Then the title read through a null object, about a second after this log line:

[gamepad] GameInputCreate real GameInputCreate failed hr=0x80004001

Wine's gameinput.dll answers E_NOTIMPL. The hook passed that failure on, and the title used the IGameInput it never got.

Fix

When the real GameInputCreate fails, the hook now wraps a built-in host object and returns S_OK. Over the 22 IGameInput slots, that object:

  • has no host devices or readings (GAMEINPUT_E_READING_NOT_FOUND, E_NOTFOUND);
  • gives QPC timestamps;
  • accepts callback registrations with fresh tokens, and UnregisterCallback returns true;
  • returns E_NOTIMPL for dispatcher and aggregate-device creation.

The existing wrapper puts the virtual Xbox gamepad on top. The title therefore sees one pad, driven through the pad control directory, and no keyboard or mouse. Hosts with a working GameInput are unchanged.

Test plan

  • Unit test null_host_input_reports_no_devices_and_accepts_registrations: timestamps, readings, tokens, unregister, find and QI through the vtable.
  • cargo check -p compat-common --tests --target x86_64-pc-windows-gnu; PR gate: 0 problems.
  • Steam Deck: Trackmania run 4 with a runtime bundle that contains this change (merged into claude/tombox-launch for the bundle build).

Generated by Claude Code

…e fails

Third Trackmania run on the Steam Deck (Proton 10): D3D12 device, queues,
heaps, resources, 8 translated shaders and ~40 compute PSOs were up, then
the title read through a null object about a second after
"[gamepad] GameInputCreate real GameInputCreate failed hr=0x80004001".
Wine's gameinput.dll answers E_NOTIMPL, the hook passed the failure on,
and the title used the IGameInput it never got.

When the real GameInputCreate fails, the hook now wraps a built-in host
object instead and returns S_OK: no host devices or readings
(GAMEINPUT_E_READING_NOT_FOUND, E_NOTFOUND), QPC timestamps, callback
registrations that succeed with fresh tokens, unregister true. The usual
wrapper puts the virtual Xbox gamepad on top of it, so the title sees one
pad (driven through the pad control directory) and no keyboard or mouse.
Hosts with a working GameInput are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014vTZArnDeG1xtBcLprpoCq

Copy link
Copy Markdown
Owner Author

rust-workspace-check fails here for the same reason as on main, #14. The repository is missing the data blobs that wldp and gamecorecomproxy include_bytes! (data/*.bin). The log has no error in compat-common or gamepad.rs. The change was checked with cargo check -p compat-common --tests --target x86_64-pc-windows-gnu. Its real test is the Deck run, using the runtime bundle built from claude/tombox-launch (which includes this branch).


Generated by Claude Code

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