The corpus is 26,503 carved containers holding 26,698 tag-0x0D payloads:
195 vertex-shader containers carry two. fssm_unpack.py now prints both
counts and, given the carve index, a line per stage. shader_library.md
records the two counts and why 195 equals the geometry-shader count.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The FSSM header holds 0x88-byte hardware-stage records from 0x100; a record starts with
u64 0x000000C0_0002_AAHH (HH = PAL hardware stage, AA = API stage). tools/pal_stages.py
decodes them from a bare FSSM or from every tag-0x0D payload of a container, and reports
the sentinel words. tools/fssm_unpack.unpack_all() exposes the payloads the tool needs.
Measured on the 26,503-blob corpus: 26,308 blobs have one record and 195 (all GS) have
two, the second at 0x188 being the VS copy. The API id equals the carve-index stage in
26,698/26,698 blobs (0 VS, 1 PS, 2 GS, 3 CS, 6 MS). Hardware id 7 appears for all 9,282
mesh shaders and nowhere else; 2 appears only in the first payload of the 195 two-payload
VS containers. 860 blobs (1,055 records) fill unused fields with paired
0xDEADBEEFDEADBEEF qwords, never a lone 32-bit word; the other 25,643 records use zeros.
Tests: tests/test_pal_stages.py (synthetic FSSM and container), plus the fssm_unpack,
fssm_crosscheck, fssm_header, fssm_wave_size, make_game and shader-stage suites.
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.
On Windows a redirected stdout uses the console's ANSI code page, and python -I ignores PYTHONUTF8 and
PYTHONIOENCODING, so a caller path with a character outside that code page ended a run with
UnicodeEncodeError as soon as a tool printed it. #1406 fixed make_game.py; every CLI tool in tools/ now starts
its __main__ block the same way (stdout errors="replace").
tests/test_tool_stdout_encoding.py checks every tool's __main__ block and reruns two measured crashes
(analyze_4240_full.py, meshlet_page.py) with a private-use-named input. Found by @abilliontokens.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Validate XBCH stored size, cap output by the declared FSSM length, and reject truncated or trailing zlib data. Add synthetic regression coverage for the declared-size ceiling and malformed streams.
Addresses BUILD-342 claimed in #1218.
unpack() checked the decompressed payload's size and that it holds at least a
magic and version, but not the magic itself, so a payload starting "JUNK" was
written as a .fssm and indexed. It is now a ValueError, counted with the
other per-file problems.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main() made <src>/fssm before it listed <src>, so a mistyped source
folder was created, whole path included, and the run then ended with
"no shader unpacked" as if the folder were real. A file given as the
source ended in a NotADirectoryError traceback, and a folder that can't
be listed in a PermissionError one. The source is now checked first: a
missing path, a file or an unlistable folder prints one line naming it
to stderr and exits 2, and nothing is written.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- 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>
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>