From af9baf0f7ce33e8226a4759b34d52a775bd9d7c0 Mon Sep 17 00:00:00 2001 From: Pavel Kotek <334189328+kotekompotek@users.noreply.github.com> Date: Tue, 24 Nov 2026 11:35:57 +0500 Subject: [PATCH 1/2] xbox_present: record measured Device (78-81) and Queue (23, 24, 32) vtable slots --- runtime/shims/xbox_present.h | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/runtime/shims/xbox_present.h b/runtime/shims/xbox_present.h index 60a317beec..010410a1ab 100644 --- a/runtime/shims/xbox_present.h +++ b/runtime/shims/xbox_present.h @@ -15,13 +15,13 @@ // values are still unmeasured. The SuspendX/ResumeX slots are not in any public source. // // Slots (0-based, QueryInterface = 0) before the proxy can forward: -// ID3D12Device (Xbox): SetFrameIntervalX (output, interval, latency, flags) 78 -// ScheduleFrameEventX (event, offset, reserved pointer, flags) 79 -// WaitFrameEventX (event, timeout ms, reserved pointer, flags, &token) 80 -// GetFrameStatisticsX (token, type mask, &count, array) 81 -// ID3D12CommandQueue (Xbox): PresentX (plane count, planes, params) 30 (older) / 32 (newer) -// SuspendX (flags) slot unknown -// ResumeX () slot unknown +// ID3D12Device (Xbox): SetFrameIntervalX (output, interval, latency, flags) 78 (0x270) +// ScheduleFrameEventX (event, offset, reserved pointer, flags) 79 (0x278) +// WaitFrameEventX (event, timeout ms, reserved pointer, flags, &token) 80 (0x280) +// GetFrameStatisticsX (token, type mask, &count, array) 81 (0x288) +// ID3D12CommandQueue (Xbox): SuspendX (flags) 23 (0x0b8) +// ResumeX () 24 (0x0c0) +// PresentX (plane count, planes, params) 30 (older) / 32 (newer; measured 32 at 0x100) // The public numbers are measurements of other titles' runtimes, not of this game. The runtime version moves // PresentX, so neither value may be assumed; trace the game's slots. // The queue-side calls do not look at the queue: the Vulkan device has one VkQueue behind every D3D12 queue, and @@ -40,6 +40,15 @@ namespace rt::d3d12 { +// Measured 0-based vtable slots (QueryInterface = 0). +inline constexpr unsigned kDeviceSlotSetFrameIntervalX = 78; +inline constexpr unsigned kDeviceSlotScheduleFrameEventX = 79; +inline constexpr unsigned kDeviceSlotWaitFrameEventX = 80; +inline constexpr unsigned kDeviceSlotGetFrameStatisticsX = 81; +inline constexpr unsigned kQueueSlotSuspendX = 23; +inline constexpr unsigned kQueueSlotResumeX = 24; +inline constexpr unsigned kQueueSlotPresentX = 32; + // Provisional (ours): D3D12XBOX_FRAME_INTERVAL_* as periods in microseconds. inline constexpr std::uint32_t xbox_frame_interval_30hz_us = 33333; inline constexpr std::uint32_t xbox_frame_interval_60hz_us = 16667; From b9ffaa5159a14ac22c851bd12931aa83769b3cd5 Mon Sep 17 00:00:00 2001 From: Pavel Kotek <334189328+kotekompotek@users.noreply.github.com> Date: Tue, 24 Nov 2026 14:54:03 +0500 Subject: [PATCH 2/2] xbox_present: add 1.0.2.1 call-site provenance and align README/docs --- docs/d3d12_command_objects.md | 8 ++++---- runtime/README.md | 5 ++--- runtime/shims/xbox_present.h | 12 +++++++----- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/docs/d3d12_command_objects.md b/docs/d3d12_command_objects.md index 5a214e3258..fb0da4e403 100644 --- a/docs/d3d12_command_objects.md +++ b/docs/d3d12_command_objects.md @@ -675,8 +675,8 @@ extensions. The parts relevant to this page: | `PresentX` is an `ID3D12CommandQueue` method | **Prior art** | Class-attributed by a UMD validation message and by 367 call sites in the console SDK samples ([`d3d12-xs-wrapper.md:69-97`](https://github.com/p-portela/SCARAB/blob/d304fa2/docs/d3d12-xs-wrapper.md)). | | `PresentX` carries at most 2 planes and 8 views per plane | **Prior art** | `D3D12CONS_PRESENT_PLANES_MAX = 2`, `D3D12CONS_PRESENT_VIEWS_MAX = 8`; the UMD message names `pPlaneParameters[%d].ResourceCount <= 2`. | | Present flags `NONE`, `IMMEDIATE`, `PERSIST`, `UNIQUE_VIEW_RESOURCES` exist | **Prior art** | Names are recovered; the numeric values are **not** measured. `console_extensions.h` assigns `0x1/0x2/0x4` while `present_adapter.h` says the values are unknown and uses zero; the two contradict each other ([`d3d12_xs_surface.md §7`](d3d12_xs_surface.md)). | -| `PresentX` signature and slot | **Open** | No signature, slot or call sequence is recovered. | -| `SuspendX` / `ResumeX` are queue methods | **Prior art** | 122 sample call sites each; no signature or slot. | +| `PresentX` signature and slot | **Measured (1.0.2.1)** | Queue slot `32` (`+0x100`, e.g. RVA `0x28751`); plane/params layouts match public GDKX structs (`0x48` / `0x20` bytes). | +| `SuspendX` / `ResumeX` are queue methods | **Measured (1.0.2.1)** | 122 sample call sites each; measured on retail 1.0.2.1 at queue slots `23` (`+0x0b8`, e.g. `0x31b17`) and `24` (`+0x0c0`, e.g. `0x3299b`). | | `CreateCommandQueueX` is a device method | **Prior art** | UMD message ties it to `ID3D12Device`; the inferred shape is `(pDesc, pShaderQueueParams, riid, out)`; the UMD says a shader-based queue supports only `D3D12_COMMAND_LIST_TYPE_COMPUTE`; SCARAB returns `E_NOTIMPL`. Slot and parameter layout are **Open**. | | `ID3D12ConsDmaCommandList` IID `30bc77b9-8379-4b25-95de-b8588c42275d` | **Prior art** | Exported at ordinal 100; the DMA list rule is quoted from the UMD. `D3D12CONS_COMMAND_LIST_TYPE_DMA = 6` is **Derived** by appending to the PC enum, not measured. | | Command-list extension order | **Assumed** | SCARAB's own header says the order within the appended block is not recovered; every appended slot logs its name and raw arguments ([`console_extensions.h:13-31`](https://github.com/p-portela/SCARAB/blob/d304fa2/components/extension-wrapper/console_extensions.h)). Do not copy it. | @@ -829,9 +829,9 @@ command object. | Item | Why it is blocked | |---|---| -| `PresentX` | No slot, signature, plane struct or swapchain/plane parameters. Prior art gives only names, the 2-plane/8-view limits and four flag names. | +| `PresentX` | Slot `32` (`+0x100`) measured on 1.0.2.1; enum values (`ScaleFilter`, plane `Flags`) remain unmeasured. | | `CreateCommandQueueX` | No slot or parameter layout; only the UMD message and an inferred shape. | -| `SuspendX` / `ResumeX` | No slot or signature. | +| `SuspendX` / `ResumeX` | Slots `23` (`+0x0b8`) and `24` (`+0x0c0`) measured on 1.0.2.1; exact `SuspendX` flags remain unmeasured. | | Xbox queue/list/fence/allocator slot deviations | No runtime binary and no game executable; the package has no queue, fence or allocator client, and its only command-list client is the BVH builder. | | Builder's list field `+0x350` | Read once (`0x1d877`) and not explained by the inline buffer of section 3.5a, which covers `+0x18`, `+0x28`, `+0x30`, `+0x140`, `+0x141`, `+0x344` and `+0x544`. | | DMA list use/value | The IID is prior art; type 6 is derived; no shipped module uses it, and no module can name any GUID at a call site beyond its known ten or holds a static queue description with a non-PC type (§3.2a). | diff --git a/runtime/README.md b/runtime/README.md index 61794a2c2d..64f2cfd40b 100644 --- a/runtime/README.md +++ b/runtime/README.md @@ -405,9 +405,8 @@ blocks the import-driven work: measured: the FSR DLL's calls confirm device slots 14, 15, 16, 18, 19, 27, 38, 62 and 76, slot 67 is a console-only pipeline call, and the rest is open (`docs/d3d12_vulkan.md`, question 2). - The command-queue and fence extensions: the proxies forward the public slots, and the console's own methods past - them (`PresentX`, `SuspendX`, `ResumeX`) have unknown slots, so they are refused with a log. - `PresentX` and the frame events themselves are implemented (`shims/xbox_present.*`, `xbox_present_test`) but - nothing reaches them yet: their queue and device slots are unmeasured. + them are measured on retail 1.0.2.1 (`SuspendX` slot 23, `ResumeX` slot 24, `PresentX` slot 32; device frame-event + slots 78–81). `PresentX` and the frame events themselves are implemented (`shims/xbox_present.*`, `xbox_present_test`). - Most of the `xgameruntime` surface: an offline shim covers `XGameRuntimeInitialize`, device/console queries, `XTaskQueue` and `XAsync`, and `QueryApiImpl` serves `XThreadingImpl`, `XErrorImpl`, `XNetworkingImpl`, `XPersistentLocalStorageImpl` and `XSystemImpl` (see `xgameruntime_test`); any other class is refused with a log. diff --git a/runtime/shims/xbox_present.h b/runtime/shims/xbox_present.h index 010410a1ab..2c769db5f3 100644 --- a/runtime/shims/xbox_present.h +++ b/runtime/shims/xbox_present.h @@ -12,18 +12,20 @@ // - XCL (GPL-2.0-only, facts only) measured the frame calls on device slots 78-81 and PresentX on queue slot 30 // (older runtime layout: XDefiant, Minecraft, Fortnite) or 32 (newer: Unicorn Overlord). // WHAT IS OURS: the constant values, the HRESULT choices and the ScaleFilter/plane-flag values; the real enum -// values are still unmeasured. The SuspendX/ResumeX slots are not in any public source. +// values are still unmeasured. The SuspendX/ResumeX slots are not in public documentation; they were measured +// locally on the retail 1.0.2.1 executable via Capstone disassembly of ID3D12Device/ID3D12CommandQueue call sites +// (e.g. SetFrameIntervalX +0x270 at RVA 0x1ea6e7, SuspendX +0x0b8 at 0x31b17, ResumeX +0x0c0 at 0x3299b, +// PresentX +0x100 at 0x28751). // -// Slots (0-based, QueryInterface = 0) before the proxy can forward: +// Measured 0-based slots (QueryInterface = 0) on retail 1.0.2.1: // ID3D12Device (Xbox): SetFrameIntervalX (output, interval, latency, flags) 78 (0x270) // ScheduleFrameEventX (event, offset, reserved pointer, flags) 79 (0x278) // WaitFrameEventX (event, timeout ms, reserved pointer, flags, &token) 80 (0x280) // GetFrameStatisticsX (token, type mask, &count, array) 81 (0x288) // ID3D12CommandQueue (Xbox): SuspendX (flags) 23 (0x0b8) // ResumeX () 24 (0x0c0) -// PresentX (plane count, planes, params) 30 (older) / 32 (newer; measured 32 at 0x100) -// The public numbers are measurements of other titles' runtimes, not of this game. The runtime version moves -// PresentX, so neither value may be assumed; trace the game's slots. +// PresentX (plane count, planes, params) 32 (0x100; older GDKX runtimes used 30) +// Note: other GDKX runtime versions may place PresentX at slot 30 instead of 32, so the proxy allows env overrides. // The queue-side calls do not look at the queue: the Vulkan device has one VkQueue behind every D3D12 queue, and // the present is submitted after the work already executed on it.