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

Open
Calvix2k wants to merge 3 commits from upstream-pr/1942 into main
Calvix2k commented 2026-11-25 01:25:59 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Calvix2k on 2026-11-25T01:25:59Z.


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).
<!-- greyfinch-sync:Marvisak/VIctory:issue:5483311421 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1942). Originally posted by [Calvix2k](https://github.com/Calvix2k) on 2026-11-25T01:25:59Z. --- 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).
catminou4 commented 2026-11-25 02:10:42 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T02:10:42Z.

Review: COMMENTED


Static review only: victory-hle is Windows-only — nothing compiles or runs on macOS; source review of the diff.

GameInput: answer IUnknown and own-IID queries: COM identity fix — pairs with #1641's earlier GameInput IUnknown work.

<!-- greyfinch-sync:Marvisak/VIctory:review:6050615625 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1942#pullrequestreview-6050615625). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T02:10:42Z. **Review:** COMMENTED --- Static review only: victory-hle is Windows-only — nothing compiles or runs on macOS; source review of the diff. GameInput: answer IUnknown and own-IID queries: COM identity fix — pairs with #1641's earlier GameInput IUnknown work.
Marvisak commented 2026-11-25 09:06:12 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T08:19:06Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7156876957 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1942#issuecomment-7156876957). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T08:19:06Z. --- <!-- 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)_
Calvix2k commented 2026-11-25 11:05:18 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Calvix2k on 2026-11-25T10:23:20Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7159626073 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1942#issuecomment-7159626073). Originally posted by [Calvix2k](https://github.com/Calvix2k) on 2026-11-25T10:23:20Z. --- 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.
BaggyALPHA commented 2026-11-25 16:09:08 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by BaggyALPHA on 2026-11-25T15:18:21Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7166630974 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1942#issuecomment-7166630974). Originally posted by [BaggyALPHA](https://github.com/BaggyALPHA) on 2026-11-25T15:18:21Z. --- **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://github.com/Marvisak/VIctory/pull/1641#issuecomment-7149480127) 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).
Calvix2k commented 2026-11-25 17:05:09 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Calvix2k on 2026-11-25T16:39:14Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7168324075 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1942#issuecomment-7168324075). Originally posted by [Calvix2k](https://github.com/Calvix2k) on 2026-11-25T16:39:14Z. --- 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.
cloph-dsp commented 2026-11-27 02:40:42 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-27T02:40:42Z.


Independent CPU-only verification on Windows (Rust 1.100.0/MSVC, worktree-local CARGO_TARGET_DIR, CARGO_BUILD_JOBS=2, no game data).

  • PR head 32db7d9; the local shallow clone has no merge-base against origin/main, so the diff/negative control were checked against the PR's actual parent 4118f33.
  • cargo test --locked -p victory-hle --lib -- modules::gameinput::tests::query_interface_answers_identity_and_the_objects_own_iid --exact --test-threads=1 --quiet -> test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 143 filtered out (exit 0).
  • git diff --check 4118f33 HEAD -> exit 0.
  • Negative control: the new test name is absent from 4118f33 (git grep -c ... crates/victory-hle/src/modules/gameinput.rs -> exit 1).

Note: only the named synthetic QueryInterface test was replayed; the full crate suite was not run. The maintainer's needs-work triage about the inherited constant-policy discussion is outside this check. GPU/driver: N/A (CPU-only HLE test). AI-assisted (Hy4 flash). No game data, assets, extracted shaders or DRM involved.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7208336633 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1942#issuecomment-7208336633). Originally posted by [cloph-dsp](https://github.com/cloph-dsp) on 2026-11-27T02:40:42Z. --- Independent CPU-only verification on Windows (Rust 1.100.0/MSVC, worktree-local `CARGO_TARGET_DIR`, `CARGO_BUILD_JOBS=2`, no game data). - PR head `32db7d9`; the local shallow clone has no merge-base against `origin/main`, so the diff/negative control were checked against the PR's actual parent `4118f33`. - `cargo test --locked -p victory-hle --lib -- modules::gameinput::tests::query_interface_answers_identity_and_the_objects_own_iid --exact --test-threads=1 --quiet` -> `test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 143 filtered out` (exit 0). - `git diff --check 4118f33 HEAD` -> exit 0. - Negative control: the new test name is absent from `4118f33` (`git grep -c ... crates/victory-hle/src/modules/gameinput.rs` -> exit 1). Note: only the named synthetic QueryInterface test was replayed; the full crate suite was not run. The maintainer's `needs-work` triage about the inherited constant-policy discussion is outside this check. GPU/driver: N/A (CPU-only HLE test). AI-assisted (Hy4 flash). No game data, assets, extracted shaders or DRM involved.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1942:upstream-pr/1942'
git switch 'upstream-pr/1942'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/1942'
git switch 'upstream-pr/1942'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1942'
git switch 'upstream-pr/1942'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1942'
git switch 'main'
git merge --squash 'upstream-pr/1942'
git switch 'main'
git merge --ff-only 'upstream-pr/1942'
git switch 'main'
git merge 'upstream-pr/1942'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!1940
No description provided.