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.
A carve folder with its own index.json (<work>/carve/common, the folder the
gamedata_* tools take) matched no <carve>/<archive>/index.json, so the run
printed "0 strings -> 0 hashes" and exited 0. Treat such a folder as that one
archive; the --out-is-an-input check covers its index.json too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The dictionary is written after the harvest, so `--out` naming an `--extra`
file or a carve folder's `index.json` replaced that input. Refuse it before
scanning with one ERROR line; os.path.samefile also catches a case-only
difference on Windows and macOS. Synthetic regression test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
Closes unmanaged open() calls in tools/tex_export.py, tools/tex_mode_probe.py,
tools/shader_disasm.py, tools/hashdict.py, and tools/d3d12_xs_surface.py to avoid
leaking file descriptors and ResourceWarning under Python 3.12+. Expands
tests/test_resource_hygiene.py to cover these tools.
The harvest pattern ended a match after 201 characters and the next match
started in the middle of the same run, so a truncated prefix and a fragment
were added as names and the path component across the cut was lost. The
whole run is matched now and split into its parts as before; a run or a
part longer than 201 characters is not added as a name, which keeps the
longest entry the dictionary could ever hold. Parts are found one at a time,
so a very long run does not build a list of all of them.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
--lookup called .get on whatever the dictionary file held, so a JSON array ended in an AttributeError; the build
read each <carve>/<archive>/index.json with a bare json.load(f)["files"], so a malformed one aborted the run with a
traceback after earlier archives were processed. Both now print one ERROR line naming the file and exit 2.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A missing or non-folder carve ended in a traceback from os.listdir. A
carved .bin that an index.json lists but that is gone from disk stopped
the whole build with FileNotFoundError, so a long harvest wrote no
dictionary at all. --lookup died on a value that isn't hex, after
printing the values before it, and on a missing or broken dictionary.
The carve folder is now checked first (exit 2, one line). A listed blob
that can't be read is skipped, counted and named in one warning, and
the dictionary is still written from everything else. --lookup checks
every value before it prints anything (a usage error, exit 2) and
names a dictionary it can't read.
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>