Commit Graph

38 Commits

Author SHA1 Message Date
383156b0f5 Merge pull request #299 from AlxcBTW 2026-11-21 17:38:42 -05:00
e19df2b0d4 make_game.py: read vulkaninfo's subgroup size per device; vk_subgroup_info.py refuses 32-bit Python
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:31:41 +01:00
b946e90ba2 make_game.py: wave64 mode survives a kill after the merge; auto keeps emulated shaders; stricter auto detection
- The mode file is written before the translation starts (index.json is absent
  then), not after it: a stop between the merge and the old write left an index
  with no mode, which counted as "off" and either re-translated hours of work
  or passed emulated shaders off as native.
- auto keeps shaders that were translated with emulation when this run would
  not emulate (a GPU asleep or hidden, vulkaninfo missing): they are exact on
  every GPU. An explicit --wave64-emulate off still translates natively.
- auto turns emulation on when tools/vk_subgroup_info.py says the runtime's GPU
  can't be made to run compute and mesh 64-wide (subgroupSizeControl, both stage
  bits: vk_pipeline_check's can_require_sg); it never turns it off.
- smallest_max_subgroup gives None (unknown, so on) when a device prints no
  subgroup size instead of leaving it out of the minimum.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:20:19 +01:00
c1686b84e0 Merge pull request #223 from Alex Collini 2026-11-21 17:07:38 -05:00
5a7d97f8ad Merge pull request #236 from intelshadow 2026-11-21 17:07:36 -05:00
e5026783ac Merge pull request #231 from mrb-eel 2026-11-21 17:07:36 -05:00
c73e25f4b7 make_game.py on Linux: leave the Windows-only runtime stage out by default, refuse it up front, find the Linux vk_pipeline_check
- Without --stages, runtime (Windows only for now) is left out off Windows.
  Before, the default build ran shaders and assets (hours) and then failed
  in runtime, so pipelines never ran.
- Asked for explicitly off Windows, preflight() refuses it before any work.
- pipelines finds vk_pipeline_check where CMake builds it off Windows
  (runtime/build/linux as in the README, or runtime/build as in
  CONTRIBUTING.md) instead of only vk_pipeline_check.exe, and says how to
  build it when it is missing. Windows is unchanged.
- tests/test_make_game_platform.py (9 tests, 6 fail before this change);
  test_make_game_preflight.py's all-tools test asks for runtime only on
  Windows, since it is now refused elsewhere.

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 22:48:41 +01:00
4aab723e34 Fix build destination checks through directory links 2026-11-21 22:43:06 +01:00
6ae2755f29 Merge pull request #205 from Parakeet-Wheat
# Conflicts:
#	make_game.py
#	tests/test_shader_stage_resume.py
2026-11-21 16:38:11 -05:00
0a57596c88 Translator: accept LLVM 23's 0x80 in unused VOP3 source fields; check for a .NET SDK, not just dotnet
LLVM 23 prints a VOP3/VOP3P source it doesn't read (SRC1/SRC2 of one- and
two-source ops) as 0x80, inline constant 0, where the game's compiler stores 0.
Re-anchoring in shaders with code-embedded data compares the printed encoding
with the blob, so those instructions never matched and 1,471 of the 1,473 such
shaders were rejected ("reachable instruction with normalized encoding").
same_encoding now ignores an SRC1/SRC2 field only when it is 0 in the blob and
0x80 as printed; a source LLVM does read prints as decoded (s0), so a real
difference still fails. The existing VOP3P op_sel_hi rule now combines with it.

make_game.py: `dotnet` is on PATH with only the .NET runtime, and the asset
stage then fails in `dotnet build` ("No .NET SDKs were found"). The preflight
now asks `dotnet --list-sdks` for an SDK 8 or newer.

Tested on Windows 11, LLVM 23.1.5 (MSYS2 UCRT64 llvm-tools), the 1,473
shaders with embedded data, disassembled with this branch's shader_disasm.py:
  main:        2 translated, 1471 "normalized encoding"
  this branch: 1473 translated, 1473 pass spirv-val
Full corpus on the earlier tree with the same rule: 26,503/26,503 pass.
.NET check: false with only the runtime installed, true after adding SDK 8.0.428.
No GPU pipeline run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013qV4hmKSJmU6cXAgrehZzr
2026-11-21 22:36:07 +01:00
8a7e2da5c6 Shader stage: keep work folders built before disasm.done (no full re-disassembly and re-translation)
Since 7cc6068 (#126) the disassembly counts as finished only by disasm.done.
Work folders built before it have none, so their next build disassembled
the whole corpus again and, as that drops spirv/index.json, translated it
all again too: hours of work on a build that was already finished.

- A folder whose translation finished (spirv/index.json) but has no
  disasm.done gets the marker: translation only ever ran after disassembly.
- The disasm moved from its old place next to the carve folder is marked
  finished, so it is translated again as intended, not disassembled again.

Two tests in tests/test_shader_stage_resume.py; both fail before this change.

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 22:28:37 +01:00
6f6ffffa8d make_game.py: --wave64-emulate auto|on|off, on for GPUs without 64-wide subgroups (SHADER-11)
#152 added rdna2spirv.py --wave64-emulate (wave64 compute and mesh shaders exact on any
subgroup size), but the build never passed it, so 32-wide GPUs (NVIDIA, Intel) got the
native translation.

- auto (default) reads the smallest maxSubgroupSize from vulkaninfo and turns emulation on
  below 64, or when vulkaninfo is missing or tells nothing (the emulated output is exact
  everywhere). on and off are taken as given.
- The mode used is written to spirv/wave64_emulate.txt; a change translates again. A folder
  without the file counts as off, which is how it was made.
- translate() passes the flag to every shard.
- Tests: tests/test_make_game_wave64.py (new), resume and argparse tests extended.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 08:24:30 +11:00
5026d36f9c Merge pull request #184 from Mokbul Miah 2026-11-21 16:08:07 -05:00
a0611c9fef Merge pull request #177 from simonbronk 2026-11-21 16:08:07 -05:00
66a410edf0 Accept LLVM_MC as a whole command in the tests and GPU tools
LLVM_MC may be one executable or a command line such as the WSL llvm-mc documented for Windows. shader_disasm.py already split it, but the tests, runtime/test/shaders/build.py and scripts/run_gpu_tests.py treated it as a single executable, so the documented setup skipped translator tests, and build.py passed a Windows path to WSL. Share the splitter in tools/mc_command.py and feed assembly on stdin.
2026-11-21 21:00:03 +00:00
95b2c091c8 Build a native Windows llvm-mc with the AMDGPU target, no WSL needed
scripts/build_llvm_mc.ps1 sparse-clones the LLVM sources llvm-mc needs,
builds it alone with LLVM_TARGETS_TO_BUILD=AMDGPU, static CRT and the DIA
SDK off (its headers need ATL, which the C++ build tools don't always
include), checks it disassembles an s_endpgm for gfx1013, keeps only
llvm-mc.exe and sets LLVM_MC for the user. README, docs/design.md and the
make_game.py / shader_disasm.py hints mention it next to the WSL route.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 21:50:01 +01:00
e149b42875 Merge pull request #153 from NWX10 2026-11-21 15:47:56 -05:00
b7db55a428 make_game.py: reject --jobs below 1, compare the game folder without case on Windows
- --jobs 0 (or a negative count) was accepted: translate() then started no
  rdna2spirv.py shard, found no failed shard, and ran --merge over nothing,
  so the translation step looked finished; shader_disasm.py's thread pool
  raises on 0 workers. --jobs now takes a positive integer (the same check
  as tools/manifest.py's positive_int); argparse exits 2 otherwise.
- The "--out and --work must be outside the game folder" check compared
  paths with case, so on Windows `--out c:\games\gta6\out` passed for the
  game folder C:\Games\GTA6. Both sides now go through os.path.normcase.
- tests: two new cases in test_make_game_argparse.py (the case test runs
  on Windows only, where paths compare without case).

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:32:11 +03:00
0a65e6a2ba Merge pull request #136 from NWX10
# Conflicts:
#	tools/fssm_unpack.py
2026-11-21 15:17:51 -05:00
eb85039a58 Assets stage: resume stopped audio steps, keep no partial files, retry failed XMA decodes
The audio steps had the same resume problem as the shader stage (#126):

- make_game.py: the Ogg Opus and XMA2 steps counted as done once their
  folder existed, which a stopped run also leaves. They now count as done
  by a marker (audio/ogg.done, audio/xma.done) written after the step
  succeeds.
- make_game.py: XMA2 -> WAV with ffmpeg now runs on every assets run for
  the streams that have no .wav yet, writes to a temporary name renamed on
  success, and checks ffmpeg's exit code. A failed or stopped decode no
  longer leaves a short .wav, and installing ffmpeg after the first run now
  decodes the streams instead of never trying again.
- awc_opus.py: .ogg/.wav files are written under a temporary name and
  renamed, so a stopped run or a full disk never leaves a truncated file.
  A read/write error (OSError) now fails the run (exit 1) so the step is
  retried; banks that do not parse are still skipped as before.
- tests: new tests/test_audio_stage_resume.py (10 tests, standard library
  only); WavValidationTest updated to set up the new markers.

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:17:32 +03:00
7cc6068ab6 Shader stage: resume only finished steps, Windows-safe carve names, clear error on empty unpack (fixes #126)
- make_game.py: a step counts as done only when the file it writes last
  exists (index.json, fssm_index.json, disasm.done, spirv/index.json),
  not when its folder exists or holds >=1000 files. Re-running a step
  drops the later steps' markers so they run again.
- shader_carve.py / fssm_unpack.py: write their index last, via a temp
  file and os.replace, so a stopped run never leaves one behind.
- shader_carve.py: file names are unique without case and Windows device
  names (CON, NUL, COM1...) get a "_" prefix; ~N suffixes never land on
  a real name.
- fssm_unpack.py: exit 1 with a clear message when nothing unpacks,
  before writing the index, instead of an IndexError.
- tests/test_shader_stage_resume.py: 13 tests, standard library only.

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:00:32 +03:00
232f24270d Merge pull request #103 from shizikaep-prog 2026-11-21 14:40:12 -05:00
db2d31d3b8 Translator: --no-asm drops the .spvasm text; make_game uses it (saves ~35 GB on the full corpus)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 14:39:45 -05:00
3008b3fd0d fix: initialize submodules in linked Git worktrees 2026-11-21 22:09:32 +03:00
693cc4f841 Merge pull request #17 from Kam471 2026-11-21 11:46:52 -05:00
cb33aa7591 Merge pull request #6 from Adrià 2026-11-21 11:46:52 -05:00
8d19580169 Merge pull request #16 from Kam471 2026-11-21 11:46:52 -05:00
f247d8aac0 Audio: gate --wav preflight on assets; add audio_wav regression test
Only require ffmpeg when the assets stage will run, so --wav with shaders/runtime only is not blocked. Add tests/test_audio_wav.py: standard-library unittest, skipped without ffmpeg, pinning a 1 s Ogg Opus to an exact 48,000-frame 16-bit mono 48 kHz WAV and checking resume and missing-ffmpeg behaviour.
2026-11-21 16:12:07 +00:00
fe12b10c8c Audio: decode the Ogg Opus streams to PCM WAV on request
Add tools/audio_wav.py (stdlib only): recursive .ogg/.opus discovery, ffmpeg to pcm_s16le, mirrored paths, skip existing, --jobs, clear summary, and a clear error when ffmpeg is missing. It trims to the Ogg Opus end granule (minus pre-skip) so ffmpeg cannot keep a partial final frame. Wire it into make_game.py behind --wav, after the Ogg Opus step, with an ffmpeg preflight. Update README and the awc_opus docstring.
2026-11-21 16:05:51 +00:00
e64ab9d3cc Shaders: fail when llvm-mc can't disassemble; accept a WSL command in LLVM_MC
The official Windows LLVM build ships no llvm-mc.exe and has no AMDGPU
target, which is what issue #7 ran into. A tool that existed but could
not disassemble produced empty output, so shader_disasm.py counted 0
invalid words, wrote an empty .s per shader and reported every one as
"clean"; make_game.py then translated nothing.

Probe one s_endpgm before the run and stop with the tool's own error.
Empty per-shader output is now "failed" and exits 1, never "clean".
LLVM_MC may be a whole command line, so Windows can call WSL's llvm-mc:

    set LLVM_MC=wsl -d Ubuntu -e /usr/lib/llvm-21/bin/llvm-mc

make_game.py accepts the same form in preflight and need(); README and
design.md now state the real requirement. New tests cover a missing
tool, a missing AMDGPU target, empty output and the success path.
2026-11-21 15:39:35 +00:00
9c09deeaab make_game: keep disasm/ inside the carve folder so the translator finds each shader's stage
rdna2spirv.py reads index.json, the .dxbc files and fssm/ from the parent of the
.s folder. With disasm/ next to dxbc/, 25,040 of 26,503 shaders got stage '?' and
were rejected. Old work folders get disasm/ moved in and spirv/ redone.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-21 14:02:45 +01:00
55fa9055c9 make_game: translate shaders on --jobs processes with rdna2spirv's --shard/--merge
rdna2spirv.py already shards; make_game.py ran it as a single process. Start one
--shard per job, fail if any shard fails, then --merge. On 1,200 shaders: 3m43s
on one process, 58s on 6, byte-identical .spv and index.json.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-21 14:02:45 +01:00
1da3c7d2aa Audio: XMA2 streams via rpf9dump xma + ffmpeg (all 1,818 decode)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 22:32:47 -05:00
a16d58e58e Audio: awc_opus.py repackages AWC Opus streams losslessly as Ogg Opus (end-trimmed); make_game runs it
300 random streams decode with ffmpeg with no errors and match their declared lengths.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 22:27:18 -05:00
250e9ffd77 Build: GPU test tools and vk_pipeline_check in CMake; make_game pipelines stage saves a driver pipeline cache
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 22:20:53 -05:00
c87bf2b5ca Assets: texture pools inside pack/*/data/ttdb; final export counts; drop one-off dump script
make_game.py found only data/ttdb pools; 11 more live in pack/<name>/data/ttdb and now go to
ttpf_pack/<pack>/. All 57 pools exported (308,895 textures, 0 failures) and 160,898 models.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 19:44:30 -05:00
53bee95d32 Find the user's copy automatically; Build.bat; prerequisite and disk preflight
make_game.py no longer needs --game: it looks for a supported copy in the usual
places (by a few file sizes only), asks when there are several or none, checks
every prerequisite and free space before a long build, and fetches the
rpf9-explorer submodule when git is available. Build.bat runs it by double-click.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 16:43:22 -05:00
db0dc8bd5e Initial commit: Leonida, build-it-yourself PC port groundwork
Shader pipeline (carve, FSSM unpack, gfx1013 disassembly, RDNA2 to SPIR-V),
asset export via rpf9-explorer's Core (submodule), PE loader and shim
skeleton, and make_game.py, which builds from the user's own copy of the game.
No game data, keys or executables are included.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 15:22:16 -05:00