Commit Graph

41 Commits

Author SHA1 Message Date
7b06905c87 docs/port_status.md: wrap the device-loss paragraph
AI-assisted.
2026-12-01 07:54:06 +01:00
8e0594344c docs/port_status.md: name the call that first returned device lost
run24's loss came from vkWaitSemaphores; run25's from vkQueueSubmit
before vkWaitSemaphores. The paragraph attributed both to run24.

AI-assisted.
2026-12-01 07:53:14 +01:00
f589493c5f docs/port_status.md: scope the second machine's list-values runs
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.
2026-12-01 07:35:33 +01:00
c7c82150b1 docs/port_status.md: the measured list-values pair past the world load
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.
2026-12-01 07:13:30 +01:00
18936010df chore: remove dead Tier 1 files, wire 5 unwired C++ tests, and fix play.ps1 path 2026-11-29 20:00:40 -05:00
e890d0a101 docs: fix inaccurate doc paths/flags/env vars and add recommended variables to running.md
- docs/running.md: add Recommended variables (all platforms) table covering async submit/compile, compile-pool sizing, warm-up throttling, heap sizing, input, and telemetry/fault variables on main; update RX 7900 XTX RADV recipe and Reporting section
- runtime/README.md: document LEONIDA_CLWB_PATCH (runtime/src/cpu_emulation.h)
- AGENTS.md: add port_ctl.py (scripts/port_ctl.py) to numpy/Pillow exception list
- d3d12/docs/replay.md: fix nonexistent --looks flag reference to --flow
- docs/port_plan.md, docs/port_status.md, docs/ultrawide.md, docs/victory_gap_gpu.md, docs/victory_gap_media.md: fix typos (chad_dsp.cpp -> chad.cpp, VIctory tests/fidelityfx.rs -> crates/victory-hle/tests/fidelityfx.rs) and clearly mark unmerged-branch paths (runtime/ ultrawide, frame_step.h, media_foundation.cpp, gameinput_xinput.cpp, d3d12_xs_exports_test.cpp, pipeline_queue.h -> pipeline_wait.h)
- tests/test_docs_cli_flags.py: scan .rs sources and clap #[arg(long)] struct fields for d3d12/docs/*.md flags, treat cargo/git-filter-repo flags as foreign, and add docs/port_plan.md to OTHER_PROJECTS

AI-assisted: Antigravity (Gemini 4 Neon). Verified: 13/13 tests/test_docs_*.py pass and scripts/check_no_game_data.py clean.
2026-11-28 09:09:23 -05:00
d859be035b port_status: the load crash is the title's hang watchdog
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 11:58:03 -05:00
37097a6a73 docs: port status: the setup flow draws; the world-load device loss and what is ruled out
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 09:40:38 -05:00
48b95f40cd docs: console mesh pipelines, the driver user SGPRs, decoding fallback; port status
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 06:09:42 -05:00
bffc6465d1 docs: port status, first visible frames
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 03:43:03 -05:00
9e62523578 docs: depth textures with unordered access, through colour twins
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>
2026-11-26 00:20:51 -05:00
07bb65111b d3d12: A8_UNORM render targets through their R8 image, the alpha splatted
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>
2026-11-25 23:38:55 -05:00
568ff3a851 docs: port status: the slot-86 refusals are not tessellation (none in the corpus)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 23:35:40 -05:00
b560d9480e docs: port status after the Vulkan boot fixes, the device loss and what is next
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 23:32:53 -05:00
4c7e7e4dad Merge port/pipelines (rest): refused streams get a pipeline object, compile-time notes
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>
2026-11-25 23:09:39 -05:00
0d1ad7d67e docs: slot 86's never-made pipelines; how far the title gets with pipelines off its thread
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 22:31:11 -05:00
34d4726873 Merge port/frame-timing: the title's time step follows real time from 1 to 3000 fps
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	docs/port_status.md
#	runtime/src/main.cpp
2026-11-25 22:05:29 -05:00
8681c690e5 Merge port/d3d12-slots2: CreateSamplerX and sampler stride, WaitValue holds, page mappings, texture layouts, GPU timestamps
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	docs/port_status.md
#	runtime/shims/d3d12_vulkan_device.cpp
#	runtime/shims/xmem.cpp
#	runtime/test/d3d12_title_memory_test.cpp
2026-11-25 22:04:38 -05:00
2694497e81 runtime: step the title by the measured frame time at any frame rate
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>
2026-11-25 22:02:40 -05:00
a4275b1571 d3d12: Write64 timestamps when the GPU gets there; docs for the slot ports
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>
2026-11-25 22:01:13 -05:00
43f98a6dd8 docs: the title now runs 36 s; its first compute pipeline blocks until the hang detector fires
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 21:35:55 -05:00
a61274951b Merge port/xmem-hooks: XMemAlloc through the title's hooks; committed resources from the title's allocator
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	docs/port_status.md
#	runtime/src/main.cpp
2026-11-25 21:33:41 -05:00
69e62ee790 runtime: committed resources from the title's allocator (__XMemAllocationHooks__)
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>
2026-11-25 21:26:28 -05:00
f6dd162511 Merge port/present: title window and Vulkan present, frame clock, 1440p display profile, frame captures
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	docs/port_status.md
2026-11-25 20:26:04 -05:00
7c81b8eef6 docs: presentation, frame clock and display profile on port/present
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>
2026-11-25 20:25:21 -05:00
f0b84e01f2 docs: title memory merged; the pool check and why it fails
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 20:20:14 -05:00
7f672dd30c Merge port/title-memory: title GPU memory imported at its own addresses on Vulkan; slots 70/71, 133; list 62/71/72/100/148
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 20:10:38 -05:00
d5095f59d1 runtime: title memory as GPU memory; console device slots 70/71 and list slots on title addresses
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>
2026-11-25 20:09:59 -05:00
345b1c2a4c docs: VIctory reference in the world on the RTX 4060 Ti with the user's save
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 19:14:47 -05:00
d359feac19 docs: shader rules merged; GPU suite 230/248 on the RTX 4060 Ti
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 18:58:43 -05:00
4d008900e9 docs: second patch source (avatarmanz/VIctory-7900XTX) and the test save
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 18:34:47 -05:00
5f8475d7fb docs: shader stage on this machine (26,503 of 26,503 translated and valid)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 17:46:14 -05:00
70b7c2f096 docs: D3D12 ABI merged; the title now stops at device slot 70
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 17:41:43 -05:00
6597528ba0 docs: BCPack merged; where gta6rt finds the format tables
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 17:32:49 -05:00
99a879b8d6 docs: audio merged; every import of the title now binds
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 17:29:51 -05:00
690b531a46 docs: DirectStorage merged; next blocker is console device slot 26
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>
2026-11-25 17:06:36 -05:00
dfe84355cc docs: Leonida's GPU test suite on the RTX 4060 Ti (226/248, 5 failures)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 16:54:57 -05:00
5504062179 docs: PowerShell finds MSYS2 git first, which mangles ^{commit}
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 16:37:21 -05:00
a344d57bd5 docs: VIctory updates polled in the background; SDK and llvm-mc notes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 16:34:49 -05:00
0283d40cb4 runtime: build on MSVC without the Vulkan device; fix SHAPE context sizes
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>
2026-11-25 16:27:46 -05:00
5aec2353db Add VIctory sync and run-control tools; let the pad file press buttons
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>
2026-11-25 15:48:32 -05:00