Skip to content

d3d12_xs: answer the console command-list IID the retail executable asks for - #142

Closed
Andretuta wants to merge 2 commits into
mainfrom
old-pr/9874
Closed

Andretuta wants to merge 2 commits into
mainfrom
old-pr/9874

Conversation

@Andretuta

Copy link
Copy Markdown
Collaborator

Carried over from old PR 9874 by YuhiAida in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9874, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
YuhiAida: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

d3d12_xs: answer the console command-list IID the retail executable asks for

What and why

Device slot 73 (CreateCommandListX) is handed the title's own command-list interface, measured on the retail
1.0.2.1 executable as {c3827890-4024-474c-98cf-645b51dc4874} — same first word as ID3D12GraphicsCommandList6
({c3827890-e548-4cfa-…}) but not that interface, and no PC list answers it.

The proxy passed that IID straight down to the layer, which answered E_NOINTERFACE (0x80004002). Every
CreateCommandList therefore failed, the title received a null list, and it read through the null.

Three changes, all in runtime/shims/d3d12_xs_device.cpp:

  • kConsoleListIID holds the measured GUID; is_list_iid() accepts it.
  • list_query_interface() skips the PC supports_iid check for it: no PC list can answer an Xbox IID, and the
    proxy answers it with itself.
  • proxy_create_command_list_x() creates the list with __uuidof(ID3D12GraphicsCommandList) and lets wrap_list()
    answer the console IID, instead of forwarding the title's IID to the layer.

Tested

Retail 1.0.2.1 executable, Wine 11.22, LEONIDA_D3D12=vulkan, NVIDIA RTX 3060 Ti (GA103), gta6rt --run:

before after
D3D12 calls 13 1,181
CreateCommandList fails, 0x80004002 581 created and closed
last call reached — XboxIDXGIDevice::GetAdapter (ok)

The run still stops later, in guest code (read 0x18 inside a static initialiser), which is a separate stop.

Depends on: #8461
Depends on: #6964

Measured on top of those two and of the one-line gameinput.dll!#1 ordinal alias (not a PR; the retail executable
imports GameInput by ordinal, so the registry never matched the shim). main alone stops earlier, at the DStorage
assert, so this change cannot show its effect without them.

Test

runtime/test/xs_proxy_mock_test.cpp: slot 73 with kConsoleListIID -> the proxy answers QueryInterface,
and PC slot 12 receives ID3D12GraphicsCommandList. CI runs it.

Item

New item. The claiming: line for the coordination issue could not be posted: this account is not a collaborator,
and the repository restricts interactions to collaborators. Whoever lands this should list it there.

Note

main at this commit does not compile for clang-cl: DescriptorHeap/identity() in
d3d12_vulkan_device.cpp and the SHAPE_* static asserts in acphal.cpp. Those are unrelated to this change and
reported separately.

AI-assisted.

…sks for

# What and why

Device slot 73 (`CreateCommandListX`) is handed the title's own command-list interface, measured on the retail
1.0.2.1 executable as `{c3827890-4024-474c-98cf-645b51dc4874}` — same first word as `ID3D12GraphicsCommandList6`
(`{c3827890-e548-4cfa-…}`) but not that interface, and no PC list answers it.

The proxy passed that IID straight down to the layer, which answered `E_NOINTERFACE` (`0x80004002`). Every
`CreateCommandList` therefore failed, the title received a null list, and it read through the null.

Three changes, all in `runtime/shims/d3d12_xs_device.cpp`:

- `kConsoleListIID` holds the measured GUID; `is_list_iid()` accepts it.
- `list_query_interface()` skips the PC `supports_iid` check for it: no PC list can answer an Xbox IID, and the
  proxy answers it with itself.
- `proxy_create_command_list_x()` creates the list with `__uuidof(ID3D12GraphicsCommandList)` and lets `wrap_list()`
  answer the console IID, instead of forwarding the title's IID to the layer.

## Tested

Retail 1.0.2.1 executable, Wine 11.22, `LEONIDA_D3D12=vulkan`, NVIDIA RTX 3060 Ti (GA103), `gta6rt --run`:

| | before | after |
|---|---|---|
| D3D12 calls | 13 | **1,181** |
| `CreateCommandList` | fails, `0x80004002` | 581 created and closed |
| last call reached | — | `XboxIDXGIDevice::GetAdapter` (ok) |

The run still stops later, in guest code (`read 0x18` inside a static initialiser), which is a separate stop.

Depends on: #8461
Depends on: #6964

Measured on top of those two and of the one-line `gameinput.dll!#1` ordinal alias (not a PR; the retail executable
imports GameInput by ordinal, so the registry never matched the shim). `main` alone stops earlier, at the DStorage
assert, so this change cannot show its effect without them.

## Item

New item. The `claiming:` line for the coordination issue could not be posted: this account is not a collaborator,
and the repository restricts interactions to collaborators. Whoever lands this should list it there.

## Note

`main` at this commit does not compile for clang-cl: `DescriptorHeap`/`identity()` in
`d3d12_vulkan_device.cpp` and the `SHAPE_*` static asserts in `acphal.cpp`. Those are unrelated to this change and
reported separately.

AI-assisted.
kConsoleListIID moves to the header so the test names it, and one case calls device slot 73 with the
console's own list interface: the proxy answers QueryInterface itself, and the layer receives the PC
base interface. Not run locally - the mock-test target does not build at this commit (finding posted),
so CI is the check.
@Mumogg

Mumogg commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Measured on top of #349 and #350, on main ece4ba5b3: Linux (Nobara 44), Wine 11.21 staging, RTX 5070 Ti (driver 615.78.08), clang-cl 22.1.8 + xwin SDK 10.0.26100, own 1.0.2.1 copy, network off.

--run D3D12 calls Ends with
main + #349 + #350 13 CreateCommandList failed, after QueryInterface: unknown IID for the list
+ this pull request 1,181 the title's int3 after its device set-up returns false (the xmem stop of #328)
+ #328 1,197 host access violation in CreateConstantBufferView, writing through a descriptor handle that is the title's own address

So this clears the list-interface stop here: 581 lists are created and closed after it.

Two things I ran into:

  • runtime/shims/d3d12_xs_device.cpp gains #include "d3d12_com.h" // local: create_console_descriptor_heap. With it xs_proxy_mock_test no longer compiles in my cross build: that target has no Vulkan include path and the header pulls vulkan/vulkan.h in through src/gfx10_descriptors.h. gta6rt builds. I do not know whether the Windows CI has the headers on that target's path; the include does not look needed by this change.
  • The queue-description part (PC prefix, flags masked to the one PC flag) does the same job as d3d12_xs: device slot 48 reads the console's 32-byte queue description, again (RT-SLOT48) #350, in proxy_create_command_queue instead of the slot 48 route. With both applied the mask runs twice, which is harmless, but one of the two is enough. The flags word of the four queue descriptions here: 0x1, 0x2, 0x3, 0x0.

AI-assisted; built and run on the machine above.

@BadgersMC

Copy link
Copy Markdown
Contributor

Native Windows build check of 4c780823a9c93614e6af581070ebbbe746a0955c on Windows 11 build 26100, MSVC 19.44.35228, SDK 10.0.26100, RelWithDebInfo.

I reproduced the standalone xs_proxy_mock_test build failure. The target compiles d3d12_xs_device.cpp without Vulkan headers. The branch's d3d12_com.h include pulls in gfx10_descriptors.h, and MSVC fails with C1083 for vulkan/vulkan.h. The native mock test therefore did not execute. This confirms the build problem already reported under Wine. The command-list change should build independently of the local descriptor-heap dependency.

Two additional test findings from source review:

  • In the new console IID check, QueryInterface increments the proxy reference count and returns console_query. The test leaves that reference live and expects release(console_list) to return zero. Release console_query first and check that one reference remains.
  • The test dereferences the IID pointer recorded by the mock after proxy_create_command_list_x returns. The fallback IID is local to that function. Copy the IID value inside the mock call and assert on the copy.

These two findings were established by source inspection. The build blocker prevents an execution result for either assertion. No game files were used. AI-assisted review and verification with Claude Code and Codex.

@ubiquitarianism

Copy link
Copy Markdown
Collaborator

Not merging this. Against current main:

  • It breaks the Windows build. The new #include "d3d12_com.h" in d3d12_xs_device.cpp pulls in vulkan/vulkan.h through gfx10_descriptors.h, and the root_sig_test target that compiles that file has no Vulkan include path (fatal error C1083). Nothing calls create_console_descriptor_heap through it anyway.
  • supports_iid(self->real, *riid) asks the device, not a list, whether it supports a command-list IID, so every list is created as the base interface. That breaks xs_proxy_mock_test's existing check at line 868.
  • The queue-flag mask in proxy_create_command_queue duplicates d3d12_xs: device slot 48 reads the console's 32-byte queue description, again (RT-SLOT48) #350, which is now merged.
  • docs/retail_boot_chain.md §3.3 keeps console IIDs out of the repository.

An IID-free fallback, retrying on E_NOINTERFACE with the PC base IID as #359 does, covers the same stop.

@x2Tweek

x2Tweek commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Boot evidence for the console command-list IID fix.

Build with a QI fix accepting IID_ID3D12GraphicsCommandList6 = {c3827890-4024-474c-98cf-645b51dc4874} (separate implementation from this PR, same root cause): retail boot now gets past CreateCommandList.

Metric Before QI fix After QI fix
CreateCommandList E_NOINTERFACE (0x80004002), null list succeeds
D3D12 calls before stop 13 1,639
Last d3d12 call — ID3D12Device::CreateUnorderedAccessView (#1639)

After #1639 the boot stops in guest code: mov dword ptr [rax], r8d with an invalid rax at game_scarlett_master.exe+0x55e3b1, stack 100% game code, no gta6rt frames. Page heap moves the allocation but the fault persists, so this is an invalid memory access in the title's own code after CreateDescriptorHeap/CreateUnorderedAccessView — a separate blocker from the QI issue.

This PR's proxy-level approach (answer the console IID in wrap_list, create PC list with base IID) and my class-level QueryInterface override both solve the same is_list_iid() gap. Both dependencies (#8461 DStorageGetFactory, #6964 slot 26) are in main.

@x2Tweek x2Tweek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tested PR #142's console command-list IID fix on the retail executable (game_scarlett_master.exe 1.0.2.1), LEONIDA_D3D12=vulkan, RTX 5090.

Before the fix: boot crashed at trace #13, ID3D12Device::CreateCommandList failed — QueryInterface: unknown IID {c3827890-4024-474c-98cf-645b51dc4874}. Five runs all identical, exit 0x80000003.

After applying the fix (kConsoleListIID accepted in is_list_iid(), supports_iid skipped for the console IID in list_query_interface(), base PC list created instead of forwarding the console IID): boot reaches trace #1639, stopping at CreateUnorderedAccessView (no "ok" after it). Exit still 0x80000003 but the blocker moved from CreateCommandList to resource creation.

Five runs with the fix, all reached #1639. D3D12 calls went from 13 to 1639.

No game data in this report — module+RVA and trace event counts only.

This confirms PR #142 resolves the CreateCommandList QI blocker. The next stop is CreateUnorderedAccessView at trace #1639.

Tested on current upstream/main (1c93c86) with the fix applied temporarily in a local worktree (reverted after testing; not committed).

@aslan2142

Copy link
Copy Markdown
Collaborator

Thanks for carrying this over, and to everyone who measured it. Closing it as covered by main:

AI-assisted (Claude Code, Claude Opus 5.5).

@aslan2142 aslan2142 closed this Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs rebase Conflicts with the base branch: rebase it on main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants