Both tools joined a following stream only after an exactly 65,536-byte one, the rule #2129 fixed in
text_tables. A resource's first stream can be 128 or 192 KiB (docs/page_directory.md).
- gamedata_index: only the headed `other` branch (0DRP pages and the MAGIC kinds) now continues after
any nonzero multiple of 64 KiB. Binary, text and XML runs keep the exact rule, since nothing proves a
continuation there; applying the multiple rule to them too folded 26,284 payloads into 25,000.
- gamedata_maps: the join is already bounded by the header's declared size, so any whole number of
64 KiB blocks may continue.
Real data (counts only), data.rpf: 0DRP pages keep 15,768 payloads and gain the 50 continuation streams
(15,877 -> 15,927). Those 50 streams stop being separate payloads (43 `binary`, 7 `text`), so the
payloads go 26,284 -> 26,234; psin/rbf0 unchanged. gamedata_maps on two carves without heightmaps:
identical output.
Tests: test_a_resource_continues_after_any_whole_number_of_64k_blocks (a 128 KiB 0DRP page joins its
continuation, a 128 KiB binary run does not) and test_groups_a_continuation_after_a_128k_first_stream
(main: all fail).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
same_report_path was copied into ten tools, and each new "refuse an output that overwrites an input" change added
another copy or a variant. Four copies (anim_index, gamedata_index, gamedata_xml, navmesh_decode) also folded case and
accents on a case-insensitive macOS volume (through _path_key), the other six did not, so the same report pair was
refused by one tool and written by another.
tools/report_paths.py holds one version (the stricter one: realpath, normcase, case-folded NFD on a case-insensitive
volume, then os.path.samefile) and awc_manifest, gamedata_index, gamedata_xml, navmesh_index, rpf_probe, tile_probe
and world_names import it. The tools keep exposing the name same_report_path. On Windows and Linux nothing changes;
on macOS the five tools that lacked the case/accent step now refuse a case-only alias of a report that doesn't exist
yet, as the other five already did.
anim_index, navmesh_decode and world_lights_paths keep their copy for now because open pull requests edit them
(#2051, #2050, #2052, #2107); tests/test_report_paths.py fails if any other tool adds a copy.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SAjLH2L6R72dBvVaRG8hka
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 stream whose first 4 KiB are over 95% printable was classed as text, and as
XML when it held a "<". data.rpf has 337 resource streams with the 0DRP page
marker at +16 that pass that test, so the index reported 337 incomplete XML
documents in an archive that has none. Check the marker before the printable
heuristic and report such a stream as "other" with detail 0DRP.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
csv.writer and csv.DictWriter default to lineterminator="\r\n", and every
one of these tools opens its report with newline="", which turns that into
CRLF on Windows and LF elsewhere: the same archive gave different report
bytes depending on the machine that exported it. awc_manifest and awc_shorts
already pin "\n" and bink_index documents why its stdout writer needs it, so
this brings the remaining 16 writers onto the same convention. A structural
test keeps new writers on it, and three tools are run end to end to check the
bytes.
Generated with Codebuff 🤖
Co-Authored-By: Codebuff <noreply@codebuff.com>
bvh_index, anim_index, gamedata_xml, gamedata_index and navmesh_decode compare
two report paths with os.path.normcase, which folds case only on Windows. On
macOS's case-insensitive APFS volume `--out o/B.json --csv o/b.json` passed and
the CSV replaced the JSON. The comparison now folds case and Unicode
normalization when the volume that will hold the path is case-insensitive
(pathconf _PC_CASE_SENSITIVE); case-sensitive volumes keep two reports.
Same fix as world_index in #1576.
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>
--json/--csv pointing at an existing directory ended in a PermissionError
after the scan, while gamedata_xml (same contract, #1383) already rejects
it. Check it in the same guard block as the input aliases, before any
work, and cover both flags with tests.
--json and --csv opened their target after the scan, so a missing folder
ended the run in a FileNotFoundError and lost the result, and a path that
resolved to <carve>/index.json (or the target archive) replaced the input
with the report. Copy navmesh_decode.py's pattern: _make_parent() before
each write, and reject report paths that same_report_path() matches
against the target, <target>/index.json and --carve-dir/index.json.
New tests/test_gamedata_index_report_paths.py covers both missing-folder
writes, both input aliases, the csv/json same-path refusal and a normal
report; main's tool fails four of the six as the negative control.
A missing target went to ArchiveSource and failed there; an empty or
short archive raised the RuntimeError the tool builds from
rpf9_carve.py's own message, but nothing caught it, so it surfaced as
a traceback; a carve folder without index.json, or with one that has
no "files" list, ended in FileNotFoundError / KeyError tracebacks.
main() now checks the target exists and prints each of these as one
line, exit 2, before --csv or --json is written.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Measure the XML/config layer of the 1.0.2.1 common.rpf: 954 zlib streams, 50.2 MB inflated, 266 XML documents across 118 roots with no RBF0, PSIN or Bink 2. Add a stdlib index tool and synthetic tests.