Files
mandy/docs/first_run_ui.md
Jan Trencansky 59c54c1eb0 d3d12_xs: list slots 71/72 have one writer, the list values, when they track the list
Found by the comparison agent, not by a failing test. #1723's console
list slot path still handed slots 71 and 72 to main's GPU-label hook
(record_gpu_label, LEONIDA_GPU_LABELS) when its own list values track
the list (track_values, on by default with LEONIDA_LIST_VALUES). The
--first-run-ui profile sets LEONIDA_GPU_LABELS=1 (runtime/src/main.cpp).
With both on, two threads stored to one title address, one from a
Vulkan command buffer's completion and query, the other from the part's
fence and a D3D12 timestamp query. A late label could rewind a rising
counter or split a begin/end pair. The suite did not catch it:
xbox_gpu_label_completion submits its real list straight to the queue,
so only the label path landed there.

The list values are the right owner. They land slots 71 to 74 in
queue order behind the gates, and they also do the waits the labels
cannot do. Now:
- The label hook runs only for a list the list values do not track
  (LEONIDA_LIST_VALUES=0, bundles). Each handoff is counted in
  ListValueStats::labels_handed.
- The --first-run-ui profile no longer sets LEONIDA_GPU_LABELS.
  runtime/README.md and docs/first_run_ui.md say so.
- xbox_gpu_label_completion runs its label section with the list values
  off, as it always measured the label path alone, and checks that all
  five writes went there. A new section turns both on and records one
  write32 and one write64 on a tracked list, submitted through the queue
  proxy. Each lands exactly once: writes_landed == 2, labels_handed == 0,
  and the values are in memory. With the old condition this section
  fails at line 136 (labels_handed was 2), on llvmpipe and the iGPU.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 06:16:46 -05:00

4.3 KiB

Offline first-run UI on Windows

This integration combines the retail frame-loop runtime with the shader and rendering changes needed to display the first-run controller prompts. The visual milestone is a solid background with legible prompts at the lower right. Gameplay and the 3D world are outside the verified result.

Build

Use an x64 Developer PowerShell with MSVC, CMake and Ninja. Install the Vulkan SDK and put the SPIR-V tools and an AMDGPU-capable llvm-mc on PATH. The shader tool setup is described in testing.md. Supply an extracted Xbox 1.0.2.1 package and its matching executable from your own files.

Run the commands from the checkout. Set $game to the local package and $scratch to a writable directory outside both the package and the checkout. These commands support a fresh shader workspace. SDL3 is fetched during configuration if there is no installed static SDL3 package.

$game = Read-Host 'Path to the extracted Xbox 1.0.2.1 package'
$scratch = Read-Host 'Path for the build, shader workspace and port'
$game = (Resolve-Path -LiteralPath $game).Path
$build = Join-Path $scratch 'build'
$work = Join-Path $scratch 'work'
$port = Join-Path $scratch 'port'
cmake -S runtime -B $build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLEONIDA_REQUIRE_VULKAN=ON -DLEONIDA_D3D12_SHIM_TESTS=ON -DLEONIDA_SDL3_FETCH=ON
cmake --build $build --target gta6rt
python -I make_game.py --game $game --work $work --out $port --runtime-build $build --stages check,shaders,runtime

Keep the generated shader workspace. The port reads the shader directory recorded in shader_path.txt. Native graphics pipelines also use the source containers in the sibling dxbc directory. The build indexes the base, library, FidelityFX, BVH and executable-embedded programs.

Launch

Run 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

& (Join-Path $port 'gta6rt.exe') --first-run-ui (Join-Path $game 'game_scarlett_master.exe')

The profile selects Vulkan, a 2 GiB graphics address arena, on-demand pipelines, console root-argument layout, frame pacing and the keyboard gamepad. GPU completion labels (LEONIDA_GPU_LABELS) are not part of it: the list values land the title's list writes, and two writers of one address could rewind a counter. Explicit environment settings take precedence; a variable that is set but empty does not count. Speech synthesis through the host's own runtime is not part of the profile: LEONIDA_LOCAL_SPEECH=1 turns it on, and without it the silent voice answers. The switches are listed in runtime/README.md. The package directory is the working directory. Guest output goes under first-run-ui/overlay beside the runtime, and sparse physical-memory backing uses first-run-ui/xmem on that volume. Use --overlay DIR or the absolute directory in LEONIDA_XMEM_BACKING_DIR to choose other writable locations.

Contributions

The frame-loop stack comes from #321. The archive and shader catalog, shader translation, depth and texture support, presentation window and rectangle-list changes retain their upstream commits. Native and derived pipeline support incorporates the work of enx, TomBox, LooperSalty and KkelebekK. Four patches of the published graphics runtime patches (GPL-3.0, author smg, committed as "Codex") are in this integration almost as published, about 390 lines: graphics-root-layout (the switch between the two packings of graphics root arguments, runtime/shims/d3d12_com.h), descriptor-table-refresh (the title's descriptors pulled into a bound table, and the table scan in the submitting device, runtime/shims/d3d12_xs_device.cpp and runtime/src/vulkan_backend.h), descriptor-write-through (descriptors the layer writes also stored at the title's address, runtime/shims/d3d12_xs_device.cpp and .h) and sampler-table-refresh (title-backed sampler tables, runtime/shims/d3d12_vulkan_device.cpp), with their tests in runtime/test/d3d12_title_va_test.cpp and runtime/test/d3d12_m2_textured_test.cpp. Each region names its patch in a comment.