From 545253542f34bea5ba4e4a00452934fff1e3e0a3 Mon Sep 17 00:00:00 2001 From: YuhiAida <21134775+YuhiAida@users.noreply.github.com> Date: Tue, 24 Nov 2026 00:41:18 +0100 Subject: [PATCH 1/2] d3d12_xs: answer the console command-list IID the retail executable asks for MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # 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. --- runtime/shims/d3d12_xs_device.cpp | 37 ++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/runtime/shims/d3d12_xs_device.cpp b/runtime/shims/d3d12_xs_device.cpp index 187406e3d8..688856caa5 100644 --- a/runtime/shims/d3d12_xs_device.cpp +++ b/runtime/shims/d3d12_xs_device.cpp @@ -23,6 +23,7 @@ // for a trace that disagrees. The frame-event calls answer from a per-device token counter: there is no vblank source // behind the device before a presenter exists, so WaitFrameEventX returns at once with a fresh non-zero token. #include "d3d12_xs_device.h" +#include "d3d12_com.h" // local: create_console_descriptor_heap #include "d3d12_trace.h" #include "../src/shader_library.h" // leonida::fspx_payload_from_parts for slot 67 @@ -976,7 +977,13 @@ inline void note_list_slot(unsigned slot, std::uint64_t a1 = 0, std::uint64_t a2 static_cast(a3), static_cast(a4)); } +// The retail executable asks CreateCommandListX for its own command-list interface rather than a PC one: measured +// at slot 73 as {c3827890-4024-474c-98cf-645b51dc4874}. It is the proxy's to answer, and its calls are mapped to +// the PC slots like the console's other list interfaces. +constexpr GUID kConsoleListIID{0xc3827890, 0x4024, 0x474c, {0x98, 0xcf, 0x64, 0x5b, 0x51, 0xdc, 0x48, 0x74}}; + inline bool is_list_iid(const IID& iid) { + if (IsEqualIID(iid, kConsoleListIID)) return true; return IsEqualIID(iid, __uuidof(IUnknown)) || IsEqualIID(iid, __uuidof(ID3D12Object)) || IsEqualIID(iid, __uuidof(ID3D12DeviceChild)) || IsEqualIID(iid, __uuidof(ID3D12CommandList)) || IsEqualIID(iid, __uuidof(ID3D12GraphicsCommandList)) || @@ -1015,7 +1022,8 @@ inline HRESULT list_query_interface(ListProxy* self, const IID* riid, void** out if (supports_iid(self->real, *riid)) log_refused_iid("list", *riid); return E_NOINTERFACE; } - if (!supports_iid(self->real, *riid)) return E_NOINTERFACE; + // No PC list answers the console interface; the proxy answers it itself. + if (!IsEqualIID(*riid, kConsoleListIID) && !supports_iid(self->real, *riid)) return E_NOINTERFACE; *out = self; list_add_ref(self); return S_OK; @@ -1361,9 +1369,27 @@ HRESULT proxy_create_command_queue(DeviceProxy* self, const D3D12_COMMAND_QUEUE_ // The caller's null output goes to the real device on purpose: its answer (S_FALSE, E_UNEXPECTED, ...) is the // one to give, although the SDK annotates the parameter as required. #pragma warning(suppress : 6387) + // The console desc starts with a PC D3D12_COMMAND_QUEUE_DESC and adds Xbox words after it + // (docs/retail_boot_chain.md 3.2). Only the PC prefix is read, and Flags is limited to the one PC flag: the + // console sets bits the PC device refuses, which made CreateCommandQueue fail and the title assert. + D3D12_COMMAND_QUEUE_DESC pc_desc{}; + if (desc) { + pc_desc = *desc; + pc_desc.Flags = static_cast(static_cast(pc_desc.Flags) & + D3D12_COMMAND_QUEUE_FLAG_DISABLE_GPU_TIMEOUT); + desc = &pc_desc; + } if (!out) return self->real->CreateCommandQueue(desc, *riid, nullptr); void* created = nullptr; const HRESULT hr = self->real->CreateCommandQueue(desc, __uuidof(ID3D12CommandQueue), &created); + { + static std::atomic logged{false}; + if (first_call(logged) || FAILED(hr)) + std::fprintf(stderr, + "[rt] queue: type=%d priority=%d flags=0x%x node=%u -> hr=0x%08lx\n", + static_cast(pc_desc.Type), pc_desc.Priority, static_cast(pc_desc.Flags), + pc_desc.NodeMask, static_cast(hr)); + } if (FAILED(hr)) return hr; return wrap_child(static_cast(created), self, riid, out); } @@ -1435,8 +1461,13 @@ HRESULT proxy_create_command_list_x(DeviceProxy* self, std::uint64_t desc_word, if (!allocator) allocator = reinterpret_cast(allocator_word); auto* initial_state = reinterpret_cast(initial_state_word); void* created = nullptr; - const HRESULT hr = self->real->CreateCommandList(0, type, allocator, initial_state, - *riid, &created); + // The layer (and any PC device behind the proxy) only knows the PC list interfaces. Hand a requested PC + // interface on as asked; for anything else (the title's own console list interface) create the base PC list and + // let wrap_list answer the requested IID with the proxy. Passing the console IID down made CreateCommandList + // answer E_NOINTERFACE, so every list came back null and the title read through it. + const IID pc_base = __uuidof(ID3D12GraphicsCommandList); + const IID* create_iid = supports_iid(self->real, *riid) ? riid : &pc_base; + const HRESULT hr = self->real->CreateCommandList(0, type, allocator, initial_state, *create_iid, &created); if (FAILED(hr)) return hr; return wrap_list(static_cast(created), self, riid, out); } From 4c780823a9c93614e6af581070ebbbe746a0955c Mon Sep 17 00:00:00 2001 From: YuhiAida <21134775+YuhiAida@users.noreply.github.com> Date: Tue, 24 Nov 2026 00:41:18 +0100 Subject: [PATCH 2/2] d3d12_xs: cover the console list IID in xs_proxy_mock_test 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. --- runtime/shims/d3d12_xs_device.cpp | 5 ----- runtime/shims/d3d12_xs_device.h | 4 ++++ runtime/test/xs_proxy_mock_test.cpp | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/runtime/shims/d3d12_xs_device.cpp b/runtime/shims/d3d12_xs_device.cpp index 688856caa5..1e29c98957 100644 --- a/runtime/shims/d3d12_xs_device.cpp +++ b/runtime/shims/d3d12_xs_device.cpp @@ -977,11 +977,6 @@ inline void note_list_slot(unsigned slot, std::uint64_t a1 = 0, std::uint64_t a2 static_cast(a3), static_cast(a4)); } -// The retail executable asks CreateCommandListX for its own command-list interface rather than a PC one: measured -// at slot 73 as {c3827890-4024-474c-98cf-645b51dc4874}. It is the proxy's to answer, and its calls are mapped to -// the PC slots like the console's other list interfaces. -constexpr GUID kConsoleListIID{0xc3827890, 0x4024, 0x474c, {0x98, 0xcf, 0x64, 0x5b, 0x51, 0xdc, 0x48, 0x74}}; - inline bool is_list_iid(const IID& iid) { if (IsEqualIID(iid, kConsoleListIID)) return true; return IsEqualIID(iid, __uuidof(IUnknown)) || IsEqualIID(iid, __uuidof(ID3D12Object)) || diff --git a/runtime/shims/d3d12_xs_device.h b/runtime/shims/d3d12_xs_device.h index ac0437215d..07d8a27fe7 100644 --- a/runtime/shims/d3d12_xs_device.h +++ b/runtime/shims/d3d12_xs_device.h @@ -150,6 +150,10 @@ bool command_object_tables_guarded(); // {7d0e6b51-34a2-4f0c-9a61-0c5b2e8f4a10}: the Vulkan layer's CommandAllocator answers it with its implementation. inline constexpr GUID kLeonidaCommandAllocatorTag{ 0x7d0e6b51, 0x34a2, 0x4f0c, {0x9a, 0x61, 0x0c, 0x5b, 0x2e, 0x8f, 0x4a, 0x10}}; +// The console's own command-list interface: CreateCommandListX (device slot 73) asks for it by name in the retail +// executable. No PC list answers it, so a command-list proxy answers it itself and maps its slots to the PC ones. +inline constexpr GUID kConsoleListIID{ + 0xc3827890, 0x4024, 0x474c, {0x98, 0xcf, 0x64, 0x5b, 0x51, 0xdc, 0x48, 0x74}}; bool is_allocator_proxy(const void* allocator); // The wrapped allocator (no reference added), or null when `allocator` is not an allocator proxy. ID3D12CommandAllocator* allocator_proxy_real_allocator(const void* allocator); diff --git a/runtime/test/xs_proxy_mock_test.cpp b/runtime/test/xs_proxy_mock_test.cpp index 6af7ad8046..c85da977b6 100644 --- a/runtime/test/xs_proxy_mock_test.cpp +++ b/runtime/test/xs_proxy_mock_test.cpp @@ -867,6 +867,20 @@ int check_xbox_slots() { EXPECT(mock->args[12][2] == word(real_allocator) && mock->args[12][3] == 0); EXPECT(mock->args[12][4] == word(&list_iid)); + // The same slot asked for the console's own list interface, {c3827890-4024-474c-98cf-645b51dc4874}, which no PC + // list answers. The proxy answers it itself; the layer receives the PC base interface. + const IID console_list_iid = xs::kConsoleListIID; + void* console_list = nullptr; + EXPECT(hr_of(raw(device, 73, word(&desc), word(allocator), 0, word(&console_list_iid), + word(&console_list))) == S_OK); + EXPECT(xs::is_command_list_proxy(console_list)); + EXPECT(std::memcmp(reinterpret_cast(mock->args[12][4]), &__uuidof(ID3D12GraphicsCommandList), + sizeof(IID)) == 0); + void* console_query = nullptr; + EXPECT(hr_of(raw(console_list, 0, word(&console_list_iid), word(&console_query))) == S_OK && + console_query == console_list); + EXPECT(release(console_list) == 0); + // Release the list before the refusal calls below: the COM convention (and the handler) nulls the caller's // output on failure, so an invalid call would clear this pointer. EXPECT(release(list) == 0);