Commit Graph

22 Commits

Author SHA1 Message Date
9f0c75b909 docs: document tools/gbuffer_census.py in gbuffer.md and tools/classify_carve.py in rpf.md (DOC-GBUFFER-AND-RPF-TOOLS) 2026-11-25 21:18:09 +05:30
3faaeb8e0b Merge main 2d3369a4 into #4035
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-23 04:54:23 +01:00
8851927aff bink_index: only an RPF9 header with a +12 that is a multiple of 16 declares a trailer
Review nits on #4035: the '?FPR' check still gives the data start for any RPF header, but +12 is a
measured trailer size only on RPF9, where it is a multiple of 16 in all 22 archives.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 03:24:47 +01:00
93cb49a099 rpf: review nits; the ImHex pattern names +12 trailer_size
movies.md says the bink_index counts for movies.rpf are derived, not a rerun, and names the 8 undecided
archives; rpf.md's small-block entropy wording; bink_index drops a redundant max().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 00:02:12 +01:00
03a3558ef4 rpf: the last u32 +12 bytes of an RPF9 are a trailer; movies.rpf's 22,812 tail bytes are zeros plus it (ASSET-318)
In movies.rpf the 22,812 bytes after the last Bink stream are 3,884 zeros up to a 4 KiB boundary and then
exactly the header's u32 +12 (18,928) bytes to EOF. Over the package's 22 RPF9 archives the same holds in 14
(10 page-aligned after zero padding, 4 found by walking 16-byte-aligned zlib streams to the end); the other 8
end in a non-zlib file and can't be checked without the TOC. None contradicts it. bink_index.py counts the
trailer as rpf_trailer instead of unread.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:57:08 +01:00
4b665196cf Merge pull request #3767 from Lucy 2026-11-22 17:03:37 -05:00
9c86acff63 docs/rpf.md: whole-package name coverage as reported in #1790 (PROC-186)
Folds #1790's 22-archive run into rpf.md: 177,087 of 1,489,677 streams named (11.89%), coverage by stream
type, and its three findings (paths come from the payload, stream alignment differs per archive, anim.rpf
is the richest). Marked as reported there, not re-run; no paths or names copied.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 21:30:46 +00:00
73bd50e269 Merge pull request #2726 from Rafael 2026-11-22 15:11:30 -05:00
cb76dfbafe Merge pull request #2377 from Kam471
# Conflicts:
#	docs/related_projects.md
2026-11-22 13:14:24 -05:00
9db658dc43 docs/rpf.md: rpf9_carve checks gaps in 1 MiB pieces since #2117; the other eight use zero_span
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:09:35 -03:00
f206d479a6 tools: classify the gap between streams without copying it
Nine archive scanners sliced every gap out of the mmap to test whether it
was all zero (`gap = m[last:s]; gap.count(0) == len(gap)`). The slice is a
copy, so a gap of N bytes allocated N bytes at once; about half of
story000.rpf (~20 GB) is non-zlib, which ends in MemoryError on a 16 GB
machine.

tools/zero_span.py compares the gap with zeros 4 MiB at a time and stops at
the first non-zero window, with the same counts (all of a gap is padding
when every byte is zero, otherwise all of it is unread). rpf9_carve,
rpf9_names, bvh_index, navmesh_index, navmesh_decode, rbf0_index,
anim_index, restofworld_index and story_index use it.

tests/test_zero_span.py checks the counts against the old expression and
runs each scanner on a 48 MiB gap under tracemalloc: 50-51 MiB heap peak
on main, under 24 MiB with this change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:07:15 -03:00
9c159e8285 docs: record the 6stars format facts that reproduce
Re-measured against the local package: the RPF9 stream boundary that ends a system prefix (and the negative on the 8 MiB rule), the PRD0 member type codes, and the navmesh polygon +4 packing. The navmesh road/pavement bit labels did not reproduce and are recorded as such. 6stars is cited as independent corroboration; no code was copied and the repository has no licence.
2026-11-22 16:48:48 +00:00
1538abe44d rpf9_carve: list each unread range with its offset, size and entropy
docs/rpf.md said unread bytes "are recorded as a range", but the carve
only wrote the totals. The gap accounting, repeated before a Bink
stream, before a zlib stream and for the tail, moves into one helper.
It also appends every gap that is not all zero bytes to a top-level
`unread` list in index.json: off, size, and the Shannon entropy in
bits/byte of its first 1 MiB (`sampled`). summary.unread_ranges is the
count. Totals are unchanged; zero padding is not listed.

Measured on data.rpf: the same 20,268,240 unread bytes are 377 ranges;
278 of them (18,257,882 bytes, 90%) are at 7.5 bits/byte or more.
Counts only, in docs/rpf.md.

tests/test_rpf9_carve.py: ranges match the layout and the totals, a
uniform gap has entropy 0, a mostly-zero gap is one range, all-zero
gaps list nothing, and a range over 1 MiB samples its first MiB.
2026-11-22 13:01:32 -03:00
60c624ec9b tools/imhex: ImHex patterns for the RPF9 header and RBF0 records
rpf9.hexpat names the measured header fields (magic, data offset at +4;
the u32s at +8 and +12 unnamed) and shows the rest of the header and the
TOC as one opaque range; it decodes nothing there. rbf0.hexpat follows
the grammar in docs/rbf0.md section 3: 1-byte descriptor index and type,
all record types including 0x50, 8- or 4-byte values from the prologue,
and it stops where the root closes, as rbf0_index.parse_rbf0 does.

tests/test_imhex_patterns.py builds synthetic wide and narrow RBF0
streams and RPF9 headers, checks them with parse_rbf0, and when ImHex
is installed runs each pattern through `imhex --pl format -f json` and
compares the result with the parser's.
2026-11-22 11:07:12 -03:00
f3c2158d8a Merge pull request #342 from Kam471 2026-11-21 18:37:56 -05:00
5b8dd6854b Tools: index named RPF9 resources without the TOC 2026-11-21 23:11:56 +00:00
fe8cd6bc72 Tools: reject out-of-range --start/--limit in RPF index tools
Adds the #283 argparse validators to anim_index, rbf0_index, restofworld_index and rpf9_carve: --start >= 0, --limit >= 1 (decimal or 0x hex), and --max-inflate >= 1 in restofworld_index. Bad ranges now exit 2 before any scan or output instead of silently scanning everything, less, or nothing. Synthetic CLI tests in all four test files; docs notes for each tool.

New item claimed in #156. AI-assisted (OpenCode).
2026-11-21 16:53:41 -06:00
d3f69013c1 Docs: measure rest-of-world and script archive composition
Add the full core_restofworld scan (1.21 GiB, 96% Bink 2 plus model/page data), re-measure story000_restofworld and story000_script, and cover the three small archives. Cross-check PSIN against script.rpf/story000 and core pages/models against packs.rpf/levels.rpf. Add a stdlib-only stream index tool and synthetic-header tests. No game data.
2026-11-21 20:30:47 +00:00
94746381a3 Merge pull request #124 from Kam471
# Conflicts:
#	docs/rpf.md
2026-11-21 15:17:50 -05:00
950e599577 Docs: decode the RPF9 0DRP page directory
Measure the 0x60-byte header, the +0x38 table of {hash,size,pointer} resource records, and continuation streams. Correct the +0x60 key claim: it is payload on 29,297 of 29,298 pages. Add a stdlib page indexer with synthetic tests.
2026-11-21 19:56:46 +00:00
ec1dbca94f Docs: measure story and minigame archive composition
Index story000, shared_minigame000, and their script/restofworld/bvh4 companions with the fixed carver. Record the measured PSIN section chain, 0DRP page headers, RSC8 v8001 headers, nested RPF9 sub-archives, Bink 2 video and the bounded story000 layout. Add a stdlib story_index.py and synthetic-header tests; no game payload or name is committed.
2026-11-21 19:46:43 +00:00
eb7c304893 Docs: RPF9 archive and carve-tool guide 2026-11-21 18:46:38 +00:00