A Mac that built into ~/Documents/Leonida before the default moved to
~/Leonida would start a fresh build and leave its resumable work folder
behind without a word. When that folder exists, the log now says where
it is and how to keep it: move it to ~/Leonida, or pass --out.
The notes come from icloud_default_notes(), tested with a temporary home
folder. From @AGVibecoder's review.
AI-assisted.
--merge globbed index.part*.json and merged whatever was there, so an
interrupted shard run published a partial index.json that make_game.py
takes as a finished translation. Each --shard run now writes a
shard<i>.json marker ({"index": i, "count": n}) beside its part, and
--merge checks that all markers agree and that the parts are exactly
0..n-1 before merging; parts from before the markers fall back to
make_game.py's shards.json plan. make_game drops the markers with the
parts when it re-plans.
open(path, "w") without newline= turns each \n into \r\n on Windows, so the same JSON report, manifest or assembly
listing was CRLF there and LF elsewhere. 91 text-mode writes (open, os.fdopen, Path.write_text) under tools/, scripts/,
make_game.py and runtime/test/shaders/ now pass newline="\n". tests/test_text_write_line_endings.py reads the source
with ast and fails for a writer that forgets it; CONTRIBUTING.md names the convention.
AI-assisted (Claude), on behalf of dev-ewann.
default_out() is ~/Documents/Leonida, and the work folder (hundreds of GB
made from the game) goes under it unless --out/--work are given. With
iCloud Desktop & Documents sync on, macOS keeps ~/Documents in iCloud
Drive: a default build uploaded game-derived files to iCloud, and
"Optimize Mac Storage" can evict work files from the disk mid-build.
On macOS, when iCloud Drive holds a Documents folder
(~/Library/Mobile Documents/com~apple~CloudDocs/Documents), the default
is ~/Leonida instead, and the log says why. Windows and Linux keep
Documents/Leonida; an explicit --out is taken as given.
AI-assisted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AMD's Windows shader compiler for RDNA2 crashes (access violation in
vkCreateComputePipelines) on many --wave64-emulate compute shaders with LDS
(#857). auto turns emulation on when any device is 32-wide, so an Intel iGPU
next to an RX 6000 card gets emulated modules, and the runtime then runs them on
the RX 6000.
tools/vk_subgroup_info.py now reports vendor_id, device_id, driver_id and
rdna2_amd_windows for the runtime's GPU (RDNA2 by PCI device ID, AMD proprietary
driver). auto leaves emulation off when that GPU is one and runs wave64
natively; on and off are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
smallest_max_subgroup splits vulkaninfo's output at each deviceName. Vulkan 1.4 drivers that report
VK_KHR_maintenance7's layered APIs print a second, deeper-indented deviceName for the same GPU (MoltenVK:
the Metal device) before the subgroup block, in both the text and the --json output, so the first "device"
had no maxSubgroupSize and the size read as unknown. Only the least indented deviceName now starts a
device. With MoltenVK 1.4.2 on an Apple M2 Max the auto mode read "unknown"; it now reads 32 (emulation
stays on either way on Apple GPUs, but a layered driver with 64-wide subgroups would have been misread).
New tests with both layouts.
AI-assisted. No game files.
rpf9dump names a pool's output folder after the source basename, so two pools with the same basename in one destination namespace shared a manifest and the second silently produced no DDS. Colliding pools now get a stable per-source export root; unique pools keep their existing folder and are not re-exported.
tools/wave64_halves.py classifies each wave64 VS/PS/GS by partition
invariance: A exact as translated, B exact by construction (waterfall loops,
wave-aggregated atomics up to slot order, readfirstlane/readlane of values
that are the same in every lane), C not exact (lane counts/ranks/ids,
readlane of varying data, stale scalars behind votes, masks as data, ...).
index.json gets wave64_graphics, wave64_graphics_reasons and
wave64_graphics_idioms; --wave64-graphics warn|error|off (error refuses
tier C). One rewrite: readlane of a proven-uniform VGPR reads the own copy.
--census prints tier counts from an index.json. ps_w64_* fixtures,
w64_graphics.py (fragment subgroup size required 64 vs 32) and semantic
tests; vk_harness gets VKH_HEAP_DUMP and a subgroup-size report.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MoltenVK can't compile PerVertexKHR to MSL, so ps_interp_f16_high failed at
pipeline creation on every Mac. With --f16-interp-fallback every VS/mesh param
(and the --mesh-compute VS) also exports its two f16 halves decoded to f32,
low halves at location 29 - 2N and high halves at 30 - 2N, and a PS *_f16 read
takes them as ordinary smooth inputs. A producer skips halves that would land
on its own params; a PS whose half location is also an attribute is rejected.
The index records f16_halves on both sides.
tools/vk_subgroup_info.py reports per_vertex_inputs (false without
fragmentShaderBarycentric or on MoltenVK); make_game.py and run_gpu_tests.py
turn the flag on where it is false. Without the flag all 139 GPU-test modules
are byte-identical to main's, so NVIDIA/AMD keep the exact per-vertex path.
Apple A18 Pro, macOS 26.6.2, MoltenVK 1.4.2: ps_interp_f16_high passes, all
4096 pixels bit-exact; run_gpu_tests.py 84 pass/50 skip/1 fail -> 85/50/0
native, 112/22/1 -> 113/22/0 with wave64 emulation; ms_f16_pack passes through
--mesh-compute. Semantic suite 1194 -> 1203 OK.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AI-assisted
decode_xma ran one ffmpeg at a time over every XMA2 stream. It now runs --jobs of them at once (the threads only
wait on their process). ex.map keeps the order, so the failures and the first one reported are the same as before.
Windows encodes a redirected stdout (make_game.py > build.log) with the console's ANSI code page, and
`python -I` ignores PYTHONUTF8, so when a found dump's path holds a character outside that code page (a
Cyrillic, Greek or CJK user name in the profile it sits under), print() raised UnicodeEncodeError and
--find / auto-discovery ended in a traceback. stderr escapes such characters (backslashreplace); stdout
was strict. cli() now reconfigures stdout with errors="replace", so the listing prints '?' where the
code page has no glyph. Interactive consoles already write Unicode and are unaffected.
The regression test runs the real `make_game.py --find` as a child process over a synthetic dump (empty
probe files with the manifest sizes, no game data) under a private-use character no ANSI code page maps:
fails before the fix on every Windows locale, passes after, and passes on UTF-8 systems either way.
ffmpeg reads stdin for key commands. Every ffmpeg call in tools/audio_wav.py
(audio_digest, decode) and make_game.py (decode_xma) inherited the caller's
stdin, so a run started in the background of a terminal stopped at its first
decode ("Stopped (tty output)"), and input piped to the caller was swallowed.
tests/test_audio_wav.py's own ffmpeg fixture calls did the same: in a
`while read` loop over tests/ with ffmpeg on PATH, they ate the next file
names and four test files were silently skipped.
Give every ffmpeg call stdin=subprocess.DEVNULL, and add fake-ffmpeg tests
that check each call reads nothing from stdin: the decode run and the resume
check of audio_wav.py, and make_game.decode_xma().
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GQWmXYJ1uVSCTNfvSjPMF7
find_dumps() built its roots from the home folder only. With OneDrive's Known
Folder Move, Explorer's Desktop and Documents are ~\OneDrive\Desktop and
~\OneDrive\Documents, two levels below the home root, so a copy kept in them
was never found and Build.bat fell back to asking for the folder.
On Windows, add the folders SHGetKnownFolderPath reports for Downloads,
Desktop and Documents (ctypes, standard library) to the search roots. Folders
that aren't moved are the same as the home-folder roots and are visited once.
default_out() is unchanged, so the port and its work folder never land in a
OneDrive-synced folder.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Opens the system folder dialog (tkinter, standard library), re-asks until the
folder is a supported version, and fails with a pointer to --game when Tk or a
display is missing or the dialog is cancelled. --pick and --game are exclusive.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AjctnXX86CYbSh3uZNaNy
- assets: awc_opus.py was started without --jobs, so with --jobs 1 the bank export still ran half the CPU count
of processes (audio_wav.py, the next step, did get it).
- runtime: with --runtime-build pointing at the output folder (a runtime build unpacked where the port goes),
shutil.copy2 raised SameFileError and the stage stopped before game_path.txt and the launcher were written.
A file that is already the destination is left as it is.
Tests: one in test_make_game_argparse.py and three in test_make_game_platform.py; one of each fails on the old
code.
CMake keeps the archiver and resource compiler given on the command line as
bare names (CMAKE_AR=llvm-lib-23), so a build folder configured from a
versioned set still needed those names on PATH: once a static library had to
be archived again, the runtime stage failed. The overrides are now the
resolved paths, so every entry in the cache is absolute.
CMake keeps a toolchain-chosen compiler in CMakeFiles/<version>/
CMakeCXXCompiler.cmake, not in CMakeCache.txt, so every runtime/build/windows
configured with the plain names went unrecognised: with only a versioned set
left on PATH, preflight passed and the build failed after the long stages.
Preflight now reads the configured tools from those files and requires each
to resolve, else it says to restore them or delete the folder.
The plain names win only when their clang-cl is 19 or newer, so an old default
no longer hides a complete newer versioned set. A mixed set names the missing
versioned tool. The overrides go to every configure until the folder records
its tools, which also covers a folder whose first configure failed.
Distributions that install LLVM as clang-cl-21, lld-link-21 and so on (Debian,
Ubuntu) were reported as having none of the five tools, so the runtime stage
was dropped or refused. Preflight now accepts the newest full set with one
version suffix and passes it to a new build folder as the toolchain's
CMAKE_<var> overrides (docs/testing.md). A runtime/build/windows whose cached
compiler still exists needs no tools on PATH: it keeps what it was configured
with.
- `translate()` takes `fallbacks` (the --no-float-controls/--bary-fallback/--texel-offset-fallback/--mesh-compute flags), keeps them in the shard plan, and passes them to every shard; shards finished under other flags restart.
- `shaders()` records the flags in spirv/translator_flags.txt like wave64_emulate.txt and re-translates when they change; `shader_outputs_reusable()` and `preflight()` count a folder with other flags as not reusable.
- New `--no-float-controls`, `--bary-fallback`, `--texel-offset-fallback` and `--mesh-compute` options; `fallback_flags()` maps them in a stable order.
- Tests: 13 new in tests/test_make_game_translator_flags.py (all 13 fail on main 426023a5 as the negative control); mocks in the resume/argparse suites take the new keyword.
python from the Python install manager (the WindowsApps alias) doesn't see folders other programs create under %LOCALAPPDATA% or %APPDATA%, so the old default made make_game.py report llvm-mc missing and the fuzzers stop with WinError 2 although LLVM_MC named the file. The default -Dest is now %USERPROFILE%\.leonida\llvm-mc, and the preflight explains an LLVM_MC that points into AppData.
Off Windows the runtime stage refused to run without --runtime-build. It now
cross-builds gta6rt.exe and gta6rt_tls_host.dll into runtime/build/windows
with runtime/cmake/clang-cl-xwin.cmake (XWIN_DIR, or ~/.local/share/xwin-sdk
as in docs/testing.md), then packages them with the Wine launcher as before.
Preflight lists what the cross-build lacks (cmake, the LLVM tools, clang-cl
older than 19, an xwin splat without VC/Tools/MSVC or Windows Kits um/x64)
and then configures it, so any toolchain error stops the run before the
shader stage. Without the tools the default stages still leave runtime out;
asking for it lists what is missing. The pipelines stage's vk_pipeline_check
is built natively into runtime/build/linux at the end of preflight, for the
same reason.
Record the llvm-mc command and version after successful disassembly. If either changes, refresh disassembly and SPIR-V translation while reusing the extracted shader inputs.
AI-assisted with Codex. Covered by synthetic LLVM version-change and interrupted-resume tests on Windows and WSL.
Keep the reserve for incomplete or stale outputs. Test a resumed build with 15 GiB free and check that translation mode and source changes still require space.
AI-assisted with Codex. Focused WSL tests: 161 passed, 1 skipped.
Ctrl+C anywhere printed a Python traceback, and end of input at the
"Which one?" or "Game folder:" prompt raised EOFError from choose_game.
The prompts now fail with the --game hint, and cli() reports Ctrl+C as
"Stopped. Run it again to continue where it left off." with exit 130.
(cherry picked from commit 31590baec6383c106e25435447d07e9647e71325)
Review of #905 (@poststructural), both findings:
1. xma.done is written with or without ffmpeg, and every run decodes the XMA2 streams that have no .wav
once ffmpeg is on PATH. A first build without ffmpeg followed by one with it would decode every stream
to 16-bit PCM while preflight counted 0 GB for the assets stage. assets_exported() now also requires,
when ffmpeg is on PATH, that no .xma.wav under assets/audio/xma is missing its .wav. The walk is
decode_xma()'s own, moved into pending_xma() and shared by both. Without ffmpeg nothing is decoded,
so undecoded streams don't count.
2. PreflightExportedAssetsSpaceTest faked tool_available but not dotnet_sdk_ok, so on a machine without a
.NET 8 SDK preflight stopped before the space check. run_preflight now fakes it, and fakes ffmpeg
explicitly, so the result doesn't depend on what the machine has installed.
Tested: tests/test_make_game_preflight.py 53/53 (4 new), and the class still passes with dotnet_sdk_ok
forced False. All test_make_game*.py pass; compileall clean. Negative control: on 7cf659a the new
ffmpeg test fails and pending_xma is missing. A real finished work folder (1,818 XMA2 streams, all
decoded, ffmpeg on PATH) still reads as exported. CPU only, no game files. AI-assisted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A rerun with the default stages (for example after a translator update) refused to start on a drive that
had already held a full build: preflight asked for 30 + 300 GB free although the asset exports were
complete and their space was already in use. The assets stage then skips every finished step anyway.
preflight now leaves the assets stage out of the sum when both of its audio markers (ogg.done, then
xma.done, the last one assets() writes) hold what mark() wrote. A fresh work folder, a stopped export or a
marker with other contents still needs the full 330 GB. --wav still counts it, because the WAV decode
writes several times the Ogg Opus size and has no marker of its own.
Tested: tests/test_make_game_preflight.py 49/49 (7 new), all test_make_game*.py 165/165, compileall
clean. The new tests fail on main without the change. Checked against a real finished work folder: the
assets markers are read as finished and preflight passes for shaders + assets with 223 GB free. CPU only,
no game files. AI-assisted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>