GameInput: answer IUnknown and own-IID queries on the COM objects (re-lands #1641) #1942

Open
github-bot wants to merge 3 commits from github-bot/gh-1942 into main AGit
Owner

@⁠Calvix2k on GitHub · 2026-11-25 01:25 UTC · original
Calvix2k:codex/gameinput-query-interface-020 → main · +157 −18 · 1 files · 3 commits · open

Re-lands #1641 (closed by the automated triage as an asset-policy violation, which I believe is a false positive: the three IIDs are constants from the public Windows SDK GameInput.h, not console SDK code or game assets; the change touches only crates/victory-hle/src/modules/gameinput.rs, and cargo xtask policy passes on the rebased tree. If the IID constants are what tripped it, please say so and I will put them behind a generator from the installed SDK header instead.)

What

IGameInput, IGameInputDevice and IGameInputReading shared one
o_interface slot. Each now has its own QueryInterface that accepts IID_IUnknown and its own interface id (GameInput.h), AddRefs through slot 1, and returns E_NOINTERFACE/E_POINTER otherwise.

BaggyALPHA's follow-up from the v0 table review is included: the Windows SDK device interface has 22 slots, and the table stopped at 21.

slot method answer
0x38 IsForceFeedbackMotorPoweredOn alse (XInput has no motor to report)
0xa0 AcquireExclusiveRawDeviceAccess alse (the host pad stays shared)
0xa8 ReleaseExclusiveRawDeviceAccess void no-op

The regression test queries the device IID first, then calls the three slots with the SDK signatures on a synthetic device.

Verification (Windows 10, Ryzen 7 5800X / RX 7800 XT)

  • cargo test -p victory-hle --locked gameinput — 10 passed (the 8 GameInput tests plus the new slot checks)
  • cargo clippy -p victory-hle --all-targets --all-features --locked -- -D warnings — clean
  • cargo xtask policy — 182 files ok
  • Rebased onto main 4118f33 (no conflicts).
**@⁠Calvix2k** on GitHub · 2026-11-25 01:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/1942) `Calvix2k:codex/gameinput-query-interface-020` → `main` · +157 −18 · 1 files · 3 commits · open Re-lands #1641 (closed by the automated triage as an asset-policy violation, which I believe is a false positive: the three IIDs are constants from the **public Windows SDK** GameInput.h, not console SDK code or game assets; the change touches only crates/victory-hle/src/modules/gameinput.rs, and cargo xtask policy passes on the rebased tree. If the IID constants are what tripped it, please say so and I will put them behind a generator from the installed SDK header instead.) ## What IGameInput, IGameInputDevice and IGameInputReading shared one o_interface slot. Each now has its own QueryInterface that accepts IID_IUnknown and its own interface id (GameInput.h), AddRefs through slot 1, and returns E_NOINTERFACE/E_POINTER otherwise. BaggyALPHA's follow-up from the v0 table review is included: the Windows SDK device interface has **22** slots, and the table stopped at 21. | slot | method | answer | | --- | --- | --- | | 0x38 | IsForceFeedbackMotorPoweredOn | alse (XInput has no motor to report) | | 0xa0 | AcquireExclusiveRawDeviceAccess | alse (the host pad stays shared) | | 0xa8 | ReleaseExclusiveRawDeviceAccess | void no-op | The regression test queries the device IID first, then calls the three slots with the SDK signatures on a synthetic device. ## Verification (Windows 10, Ryzen 7 5800X / RX 7800 XT) - cargo test -p victory-hle --locked gameinput — 10 passed (the 8 GameInput tests plus the new slot checks) - cargo clippy -p victory-hle --all-targets --all-features --locked -- -D warnings — clean - cargo xtask policy — 182 files ok - Rebased onto main 4118f33 (no conflicts).
IGameInput, IGameInputDevice and IGameInputReading shared one slot 0 that
always returned E_NOINTERFACE and never touched *out. Each object now
answers IID_IUnknown and its own interface GUID from GameInput.h, AddRefs
through its own slot 1 (so readings stay reference counted), clears *out on
failure and returns E_POINTER for null required pointers.

Add a test that exercises both paths on all three objects, including the
null-out and null-IID cases.

Addresses VIC-BT-020 from audit #1242.

Validation:
- cargo test -p victory-hle --locked -- --test-threads=1
- cargo clippy -p victory-hle --all-targets --all-features --locked -- -D warnings
- cargo xtask policy
BaggyALPHA's follow-up on the v0 table review: the Windows SDK interface has
22 slots and the device table stopped at 21. IsForceFeedbackMotorPoweredOn
(0x38) and AcquireExclusiveRawDeviceAccess (0xa0) now answer false, and
ReleaseExclusiveRawDeviceAccess (0xa8) is a typed void no-op, so a title that
calls them gets an answer instead of E_NOTIMPL at the wrong slot.

Reported-by: BaggyALPHA <[email protected]>
The repository does not name the console SDK or quote its headers. Rename
the three ids the way media.rs names its own (`INPUT_IID`, `DEVICE_IID`,
`READING_IID`), drop the header name from the doc comment, and describe
the typed stubs by what they do instead of by the methods' names.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:49:32 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 08:19 UTC · original · edited 2026-11-26 00:22 UTC

Automated triage for the maintainers.

Needs work: needs the maintainer's decision. The head (32db7d9) hasn't changed, so the code verdict stands. query_interface in crates/victory-hle/src/modules/gameinput.rs reads correctly, and the 22-slot device table with its typed stubs at 0x38, 0xa0 and 0xa8 is fine. I checked the diff again and it names no SDK headers, paths or kits.

On the replies (yours and BaggyALPHA's): agreed that the open question is the policy call, not the code. The three interface ids are the same kind of constant main already keeps (IID_2026 in modules/storage.rs, the ids in modules/display.rs and modules/media.rs), and docs/asset-policy.md allows small interoperability constants. But #1641 was closed over exactly this question, so reversing that decision is for the maintainer, not triage. If it is accepted, this PR supersedes #1329, which BaggyALPHA has offered to close. Nothing more is needed from you in the meantime.

CI: passing (check).


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 08:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/1942#issuecomment-7156876957) · edited 2026-11-26 00:22 UTC <!-- victory-triage v1 head=32db7d9cff43439e0cb65ffb6064e01332d6eaf6 verdict=needs-work at=2026-11-26T00:22:25Z --> Automated triage for the maintainers. **Needs work: needs the maintainer's decision.** The head (`32db7d9`) hasn't changed, so the code verdict stands. `query_interface` in `crates/victory-hle/src/modules/gameinput.rs` reads correctly, and the 22-slot device table with its typed stubs at 0x38, 0xa0 and 0xa8 is fine. I checked the diff again and it names no SDK headers, paths or kits. On the replies (yours and BaggyALPHA's): agreed that the open question is the policy call, not the code. The three interface ids are the same kind of constant `main` already keeps (`IID_2026` in `modules/storage.rs`, the ids in `modules/display.rs` and `modules/media.rs`), and `docs/asset-policy.md` allows small interoperability constants. But #1641 was closed over exactly this question, so reversing that decision is for the maintainer, not triage. If it is accepted, this PR supersedes #1329, which BaggyALPHA has offered to close. Nothing more is needed from you in the meantime. CI: passing (`check`). --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠Calvix2k on GitHub · 2026-11-25 10:23 UTC · original

Thanks — the wording half is done, and I agree the rest is the maintainer's call. One note to make that call easier, since the triage lists three PRs for the same slot:

  • #1329 does IID_IUnknown only, without the interface ids.
  • This PR does IID_IUnknown plus each object's own id, keeps the reading's reference counting through its own slot 1, and carries the 22-slot device table with the typed stubs at 0x38, 0xa0 and 0xa8. It is a superset of #1329; if it lands, #1329 is redundant.
  • #1958 is broader (dispatcher, device methods, trigger rumble) and still has wording issues; the dispatcher/rumble parts would apply on top of either.

On the asset policy: the three ids are the same kind of interoperability constants main already keeps in media.rs and display.rs; they are the values a title passes to QueryInterface, and the test uses them as such. If the maintainer reads that as acceptable, landing this one and closing #1329 leaves a single GameInput slot-0 implementation.

The commit message from 883440d mentioning "the SDK's 22-slot device table" only lives in history and disappears on a squash, as the triage notes.

**@⁠Calvix2k** on GitHub · 2026-11-25 10:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/1942#issuecomment-7159626073) Thanks — the wording half is done, and I agree the rest is the maintainer's call. One note to make that call easier, since the triage lists three PRs for the same slot: - **#1329** does `IID_IUnknown` only, without the interface ids. - **This PR** does `IID_IUnknown` plus each object's own id, keeps the reading's reference counting through its own slot 1, and carries the 22-slot device table with the typed stubs at 0x38, 0xa0 and 0xa8. It is a superset of #1329; if it lands, #1329 is redundant. - **#1958** is broader (dispatcher, device methods, trigger rumble) and still has wording issues; the dispatcher/rumble parts would apply on top of either. On the asset policy: the three ids are the same kind of interoperability constants `main` already keeps in `media.rs` and `display.rs`; they are the values a title passes to `QueryInterface`, and the test uses them as such. If the maintainer reads that as acceptable, landing this one and closing #1329 leaves a single GameInput slot-0 implementation. The commit message from `883440d` mentioning "the SDK's 22-slot device table" only lives in history and disappears on a squash, as the triage notes.
Author
Owner

@⁠BaggyALPHA on GitHub · 2026-11-25 15:18 UTC · original

On the asset-policy question this inherited from #1641: the constants are public PC API surface, and main already carries the same two kinds. Evidence below; the call is still the maintainer's.

I have an interest to declare: my #1329 is the narrow alternative to this PR, so if this one is acceptable mine is redundant and I will close it. That cuts against me, which is why I would rather the question were settled on facts than left to sit.

What actually closed #1641. The closure was automated triage, with the generic line "nothing taken from the console SDK or the game", and it invites correction: "If this is mistaken, reply here with what was missed". No human review found a specific violation, and @⁠Calvix2k already called it a likely false positive.

1. GameInput is a public PC API, not console SDK material. Microsoft documents IGameInput, IGameInputDevice and IGameInputReading publicly, and ships GameInput.h for PC via NuGet from a public repository, supporting Windows 10 19H1 and later — distribution that is separate from Xbox GDK licensing ("GameInput is available on Xbox via the GDK and PC via NuGet"). So these IIDs are the same class of constant as any other public Windows interface id. Sources: IGameInputDevice reference, GameInput API members, public GameInput distribution.

2. main already carries both kinds of constant this PR adds. At 940d32f:

  • Interface ids the title asks for: thirteen HLE modules define Guid::new constants (rpcrt4 6, xgame 5, display 5, xsystem 4, xstore/storage 3 each, and so on).
  • Interface ids plus slot offsets, documented as such: modules/xpackage.rs defines IID_2026 under the comment "As Grand Theft Auto VI (2026) asks for it. Its slots up to 0xd0 take the arguments the public API lists in the same order; 0x110 uninstalls a package, 0x128/0x130 mount one with UI, 0x138 enumerates packages." That is the same shape as this PR's 0x38 / 0xa0 / 0xa8, and it is on main today.
  • Vtable sizes: modules/gameinput.rs already declares Table<22>, Table<21> and Table<25>. The 22-slot correction here changes the device table from 21 to 22 — a correction to a number already in the file, not a new kind of information.

3. Against the policy's own wording. docs/asset-policy.md forbids the title's assets and executable and anything derived from them, and explicitly allows "small interoperability constants (magic numbers, enum values) we write" and "per-build offsets of functions we hook, under names we choose". Nothing here comes from the title's executable.

4. Provenance of the 22-slot correction, since it is mine. I derived it from the signatures in the public header and verified it against a synthetic device in a Windows test, not from the title's binary — eight GameInput tests passed at the time. If anything in this PR were going to be game-derived it would be that piece, and it is not.

So on the evidence the stated ground for closing #1641 does not appear to apply here, and this PR's constants match accepted practice in the tree. Whether that is the right call is still the maintainer's, and I am not asking for a verdict in this thread — only that the question not be the thing that keeps VIC-BT-020 unfixed.

No game files were used for any of the above: it is the public documentation, the policy text, and grep over main.

AI-assisted (Claude Code).

**@⁠BaggyALPHA** on GitHub · 2026-11-25 15:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/1942#issuecomment-7166630974) **On the asset-policy question this inherited from #1641: the constants are public PC API surface, and `main` already carries the same two kinds. Evidence below; the call is still the maintainer's.** I have an interest to declare: my #1329 is the narrow alternative to this PR, so if this one is acceptable mine is redundant and I will close it. That cuts against me, which is why I would rather the question were settled on facts than left to sit. **What actually closed #1641.** The [closure](https://git.gtahub.st/github/Marvisak--VIctory/pulls/1641) was automated triage, with the generic line "nothing taken from the console SDK or the game", and it invites correction: "If this is mistaken, reply here with what was missed". No human review found a specific violation, and @⁠Calvix2k already called it a likely false positive. **1. GameInput is a public PC API, not console SDK material.** Microsoft documents `IGameInput`, `IGameInputDevice` and `IGameInputReading` publicly, and ships `GameInput.h` **for PC via NuGet** from a public repository, supporting Windows 10 19H1 and later — distribution that is separate from Xbox GDK licensing ("GameInput is available on Xbox via the GDK and PC via NuGet"). So these IIDs are the same class of constant as any other public Windows interface id. Sources: [IGameInputDevice reference](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice?view=gdk-2610), [GameInput API members](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/input/gameinput/gameinput_members?view=gdk-2610), [public GameInput distribution](https://github.com/microsoftconnect/GameInput). **2. `main` already carries both kinds of constant this PR adds.** At `940d32f`: - **Interface ids the title asks for:** thirteen HLE modules define `Guid::new` constants (`rpcrt4` 6, `xgame` 5, `display` 5, `xsystem` 4, `xstore`/`storage` 3 each, and so on). - **Interface ids *plus* slot offsets, documented as such:** `modules/xpackage.rs` defines `IID_2026` under the comment "As Grand Theft Auto VI (2026) asks for it. Its slots up to `0xd0` take the arguments the public API lists in the same order; `0x110` uninstalls a package, `0x128`/`0x130` mount one with UI, `0x138` enumerates packages." That is the same shape as this PR's `0x38` / `0xa0` / `0xa8`, and it is on `main` today. - **Vtable sizes:** `modules/gameinput.rs` already declares `Table<22>`, `Table<21>` and `Table<25>`. The 22-slot correction here changes the device table from 21 to 22 — a correction to a number already in the file, not a new kind of information. **3. Against the policy's own wording.** [docs/asset-policy.md](https://github.com/Marvisak/VIctory/blob/main/docs/asset-policy.md) forbids the *title's* assets and executable and anything derived from them, and explicitly allows "small interoperability constants (magic numbers, enum values) we write" and "per-build offsets of functions we hook, under names we choose". Nothing here comes from the title's executable. **4. Provenance of the 22-slot correction, since it is mine.** I derived it from the signatures in the public header and verified it against a **synthetic** device in a Windows test, not from the title's binary — eight GameInput tests passed at the time. If anything in this PR were going to be game-derived it would be that piece, and it is not. So on the evidence the stated ground for closing #1641 does not appear to apply here, and this PR's constants match accepted practice in the tree. Whether that is the right call is still the maintainer's, and I am not asking for a verdict in this thread — only that the question not be the thing that keeps VIC-BT-020 unfixed. No game files were used for any of the above: it is the public documentation, the policy text, and `grep` over `main`. AI-assisted (Claude Code).
Author
Owner

@⁠Calvix2k on GitHub · 2026-11-25 16:39 UTC · original

Agree with the analysis, and it matches what I said when #1641 was closed: the closure there was a false positive on the policy. The constants are public PC API (GameInput.h via NuGet), main already carries interface ids and slot offsets of the same shape (xpackage's IID_2026), and the 22-slot table size is a correction to a number already in the file. Nothing here is game-derived.

So the only open question is the merge decision, not the policy. If this lands, #1329 can close; I will leave that call to @⁠Marvisak.

**@⁠Calvix2k** on GitHub · 2026-11-25 16:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/1942#issuecomment-7168324075) Agree with the analysis, and it matches what I said when #1641 was closed: the closure there was a false positive on the policy. The constants are public PC API (`GameInput.h` via NuGet), `main` already carries interface ids and slot offsets of the same shape (`xpackage`'s `IID_2026`), and the 22-slot table size is a correction to a number already in the file. Nothing here is game-derived. So the only open question is the merge decision, not the policy. If this lands, #1329 can close; I will leave that call to @⁠Marvisak.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1942/head:github-bot/gh-1942'
git switch 'github-bot/gh-1942'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1942'
git switch 'github-bot/gh-1942'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1942'
git switch 'github-bot/gh-1942'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1942'
git switch 'main'
git merge --squash 'github-bot/gh-1942'
git switch 'main'
git merge --ff-only 'github-bot/gh-1942'
git switch 'main'
git merge 'github-bot/gh-1942'
git push origin 'main'
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/Marvisak--VIctory!1942
No description provided.