Commit Graph

17 Commits

Author SHA1 Message Date
d1d30cef24 Test case-variant output names in both RBF0 report commands
Run each CLI with unused paths on the filesystem under test. A folding volume must reject the colliding names before publishing; a case-sensitive one must accept separate reports. AI-assisted.
2026-11-24 22:00:19 +01:00
3f20d0ff06 rbf0_tree: both error lines name the path as typed, not through repr() (EGEN-RBF0TREE-PATHREPR) (#6690)
Squash-merged after diff review of PR #6690
2026-11-23 10:56:26 -06:00
cb168f4647 rbf0_tree: identify source files in the flat node CSV (#6886)
Squash-merged after diff review of PR #6886 - rbf0_tree: identify source files in the flat node CSV
2026-11-23 09:44:43 -06:00
4c4cb16bbf Merge pull request #4516 from bobcatchris
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:15:28 -05:00
d79bf5c500 Fix read-only temp cleanup in staged report writers
bvh_index, navmesh_index and rbf0_tree give the staging file the destination mode before os.replace. On Windows a read-only destination makes the replace fail and leaves a temp that cannot be unlinked. Restore 0600 in the failure path before unlink, and add regressions that pin the mode reset, old bytes and no leftovers.
2026-11-22 20:00:30 -06:00
35cf9915cb rbf0_tree: refuse out, --csv or --xml over the streams of a carve folder
The overwrite check only ran when the source was a single file. With a carve folder as the
source:
- out or --csv naming one of its streams replaced that stream with the report;
- --xml on the folder itself wrote the XML files among the streams, and the next run read
  them as resources.
All three now stop with one argparse error (exit 2) before anything is decoded. Reports
beside the streams (.json, .csv) and an --xml sub-folder are still allowed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 02:32:00 +01:00
d694ae38b5 Merge pull request #2265 from Narek Shaghoyan 2026-11-22 11:43:35 -05:00
807ab1ba5e rbf0_tree: skip .json/.csv reports in directory mode and reject >64 KiB continuations 2026-11-22 16:30:39 +00:00
c4cc607367 fix(tools): preserve carriage returns in RBF0 XML text
XML parsers normalize literal carriage returns. Emit character references for them so text survives the export round trip.
2026-11-22 17:22:20 +01:00
e8562e3856 ttpf_mips scan, rbf0_tree: a report path can't overwrite an input
ttpf_mips scan wrote --json after reading every pool, without checking
the path: a pool given as --json (directly or found under a game folder)
was replaced by the report, and a directory or a missing folder ended in
a traceback before the report was printed. Now a --json that is a
directory or one of the pools is refused before the scan, the report is
printed first, its folder is created, and a write that still fails is
one "cannot write" line (exit 2).

rbf0_tree wrote out and --csv after the decode: either naming the source
file replaced it (write_json's atomic os.replace included), and out and
--csv on the same file kept only the CSV. Both are refused up front.

Same checks as navmesh_decode/bvh_index (same_report_path /
same_output_path). Synthetic pools and RBF0 blobs only, no game files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 16:39:06 +05:30
f8bd330108 rbf0_tree.py: the replaced report keeps its permission bits (review)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 06:41:13 +01:00
7ddb343992 rbf0_tree.py: carved files sharing an offset each decode, and a failed export keeps the old report
_rows() mapped each carve-folder file's offset to its path, so two files with
the same leading hex offset (000000000100-left.bin, -right.bin) both read the
last one. Rows now read the file they were built from.

write_json() opened the report for writing before serializing, so a tree too
deep to serialize (RecursionError) left the previous report truncated. The
JSON is written to a temporary file in the same folder and renamed in; a too
deep tree or an unwritable output is one line on stderr, exit 1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 06:35:25 +01:00
bfbe90e561 rbf0_tree: validate selectors in the callable decoder 2026-11-22 00:45:42 +01:00
5800d0ec69 rbf0_tree.py: validate requested limits and offsets before decoding 2026-11-22 00:23:40 +01:00
2992956624 rbf0_tree: record child counts, add CSV rows and tree-shape summary
Each element now carries attrs_actual, children and content_count. The JSON summary reports the measured depth and child-count histograms, leaf/empty/text-only counts and parent-child edges. --csv writes one flat row per node with parent, slot and sibling columns. Tests cover sibling order, malformed close tags against the flat parser, tree-shape summary and CSV output. The docs replace the game-name sample trees with aggregate tree shape and a synthetic example.
2026-11-21 21:30:42 +00:00
bd7cd27e56 rbf0_tree: keep string bytes, overwrite XML on rerun
Preserve a trailing NUL byte in a length-prefixed string instead of treating it as a terminator, overwrite per-resource XML files on a rerun rather than adding -0000 duplicates, and reject a source with no RBF0 start. Add tests for trailing NUL strings, non-finite floats and XML reruns.
2026-11-21 21:23:49 +00:00
d50ba56650 Tools: decode RBF0 trees for UI and subtitles
Add a stdlib record/tree decoder for the measured RBF0 format. It joins 64 KiB continuations, parses the inline descriptor table, builds element/attribute/content/text trees, and writes JSON plus optional generic XML. Unknown descriptors, record types and malformed framing fail closed with a partial tree. Add synthetic tests and the measured grammar, samples and remaining unknowns to docs/rbf0.md; note the rig-set blob tree result in docs/animation.md.
2026-11-21 21:01:14 +00:00