Commit Graph

52 Commits

Author SHA1 Message Date
566d74f5f1 ttpf_mips: ask report_paths for the report-path guard
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).
2026-12-01 19:44:40 -05:00
00131bb85e main keeps its own runtime, tools and tests; the branch's variants stay on port/d3d12-nvidia
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>
2026-11-27 17:58:38 -05:00
ee23a4041d PR #1173: ttpf_mips: ask report_paths for the report-path guard (TTPF-MIPS-SHARED-REPORT-PATH)
From https://github.com/ProjectLeonida/mandy/pull/1173 (head 9ad892fddde0), applied as a reviewed patch.

Co-authored-by: breachato <breachato@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 15:42:21 -05:00
6664b0dbb2 docs: point ttpf_mips at its --help usage line (#6640)
Squash-merged after diff review of PR #6640
2026-11-23 11:08:45 -06:00
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
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