Commit Graph

826 Commits

Author SHA1 Message Date
0fa2b4fc4f Merge branch 'feat/presentation' into port/d3d12-nvidia 2026-11-27 12:16:18 -05:00
701cc74966 Launcher and F1 menu: -Dlss, -FrameGen, -Aspect, -PresentScale, -DryRun
scripts\play-d3d12.ps1 and d3d12\scripts\play-nvidia.ps1:
  -Dlss quality|balanced|performance|ultra   DLSS makes the output from 2/3,
                0.6, 1/2 or 1/3 of its lines (Series X: 1440, 1296, 1080, 720)
  -FrameGen 2..6   DLSS frame generation
  -Aspect 21:9|32:9|W:H|auto, -PresentScale fit|stretch   the window's shape
  -DryRun       the settings a start would run with, and nothing started
With none of them a start sets what it set before (Series X: 1440 lines and
the title's own upscaler).

On Series X the launcher puts the pieces together after the F1 menu's saved
choices are read: DLSS or the stretch there means LEONIDA_FSR_UPSCALER=1 and no
LEONIDA_OWN_UPSCALER, with render scale 2/3 unless one is set; frame generation
there turns DLSS on (or is left off without DLSS's files), since its depth and
motion vectors come from that upscale. A menu choice of DLSS without the files
falls back to the title's own upscaler on Series X.

F1 menu: RENDER SCALE names the DLSS modes, UPSCALER's last value is the
game's own on either console, and WINDOW SHAPE and PICTURE IN ANOTHER SHAPE
(live) are new.

The script's own $dlss is now $dlssOn: PowerShell does not tell it from the
-Dlss parameter. Checked with -DryRun over the parameter and menu
combinations; not run in the game.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 12:12:38 -05:00
f0e451db06 Launcher: Smooth Motion back to opt-in (the one default start ended in the title's breakpoint)
leonida_sm.exe started by default ended 2.4 s in with 0x80000003 from the title's main loop; the
next start, of leonida.exe, ran. One start each: not looked into yet, so it is not the default.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 12:10:49 -05:00
d62bf5a0a9 Launcher: Smooth Motion by default (-NoSmoothMotion: only rendered frames)
The user's call (2026-11-27): generated frames to play with while the rendered rate is under 30.
The driver's profile for leonida_sm.exe was on already; the launcher now starts that copy unless
-NoSmoothMotion is given (measurements are made with it). The rendered rate is what the window
title and the log give.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 11:40:28 -05:00
51799d7df6 Launcher: the Series X profile at 1440p rendered is the default; -SeriesS runs the lighter profile
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 01:36:06 -05:00
f6496d2fc2 Shaders and pipelines precompiled before the title starts; reflection guard off by default; a play build profile
Launcher (d3d12/scripts/play-nvidia.ps1, passed through by scripts/play-d3d12.ps1;
-NoPrecompile skips it): before the title starts, `leonida shaders` translates
every shader of the title's shader archive into the cache with the settings of
that start, and `leonida warm --used` makes the host pipelines earlier runs
drew with, in processes of their own. Runs write the title's pipelines down for
it (LEONIDA_PIPELINE_BOOK=1). Until now the first load of the world after a
change of the translator ran at 0.2 fps for a minute and came up half drawn
while 2,000 shaders were translated and their pipelines made. Measured here
(Ryzen 5 7600X, the machine busy with other builds): 25,663 shaders in 109 s,
226 of them with no translation (195 containers without a program, 26 wave64
programs without a 32-lane form, 5 others); 1,891 pipelines in about 150 s. A
second start finds them in the cache. The commands' log is kept quiet for the
step instead of redirected: Windows PowerShell 5.1 turns a native command's
redirected error stream into errors.

ambient.rs: LEONIDA_REFLECT_MOST is off unless set. On the renderer merged at
00698e1e8 the guard made the whole picture posterized and grey, sky and skin in
a few flat tones (run n2: all 411 recorded frames; with it off, run n3: none of
431). The program it follows is not only the reflections' there.

Cargo.toml: profile `play` (the diag build with thin LTO and one code
generation unit), to be measured against diag.

README: the table of Leonida's fixes follows the merged renderer (DLSS in place
of -Resolution native, LEONIDA_SHARPEN gone with the compose pass it lived in),
and a section on the precompile.

AI-assisted.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-26 22:05:11 -05:00
00698e1e84 d3d12: the runtime takes trustno1-coder/VIctory-NVIDIA b190242 (CGBJ's renderer, DLSS, frame generation, F1 menu)
Upstream's four commits past 6a31e43 (5b36758, 9e7ab9d, 6395727, b190242;
GPL-3.0), brought in as a three-way merge: upstream's trees before and after
written under Leonida's names (crates leonida-*, LEONIDA_* settings) and the
difference merged onto Leonida's own changes. What comes with it, by its
authors:
- the renderer of codec-d/cool_fox f4b48ad (CGBJ) with trustno1-coder's NVIDIA
  fixes on top (residency.rs, stretch.rs, the title's upscale dispatch);
- DLSS for the title's upscale, from avatarmanz/VIctory-7900XTX pull request
  203 (feature dlss, LEONIDA_UPSCALE=dlss): the game renders its own 720p and
  DLSS takes it to 1080p on the Series S profile;
- DLSS frame generation through NVIDIA Streamline (streamline.rs, fg.rs), an
  F1 settings menu (host/menu.rs), LEONIDA_FPS_CAP, real ray tracing as an
  option (LEONIDA_BVH_BUILDER=1: the structure builder runs on NVIDIA).
NVIDIA's own files (DLSS, Streamline) are not part of the repository:
d3d12/Get-NVIDIA-DLSS.cmd fetches them from NVIDIA's GitHub into
d3d12/nvidia-sdk/ (git-ignored).

Where both sides had changed the same lines:
- compose.rs is upstream's (planes drawn by a pixel shader into the back
  buffer); Leonida's LEONIDA_SHARPEN lived in the compute pass it replaces
  and is not in this commit (DLSS has its own sharpness setting).
- draw.rs keeps Leonida's slow-beat texture re-check (300 frames by default);
  upstream's switch of the same name is dropped.
- ambient.rs keeps LEONIDA_AMBIENT_MOST and the reflection guard.
- play-nvidia.ps1 is upstream's with Leonida's defaults put back while rays
  are off: strict indirect batches (INDIRECT_BATCH=1), the light stand-in
  (AMBIENT=0.8, AMBIENT_MOST=2), ray walks ended at the root and the
  ray-resolve skip list. With upstream's defaults (stand-in off, no skip
  list) shade was black and the sky white in the world, and the card worked
  33-50 ms a frame (run n1).
- scripts/play-d3d12.ps1 follows the new launcher: DLSS by default, a shader
  cache of its own (cache-2), -NoDlss, -RayTracing, -Capture, -Log.

Builds with and without the dlss feature (cargo build --profile diag
-p leonida --features diagnostics[,dlss]). In the world on an RTX 4060 Ti 16 GB
(driver as installed) and a Ryzen 5 7600X: DLSS starts (1280x720 to
1920x1080), about 14 fps where it was 13.4. The picture is not right yet: a
posterized look in run n2 is being traced. AI-assisted.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-26 21:48:18 -05:00
72621b80ea Leonida: NVIDIA Smooth Motion for leonida_sm.exe (scripts/smooth-motion.ps1, play-d3d12.ps1 -SmoothMotion)
The driver shows twice the frames the game renders on RTX 40/50 cards. The
script writes one per-application setting in the driver's profile store
through NVAPI (query, on, off); the setting's ID was found by
lepotane/VIctory-leonida (GPL-3.0).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 19:58:34 -05:00
673036bb98 Leonida launcher: native 1080p with the title's own upscaler by default
Measured on an RTX 4060 Ti, Series S profile, the user's save: 11.8 fps without
-Quality (8.3 with it); skin and bodies stayed right in every burst frame.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 17:29:05 -05:00
0cc6eee205 Leonida picture fixes: native 1080p, sharpening, black skin, legacy MAD, reflection guard
- play-d3d12.ps1 / play-nvidia.ps1: -Resolution native renders at the title's
  own 1920x1080 on Series S with neither title patch. A pinned render scale of
  1 with the own upscaler forced stopped the title in its init (frame 0, twice).
- compose.rs: LEONIDA_SHARPEN (0.4) sharpens the game plane before the
  interface goes over it, kept inside each pixel's neighbourhood (no halos).
- watch.rs: LEONIDA_PAGE_WRITES defaults to bits 1, 2 and 8: textures picked by
  index that were uploaded before DirectStorage or a plain read filled them are
  uploaded again (fxceless/victory-fork e4245f3: black faces and skin).
- draw.rs: LEONIDA_HEAP_RECHECK_EVERY (300 frames) keeps looking at uploaded
  textures picked by index after the fixed schedule (fxceless, after RyanCase94).
- lower.rs: v_mac_legacy_f32 / v_mad_legacy_f32 fused with flushed sources as
  RDNA 2 runs them (fxceless f6a09d3); new GPU test passes on hardware and WARP.
- ambient.rs: a reflection guard after CS_UpdateHistory (LEONIDA_REFLECT_MOST,
  3) caps reflections at a multiple of the room's light and pulls colour spikes
  to grey; the view's place from lepotane/VIctory-leonida.

Translator arithmetic and differential tests: 52 passed, 0 failed (RTX 4060 Ti).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 17:08:17 -05:00
fee07ff779 d3d12: Leonida's D3D12 runtime under its own name
What changed:
- victory/ is now d3d12/;
- its crates are leonida-* (leonida_* code paths);
- the program is leonida.exe;
- settings are LEONIDA_*, and the older VICTORY_* names still work through apps/leonida/src/leonida.rs;
- the config file is leonida.toml;
- log names and user-facing text say Leonida.

What did not change: lines that credit upstream projects or people, URLs, copyright notices and the
GPL-3.0 LICENSE. d3d12/README.md opens with a Leonida section that says the runtime grew from
Marvisak/VIctory through trustno1-coder/VIctory-NVIDIA. The rest of that README is labelled as
trustno1-coder's.

The launchers (scripts/play-d3d12.ps1, scripts/play-linux.sh), docs/linux.md and
scripts/sync_victory.py (prefix d3d12) follow the move. Future upstream merges will need a
mapping from upstream's names onto these.

Builds with `cargo build --profile diag -p leonida --features diagnostics`. The settings alias
tests pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 16:11:32 -05:00
010c21b7de d3d12: the runtime is leonida.exe, its window says Leonida
victory/ builds as leonida.exe ([[bin]] in apps/victory; the package keeps VIctory's name so upstream merges and cargo -p victory still work), the window caption reads Leonida, and the launchers (victory/scripts/play-nvidia.ps1 and play.ps1, scripts/play-d3d12.ps1, scripts/play-linux.sh) start leonida.exe; the Smooth Motion copy is leonida_sm.exe. VICTORY_* settings are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 16:01:44 -05:00
4d871376bf scripts: play-d3d12.ps1 starts the D3D12 runtime (victory/) on Windows
A wrapper over victory/scripts/play-nvidia.ps1: it builds victory/ (diag) when missing, keeps caches and saves under %LOCALAPPDATA%\Leonida\d3d12, and passes -SeriesX, -Quality, -Resolution, -Adapter and -More through. The Vulkan renderer stays scripts/play.ps1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 15:49:35 -05:00
8a73677be8 Linux: bundle VKD3D-Proton with the D3D12 runtime
On Linux the D3D12 runtime (victory/) runs under Wine. Its Direct3D 12 now comes in the package, so
players download nothing else for D3D12.
- scripts/fetch_vkd3d_proton.py puts VKD3D-Proton 3.1's unmodified 64-bit d3d12.dll and
  d3d12core.dll in the package. It also adds the LGPL-2.1 text and notice from the v3.1 tag and a
  note on where the source is. Every download is checked against a pinned SHA-256. Standard
  library only; Python 3.14 for compression.zstd.
- scripts/play-linux.sh installs the bundled DLLs into Leonida's own Wine prefix (no other prefix is
  touched) and sets WINEDLLOVERRIDES=d3d12,d3d12core=n. It runs the runtime with the measured
  NVIDIA defaults of play-nvidia.ps1.
- docs/linux.md describes the package and what is still untested: the launcher is syntax-checked
  only; it has not run on a Linux machine yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 15:49:02 -05:00
f3628ac2e6 Ultrawide: LEONIDA_ASPECT and a pillarboxing present
- LEONIDA_ASPECT (21:9, 32:9, 43:18, any W:H or ratio from 1 to 4, or auto) widens the display mode
  the runtime reports to the title, at the same height, and widens the title's window.
- LEONIDA_PRESENT_SCALE=fit|stretch: fit keeps the frame's shape, centred with black bars. It is
  the default when LEONIDA_ASPECT is set; stretch, the old behaviour, is the default otherwise.
- The aspect math is in src/aspect_fit.h, with aspect_fit_test.
- docs/ultrawide.md describes how resolution flows from window to title to present, and what
  needs the game running: whether the title renders wider at all, its FOV and its HUD.
- play.ps1 gets -Aspect and -PresentScale.

Built; aspect_fit_test passes. The bars have not been checked on screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 12:04:52 -05:00
fad8230d77 scripts/play.ps1: start the title on the Vulkan renderer with today's working settings
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 03:43:47 -05:00
49fa907e4d media: a source resolver that opens local files only
The title's mfplat.dll imports bind to the host, and the host's
MFCreateSourceResolver fetches http, rtsp and other URLs over the
network. Port VIctory's media module (media.rs, GPL-3.0-or-later): a
proxy resolver that refuses anything but a local file with
MF_E_UNSUPPORTED_SCHEME (logged once per scheme and host), rewrites
console paths (GAME:, G:, T:, also as file: URLs) to their host files
through the new rt::fs::read_path, and forwards the rest to the host's
resolver. mfplat.dll stays a host module for LoadLibrary.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 02:16:17 -05:00
c8e826a3d8 gameinput: XInput, DualSense and keyboard shim for builds without SDL3
Port VIctory's GameInput module (gameinput.rs, gameinput/dualsense.rs,
GPL-3.0-or-later) as shims/gameinput_xinput.cpp: XInput pads 0-3, a
wired DualSense over HID, the keyboard as its own device, and a keyboard
pad that stands in while no other pad is connected. Readings per change
with a 32-deep history, blocking and async device enumeration,
UnregisterCallback waiting for a running callback, FindDeviceFromId and
XInput rumble, all as VIctory runs the title.

It is built into gta6rt when the SDL3 shim is not (the main build has no
SDL3), instead of binding the import to the host's GameInput.dll, which
has no keyboard pad; LEONIDA_GAMEINPUT=host keeps that path and
LEONIDA_KEYBOARD_PAD=off drops the keyboard pad. Registered by name and
ordinal #1. gameinput_xinput_test runs it over a fake host.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 02:12:27 -05:00
3edb3119fe runtime: answer the console model the title reads from the registry
The title takes its console model from HKLM\Software\Microsoft\Windows NTCurrentVersion\OEM\ConsoleMode, not from XSystemGetDeviceType alone; a PC
has no such value. registry_oem.cpp (ported from VIctory's xsystem.rs)
answers RegOpenKeyW/RegOpenKeyExW/RegQueryValueExW/RegCloseKey for that
key with 0x64 (Series X; 0x60 with LEONIDA_DEVICE_TYPE=6) and passes every
other key to the host. advapi32.dll stays a host module for LoadLibrary.

Found on the real title: its render-target pool budget (0x4000000 or
0x5200000) is picked by this model. The title still stops at its pool
check (game_scarlett_master.exe+0x247af2d): it counts the back buffers
through its XMemAlloc hooks, which Leonida does not call yet.

Tested: registry_oem (new) and d3d12_title_memory pass; gta6rt binds the
four imports to the shim.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 20:19:40 -05:00
5baca71609 Merge port/bcpack: BCPack decoder in C++, bit-exact with VIctory's
Bit-exact with VIctory's Rust decoder on all 105,845 BCPack chunks of the
1.0.2.1 package (BC1, BC3, BC4, BC5, BC6H, BC7; 16.4 GB decoded), about as
fast on one core (59-61 MB/s against 57).

Merge resolution: gta6rt no longer compiles src/bcpack_decode_stub.cpp,
which as an object file would have silently replaced the decoder in
gta6rt_bcpack; only dstorage_xs_test links the stub now. bcpack_decode.h
keeps both sides' notes; build_runtime.ps1 lists the union of sources
without the stub.

Tested: gta6rt builds with the Vulkan device; bcpack, bcpack_tables (with
local tables) and dstorage_xs pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 17:32:37 -05:00
7bde974af5 runtime: port VIctory's BCPack decoder (gta6rt_bcpack, leonida_bcpack_decode)
BCPack is the console's DirectStorage codec for BC1-BC7 block streams.
src/bcpack.h and src/bcpack.cpp port victory-formats' bcpack.rs
(GPL-3.0-or-later, Marvisak and contributors) and the table loading
around bcpack::decode in victory-hle's dstorage.rs. src/bcpack_decode.h
declares leonida_bcpack_decode, the entry point the DirectStorage port
calls; the definition here replaces that branch's stub. Drop
bcpack_decode_stub.cpp when merging: a static library member is only
pulled in for unresolved symbols, so a stub left in gta6rt's sources
would win without a link error.

The format tables are not under the project's license and are never
committed: they are read on first use from LEONIDA_BCPACK_TABLES, else
bcpack-tables.bin next to the executable, and refused unless their
SHA-256 is the one VIctory's Initialize-FormatTables.ps1 pins; without
them every BCPack request fails. Decoding allocates nothing and shares
nothing mutable, so worker threads may decode at once.

Checked against VIctory's decoder (Rust, release build) on all 105,845
BCPack chunks of the user's texture pools (BC1 100,020, BC3 35, BC4 77,
BC5 325, BC6H 268, BC7 5,120; 12.1 GB packed, 16.4 GB decoded): every
output is byte-identical. One core, every 10th chunk, decode calls only:
59-61 MB/s out for the port against 57 MB/s for VIctory's build (BC1
64-66 against 62, BC7 29-30 against 27; Ryzen 5 7600X, MSVC 2022,
RelWithDebInfo).

bcpack_test (CTest bcpack) needs no game data or tables: SHA-256
vectors, table parsing and loading, VIctory's fixed BC4 stream, and
streams it encodes itself against tables of its own. bcpack_tables
repeats the checks on the real tables (SKIP, exit 77, without them) and
pins the hashes of the blocks VIctory's decoder makes of the streams it
builds; VIctory's reference_chunks test passes on those streams.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 17:30:15 -05:00
2daf532562 Merge port/audio: APU, DSP and audio coprocessor shims ported from VIctory
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	scripts/build_runtime.ps1
2026-11-25 17:27:11 -05:00
1a3f1ebee8 port_ctl.py: name the line ending of the run log it opens
tests/test_text_write_line_endings.py requires every text writer to name
its line ending.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 17:26:16 -05:00
908fb65d8a runtime: port VIctory's audio HLE (xapu, chad, acphal coprocessor, XMA)
Ported from VIctory (victory/crates/victory-hle/src/modules/apu.rs, dsp.rs,
audio.rs; victory-formats/src/xma.rs), GPL-3.0-or-later, Marvisak and
contributors (DexNom fork), keeping its measured ABI: XApu records
(CommandId 0x18, Activate 0x38, Process 0x40, ApuResult 0x50), command
kinds, options and HRESULTs; XDsp StreamDesc 0x1c, Status 16, Command
0x20; IAcpHal slot order, 28-byte messages, command ids 1-3, 5-8, 18;
SHAPE_CONTEXTS 0x60.

- shims/xapu.cpp (xapu.dll): queues and results are real. PLACEHOLDER
  decoding: no Opus decoder is in the repository (VIctory uses the
  opus-pure crate), so a process command parses its packet
  (src/opus_packet.h, RFC 6716 framing as libopus checks it) for its
  frame count, output length and errors, and writes silence. Malformed
  packets fail with BAD_PACKET; rate conversion stays E_NOTIMPL.
- shims/chad_dsp.cpp (chad.dll): completion (status words, tickets) is
  real; convolutions and transforms output silence, as in VIctory.
- shims/acphal.cpp: the coprocessor acknowledges commands with VIctory's
  messages (fmod waits for the first in System_Create; the old stub never
  answered), sets notification words, and decodes enabled XMA contexts on
  a thread into their rings. Context arrays get device addresses that map
  back. Fixes: SHAPE_CONTEXTS is 0x60 (APU addresses are 32-bit; 120
  bytes wrote 24 past the title's structure); AcpHalReleaseShapeContexts
  writes nothing through its argument (the title passes a handle); the
  non-cached heap's device addresses start on a 64 KiB boundary; state
  the decoding thread reads is immortal.
- src/xma_decode.*, src/xma_tables.h: real XMA2 decoding (VIctory's port
  of FFmpeg's WMA Pro decoder) with four fixes from VIctory's history
  that the DexNom snapshot lacks (ba42db643, d4d182204, 03a6f2290,
  4eb0898b3); src/xma_context.*: the context machine, with three more
  (7a5d85e6a, 1054fe87d, 985d8d4b0).

Host output is unchanged: the title's middleware opens WASAPI through
COM (com_shim.cpp forwards CoCreateInstance to the host), as in VIctory.

Tests (CPU only, no game data, in CTest): xma (decoder against a
direct-sum IMDCT, VIctory's frame walk, noise and ring tests), xapu,
chad_dsp, and acphal extended (messages, notification words, the
decoding thread filling a ring). gta6rt --dry-run on 1.0.2.1 binds all
ten xapu/chad imports (unimplemented 11 -> 1: DStorageGetFactory).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 17:25:05 -05:00
0d97ae62ee runtime: Xbox DirectStorage (XCRDAPI.dll), ported from VIctory's dstorage.rs
gta6rt --run stopped at the first unimplemented import, XCRDAPI.dll!DStorageGetFactory.
shims/dstorage_xs.cpp now serves it, ported from VIctory's
crates/victory-hle/src/modules/dstorage.rs (GPL-3.0-or-later; Marvisak and contributors,
DexNom fork) with VIctory's measured ABI: the factory interface id, the factory, file,
status-array and queue method tables in their slot order, the 0x48-byte request and the
queue description (shims/dstorage_xs.h), and its status and error reporting.

- One pool of workers runs every queue's requests: started in queue order, queues shared
  by priority with weighted round robin (about 10x per level, in bytes), at most the
  staging buffer's worth of compressed source in flight. A status entry is written once
  every earlier request of its queue has finished, with the first failure since the last
  entry. A queue submits itself at half its capacity and blocks when full; Close drops
  what has not started and waits for what runs.
- Files open through the title's CreateFileW shim, so GAME: and G: paths read the
  overlay copy or the package. zlib is leonida::zlib_inflate. Destinations are addresses
  or xmem physical pages, whose page array is read when the request runs (waiting up to
  100 ms for numbers still zero); new rt::xmem::physical_span/write_physical write the
  pages through their section's own view, committed first.
- Raw file reads into title memory are read beside and copied in (VIctory's fix for
  ERROR_INVALID_USER_BUFFER): here a ReadFile into an untouched mapped physical page fails
  with ERROR_NOACCESS, while our copy faults into xmem's commit handler.
- BCPack goes through leonida_bcpack_decode (src/bcpack_decode.h); the stub linked for
  now returns false, so BCPack requests complete with HRESULT_FROM_WIN32(ERROR_INVALID_DATA),
  logged once per BC format.
- No thread_local with a destructor: it made gta6rt.exe's CRT register its thread-local
  destructor callback with the UCRT, which takes one per process, and the title's CRT
  startup then ended the process with 0xC0000409 after its static initializers.
- LEONIDA_DSTORAGE_TRACE (failed or all requests) and LEONIDA_DSTORAGE_RETRIES (physical
  page write retries) are documented in runtime/README.md.

dstorage_xs_test (CTest dstorage_xs, no game files): reads from a synthetic GAME: file
through a queue, zlib streams compressed by the test, memory sources, statuses completing
in order with the first failure (EOF, bad zlib, BCPack, unsupported option, oversized
read), self-submission, closed queues, the scheduler's priority and staging choices, and
physical-page destinations (one allocation, several, a late page array, an unknown page,
a raw read into untouched pages). 59 checks pass.

On the 1.0.2.1 package, --run now gets the factory, sets the 32 MiB staging buffer and
opens 12 RPF archives through DirectStorage; it then stops in the D3D12 device proxy's
slot 26 (GetCustomHeapProperties), which receives the hidden return pointer in RCX.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 17:04:24 -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
e762895f06 Rename the runtime's user-facing name from DexNom Runtime to Leonida
Window title and frame-rate caption, the diagnostics overlay, launcher
messages, the setup script (Setup-Leonida.ps1), its Start menu shortcuts
and install folder (%LOCALAPPDATA%\Leonida). Credits to DexNom and VIctory
are kept. Crate, binary and VICTORY_* switch names are unchanged so
upstream VIctory updates still merge.

port_ctl.py strips the log's colour codes before reading it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 15:51:50 -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
d083a2cc37 Make main's tests green: 12 test files that drifted from the code (#9896)
Twelve test files failed on main at 2d53a8055 (CI's check and semantic-tests steps, run locally): most are a test
and the code it checks changed by different pull requests in the same merge round. Each fix below is either taken
from a closed pull request that already had it, or restores what an earlier merged change intended.

From closed pull requests:
- test_make_game_resume: FakeProc gets poll(), which translate() now calls (#7018)
- test_make_game_empty_translation: the Exited stub gets poll() and the failed-shard path is checked (#7214)
- test_shader_checks: stub table_fetch_test in the Wave64Checks harness and count it (#7433)
- test_runtime_paths: runtime.yml's path filter lists tools/replace_retry.py, which rdna2spirv.py imports (#7029)
- test_psin_names: patch the same_report_path helpers that report_paths now calls (#8719)
- test_report_source_collision: the fixture is a real Bink 2 header; bink_index refuses other files (#7408)
- test_missing_input_exit_codes: tile_probe checks its inputs before it asks for numpy (#4771)

Restored:
- merge_check: a failed `git show` is an error again (5b88d58); 21016cf brought back the lenient read that
  treated it as a new file, while new files are already left out when the diff is read
- rpf_probe: a symlinked --out updates its target again (44d3595); 55d21cc's staged write replaced the link

Updated to the code:
- test_shader_stage_resume: TRANSLATION_SOURCES lists fssm_unpack.py and shader_stage_manifest.py, which the
  translator imports; existing work folders translate once more after this
- test_tool_stdout_encoding: the 15 programs merged without the stdout guard get the same block as the others
- test_rdna2spirv_decode: drop the test of decode_any_format, which SHADER-849 replaced with the table decode
  that tests/semantic/test_format_decode_table.py checks

Co-authored-by: jewmaster1337 <102986566+jewmaster1337@users.noreply.github.com>
Co-authored-by: TanmaySatyam <248538550+TanmaySatyam@users.noreply.github.com>
Co-authored-by: evilclanker9000 <45567075+evilclanker9000@users.noreply.github.com>
Co-authored-by: slint6614-dev <359954236+slint6614-dev@users.noreply.github.com>
Co-authored-by: BlackNife <108077267+Poussistar@users.noreply.github.com>
Co-authored-by: fiestorra <65175643+fiestorra@users.noreply.github.com>
Co-authored-by: fearkov <289226582+fearkov@users.noreply.github.com>
Co-authored-by: DoubleD17 <48109637+DoubleD17@users.noreply.github.com>
2026-11-24 00:21:26 +01:00
3faeaf2ca6 Merge remote-tracking branch 'origin/pr/8980'
# Conflicts:
#	scripts/merge_check.py
2026-11-23 17:43:03 -05:00
8b63b583ae Merge remote-tracking branch 'origin/pr/8995'
# Conflicts:
#	runtime/test/shaders/check.py
#	scripts/run_gpu_tests.py
2026-11-23 17:41:48 -05:00
17bbb2dfb8 Merge remote-tracking branch 'origin/pr/8946' 2026-11-23 17:41:06 -05:00
0aedf6a72a Merge remote-tracking branch 'origin/pr/8958' 2026-11-23 17:41:03 -05:00
887a0e4ef2 Merge remote-tracking branch 'origin/pr/8965' 2026-11-23 17:41:02 -05:00
0fdb6c375f Merge remote-tracking branch 'origin/pr/8968' 2026-11-23 17:41:01 -05:00
65a84a39a4 Merge remote-tracking branch 'origin/pr/8975' 2026-11-23 17:41:00 -05:00
4c55690e89 Merge remote-tracking branch 'origin/pr/8986' 2026-11-23 17:40:57 -05:00
f48adad761 Merge remote-tracking branch 'origin/pr/9523'
# Conflicts:
#	runtime/CMakeLists.txt
#	scripts/build_runtime.ps1
2026-11-23 17:38:03 -05:00
ff8ff4dd96 Merge remote-tracking branch 'origin/pr/9516'
# Conflicts:
#	scripts/build_runtime.ps1
2026-11-23 17:37:15 -05:00
c925ac7f79 Merge remote-tracking branch 'origin/pr/9494'
# Conflicts:
#	docs/design.md
#	runtime/test/shaders/check.py
#	scripts/run_gpu_tests.py
2026-11-23 17:36:51 -05:00
97230ed64f Merge remote-tracking branch 'origin/pr/9491' 2026-11-23 17:32:53 -05:00
21714399e8 Merge remote-tracking branch 'origin/pr/9761'
# Conflicts:
#	runtime/test/shaders/check.py
#	scripts/run_gpu_tests.py
2026-11-23 17:30:03 -05:00
f7b3afcda9 Merge remote-tracking branch 'origin/pr/9754'
# Conflicts:
#	scripts/build_runtime.ps1
2026-11-23 17:29:12 -05:00
e352ad3d37 Merge remote-tracking branch 'origin/pr/9753' 2026-11-23 17:24:50 -05:00
b055a73352 Merge remote-tracking branch 'origin/pr/9712' 2026-11-23 17:24:39 -05:00
e6b8e21d3e Merge remote-tracking branch 'origin/pr/9705' 2026-11-23 17:24:37 -05:00
d578b4806e Tests: GPU coverage for ds_wrxchg*_rtn_b64, ds_or_rtn_b64, ds_min_f32 and ds_max_rtn_f32
docs/design.md marks the 64-bit LDS exchanges not GPU-verified, and
cs_lds_atomics_ext.asm (#9494) leaves ds_or_b64 and the f32 min/max
forms out. cs_lds_xchg64_ext.asm runs one lane through
ds_wrxchg_rtn_b64 (both dwords left and the returned pair),
ds_wrxchg2_rtn_b64 at offsets 0/2 (four old and four new dwords),
ds_wrxchg2st64_rtn_b64 at offsets 1/2 (512-byte steps), ds_or_rtn_b64,
ds_min_f32 with a quiet NaN in memory and ds_max_rtn_f32 ordering -0.0
below +0.0. The eight expected words are derived in its header from
the rows. Registered in check.py and run_gpu_tests.py next to
cs_lds_b64_cmpst; the wrxchg row notes the GPU check (the min/max and
bitwise b64 rows get theirs in #9494, to keep the two PRs apart).
2026-11-23 14:09:15 -08:00
629704a775 Merge PR #9604 2026-11-23 17:09:00 -05:00
f475ea37f1 Merge PR #9581 2026-11-23 17:08:22 -05:00
84d40f32f7 Merge PR #9580 2026-11-23 17:08:21 -05:00