xcrdapi: accept the newer IDStorageQueueX IID and CreateQueue at factory slot 10 #337

Closed
GDAgent wants to merge 1 commit from upstream-pr/337 into main
GDAgent commented 2026-11-23 20:30:33 +00:00 (Migrated from github.com)

Imported from omonkeyz/xbox-emulator. Originally posted by GDAgent on 2026-11-23T20:30:33Z.


Library / area: xcrdapi (abi.rs, objects.rs, tests.rs)

Exports changed (exports.txt rows): none

Source of the behaviour: call sites of a very popular AAA title (Xbox Series X build), native Windows 11 on an RDNA2 GPU; not run under Proton.

What

  • IID_QUEUE_X1 (3c02cb0c-c050-4195-99a1-a1ce94ba33c5) is answered by the queue object's QueryInterface with the same object, next to IID_QUEUE_X and IUnknown.
  • IDStorageFactoryX slot 10 was a trap. It now creates a queue: the title passes a 0x20-byte desc, which is the 0x18-byte desc that slot 3 (CreateQueue) already takes plus 8 bytes at +0x18. Slots 3 and 10 share one implementation (create_queue_from); the extra 8 bytes are read, logged as "not modelled" and otherwise ignored.

Why / evidence

Static evidence from the title's code (no run reached slot 10 yet):

  • Its factory calls go to slots 4 (OpenFile), 5 (CreateStatusArray), 8 (SetStagingBufferSize, 32 MiB) and 10. The first three match the existing console-layout IDStorageFactoryX.
  • Slot 10 takes (desc, riid, ppv) like CreateQueue. The desc is 0x20 bytes: the existing 0x18-byte console queue desc (source type, capacity at 8, priority at 0xa, name at 0x10) plus a u64 at 0x18 that the title sets to 1.
  • The riid it passes to slot 10 is 3c02cb0c-c050-4195-99a1-a1ce94ba33c5. In .rdata it sits next to the factory IID and the known status-array IID, so it is taken to be the queue interface of the same SDK version.

Slots 9 and 11-15 stay traps, so any newer method the title calls stops the run with a named slot instead of running on a guessed ABI.

This is independent of #296, which accepts the newer factory IID (62959d11-...) in factory_qi. This PR does not touch factory_qi or add that IID, so the two do not conflict; the title needs both to reach slot 10 (with #296 it gets the factory; with this PR slot 10 then creates a queue).

Tests

  • newer_queue_iid_reaches_the_same_queue_and_factory_slot_10_creates_queues: slot 10 with a memory-queue desc (name pointer, capacity, realtime priority, 8 extra bytes) returns S_OK and a queue that answers IID_QUEUE_X, IID_QUEUE_X1 and IUnknown with the same pointer; QueryInfo echoes the first 0x18 desc bytes; an invalid memory-queue priority returns E_DSTORAGE_INVALID_MEMORY_QUEUE_PRIORITY with a null out pointer; a null desc returns E_INVALIDARG; a null out pointer returns E_POINTER; a file-queue desc works and releases cleanly.
  • cargo test -p xcrdapi: 164 passed, 1 failed. The failure is fixed_result_exports_match_every_console_xcrdapi, which needs console xcrdapi.dll dumps this machine does not have (it fails the same way on main). The new test passes.

Not verified

  • Not verified in a title run: the evidence is static, and no run has reached slot 10 yet, so no DStorage read through a slot-10 queue has been seen.
  • The 8 bytes at +0x18 and the behavioural difference between slot 3 and slot 10 queues are not known; this PR only makes slot 10 create the same queue slot 3 does.
  • The newer queue IID is only checked against the title's call site, not against a console oracle.
<!-- greyfinch-sync:omonkeyz/xbox-emulator:issue:6568220170 --> Imported from [omonkeyz/xbox-emulator](https://github.com/omonkeyz/xbox-emulator/pull/337). Originally posted by [GDAgent](https://github.com/GDAgent) on 2026-11-23T20:30:33Z. --- **Library / area:** `xcrdapi` (`abi.rs`, `objects.rs`, `tests.rs`) **Exports changed (exports.txt rows):** none **Source of the behaviour:** call sites of a very popular AAA title (Xbox Series X build), native Windows 11 on an RDNA2 GPU; not run under Proton. ## What - `IID_QUEUE_X1` (`3c02cb0c-c050-4195-99a1-a1ce94ba33c5`) is answered by the queue object's `QueryInterface` with the same object, next to `IID_QUEUE_X` and `IUnknown`. - `IDStorageFactoryX` slot 10 was a trap. It now creates a queue: the title passes a 0x20-byte desc, which is the 0x18-byte desc that slot 3 (`CreateQueue`) already takes plus 8 bytes at `+0x18`. Slots 3 and 10 share one implementation (`create_queue_from`); the extra 8 bytes are read, logged as "not modelled" and otherwise ignored. ## Why / evidence Static evidence from the title's code (no run reached slot 10 yet): - Its factory calls go to slots 4 (OpenFile), 5 (CreateStatusArray), 8 (SetStagingBufferSize, 32 MiB) and 10. The first three match the existing console-layout `IDStorageFactoryX`. - Slot 10 takes `(desc, riid, ppv)` like `CreateQueue`. The desc is 0x20 bytes: the existing 0x18-byte console queue desc (source type, capacity at 8, priority at 0xa, name at 0x10) plus a u64 at 0x18 that the title sets to 1. - The riid it passes to slot 10 is `3c02cb0c-c050-4195-99a1-a1ce94ba33c5`. In `.rdata` it sits next to the factory IID and the known status-array IID, so it is taken to be the queue interface of the same SDK version. Slots 9 and 11-15 stay traps, so any newer method the title calls stops the run with a named slot instead of running on a guessed ABI. This is independent of #296, which accepts the newer factory IID (`62959d11-...`) in `factory_qi`. This PR does not touch `factory_qi` or add that IID, so the two do not conflict; the title needs both to reach slot 10 (with #296 it gets the factory; with this PR slot 10 then creates a queue). ## Tests - `newer_queue_iid_reaches_the_same_queue_and_factory_slot_10_creates_queues`: slot 10 with a memory-queue desc (name pointer, capacity, realtime priority, 8 extra bytes) returns S_OK and a queue that answers `IID_QUEUE_X`, `IID_QUEUE_X1` and `IUnknown` with the same pointer; `QueryInfo` echoes the first 0x18 desc bytes; an invalid memory-queue priority returns `E_DSTORAGE_INVALID_MEMORY_QUEUE_PRIORITY` with a null out pointer; a null desc returns `E_INVALIDARG`; a null out pointer returns `E_POINTER`; a file-queue desc works and releases cleanly. - `cargo test -p xcrdapi`: 164 passed, 1 failed. The failure is `fixed_result_exports_match_every_console_xcrdapi`, which needs console `xcrdapi.dll` dumps this machine does not have (it fails the same way on `main`). The new test passes. ## Not verified - Not verified in a title run: the evidence is static, and no run has reached slot 10 yet, so no DStorage read through a slot-10 queue has been seen. - The 8 bytes at `+0x18` and the behavioural difference between slot 3 and slot 10 queues are not known; this PR only makes slot 10 create the same queue slot 3 does. - The newer queue IID is only checked against the title's call site, not against a console oracle.
omonkeyz commented 2026-11-25 13:50:12 +00:00 (Migrated from github.com)

Imported from omonkeyz/xbox-emulator. Originally posted by omonkeyz on 2026-11-25T13:50:12Z.


Applied on main in 5129361 (cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.

<!-- greyfinch-sync:omonkeyz/xbox-emulator:comment:7164360788 --> Imported from [omonkeyz/xbox-emulator](https://github.com/omonkeyz/xbox-emulator/pull/337#issuecomment-7164360788). Originally posted by [omonkeyz](https://github.com/omonkeyz) on 2026-11-25T13:50:12Z. --- Applied on main in 5129361 (cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.

Pull request closed

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
omonkeyz/xbox-emulator!337
No description provided.