Commit Graph

113 Commits

Author SHA1 Message Date
754c9f9d25 Merge pull request #1804 from liang-kai-shui 2026-11-22 09:48:20 -05:00
b189efea55 Merge pull request #1758 from sovljanskii 2026-11-22 09:48:10 -05:00
00452cfaa3 Merge pull request #1615 from Ewann 2026-11-22 09:48:04 -05:00
b95bc8fac6 make_game: name an earlier ~/Documents/Leonida build when the Mac default moves
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.
2026-11-22 15:41:48 +01:00
ffcc9a4060 rdna2spirv: refuse an incomplete shard set at --merge
--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.
2026-11-22 22:39:13 +08:00
ec9b6cf22b tools: text reports are written with LF line ends on every platform (BUILD-468)
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.
2026-11-22 14:20:30 +00:00
2fc613a32a Merge pull request #1758 from sovljanskii 2026-11-22 09:15:07 -05:00
2ac20a6622 make_game: keep the default build folder out of iCloud-synced Documents on a Mac
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>
2026-11-22 14:57:09 +01:00
9eb822f2ff Merge pull request #1708 from Ash Hopkins 2026-11-22 08:38:37 -05:00
95a89a75d3 make_game: --wave64-emulate auto leaves emulation off on RDNA2 under the AMD Windows driver (#857)
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>
2026-11-22 14:15:04 +01:00
2af78ff42d make_game.py: a layered driver's nested deviceName is not another GPU
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.
2026-11-22 13:04:16 +00:00
baebfd3568 Merge pull request #1590 from anusara-bemal 2026-11-22 07:38:25 -05:00
114000eadc make_game: export both pools when texture basenames collide
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.
2026-11-22 17:59:51 +05:30
ce305ec6b3 Translator: wave64 VS/PS/GS on 32-wide subgroups when the halves can't tell (SHADER-10)
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>
2026-11-22 13:03:37 +01:00
ebef9057cb Merge pull request #1448 from EdouardSence 2026-11-22 06:38:06 -05:00
f4e0f706e1 Merge pull request #1407 from Hamza 2026-11-22 06:37:56 -05:00
1681f3dc1e Translator: --f16-interp-fallback reads f16 halves without PerVertexKHR (SHADER-196)
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
2026-11-22 14:32:28 +03:00
e5ab7e512e make_game: decode XMA2 streams with ffmpeg on --jobs threads
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.
2026-11-22 12:30:10 +01:00
302f925cc3 make_game: a redirected console must not kill --find on an un-encodable path
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.
2026-11-22 03:08:37 -08:00
34d3897553 Merge pull request #1356 from Claude 2026-11-22 05:37:54 -05:00
a2d89b0a40 Merge pull request #1351 from jakeefr 2026-11-22 05:37:53 -05:00
afbcfdb709 Merge pull request #1348 from Flyander 2026-11-22 05:37:52 -05:00
080cee9036 Merge pull request #1342 from ICUMADETHIS 2026-11-22 05:37:50 -05:00
1dba48b7b7 audio: start ffmpeg without the caller's stdin
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
2026-11-22 10:28:47 +00:00
8abf740a7e [TEST-192] Detect default 64-wide subgroup path 2026-11-22 11:27:17 +01:00
4b63e03b47 make_game: search the real Downloads, Desktop and Documents for the game
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>
2026-11-22 10:24:32 +00:00
3cf44713e9 make_game.py: add --pick to choose the game folder in a folder dialog
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
2026-11-22 12:12:50 +02:00
204989e9e7 make_game: --jobs reaches the Ogg Opus step; --runtime-build may be the output folder
- 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.
2026-11-22 10:00:48 +00:00
779aa4ae80 Merge pull request #1273 from Kevin Morales 2026-11-22 04:37:59 -05:00
a65a039cfd make_game.py: pass the versioned LLVM tools to CMake as full paths
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.
2026-11-22 02:36:02 -07:00
961792cd8e make_game.py: read the cross-build's tools from CMake's compiler files
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.
2026-11-22 02:34:50 -07:00
5e9f17c6b3 make_game.py: accept versioned LLVM tools for the Linux cross-build
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.
2026-11-22 02:27:17 -07:00
c91b571031 Merge origin/main into build/make-game-translator-flags
Keep both sides: preflight/main() take fallbacks and jobs; argparse mock
asserts fallbacks=() and jobs=6 together.
2026-11-22 01:23:07 -08:00
f5a073213f make_game: forward the translator's fallback flags and record them beside the translation
- `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.
2026-11-22 01:19:27 -08:00
cac87b289d Merge pull request #1233 from Nostyxx 2026-11-22 04:07:47 -05:00
342028959a build_llvm_mc: install llvm-mc outside AppData, where the install manager's python can see it
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.
2026-11-22 15:39:48 +07:00
273886db50 make_game.py: build the runtime stage on Linux with clang-cl and xwin
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.
2026-11-22 01:36:05 -07:00
8bcf5bb3e2 Merge pull request #1140 from wish131400 2026-11-22 03:14:12 -05:00
23fe0a0c3a Complete BCPack DDS entries during the normal assets export 2026-11-22 16:04:49 +08:00
d8e4df46ff Merge pull request #1090 from Samu3k 2026-11-22 02:09:03 -05:00
16e7591419 runtime: thunk deduplication, XGameRuntime shims, PE loader long paths, and drive-root packaging 2026-11-22 12:19:06 +05:30
e6373238dc Refresh shader disassembly when llvm-mc changes
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.
2026-11-22 07:39:12 +01:00
d7560e202f Skip shader disk reserve when outputs can be reused
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.
2026-11-22 07:38:50 +01:00
25c746aa3f make_game: Ctrl+C and end of input give one line, not a traceback
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)
2026-11-22 00:33:46 -05:00
a447eff1d2 Merge pull request #905 from Thatters 2026-11-22 00:33:06 -05:00
b7ec22e798 Merge pull request #890 from nicolas 2026-11-22 00:33:00 -05:00
91ba8e4795 make_game.py: count the assets space while ffmpeg still has XMA2 streams to decode; tests don't need a .NET SDK
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>
2026-11-22 00:03:11 -05:00
7cf659a7d6 make_game.py: preflight doesn't count the assets stage's 300 GB when its exports are already finished
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>
2026-11-21 23:51:09 -05:00
eb3bdb8b8e Merge pull request #640 from Proudnoob4 2026-11-21 23:15:24 -05:00
ed784a2300 Report incomplete texture pool exports and retry missing DDS files 2026-11-21 21:10:28 -07:00