upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorRain156 <77776581+Rain156@users.noreply.github.com>2026-11-24 22:51:02 +0800
committerRain156 <77776581+Rain156@users.noreply.github.com>2026-11-24 22:51:02 +0800
commit2d9987f3cd488b1c466b156d24948d7cc14ab7ef (patch)
tree0187e06cb4ab4f4ea5650210fc4ff1e88f64019e /docs
parent7cee65bc7c53b6a90ed04ca7f37c778373ff397f (diff)
parentd0da7dade8b688f2e0f7f23f4155d6cbb438809e (diff)
Merge the upstream offline services, frame events and queue ABI into the Windows UI integration
Retain the first-run origin-token poll and shared tokens alongside standard origin, vblank and flip events. Route attached presenter callbacks before the fallback window and dispatch local speech through the Windows provider with the upstream offline fallback. The offline pipeline checker now enables the runtime mesh query feature for cache-producing runs. A controlled GPU comparison with the same compute shader changed from a miss to an application cache hit.
Diffstat (limited to 'docs')
-rw-r--r--docs/boot.md6
-rw-r--r--docs/d3d12_vulkan.md1
-rw-r--r--docs/first_run_ui.md2
-rw-r--r--docs/pipeline_check.md1
-rw-r--r--docs/retail_boot_chain.md2
-rw-r--r--docs/runtime_imports.md76
6 files changed, 72 insertions, 16 deletions
diff --git a/docs/boot.md b/docs/boot.md
index f2d39f270..aa9fdcc98 100644
--- a/docs/boot.md
+++ b/docs/boot.md
@@ -1,9 +1,9 @@
1# First boot: the runbook and the two traces 1# First boot: the runbook and the two traces
2 2
3The Windows integration has a dedicated [offline first-run UI profile](first_run_ui.md). The original dry-run 3The Windows integration has a dedicated [offline first-run UI profile](first_run_ui.md). The original dry-run
4and initialization measurements in this runbook used a separately supplied executable and identified 30 unimplemented 4and initialization measurements used a separately supplied executable and identified 30 unimplemented imports.
5imports. The executable's Winsock imports bind to the host, so keep retail runs offline and traces on the player's 5The Winsock shim restricts connections to loopback and the WinHTTP shim refuses outbound requests. Keep retail runs
6machine. [Original import measurements](runtime_imports.md#the-retail-executable-rt-5) 6offline and traces on the player's machine. [Original import measurements](runtime_imports.md#the-retail-executable-rt-5)
7 7
8## 1. What the first boot produces 8## 1. What the first boot produces
9 9
diff --git a/docs/d3d12_vulkan.md b/docs/d3d12_vulkan.md
index 247476da1..a6cce00a2 100644
--- a/docs/d3d12_vulkan.md
+++ b/docs/d3d12_vulkan.md
@@ -3687,6 +3687,7 @@ to be recovered from call sites (or the NDA GDK headers, if a developer has acce
3687| Device slots 48/73/78/79/80 | Public HLE `Freminet`/`ScarlettX` (third-party, not Microsoft documentation) | `d3d12_xs_device.cpp` routes `CreateCommandQueueX` (48), `CreateCommandListX` (73), `SetFrameIntervalX` (78), `ScheduleFrameEventX` (79) and `WaitFrameEventX` (80) before it indexes the PC vtable. Queue and list creation use the existing create paths. The frame-event calls are a per-device token counter: `WaitFrameEventX` returns at once with a fresh non-zero token, because there is no vblank source before a presenter exists. The five indices can be moved with `LEONIDA_XS_QUEUE_X_SLOT`, `LEONIDA_XS_LIST_X_SLOT`, `LEONIDA_XS_FRAME_INTERVAL_SLOT`, `LEONIDA_XS_SCHEDULE_EVENT_SLOT` and `LEONIDA_XS_WAIT_EVENT_SLOT` (3..127; a value that names a slot the proxy already handles keeps that slot's handler); a trace that disagrees wins. | 3687| Device slots 48/73/78/79/80 | Public HLE `Freminet`/`ScarlettX` (third-party, not Microsoft documentation) | `d3d12_xs_device.cpp` routes `CreateCommandQueueX` (48), `CreateCommandListX` (73), `SetFrameIntervalX` (78), `ScheduleFrameEventX` (79) and `WaitFrameEventX` (80) before it indexes the PC vtable. Queue and list creation use the existing create paths. The frame-event calls are a per-device token counter: `WaitFrameEventX` returns at once with a fresh non-zero token, because there is no vblank source before a presenter exists. The five indices can be moved with `LEONIDA_XS_QUEUE_X_SLOT`, `LEONIDA_XS_LIST_X_SLOT`, `LEONIDA_XS_FRAME_INTERVAL_SLOT`, `LEONIDA_XS_SCHEDULE_EVENT_SLOT` and `LEONIDA_XS_WAIT_EVENT_SLOT` (3..127; a value that names a slot the proxy already handles keeps that slot's handler); a trace that disagrees wins. |
3688| Indirect argument type 105 | The retail title's startup creates five one-argument command signatures (device slot 41) with no root signature; one has type 105 and a 12-byte stride. Its two `ExecuteIndirect` sites, read statically, set the compute state first, as the `DISPATCH` sites do, and pass one command from the same argument buffer, on a second command list | `d3d12_xs_device.cpp` creates it as `DISPATCH` (`D3D12_DISPATCH_ARGUMENTS`). What the console does differently for it is **Open**. | 3688| Indirect argument type 105 | The retail title's startup creates five one-argument command signatures (device slot 41) with no root signature; one has type 105 and a 12-byte stride. Its two `ExecuteIndirect` sites, read statically, set the compute state first, as the `DISPATCH` sites do, and pass one command from the same argument buffer, on a second command list | `d3d12_xs_device.cpp` creates it as `DISPATCH` (`D3D12_DISPATCH_ARGUMENTS`). What the console does differently for it is **Open**. |
3689| Device slot 61 | The retail title's boot under `gta6rt --run` (stop 20 of the RT-5 measurements in #6910): called as `(desc, dest handle)` once per sampler | `d3d12_xs_device.cpp` routes it to the PC `CreateSampler` (slot 22) with the description's PC `D3D12_SAMPLER_DESC` prefix; the PC slot 61 is `CreateMetaCommand`. The layout of the description beyond the PC fields is **Open**. | 3689| Device slot 61 | The retail title's boot under `gta6rt --run` (stop 20 of the RT-5 measurements in #6910): called as `(desc, dest handle)` once per sampler | `d3d12_xs_device.cpp` routes it to the PC `CreateSampler` (slot 22) with the description's PC `D3D12_SAMPLER_DESC` prefix; the PC slot 61 is `CreateMetaCommand`. The layout of the description beyond the PC fields is **Open**. |
3690| Device slot 81, queue `PresentX`/`SuspendX`/`ResumeX` | XCL (GPL-2.0-only, third-party): `GetFrameStatisticsX` at device slot 81, `PresentX` at queue slot 30 (older runtime layout) or 32 (newer); `SuspendX`/`ResumeX` slots unmeasured | `set_presentation_handler` forwards 78-81 and the queue routes to a presenter (`attach_xbox_presentation`; `the Windows integration also creates its own presenter on first use). Without one, slot 81 answers `S_FALSE` with a zero count (no statistics yet) and the queue slots stay refused. Moved with `LEONIDA_XS_FRAME_STATISTICS_SLOT` (3..127) and `LEONIDA_XS_PRESENT_X_SLOT` (default 30); `SuspendX` and `ResumeX` are routed only when `LEONIDA_XS_SUSPEND_X_SLOT` / `LEONIDA_XS_RESUME_X_SLOT` are set (queue slots 19..127; two routes on one slot are refused with a log). |
3690| VRS | Public `D3D12_SHADING_RATE` / `D3D12_AXIS_SHADING_RATE` | `VK_KHR_fragment_shading_rate`; `RSSetShadingRate`/image-based rate map to `vkCmdSetFragmentShadingRateKHR`. | 3691| VRS | Public `D3D12_SHADING_RATE` / `D3D12_AXIS_SHADING_RATE` | `VK_KHR_fragment_shading_rate`; `RSSetShadingRate`/image-based rate map to `vkCmdSetFragmentShadingRateKHR`. |
3691| Mesh shader tier | Public `D3D12_MESH_SHADER_TIER` | `VK_EXT_mesh_shader`; the 9,282 translated mesh shaders make this a hard requirement for any content that uses them. | 3692| Mesh shader tier | Public `D3D12_MESH_SHADER_TIER` | `VK_EXT_mesh_shader`; the 9,282 translated mesh shaders make this a hard requirement for any content that uses them. |
3692| Wave MMA | Public `D3D12_WAVE_MMA_TIER` | Not used: no shader sets `WAVE_MMA` in SFI0 and none contains `v_mfma`/`v_wmma` (all 26,503, `tools/feature_scan.py`). Answer the tier query truthfully; no cooperative-matrix mapping is needed. | 3693| Wave MMA | Public `D3D12_WAVE_MMA_TIER` | Not used: no shader sets `WAVE_MMA` in SFI0 and none contains `v_mfma`/`v_wmma` (all 26,503, `tools/feature_scan.py`). Answer the tier query truthfully; no cooperative-matrix mapping is needed. |
diff --git a/docs/first_run_ui.md b/docs/first_run_ui.md
index ac06fd168..02766c1a1 100644
--- a/docs/first_run_ui.md
+++ b/docs/first_run_ui.md
@@ -24,7 +24,7 @@ Keep the generated shader workspace. The port reads the shader directory recorde
24 24
25## Launch 25## Launch
26 26
27Run the title offline. The original boot runbook explains which socket imports reach Windows. The hardware verification used a Windows AppContainer with zero network capabilities. [Boot runbook](boot.md) 27Run the title offline. The Winsock shim permits loopback and the WinHTTP shim refuses outbound requests. The hardware verification used a Windows AppContainer with zero network capabilities. [Boot runbook](boot.md)
28 28
29```powershell 29```powershell
30& (Join-Path $port 'gta6rt.exe') --first-run-ui (Join-Path $game 'game_scarlett_master.exe') 30& (Join-Path $port 'gta6rt.exe') --first-run-ui (Join-Path $game 'game_scarlett_master.exe')
diff --git a/docs/pipeline_check.md b/docs/pipeline_check.md
index 276849237..d22db544a 100644
--- a/docs/pipeline_check.md
+++ b/docs/pipeline_check.md
@@ -448,6 +448,7 @@ driver gives it the same cache key in both programs. Measured on Windows with an
448- The three device features `robustBufferAccess`, `scalarBlockLayout` and `robustImageAccess` each affect the key. 448- The three device features `robustBufferAccess`, `scalarBlockLayout` and `robustImageAccess` each affect the key.
449 The first two are disabled on both devices. This integration enables supported core image robustness for storage 449 The first two are disabled on both devices. This integration enables supported core image robustness for storage
450 views on both the runtime device and the checker. The seed test compares the two using one synthetic pipeline. 450 views on both the runtime device and the checker. The seed test compares the two using one synthetic pipeline.
451- On a Windows RTX 5070 Ti (617.42), a compute-only seed missed with mesh features omitted and hit with the supported mesh and mesh-query features enabled on both devices. The shader, push constants and pipeline layout were identical. Cache-producing runs request this device configuration for every selected shader batch.
451- The executable's file name is part of the key; its folder is not. A copy of the checker under another name 452- The executable's file name is part of the key; its folder is not. A copy of the checker under another name
452 misses the cache the original wrote, and the runtime's device hits the checker's cache only from a program 453 misses the cache the original wrote, and the runtime's device hits the checker's cache only from a program
453 with the checker's file name. So on this driver a cache written by `vk_pipeline_check.exe` does not hit in 454 with the checker's file name. So on this driver a cache written by `vk_pipeline_check.exe` does not hit in
diff --git a/docs/retail_boot_chain.md b/docs/retail_boot_chain.md
index 9eadb6614..4450b81e7 100644
--- a/docs/retail_boot_chain.md
+++ b/docs/retail_boot_chain.md
@@ -79,7 +79,7 @@ queues come from this slot, the first of them a compute queue. The first queue c
79 79
80Xbox device slot 73 is `(desc, allocator, pso, riid, out)`. `desc` is 16 bytes and its first word reads as the 80Xbox device slot 73 is `(desc, allocator, pso, riid, out)`. `desc` is 16 bytes and its first word reads as the
81`D3D12_COMMAND_LIST_TYPE`. `riid` is a console command-list IID that is not in the PC SDK (#3520 records that the 81`D3D12_COMMAND_LIST_TYPE`. `riid` is a console command-list IID that is not in the PC SDK (#3520 records that the
82package doesn't export it). The shim's unknown-IID log names it on the player's machine. Creating an 82package doesn't export it). A retail run logged it as `{c3827890-4024-474c-98cf-645b51dc4874}` (#445). Creating an
83`ID3D12GraphicsCommandList` of that type and handing out #2490's console list 83`ID3D12GraphicsCommandList` of that type and handing out #2490's console list
84proxy gets all 581 lists created and closed. 84proxy gets all 581 lists created and closed.
85 85
diff --git a/docs/runtime_imports.md b/docs/runtime_imports.md
index 51aba517c..d81df11d9 100644
--- a/docs/runtime_imports.md
+++ b/docs/runtime_imports.md
@@ -208,9 +208,10 @@ What this does not show: `--run` has not been run, so the entry point has not be
208reached on the way to the first frame. A bound import is not a working one (the binding only says a function with 208reached on the way to the first frame. A bound import is not a working one (the binding only says a function with
209that name exists), and an unimplemented import stops the run only if the title calls it 209that name exists), and an unimplemented import stops the run only if the title calls it
210([When an unimplemented import is called](#when-an-unimplemented-import-is-called)). The executable imports 25 210([When an unimplemented import is called](#when-an-unimplemented-import-is-called)). The executable imports 25
211functions from `ws2_32.dll` (23 by ordinal, plus `getaddrinfo` and `freeaddrinfo`) and the loader binds them to the 211functions from `ws2_32.dll` (23 by ordinal, plus `getaddrinfo` and `freeaddrinfo`). The `ws2_offline` shim now serves the
212host's, so a `--run` can open real sockets: run it with the network off. `winhttp.dll` is served by the offline shim, 212outbound and name-resolution calls among them, loopback only (see the Winsock2 section below), and the remaining
213which opens none. 213imports bind to the host's. `winhttp.dll` is served by the offline shim, which opens none. Known gap: `dnsapi.dll`
214(`DnsQuery*`) is not shimmed, so a title that calls it reaches the host's resolver.
214 215
215## Audio hardware (`AcpHal.dll`) 216## Audio hardware (`AcpHal.dll`)
216 217
@@ -494,14 +495,23 @@ on the executable, the rest is not:
494 card and text entry, which fail before starting. 495 card and text entry, which fail before starting.
495 496
496- **Accessibility and speech** (`IXAccessibilityImpl2`, slots 3-21): `XHighContrastGetMode` (5) answers Off and 497- **Accessibility and speech** (`IXAccessibilityImpl2`, slots 3-21): `XHighContrastGetMode` (5) answers Off and
497 `XClosedCaptionSetEnabled` (4) is accepted. No voice is installed: `XSpeechSynthesizerEnumerateInstalledVoices` 498 `XClosedCaptionSetEnabled` (4) is accepted. One silent voice is installed:
498 (8) calls back zero times and returns `S_OK`, `XSpeechSynthesizerCreate` (9) fails (`E_FAIL`) with a null handle, 499 `XSpeechSynthesizerEnumerateInstalledVoices(context, callback)` (8) calls back once, with voice id `leonida-silent`
499 and the handle calls (10-16, 21: close, default and custom voice, streams from text and SSML, stream size and 500 and language `en-US` (the GDK reference's `XSpeechSynthesizerVoiceInformation` layout), and returns `S_OK`
500 data) refuse the handle they were never given (`E_INVALIDARG`, outputs zeroed). The closed-caption properties (3) 501 (`E_INVALIDARG` without a callback). `XSpeechSynthesizerCreate` (9) hands
501 and the speech-to-text display calls (6, 7, 17-20) fail with `E_FAIL`, writing nothing: their parameter lists 502 out a synthesizer handle that speaks with it (`E_POINTER` for a null out pointer). Close (10), set default voice (11)
502 are not in the docs' layout. 503 and set custom voice (12, only for that voice id) accept that handle and refuse any other with `E_INVALIDARG`.
503- **`XLauncherImpl`** (`IXLauncherImpl`, slots 3-5): `XLaunchUri`, `XDisplayAcquireTimeoutDeferral` (null handle) 504 Streams from text (13) and SSML (21) are created from it and return a
504 and `XDisplayCloseTimeoutDeferralHandle` fail with `E_FAIL`; nothing is launched. 505 stream handle; its close (14) accepts it. Stream size (15) reports 44 bytes and stream data (16) copies them: a valid
506 RIFF/WAVE header for 16 kHz, 16-bit mono PCM with zero data bytes, so a title that plays narration reads a silent
507 stream (a buffer under 44 bytes gets `ERROR_INSUFFICIENT_BUFFER`). A foreign handle on 15 or 16 gets `E_INVALIDARG`,
508 outputs zeroed. The closed-caption properties (3) and the speech-to-text display calls (6, 7, 17-20) fail with
509 `E_FAIL`, writing nothing: their parameter lists are not in the docs' layout.
510- **`XLauncherImpl`** (`IXLauncherImpl`, slots 3-5): `XLaunchUri` fails with `E_FAIL`; nothing is launched.
511 `XDisplayAcquireTimeoutDeferral` (4) creates a Win32 `PowerRequestDisplayRequired` request and returns its handle (a
512 failing `PowerCreateRequest` or `PowerSetRequest` returns the Win32 error as an HRESULT).
513 `XDisplayCloseTimeoutDeferralHandle` (5) clears that request and closes the handle, so the display may sleep again.
514 Side effect on the host: while the title holds a deferral, Windows keeps the PC's display on.
505- **ASSUMPTION:** the parameter lists of the speech calls and `XHighContrastGetMode` (Off is 0), from the GDK 515- **ASSUMPTION:** the parameter lists of the speech calls and `XHighContrastGetMode` (Off is 0), from the GDK
506 reference; only the argument counts were measured, from `tools/gdk_runtime_calls.py` on the executable. 516 reference; only the argument counts were measured, from `tools/gdk_runtime_calls.py` on the executable.
507- **HDR:** `XDisplayTryEnableHdrMode` answers Disabled, because the host output is SDR. With `LEONIDA_HDR=1` it 517- **HDR:** `XDisplayTryEnableHdrMode` answers Disabled, because the host output is SDR. With `LEONIDA_HDR=1` it
@@ -673,6 +683,50 @@ Each refused server is logged once (`[rt] winhttp: offline, refused <host>:<port
673tried to reach. `runtime/test/winhttp_offline_test.cpp` (ctest `winhttp_offline`) covers the synchronous and 683tried to reach. `runtime/test/winhttp_offline_test.cpp` (ctest `winhttp_offline`) covers the synchronous and
674asynchronous paths with `.invalid` names; it opens no connection. 684asynchronous paths with `.invalid` names; it opens no connection.
675 685
686## Winsock2 (`ws2_32.dll`) offline
687
688`runtime/shims/ws2_offline.cpp` intercepts outbound Winsock2 entry points — both by name and by standard Windows
689`ws2_32.dll` ordinal (`bind`/`#2`, `connect`/`#4`, `sendto`/`#20`, `setsockopt`/`#21`, `gethostbyaddr`/`#51`,
690`gethostbyname`/`#52`,
691`WSAAsyncGetHostByAddr`/`#102`, `WSAAsyncGetHostByName`/`#103`, `getaddrinfo`, `GetAddrInfoW`, `GetAddrInfoExA/W`,
692`getnameinfo`, `GetNameInfoW`, `WSAConnect`, `WSAConnectByNameA/W`, `WSAConnectByList`, `WSASendTo`, `WSASendMsg`,
693`WSALookupServiceBeginA/W`, `WSAJoinLeaf`, and `WSAIoctl` for `WSAID_CONNECTEX` and `WSAID_WSASENDMSG`). `wsock32.dll` maps its
694`bind`, `connect`, `sendto`, `gethostbyaddr`, `gethostbyname` and `WSAAsyncGetHostBy*` exports (and their ordinals) to
695the same wrappers, since its exports forward to `ws2_32.dll` natively; its `setsockopt` (`#21`) is its own export,
696which takes the Winsock 1.1 option numbers, so it has its own wrapper. Like `ws2_32.dll` it stays host-owned
697(`owns_dll`), so `LoadLibrary` returns the real module. The shim keeps `ws2_32.dll` partially overridden
698so local socket bookkeeping (`WSAStartup`, `socket`, `closesocket`, `select`, `recv`, `send`, byte-order helpers) still
699works for loopback traffic:
700
701- `connect`, `WSAConnect`, `ConnectEx`, `sendto`, `WSASendTo`, `WSASendMsg`, `WSAConnectByNameA/W` and
702 `WSAConnectByList` allow only IPv4 loopback (`127.0.0.0/8`), IPv6 loopback (`::1`) and IPv4-mapped loopback
703 (`::ffff:127.0.0.0/104`); everything else fails with `WSAENETUNREACH`.
704- `WSAConnectByNameA/W` pass `localhost` to the host as the literal `127.0.0.1`, so the host never reads its hosts
705 file. Numeric loopback literals pass through unchanged.
706- `ConnectEx` and `WSASendMsg` from `WSAIoctl` are the host's own pointers, fetched for the socket they are called on
707 (each Winsock provider has its own), after the same loopback check.
708- `bind` narrows wildcard binds (`0.0.0.0`, `::`) to loopback (`127.0.0.1`, `::1`) and refuses other non-loopback
709 addresses with `WSAEADDRNOTAVAIL`.
710- A send to a loopback address on an unbound socket (`sendto`, `WSASendTo`, `WSASendMsg`, `WSAJoinLeaf`) would bind it
711 to the wildcard address, as Microsoft's `sendto` remarks describe, and its port would then take datagrams from other
712 hosts. The shim first binds such a socket to `127.0.0.1`, `::1` or `::ffff:127.0.0.1` (matching the destination); if
713 it stays unbound the send fails with `WSAEADDRNOTAVAIL`.
714- Multicast group joins through `setsockopt` (`IP_ADD_MEMBERSHIP`, `IP_ADD_SOURCE_MEMBERSHIP`, `IPV6_ADD_MEMBERSHIP`,
715 `MCAST_JOIN_GROUP`, `MCAST_JOIN_SOURCE_GROUP`, and `wsock32.dll`'s Winsock 1.1 `IP_ADD_MEMBERSHIP` = 5) fail with
716 `WSAEADDRNOTAVAIL`; other options pass through. `WSAJoinLeaf` gets the same loopback check as `connect`, so a group
717 address is refused with `WSAENETUNREACH`.
718- Forward lookups refuse external names with `WSAHOST_NOT_FOUND` without sending DNS traffic. A dotted octet with a
719 leading zero (`0127.0.0.1`) is refused too: Windows reads it as octal, so it is not the loopback address it looks
720 like. `getnameinfo` / `GetNameInfoW` force `NI_NUMERICHOST` (or return `WSAHOST_NOT_FOUND` under `NI_NAMEREQD`) for
721 non-loopback addresses.
722- `WSALookupServiceBeginA/W` (name-service queries) always fail with `WSASERVICE_NOT_FOUND`.
723
724`runtime/test/ws2_offline_test.cpp` (ctest `ws2_offline`) verifies name and ordinal bindings, the `wsock32.dll`
725aliases, external refusals using RFC 5737 / RFC 3849 / `.invalid` targets, the `0127.0.0.1` refusal, the
726`WSASERVICE_NOT_FOUND` refusal, wildcard-bind narrowing, a `ConnectEx` pointer from `WSAIoctl` connecting to a loopback
727listener, a local loopback UDP round-trip, loopback binds for sends on unbound UDP sockets (with a control showing
728the host's own `sendto` binds to `0.0.0.0`), and the multicast and `WSAJoinLeaf` refusals.
729
676## What this proves and what it does not 730## What this proves and what it does not
677 731
678- It proves the loader parses real Xbox Series PE files, maps their sections, applies no unnecessary relocation, 732- It proves the loader parses real Xbox Series PE files, maps their sections, applies no unnecessary relocation,