Commit Graph

34 Commits

Author SHA1 Message Date
2c2f6ffbd7 Merge pull request #2658 from Vonsek 2026-11-22 13:16:52 -05:00
4fdb428178 Merge pull request #2558 from Leo Leahy 2026-11-22 13:16:09 -05:00
f02cae5acf Merge pull request #2488 from bbareth 2026-11-22 13:15:40 -05:00
ce6bef70fa fix(tools): decode BC2 colors for TTPF mip verification
Both BC2 formats can be exported, but the validation decoder never returned their pixels. They use the same four-entry RGB interpolation as BC3.
2026-11-22 18:44:19 +01:00
2093c0268e ttpf_mips, ttpf_assets: skip unmapped ETPF sentinels in Pool.span and guard pool.codecs 2026-11-22 14:28:42 -03:00
8070ada41b ttpf_mips: keep forced exports from overwriting inputs 2026-11-22 18:13:28 +01:00
108c6a82c6 fix(tools): export requested readable TTPF mip prefixes
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.
2026-11-22 17:48:30 +01:00
222321b4e8 Merge pull request #1983 from Tim Elery 2026-11-22 10:40:07 -05:00
4695bb398e tools/bcpack: add pure-stdlib local history calibrator (bcpack_history_calib.py)
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`.
2026-11-22 07:21:13 -08:00
ec9b6cf22b tools: text reports are written with LF line ends on every platform (BUILD-468)
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.
2026-11-22 14:20:30 +00:00
8dc8344bb4 Merge pull request #1664 from Tim Elery 2026-11-22 08:08:36 -05:00
9ff55521ab ttpf_mips: add DXGI 11 and validate 2D uncompressed tiling (RDNA2 64K 4BPP) 2026-11-22 05:01:41 -08:00
2dbd2170b5 Merge pull request #1458 from Rafael 2026-11-22 07:37:58 -05:00
38d43286b9 ttpf_mips: decode BC6H and BC7 blocks in check 2026-11-22 04:29:11 -08:00
d835fac9b4 ttpf_mips: find_pools escapes the folder before globbing
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>
2026-11-22 09:15:12 -03:00
30e5431437 ttpf_mips: scan searches any pool folder and rejects a path with no pool
`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>
2026-11-22 09:15:12 -03:00
89cf18645e Merge pull request #1428 from Dominik 2026-11-22 06:38:01 -05:00
f698bf2206 tools: a path outside the console's code page no longer crashes a tool's output
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>
2026-11-22 11:27:00 +00: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
23fe0a0c3a Complete BCPack DDS entries during the normal assets export 2026-11-22 16:04:49 +08:00
0a288c3cd0 textures: support locally calibrated BCPack DDS exports 2026-11-22 15:33:40 +08:00
1404609976 Check and export the visible mip blocks at texture edges 2026-11-21 22:03:37 -07:00
1c71f8cd3c Merge pull request #731 from nicolas 2026-11-21 21:37:54 -05:00
03d1e118a6 bcpack: add BC6H and BC7 decoders with external runtime history loader (ASSET-5) 2026-11-21 18:27:01 -08:00
32d0a4bf32 Use four-color BC3 interpolation when checking texture mip chains 2026-11-21 19:18:34 -07:00
569d4aa33a Textures: decode all 697 TTPF 2D arrays, streaming cubemaps and 3D volumes (ASSET-36) 2026-11-21 21:31:04 -03:00
183426f261 ttpf_mips.py: name a bad pool instead of a traceback, and close it
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>
2026-11-21 21:00:44 -03:00
80fb7f2e41 Textures: add clean-room BCPack decoder (rANS + BC1/BC3/BC4/BC5) 2026-11-21 14:44:27 -08:00
ddd49a818f Textures: count every gated compact record in the scan total 2026-11-21 21:23:48 +00:00
0589fb5a37 Textures: share the compact layout and record the after split 2026-11-21 21:23:48 +00:00
bb20c19651 Textures: make the compact mode split reproducible in scan 2026-11-21 21:02:00 +00:00
4be73f9bbb Textures: tighten the compact tool wording and BC coverage note 2026-11-21 21:01:03 +00:00
c3cd32888f Textures: report the compact standalone/tail split in scan 2026-11-21 21:01:03 +00:00
39631ee147 Textures: decode the TTPF compact mip tail 2026-11-21 21:01:03 +00:00