Both output guards compared paths with a private `same_output_path`, a second derivation of `report_paths.same_report_path` that CONTRIBUTING.md asks a report writer to call, and one that missed the helper's folding-volume probe (vfat/exFAT/CIFS).
After the merge the tree held this branch's older states of files main maintains. Run against main's code,
tests/test_acphal_abi.py and 11 of the 15 translator tests that differed failed, and the C++ runtime would have
been built from two generations of its sources. So that the merge cannot break what main builds and tests:
- runtime/ is main's, file for file (68 files only this branch had are not carried over);
- every file under tools/, tests/ and docs/ that both sides have is main's (80 files);
- ten translator tests only this branch has, which test rules main's translator does not have, and their
fixtures are left out.
What main gains: d3d12/ (the Rust D3D12 runtime), its launchers and helpers (Launcher.bat, scripts/play*.ps1,
play-linux.sh, port_ctl.py, smooth-motion.ps1, fetch_vkd3d_proton.py, sync_victory.py), mods/example_lua, eleven
notes under docs/, seven tools and the tests that pass with main's code, the README's sections and credits, and
the "Runtime traps" section of AGENTS.md. Everything left out here is on the branch port/d3d12-nvidia.
Checked: compileall; make_game.py --help; check_no_game_data.py over every file this adds to main; the
line-ending, docs-encoding, CI-registration and docs tests; each test file that differs from main, on its own.
Not run: the whole translator suite, the C++ build, cargo over d3d12/ after the merge (d3d12/ is byte for byte the
branch's), CI.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Pool.descriptor() gave asset_key_at None whenever the key sat past the record
area, which is where most of the array lives in retail pools: 28,666 of 357,115
entries over the 57 pools of a 1.0.2.1 install. TtpfReader.cs at the e293917
pin reads the key from the ID region in that case and refuses only a key split
by the boundary itself; mirror both. write_rds5_pool grows an optional area so
tests can build a straddling pool.
Physical chunk offsets are local to a pool. Reusing a read cache across pools with identical chunk metadata can return texture bytes from the wrong file.
VOLUME_PATTERNS_4K rows 1, 2 and 4 and the matching tile extents in
tex_headers._VOLUME_4K_TILE matched no GFX10 pattern in Mesa addrlib. They
now follow GFX10_SW_4K_S3_PATINFO (the RbPlus table is identical, and so is
rpf9-explorer's VolumePatterns): 2-byte tiles are 8x16x16, 4-byte 8x16x8,
16-byte 4x8x8. In the 1.0.2.1 corpus this changes the one R16_FLOAT volume
(ttdb_graphics #901): adjacent-Y voxel differences fall from 0.357 to 0.067 of
the random-pair level, adjacent-Z from 0.029 to 0.007, and the check's 3D
Z-diff from 0.023623 to 0.004238 (29.3x below the 2D control instead of 5.3x).
The two 8-byte volumes are unchanged. New VolumePatternTest pins the table to
addrlib's rows and checks the extents follow from it; it fails on main.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A codec used only in an unrequested lower mip should not block a DDS of the readable top levels. Check availability for the requested prefix and retain the full-chain requirement for default export.
Add `tools/bcpack_history_calib.py` to derive external `--history <path>` JSON
tables (`bc1.json`..`bc7.json` or combined JSON) locally from a player's own
texture pools or exact reference block/DDS pairs using only the Python
standard library (`python -I`):
- Exact reference inversion (`--ref-dds POOL:INDEX=REF.dds`, `--ref-pairs`):
algebraically inverts direct built-in history references (`d > i` in blocks
0..255) across BC1/BC3/BC4/BC5/BC6H/BC7 into confirmed strict-mode entries.
- Read-only TTPF pool self-calibration (`inputs ...`): uses a prefix rANS lane
decoder (`decode_lanes_prefix`) together with exact BC6H/BC7 anchor MSB and
BC7 Mode-1 shared p-bit parity constraints, intra-block index smoothness
voting, and sibling raw/zlib mip endpoint fitting to derive provisional
tables usable with `--history <path> --allow-provisional`.
- Extend `tools/bcpack_tables_bptc.py`, `tools/bcpack.py`, and
`tools/ttpf_mips.py` so `--history` also accepts optional BC1-BC5 JSON
tables (`confirmed`, `provisional`, optional `replace`) alongside BC6H/BC7.
- Add synthetic unit tests in `tests/test_bcpack_history_calib.py` and document
the schemas and CLI workflow in `docs/textures.md`.
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 folder name with glob characters, like "Game [v1]", was used as a glob pattern, so no pool
matched and the new "no .ttpf pool in it" error would name a folder that does hold pools. The
folder is now passed through glob.escape; only the parts below it are patterns.
Test: test_scan_finds_pools_below_any_folder_and_rejects_paths_without_one now builds its game
folder as "game [v1]" (without the escape: 0 pools).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`scan` only looked for pools under <path>/data/ttdb and <path>/pack/*/data/ttdb, so pointing it at
data/ttdb itself, one of its folders or pack/ found nothing, and a mistyped path did the same: it
printed an all-zero summary and exited 0. A folder that holds no pool at those game-root places is
now searched recursively for .ttpf, and a path that still yields no pool is an ERROR line naming
it (no such file or folder / no .ttpf pool in it) with exit code 2.
Real data (counts only), pools found on my 1.0.2.1 copy, main -> this change: game root 57 -> 57
(same list), pack/story000 3 -> 3 (same list), data/ttdb 0 -> 46, data/ttdb/peds 0 -> 9,
pack 0 -> 11; a mistyped dat/ttdb now exits 2 instead of 0.
Tests: test_scan_finds_pools_below_any_folder_and_rejects_paths_without_one (main: 0 pools for
data/ttdb).
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>
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>
A truncated or unsupported .ttpf raised ValueError from Pool() after the
file was opened and mapped, without closing either, so the pool stayed
locked on Windows. Nothing caught it: one bad pool stopped `scan` with a
traceback and no report, and layout/check/export ended the same way, as
did an index past the pool (IndexError).
Pool() now closes what it opened when a check fails, and every command
prints one line that names the pool (or the valid index range) and exits
with 2. Tests build the pools by hand.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>