Repository navigation
Conversation
kacper-serewis
left a comment
There was a problem hiding this comment.
AI-assisted independent Windows CPU review at a53af80. For a synthetic 32 MiB sparse Bink file, Python read 256 bytes on head versus 33,554,432 on the parent. Both reported the full stored size. Peak traced Python allocation for the three-file scan fell from 33,567,637 to 14,740 bytes. A 1,268-byte PSIN named .bk2 triggered a full reread and retained its classification. Its .bin counterpart retained its indexed 37-byte stored size. Report rows and summary fields matched apart from elapsed time.
|
Verified the bounded read on all 18 retail Bink videos in the two rest-of-world archives from Xbox 1.0.2.1 (11 core, 7 story). I carved each video with the stock carver and indexed the folder twice, with its carve manifest and then without it. Across all 36 comparisons, the parent and The largest video was 202,419,276 bytes. Across the 36 isolated folder scans, peak Python allocation measured with |
Kam471
left a comment
There was a problem hiding this comment.
Review at head a53af8080 (Windows 11, synthetic inputs).
Commands:
python -I -m pytest tests/test_restofworld_index_memory.py tests/test_restofworld_index.py -q
git diff --check 3faac557b..HEAD
Results: 36 passed, 4 subtests; diff --check clean.
The bounded path reads 256 bytes, and classify needs at most data[:0x20] for the KB2 branch, so the header probe is sufficient. Only signature == "bink2" keeps the short read (with size=stored set to the full length, matching archive mode); every other .bk2 rewinds with f.seek(0) and follows the old full-payload path. .bin limits and classification are untouched.
Verdict: approve.
Why
Carved-folder indexing in tools/restofworld_index.py reads an entire .bk2 file into Python memory to produce a fixed-header report. Videos are intentionally exempt from --max-inflate, so large videos still require a file-sized allocation. Archive indexing already reads only a 256-byte header for the same report.
Claim: #5361 (comment)
Item ID: pending coordinator assignment.
Depends on: none.
Change
Probe the first 256 bytes of a .bk2 file and retain that bounded path only when the existing classifier returns bink2. Use the complete file length for the default stored-byte count, preserving any count supplied by the carve index. Other .bk2 contents rewind and follow the existing full-payload reader, preserving complete PSIN chains, texture scans and signature precedence. The .bin path and classification rules are unchanged.
Validation
Windows x64, Python 3.14.6, standard library, CPU only. All inputs were generated synthetically; no game files were accessed.
Interaction checks
The changed source merges cleanly with #3942 at a4c23fe, #5008 at 621c4c8 and #5135 at 038c794, individually and together. These change output-write errors, summary conversions and carve-index exception handling.
A local combination with those three source changes and exact #5372 f225fb3 passes 70 focused methods: the same 53 plus eight short-page and nine model-joiner methods. An additional actual-carver control confirms #5372 emits a compressed KB2-prefixed page as .bin and raw video as .bk2; this read change preserves the baseline index rows and counts for that inventory. Current #3793 and #4632 do not change tools/restofworld_index.py. No additional dependency is required.
AI-assisted: yes.