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:
authorRafael <rafaelalvesp2005@gmail.com>2026-11-23 15:36:26 -0300
committerRafael <rafaelalvesp2005@gmail.com>2026-11-23 15:36:26 -0300
commit63f0e0dea3a9d44201db408c4e2c3f2f5b2b94d6 (patch)
tree86f0dcad8070e2a3a693ef4897aa83950cfeb224 /docs/boot.md
parentf78f7d6a2a9364cb128c03ac539fe540d5c70df1 (diff)
parent6dda0630bd6fc0514baadb94fb98e36bd7d64c0b (diff)
Merge main into fix/walk-bink_names
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'docs/boot.md')
-rw-r--r--docs/boot.md51
1 files changed, 34 insertions, 17 deletions
diff --git a/docs/boot.md b/docs/boot.md
index 4738b9a73..4ffc924b2 100644
--- a/docs/boot.md
+++ b/docs/boot.md
@@ -1,8 +1,12 @@
1# First boot: the runbook and the two traces 1# First boot: the runbook and the two traces
2 2
3**Status: prepared, not yet run against the retail executable.** The package in the repository's test corpus does 3**Status: `--dry-run` and `--init` have been run on the retail executable; `--run` has not.** The package in the
4not contain `game_scarlett_master.exe` (RT-5), so this page is the procedure and the trace tool for the day it 4repository's test corpus does not contain `game_scarlett_master.exe` (RT-5); the dry-run on an executable supplied
5arrives. Nothing here quotes game data; a real trace stays on the player's machine. 5separately maps it and leaves 30 imports unimplemented, and `--init` runs its TLS callbacks and the package DLLs'
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
8trace tool for the first boot. The executable's `ws2_32.dll` imports bind to the host's, so run `--run` with the
9network off. Nothing here quotes game data; a real trace stays on the player's machine.
6 10
7## 1. What the first boot produces 11## 1. What the first boot produces
8 12
@@ -36,14 +40,15 @@ $exe = "C:\path\to\game_scarlett_master.exe"
36$pkg = "C:\path\to\the\package" 40$pkg = "C:\path\to\the\package"
37$trace = Join-Path $env:TEMP boot.jsonl 41$trace = Join-Path $env:TEMP boot.jsonl
38$log = Join-Path $env:TEMP d3d12.log 42$log = Join-Path $env:TEMP d3d12.log
39.\runtime\build\gta6rt.exe --run $exe --game-dir $pkg --trace $trace --trace-d3d12 2> $log 43.\runtime\build\gta6rt.exe --run $exe --game-dir $pkg --trace $trace --trace-d3d12 2>&1 |
44 ForEach-Object { $_.ToString() } |
45 Out-File -LiteralPath $log -Width 4096 -Encoding utf8
40python -I tools\boot_trace.py $trace --d3d12 $log 46python -I tools\boot_trace.py $trace --d3d12 $log
41``` 47```
42 48
43Windows PowerShell 5.1 writes `2>` as UTF-16LE; the tool names that file instead of parsing it. Use 49The capture pipeline writes each message as text to avoid PowerShell 5.1 wrapping the first stderr record at a
44`2>&1 | Out-File -Encoding utf8 $log` there, or PowerShell 7, which defaults to UTF-8. The tool strips the BOM that 50narrow output width. The tool also reads existing UTF-16LE logs saved with `2>` in PowerShell 5.1 and recognizes
455.1 writes with `utf8`, and accepts the `program.exe : ` prefix 5.1 puts in front of the first stderr line when it 51the `program.exe : ` prefix on the first stderr line.
46turns it into an error record, so that call is not lost. `cmd /c` writes the lines unchanged.
47 52
48Linux under Wine (a cross build made with xwin, or the `runtime-windows` artifact; the backend must be Vulkan): 53Linux under Wine (a cross build made with xwin, or the `runtime-windows` artifact; the backend must be Vulkan):
49 54
@@ -67,6 +72,10 @@ Useful switches:
67 printing the caller's `module+RVA` and the argument registers (with a debugger attached it breaks instead). Start 72 printing the caller's `module+RVA` and the argument registers (with a debugger attached it breaks instead). Start
68 with `log`, then use `stop` to pin the first blocker and `fail` to see how the game's own failure path reacts. 73 with `log`, then use `stop` to pin the first blocker and `fail` to see how the game's own failure path reacts.
69 This switch covers imports only; it does not affect the D3D12 outcomes. 74 This switch covers imports only; it does not affect the D3D12 outcomes.
75* `LEONIDA_SKIP_INT3=1` (with `--trace`) steps over each int3 in guest code and logs it once per address as an
76 `int3_skipped` event, so a boot can be followed past soft asserts (an int3 followed by code that carries on).
77 Diagnostic only: a correct run reaches none, so each skipped address is a finding, not a fix. A failed guest file
78 open is always traced as `file_open_failed` (path, error, caller) when `--trace` is on.
70* `LEONIDA_VK_VALIDATION=1` enables the Khronos validation layer with the Vulkan backend (startup overhead; it is a 79* `LEONIDA_VK_VALIDATION=1` enables the Khronos validation layer with the Vulkan backend (startup overhead; it is a
71 diagnostic). 80 diagnostic).
72* `DISABLE_RTSS_LAYER=1` and `DISABLE_VULKAN_OBS_CAPTURE=1` when MSI Afterburner or OBS is installed; their 81* `DISABLE_RTSS_LAYER=1` and `DISABLE_VULKAN_OBS_CAPTURE=1` when MSI Afterburner or OBS is installed; their
@@ -84,20 +93,28 @@ Read the startup trace first; the first event that is not the expected one is th
84 deliberate failure in `runtime/shims/registry.cpp`; rerun with `LEONIDA_UNIMPLEMENTED=stop` to halt at the first 93 deliberate failure in `runtime/shims/registry.cpp`; rerun with `LEONIDA_UNIMPLEMENTED=stop` to halt at the first
85 remaining blocker. 94 remaining blocker.
863. **`tls_callback` / `dllmain`** — a failed DllMain, or a TLS callback that faults, usually points at the CRT or 953. **`tls_callback` / `dllmain`** — a failed DllMain, or a TLS callback that faults, usually points at the CRT or
87 TLS index; the loader's own TLS is checked by `run_tiny_game_tls`. 96 TLS index. The summary shows the address and phase of the last observed TLS callback
97 (`last_tls_callback` in JSON). The loader records it before invoking the callback, so the record gives no
98 completion result. The loader's own TLS is checked by `run_tiny_game_tls`.
884. **`exception`** — code, `at`, access/address and the stack frames. The loader's vectored handler only records, 994. **`exception`** — code, `at`, access/address and the stack frames. The loader's vectored handler only records,
89 so the process behaviour is the same with or without the trace. 100 so the process behaviour is the same with or without the trace. When the report reaches `--limit`, it reserves
101 the final slot for the last observed exception. The trace also includes handled exceptions, so the last
102 observation alone does not establish what caused the run to stop.
905. **`exit` / `error`** — a clean exit is not a correct frame; continue to the D3D12 trace. 1035. **`exit` / `error`** — a clean exit is not a correct frame; continue to the D3D12 trace.
916. **D3D12 trace** — the `failed`, `unsupported` and `refused` lines name the method. Compare its position with 1046. **D3D12 trace** — the `failed`, `unsupported`, `refused` and `partial` lines name the method. A `partial`
92 the public SDK vtable; an unknown slot is expected until the executable names it (Q2, Q6). The `[rt]` lines in 105 submission ran the supported commands from a list. The runtime's `[rt]` diagnostic names the command it left out.
93 the same log carry what the trace does not: the 24 device words, feature ids, warnings. 106 Compare the method's position with the public SDK vtable. An unknown slot is expected until the executable names it
107 (Q2, Q6). The `[rt]` lines in the same log carry the 24 device words, feature IDs and warnings.
947. **First frame** — after the device and queues, the first `CreateRootSignature`, PSO, `Draw*` and `PresentX` (or 1087. **First frame** — after the device and queues, the first `CreateRootSignature`, PSO, `Draw*` and `PresentX` (or
95 DXGI) calls are the frame's critical path. The layer's M0–M4 tests already exercise the offscreen parts; the 109 DXGI) calls are the frame's critical path. The layer's M0–M4 tests already exercise the offscreen parts; the
96 present slots are the part that cannot be measured from the package alone. 110 present slots are the part that cannot be measured from the package alone.
97 111
98The trace tool prints the first call per method and the `unsupported`/`failed`/`refused` lists; `--json` gives the 112The trace tool prints the first call per method and the `unsupported`/`failed`/`refused`/`partial` lists. The `--json`
99same summary for a script. Share that summary's **counts and error classes**, not the trace file or its debug 113option gives the same summary for a script. Share only the summary's **counts and error classes**.
100strings. 114
115If startup stops before the first D3D12 call, the combined command still prints the startup report. A missing
116or invalid requested trace is reported on stderr and sets exit code 2. In a partial JSON report that section
117is `null`; if neither input yields a report, stdout is empty.
101 118
102## 4. The open questions, and the trace signal for each 119## 4. The open questions, and the trace signal for each
103 120
@@ -106,7 +123,7 @@ the de-duplicated 1–22. It maps each question to the event to look for; it doe
106 123
107| # | Question | Signal in the first trace | 124| # | Question | Signal in the first trace |
108|---|---|---| 125|---|---|---|
109| 1 | `D3D12XboxCreateDevice` 24-word params and flags | first `D3D12XboxCreateDevice` in the D3D12 trace; the shim prints the 24 words only when `--trace-d3d12` is off, so run once without it (or grep `^\[rt\]`); accept unknown flags | 126| 1 | `D3D12XboxCreateDevice` 24-word params and flags | first `D3D12XboxCreateDevice` in the D3D12 trace; the shim prints the 24 words as an `[rt]` line in the same log, with or without `--trace-d3d12` (grep `^\[rt\]`); accept unknown flags |
110| 2 | Xbox device/heap/queue/command-list slots | queue, fence and allocator method names in the D3D12 trace; device slots past the PC vtable print an `[rt] d3d12_xs: device slot …` line instead and record nothing; compare with the SDK vtable | 127| 2 | Xbox device/heap/queue/command-list slots | queue, fence and allocator method names in the D3D12 trace; device slots past the PC vtable print an `[rt] d3d12_xs: device slot …` line instead and record nothing; compare with the SDK vtable |
111| 3 | Root signature → `s0..s31` | `CreateRootSignature`, `SetGraphicsRootSignature`, then the shader's user-SGPR reads; mask `0x03000000` on a copy | 128| 3 | Root signature → `s0..s31` | `CreateRootSignature`, `SetGraphicsRootSignature`, then the shader's user-SGPR reads; mask `0x03000000` on a copy |
112| 4 | Descriptor bytes and heap increments | first `CreateShaderResourceView`/`CreateSampler` and the first draw; dump the heap bytes and compare with the T#/S# parser | 129| 4 | Descriptor bytes and heap increments | first `CreateShaderResourceView`/`CreateSampler` and the first draw; dump the heap bytes and compare with the T#/S# parser |