Move the runs out of the 2026-11-25 boot section into their own dated
section, name the build and driver, say how many runs each configuration
has, keep "draws further" with run24 only, and report cgroup memory.
Scope the two test-machine statements that said the title stops before
its first frame.
AI-assisted.
The device-loss paragraph now has the measured reproduction on a 12 GB
NVIDIA card: with the list values on, the opening sequence's night scene
waits in one console value for 101 minutes; with LEONIDA_LIST_VALUES=0 it
draws further and ends in the title's device-removed handler, with no
fault address. Links the two #2464 run comments.
AI-assisted.
d3d12_vulkan.md 4.2 has the twins (formats, who gets them, views, sync
points, copies, what is left out from VIctory and the test); the contract
table in design.md a row for the UAV T#s of such a texture; port_status.md
marks the item done, to be checked on a title run.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An A8 texture is an R8 image, and its RTVs were left null, so whatever the
title drew into one was lost. Now a pipeline with an A8 target uses an R8
attachment.
- At build, the pixel shader's output at that Location is stored as .wwww
(src/spirv_output_splat.h, on the translator's whole-vector OpStore), so the
one channel holds SV_Target.a.
- The channel blends with the alpha factors and op, the destination alpha
read as the stored red.
- The alpha write bit writes it.
- RTVs of an A8 texture in A8 or UNKNOWN are made in the image's own format.
spirv_output_splat_test covers it on hand-built SPIR-V. It passes, as do
d3d12_draw, d3d12_rect_list and spirv_stores (RTX 4060 Ti, 616.64).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflicts kept both sides: slot 61 sampler and page mapper handlers beside the refused-pipeline handler, and the per-type descriptor increment.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The title's timer steps its time sets by the measured QueryPerformanceCounter
delta, but held to at least the nominal frame time (1 / its 30 fps target)
and at most a 1/15 s constant (+0x2226040, and the camera's set in
+0x22264d0). The step is real only between 15 and 30 fps: above 30 the
world runs fps/30 too fast (the console's doubled speed when a glitch
doubles the frame rate), below 15 at fps/15 of real time (0.10-0.15 in
VIctory's 1.5 fps world).
src/frame_step.h moves the floor's two loads to the timer's own minimum
step (1/3000 s) and the cap's two loads to its 1.0 constant, after checking
all four loads and both targets hold the 1.0.2.1 bytes; main.cpp applies it
before any title code runs. LEONIDA_TIME_STEP=stock keeps the title's step.
The same patch written into VIctory's running title gave game time at 1.000
of real time at 30 and 70 fps and over every world frame under 1 s.
frame_step_test checks the plan, the step it gives from 1 to 1000 fps,
refusals on other bytes, the switch, and apply_to_image on a mapped stand-in
whose loads share a page.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ported from VIctory (GPL-3.0-or-later, Marvisak and contributors, DexNom fork),
victory-gpu queue.rs:697-731 (Written::GpuTimestamp, SystemTimestamp) and
list.rs:1964-1983.
- List slot 72 flag 1, the GPU timestamp: a timestamp query of the device's
own heap (COPY_QUEUE_TIMESTAMP for copy lists) ended where the list is and
resolved into the title address, so the GPU writes its clock there when it
reaches it, in the queue's ticks (GetTimestampFrequency,
GetClockCalibration). An address that is not 8-byte aligned, or a device
without timestamp queries, keeps the CPU clock at recording (logged).
- Flag 2, the system timestamp: QueryPerformanceCounter once the submission
has run, as VIctory stores it. The console queue signals a fence of its own
behind an ExecuteX whose lists asked for one; a thread-pool wait writes the
counter at each address when it completes.
- docs/port_plan.md and docs/port_status.md: what port/d3d12-slots2 does.
Tests: xs_proxy_mock_test (flag 2 stored after the submission, the queue's
fence made once, a reset forgets the stamps), d3d12_title_memory_test on the
RTX 4060 Ti (the GPU timestamp lies between calibrations taken after
recording and after completion; the system timestamp likewise).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ported from VIctory (GPL-3.0-or-later, Marvisak and contributors, DexNom
fork): victory-hle xmem.rs (hooks, XMemAlloc/XMemFree, XMemAllocDefault)
and victory-gpu resource.rs (use_allocator, Memory::for_resource,
resource_attributes).
- xmem: once the title is mapped, gta6rt reads the exe's export
__XMemAllocationHooks__ (two routine pointers, read at every call).
XMemAlloc/XMemFree call them; the Default variants never do. An
XMemAlloc/XMemFree made from inside the routines takes the default
allocator, and no lock is held across a hook call (the title's handlers
call XMemAllocDefault, which announces GPU blocks to the D3D12 layer).
- XMemAllocDefault decodes the attribute word (title_memory.h): CPU blocks
at the asked alignment; graphics memory types and 32-bit addresses get
pages of their own in the GPU window, made visible to the D3D12 layer and
taken off it before they are freed (stale visible ranges under a new
block are dropped first).
- D3D12 layer (rt::d3d12::set_title_allocator): the title's committed
resources (CreateCommittedResource*, console slots 76/127 through the
proxy) take GetResourceAllocationInfo's size from the allocator with
VIctory's attributes (graphics allocator 128, page size, alignment,
memory type 1/3), zeroed. Buffers are bound to that memory's import, so
their GPU virtual address is the title address; textures report it and
keep their own image memory. Released resources go back through the free
routine (a buffer after the GPU retired the work submitted so far).
Without hooks nothing changes.
- Tests: xmem_test (hook routing with a stand-in export, re-entrancy,
rewritten and null table entries, GPU blocks); d3d12_title_memory_test
(a slot-127 texture and committed buffers at the allocator's addresses,
a GPU copy landing in the title's pages, frees through the hook).
Retail title: its hook takes a 64 MiB render-target pool from
XMemAllocDefault (attributes 0x30808000) and hands both back buffers out of
it; the pool check passes. Next: XboxBvhBuilder.dll throws a C++ exception
right after the first slot 62 pipeline finds no translated shaders.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
d3d12_vulkan.md 4.5 describes the wiring (title window, presenting queue,
device clock, screenshots), and its device-slot row now names VIctory's
clock and LEONIDA_XS_FRAME_STATISTICS_SLOT. runtime_imports.md lists the
title's window imports and what sizes its frames (measured: the DXGI mode
does not, the executable's SDR mode does). port_plan.md and port_status.md
give the state.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A GPU address is now the title's CPU address on a capture-replay device
(src/title_memory.h has the design and the RTX 4060 Ti / 616.64
measurements behind it):
- The arena's memory asks for the device address heap_base = 512 GiB
(bufferDeviceAddressCaptureReplay, enabled on the standalone device), and
every range of the title's graphics memory is imported with
VK_EXT_external_memory_host at heap_base + its address (Resource::
create_host_buffer) and registered as a buffer at VA = that address, so
heap_base + VA in shaders and buffer_at in the replay both reach the
title's own bytes, with no copy. LEONIDA_TITLE_MEMORY=0 turns it off.
- xmem places 32-bit graphics memory in [1 GiB, 4 GiB) and the rest in
[64 GiB, 448 GiB) (VIctory xmem.rs:63-88), drops write-combining as VIctory
does (xmem.rs:60-64), and tells the layer what becomes GPU-visible (commits
of graphics memory, mapped physical pages, committed then) and what is
about to go (VirtualFree, unmaps, remaps): rt::xmem::set_graphics_listener,
connected in gta6rt.
- Driver behaviour the imports work around, each measured: imported memory
cannot be sparse-bound (no 2^40 mirror); every import but the first also
takes an ordinary device range right after the arena, so the windows'
device addresses are held by sparse buffers at them and an import takes
its part; imports get addresses 2 MiB at a time, so imports in one 2 MiB
block are merged.
- Device slot 133 binds its buffer to the import that holds its pages.
- Device slots 70/71 (V device.rs:443-444, descriptor.rs:795-818,
resource.rs:2383-2448): buffer views are V#s at the title address; texture
views get a texture keyed by (address, description with words 1 and 13
zeroed), filled from title memory and detiled (gfx10_tiling.h) for one 2D
level of SW_4KB_S or SW_64KB_D; other layouts start zeroed, logged.
- List slots (V list.rs:1294-1431, 1596-1613, 1891-1983): 62
CopyMemoryToMemoryX as copies between the buffers at those addresses,
71/72 Write32/64 as WriteBufferImmediate MARKER_OUT (timestamps: the CPU
clock at recording), 100 DispatchMeshX as DispatchMesh(x, 1, 1) (indirect
dropped, as V does), 148 AllocateUploadMemory from the device's imported
upload blocks, given back at reset; 73/74 WaitValue recorded and waited
for at ExecuteX up to LEONIDA_VALUE_WAIT_MS (100), not held as V holds
them.
d3d12_title_memory_test (RTX 4060 Ti): a compute shader written to the
translator's contract reads title memory through a slot-70 V# in a console
descriptor heap in 32-bit title memory and writes it back through a root UAV
at a title address; a slot-70 SW_64KB_D texture reads back as its texels;
slot 71 V#/T#; list slots 62/71/72/73/148; slot 133 on mapped physical pages;
unmapping and the title's VirtualFree release the imports.
Retail title: every import succeeds (4.5 GB of pools, the 32-bit windows,
slot 133's 174 MB buffer); slot 70 now writes its view. The title still stops
at its breakpoint game_scarlett_master.exe+0x247af2d after its back buffers:
a pool check that slot 70 does not reach.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AGENTS.md gets two runtime traps found on the real title: a thread_local
with a destructor in gta6rt.exe aborts the title (0xC0000409), and console
methods returning a struct by value take a hidden return pointer in RCX.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
d3d12_xs_device.cpp called rt::d3d12::create_console_descriptor_heap
(slot 14, 3630610ca) without including d3d12_com.h, which exists only with
the Vulkan device (LEONIDA_VULKAN_DEVICE), so gta6rt did not compile
without Vulkan headers. The console path is now built with the Vulkan
device only, and when the helper refuses a host D3D12 device the PC call
makes the heap from the 16-byte desc, as before 3630610ca.
acphal.cpp: SHAPE_XMA_CONTEXT's bit fields fill five dwords and
SHAPE_PCM_CONTEXT's six, so with 10 and 1 reserved dwords the structs
were 60 and 28 bytes and the GDK-size asserts (64, 32) failed on MSVC.
Only the size is used (the stride of the title's context arrays), so the
reserved tails are 11 and 2 dwords.
Tested: gta6rt builds (VS 2022, RelWithDebInfo); gta6rt --dry-run and
--init on the Xbox Series 1.0.2.1 package map and initialise all five
modules; --run stops at the first unimplemented import,
xcrdapi.dll!DStorageGetFactory.
docs/port_status.md: Leonida is the base, VIctory the patch source.
port_ctl.py: shot --small writes a reduced copy.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
scripts/sync_victory.py fetches DexNom/VIctory and merges new commits into
victory/ with git subtree pull. scripts/port_ctl.py starts a run with its
logs, captures and saves outside the repository, presses stand-in pad keys
through VICTORY_MOVEMENT_FILE, saves frames through VICTORY_CAPTURE_REQUEST
and reads the frame-rate lines.
The movement file now takes every key of the stand-in pad's table (Enter,
Back, Esc, Tab, the D-pad, shoulders, triggers, stick clicks), so menus can
be driven by a script. Tested with cargo test -p victory-hle --features
diagnostics movement (4 passed).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>