upleb.uk

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

summaryrefslogtreecommitdiff
path: root/docs/boot.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/boot.md')
-rw-r--r--docs/boot.md48
1 files changed, 35 insertions, 13 deletions
diff --git a/docs/boot.md b/docs/boot.md
index 1ff3fa2f4..31a7ba3d1 100644
--- a/docs/boot.md
+++ b/docs/boot.md
@@ -5,8 +5,9 @@ repository's test corpus does not contain `game_scarlett_master.exe` (RT-5); the
5separately maps it and leaves 30 imports unimplemented, and `--init` runs its TLS callbacks and the package DLLs' 5separately maps it and leaves 30 imports unimplemented, and `--init` runs its TLS callbacks and the package DLLs'
6`DllMain`s without an exception 6`DllMain`s without an exception
7([`runtime_imports.md`](runtime_imports.md#the-retail-executable-rt-5)), so this page is still the procedure and the 7([`runtime_imports.md`](runtime_imports.md#the-retail-executable-rt-5)), so this page is still the procedure and the
8trace tool for the first boot. The executable's `ws2_32.dll` imports bind to the host's, so run `--run` with the 8trace tool for the first boot. Outbound `ws2_32.dll` and `winhttp.dll` calls are restricted offline by the shims
9network off. Nothing here quotes game data; a real trace stays on the player's machine. 9(`ws2_offline.cpp` permits loopback only; `winhttp_offline.cpp` refuses all requests), though running with the network
10off remains good defence in depth. Nothing here quotes game data; a real trace stays on the player's machine.
10 11
11## 1. What the first boot produces 12## 1. What the first boot produces
12 13
@@ -28,8 +29,11 @@ Two traces are written independently:
28 29
29`tools/boot_trace.py` reads both and prints the triage units: modules, unimplemented calls and callers, 30`tools/boot_trace.py` reads both and prints the triage units: modules, unimplemented calls and callers,
30DllMain/TLS results, exceptions with their stack frames, the exit, and the D3D12 calls by outcome and first call 31DllMain/TLS results, exceptions with their stack frames, the exit, and the D3D12 calls by outcome and first call
31per method. The `[rt]` lines in the same stderr log carry the device parameters, feature ids and warnings; the 32per method. When `XboxPresentation` logs its teardown `[rt] present: pacing summary ...` line (BL-6), the D3D12
32summary leaves them as a count, so grep `^\[rt\]` for those. 33summary also reports the frame count, interval count, target interval, mean and drift against target, `p50`/`p95`/`p99`
34frame times, and `p50`/`p95`/`p99` origin-to-present latencies (and includes the numeric `frame_pacing` object in
35`--json` and `--counts-only`). The remaining `[rt]` lines in the same stderr log carry the device parameters, feature
36ids and warnings; the summary leaves them as a count, so grep `^\[rt\]` for those.
33 37
34For `xmem_physical_pages`, the shim records the first request for each distinct attribute word. The text and 38For `xmem_physical_pages`, the shim records the first request for each distinct attribute word. The text and
35JSON summaries list the API, raw attribute word, requested page count and caller for the first `--limit` 39JSON summaries list the API, raw attribute word, requested page count and caller for the first `--limit`
@@ -46,7 +50,8 @@ $exe = "C:\path\to\game_scarlett_master.exe"
46$pkg = "C:\path\to\the\package" 50$pkg = "C:\path\to\the\package"
47$trace = Join-Path $env:TEMP boot.jsonl 51$trace = Join-Path $env:TEMP boot.jsonl
48$log = Join-Path $env:TEMP d3d12.log 52$log = Join-Path $env:TEMP d3d12.log
49.\runtime\build\gta6rt.exe --run $exe --game-dir $pkg --trace $trace --trace-d3d12 2>&1 | 53& { $ErrorActionPreference = 'Continue'
54 .\runtime\build\gta6rt.exe --run $exe --game-dir $pkg --trace $trace --trace-d3d12 2>&1 } |
50 ForEach-Object { $_.ToString() } | 55 ForEach-Object { $_.ToString() } |
51 Out-File -LiteralPath $log -Width 4096 -Encoding utf8 56 Out-File -LiteralPath $log -Width 4096 -Encoding utf8
52python -I tools\boot_trace.py $trace --d3d12 $log 57python -I tools\boot_trace.py $trace --d3d12 $log
@@ -56,6 +61,13 @@ The capture pipeline writes each message as text to avoid PowerShell 5.1 wrappin
56narrow output width. The tool also reads existing UTF-16LE logs saved with `2>` in PowerShell 5.1 and recognizes 61narrow output width. The tool also reads existing UTF-16LE logs saved with `2>` in PowerShell 5.1 and recognizes
57the `program.exe : ` prefix on the first stderr line. 62the `program.exe : ` prefix on the first stderr line.
58 63
64The `& { ... }` block matters when the session (or a profile or script) has `$ErrorActionPreference = 'Stop'`:
65Windows PowerShell 5.1 then turns the first stderr line into a terminating error, the run stops there, and the log
66holds no `[d3d12-trace]` line, so it reads as a run with no D3D12 call. The block sets `Continue` for the run only
67(`scripts/first_look.ps1` captures its dry run the same way). Measured on 5.1.26100 with a stand-in that prints three
68trace lines to stderr and exits 37: without the block, all three with `Continue` and none with `Stop`; with it, all
69three with either, `$LASTEXITCODE` 37, and the session's preference unchanged.
70
59Linux under Wine (a cross build made with xwin, or the `runtime-windows` artifact; the backend must be Vulkan): 71Linux under Wine (a cross build made with xwin, or the `runtime-windows` artifact; the backend must be Vulkan):
60 72
61```sh 73```sh
@@ -66,10 +78,17 @@ wine runtime/build/windows/gta6rt.exe --run /path/to/game_scarlett_master.exe \
66python3 -I tools/boot_trace.py /tmp/boot.jsonl --d3d12 /tmp/d3d12.log 78python3 -I tools/boot_trace.py /tmp/boot.jsonl --d3d12 /tmp/d3d12.log
67``` 79```
68 80
81`runtime\build\gta6rt.exe` is where `scripts\build_runtime.ps1` (Ninja) puts it; the direct CMake path in
82[runtime/README.md](../runtime/README.md) uses the multi-config Visual Studio generator, which writes
83`runtime\build\RelWithDebInfo\gta6rt.exe` instead.
84
69`--trace FILE` **refuses an existing file** (exit 2): it is created before the loader reads anything, so use a 85`--trace FILE` **refuses an existing file** (exit 2): it is created before the loader reads anything, so use a
70fresh name or delete the old one. `LEONIDA_D3D12=vulkan` selects the Vulkan-backed device, the only backend that 86fresh name or delete the old one. `LEONIDA_D3D12=vulkan` selects the Vulkan-backed device, the only backend that
71writes the `[d3d12-trace]` lines; without it the layer uses the Windows D3D12 device and the trace has nothing to 87traces command lists, resources and pipelines; without it the layer uses the Windows D3D12 device, and the
72read. Keep the traces out of the repository: they can quote whatever the game prints. 88`[d3d12-trace]` lines are only what the Xbox-ABI proxy forwards (device creation, queue, fence and allocator
89calls), which `boot_trace.py` summarizes without complaint. A run on the Vulkan device prints
90`[rt] d3d12: Vulkan device: <name>`; check the log for it (a runtime built without the Vulkan headers accepts the
91variable and stays on the Windows device). Keep the traces out of the repository: they can quote whatever the game prints.
73 92
74Useful switches: 93Useful switches:
75 94
@@ -90,7 +109,8 @@ Useful switches:
90* `DISABLE_RTSS_LAYER=1` and `DISABLE_VULKAN_OBS_CAPTURE=1` when MSI Afterburner or OBS is installed; their 109* `DISABLE_RTSS_LAYER=1` and `DISABLE_VULKAN_OBS_CAPTURE=1` when MSI Afterburner or OBS is installed; their
91 implicit layers add swapchain usage that shows up as validation errors ([testing.md](testing.md), "Known 110 implicit layers add swapchain usage that shows up as validation errors ([testing.md](testing.md), "Known
92 problems"). 111 problems").
93* `--overlay DIR` sends the guest's writes to a private folder instead of the package. 112* `--overlay DIR` sends the guest's writes to DIR instead of the default `<game-dir>\overlay` (useful when the
113 package drive is read-only); the package itself is never written.
94 114
95## 3. Triage order 115## 3. Triage order
96 116
@@ -110,8 +130,9 @@ Read the startup trace first; the first event that is not the expected one is th
110 the final slot for the last observed exception. The trace also includes handled exceptions, so the last 130 the final slot for the last observed exception. The trace also includes handled exceptions, so the last
111 observation alone does not establish what caused the run to stop. 131 observation alone does not establish what caused the run to stop.
1125. **`exit` / `error`** — a clean exit is not a correct frame; continue to the D3D12 trace. 1325. **`exit` / `error`** — a clean exit is not a correct frame; continue to the D3D12 trace.
1136. **D3D12 trace** — the `failed`, `unsupported`, `refused` and `partial` lines name the method. A `partial` 1336. **D3D12 trace** — the `failed`, `unsupported` and `refused` lines name the method. A `failed`
114 submission ran the supported commands from a list. The runtime's `[rt]` diagnostic names the command it left out. 134 `ExecuteCommandLists` submitted nothing from its lists. (`boot_trace.py` also lists a `partial` outcome, a
135 submission that ran only the supported commands; the runtime does not write it yet.)
115 Compare the method's position with the public SDK vtable. An unknown slot is expected until the executable names it 136 Compare the method's position with the public SDK vtable. An unknown slot is expected until the executable names it
116 (Q2, Q6). The `[rt]` lines in the same log carry the 24 device words, feature IDs and warnings. 137 (Q2, Q6). The `[rt]` lines in the same log carry the 24 device words, feature IDs and warnings.
117 The summary expects `#1` first, then one more than the last observed number. It counts each mismatch once and 138 The summary expects `#1` first, then one more than the last observed number. It counts each mismatch once and
@@ -130,8 +151,8 @@ is `null`; if neither input yields a report, stdout is empty.
130 151
131## 4. The open questions, and the trace signal for each 152## 4. The open questions, and the trace signal for each
132 153
133The questions are in [`d3d12_vulkan.md`](d3d12_vulkan.md) §8.2; that table repeats 16, 19 and 20, and this one is 154The questions are in [`d3d12_vulkan.md`](d3d12_vulkan.md) §8.2; this table takes the same 1–22 in
134the de-duplicated 1–22. It maps each question to the event to look for; it does not answer them. 155order. It maps each question to the event to look for; it does not answer them.
135 156
136| # | Question | Signal in the first trace | 157| # | Question | Signal in the first trace |
137|---|---|---| 158|---|---|---|
@@ -172,5 +193,6 @@ the de-duplicated 1–22. It maps each question to the event to look for; it doe
172The retail executable is not in the package, so this page is untested against it; the tool and the trace formats 193The retail executable is not in the package, so this page is untested against it; the tool and the trace formats
173are tested on synthetic fixtures and on `tiny_game` (which has no D3D12 calls). The present slots (Q6) and the 194are tested on synthetic fixtures and on `tiny_game` (which has no D3D12 calls). The present slots (Q6) and the
174Xbox device parameters (Q1) remain the first things the executable itself has to name. The D3D12 trace needs the 195Xbox device parameters (Q1) remain the first things the executable itself has to name. The D3D12 trace needs the
175Vulkan backend; a build without it runs the game's calls through the PC device and records nothing. The runbook 196Vulkan backend; a build without it runs the game's calls through the PC device and records only the proxy's
197device, queue, fence and allocator calls. The runbook
176does not make the game boot; it makes the first real trace readable. 198does not make the game boot; it makes the first real trace readable.