Commit Graph

38 Commits

Author SHA1 Message Date
d3266b5706 ttpf_mips: table-driven BC1/BC4 decode and vectorised block_means, float-identical (#6872)
Squash-merged after diff review of PR #6872 - ttpf_mips: table-driven BC1/BC4 decode and block_means, ~2.5-2.7x faster and float-identical
2026-11-23 09:52:18 -06:00
e10060a42c ttpf_mips: precompute X/Y swizzle tables and coalesce contiguous runs in detile() (9x-35x) (#6280)
Squash-merged after diff review of PR #6280 - ttpf_mips: precompute X/Y swizzle tables and coalesce contiguous runs in detile() (9x-35x)
2026-11-23 08:23:07 -06:00
dd095c8805 Merge pull request #4072 from p3n1cillin
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:11:01 -05:00
be036ae3ae Merge pull request #3876 from Silent
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:09:08 -05:00
868fdcac17 Merge pull request #3860 from Tayar
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:08:59 -05:00
67dfec1660 Merge remote-tracking branch 'origin/main' into ttpf-volume-patterns
# Conflicts:
#	tests/test_ttpf_mips.py
2026-11-23 02:48:23 +00:00
e45f3af513 Validate TTPF zlib output before caching chunks 2026-11-22 23:16:09 +00:00
d5ef9a4c20 ttpf_mips: read the asset key across the records/ids boundary, as TtpfReader does
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.
2026-11-22 19:15:16 -03:00
f8c574bb7a Discover only files when scanning for TTPF pools 2026-11-22 19:06:25 -03:00
4c0e42b222 Merge pull request #3238 from HAMADA 2026-11-22 15:16:04 -05:00
dfc75a31db ttpf_mips: report export write failures 2026-11-22 20:06:51 +00:00
2af7649b3b Merge upstream main into codex/ttpf-pool-cache-isolation 2026-11-22 21:04:07 +01:00
dbb08e6c6d fix(assets): isolate cached chunks by texture 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.
2026-11-22 20:07:07 +01:00
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
b43a9dad55 ttpf_mips: 3D SW_4KB_S volumes use AMD's bit order for 2-, 4- and 16-byte elements
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>
2026-11-22 17:40:50 +00: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
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
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
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
96c543374f Tests: cover the unknown-element-size diagnostic bucket 2026-11-21 21:29:46 +00:00
0589fb5a37 Textures: share the compact layout and record the after split 2026-11-21 21:23:48 +00:00
39631ee147 Textures: decode the TTPF compact mip tail 2026-11-21 21:01:03 +00:00