The output guard compared --dialogue/--tables/--strings only with the
named sources and a carve's index.json. blobs() also reads every file
below a plain source directory and every carved <offset>.bin/.bk2 beside
index.json, so `text_tables.py src --tables src/notes.txt` read the file
and then replaced it with the CSV (exit 0). Refuse such a report before
anything is written; carved streams go through gamedata_index's
carved_stream(). A new report inside a source directory is still allowed:
it is written after the scan, so it was never an input.
AI-assisted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
blobs() sorted the files of each folder but walked the subfolders in the
order os.walk lists them, which is the file system's: by name on NTFS, by
hash on ext4. The dialogue table keeps the last text read for a label
(docs/text.md, "Labels with two texts"), so the same folder of resources
gave a different text_en, and a different --tables/--strings row order,
on Windows and Linux. Sort the subfolders in place so the walk descends
in name order everywhere.
Tested: new test_subfolders_are_read_in_name_order with a walk that lists
subfolders backwards; it fails before the fix (b before a, the first
table's text wins) and passes after.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A string table with more than 1 MiB of text splits its blob into several
tag-0x10 descriptor entries. From the blob on, the descriptor is a run of
16-byte entries (u32 tag, u32 bytes, pointer). An index entry names its chunk
in the low bits of its second word (0b1cc, chunk = flags & 3). string_tables()
read every offset from the first chunk, so 293,292 strings in 23 data.rpf
tables came out with the wrong text and no error. story000.rpf and
shared_minigame000.rpf tables read the same as before.
docs/text.md documents the entries and the chunk bits, updates the
story000.rpf table count to what main reads today (15,951), and lists the
hash entries with byte +8 = 5/7/8 as an open question.
docs/text.md had "Language per table" open: the tables carry no
language field and each one's language was guessed from its text. In
data.rpf and story000.rpf every string table sits in one of 13 nested
RPF9 archives (9FPR at 4 KiB-aligned offsets), and each archive is one
language.
A table in a nested archive now takes the guess most of that archive's
tables share (xx left out), when it covers more than half of them;
otherwise, and outside nested archives, a table keeps its own guess.
Nested archives come from an .rpf source or from the archive an
rpf9_carve.py directory's index.json names. --tables gains `guess` (the
per-table guess) and `archive` (the nested archive's offset). Scan
keeps the guesses and resolves languages when tables or texts are read.
Measured (counts only): data.rpf 14,440 tables in 13 archives, 2,075
change; story000.rpf 15,831 tables in 13 of 436 nested archives, 849
change. xx, plain es and plain zh drop to 0 in both. Table in
docs/text.md.
tests: nested-archive detection, archive majority over strays and xx,
no majority keeps each guess, a carve directory end to end through its
index.json, and a source with no archive.
_chains joined the next stream only when the previous one was exactly BLOCK (65,536 bytes). But a
resource's first stream can be 128 or 192 KiB (docs/page_directory.md shows one ending at 0x20000 that
the next stream continues), and its string-table descriptors then end in the following stream. On my
1.0.2.1 copy, 41 data.rpf resources start with a 131,072- or 196,608-byte stream: 20 of their tables
were refused as out of range and 21 lost entries through the at + 8 > len(buf) skip. A stream now
continues a previous one whose size is a nonzero multiple of BLOCK.
Real data (counts only): data.rpf 14,440 -> 14,482 tables and 4,118,181 -> 4,197,518 strings, the same
from the archive and from an rpf9_carve folder; shared_minigame000.rpf unchanged (78 tables, 22,371
strings). docs/text.md updated.
Tests: test_resource_across_a_128k_first_stream and
test_whole_block_streams_continue_and_others_end_the_chain (main: the 128/192 KiB cases fail).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A failure in the replacement loop could leave a mixture of old and new CSVs (e.g. Windows WinError 5/32 when a reader holds an output open). Move every existing report to a private backup first, so a failure leaves them all untouched, then publish all staged files and drop the backups.
Reject output paths that resolve to the same file before writing anything. Write every CSV to a private file beside its destination, then replace them all only after the writes succeed, so a failed run keeps the previous reports. Preserve published file modes via file_mode.published_mode.
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>
- run_gpu_tests.py: #1541's wave64 pixel fixtures (runtime/test/shaders/w64_graphics.py FIXTURES, tiers A-C) are
checked by that runner; run_gpu_tests picked up their .asm and failed 14 of them with "no checker defined".
It now leaves w64_graphics.FIXTURES to that runner.
- d3d12_d24_support_test (#1493): expected DEPTH_STENCIL in FORMAT_SUPPORT for R24G8_TYPELESS. Measured here, the
host D3D12 (RTX 4060 Ti and WARP) reports 0x001010b0 for R24G8_TYPELESS and 0x003110b0 (DEPTH_STENCIL) only for
D24_UNORM_S8_UINT, which #1511's per-format rules follow; the check now expects the bit for the typed format only.
- fma_mix_probe, text_tables, wave64_halves, xdxr_bvh: new tools without #1428's stdout errors='replace' guard.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Text resources are 0DRP logical resources holding a joaat label hash table,
an index array and a UTF-8 string blob, located by a descriptor of
0x5xxxxxxx resource pointers. text_tables.py joins each 0DRP stream with
its 64 KiB continuations (carve directory or archive via gamedata_index, or
whole-resource files), decodes the tables, guesses each table's language
(script, distinctive letters, common words; es-ES/es-419 and
zh-Hant/zh-Hans by markers; xx when undecided), and joins conversation
key/label pairs (<key>_01.. waves) to their text in every language.
On 1.0.2.1: 30,349 tables / 7.17M strings; 118,351 dialogue keys and
138,104 lines, 88-93% with text per language. docs/text.md records the
format, the per-language conflict counts and the open questions.
Standard library only; tests are synthetic.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>