Commit Graph

14 Commits

Author SHA1 Message Date
7df404beee Merge upstream/main into fix/ttpf-assets-stage-cleanup 2026-11-30 13:37:43 +03:00
a23d691944 make_game assets: keep a full-chain DDS its decoder already wrote
With a calibration profile, a history edit changes the pass stamp, so the
pass decoded every calibrated row again and replaced its DDS with the same
bytes under the same name. Calibrated output does not depend on the
history, and a replacement denied for a file in use stopped the pass
before the strict fallbacks.

Skip a row whose decoder stamp and file name already match the pass and
whose file exists.
2026-11-28 16:45:29 +01:00
0507555a57 make_game assets: check BC6H/BC7 history ranges before strict decoding
load_history() checked the bc6h and bc7 sections through the table loaders,
which check shapes and integers only. A confirmed endpoint depth above the
known one (9 over 8) passed, and strict decoding then published a
provisional reconstruction as a confirmed DDS.

Move the range checks of bcpack_history_calib.py --verify into
check_history_tables() and run them on the parsed history before any pool
is opened. Both now also reject an entry with confirmed bits whose values
the table leaves out: the decoder read zeros there as confirmed values.
2026-11-28 16:45:20 +01:00
51b2819b65 make_game assets: reuse local BCPack history on resume 2026-11-28 00:02:00 +01:00
dbf28bde75 ttpf_assets: restore write mode before unlink on replace failure in publish() (TTPF-ASSETS-STAGE-CLEANUP)
Apply published_mode(path) and restore write permission (0o600) on replace
failure before unlinking the temporary file in publish(), preventing Windows
PermissionError [WinError 5] and stranded temporary files.

agent: yes
AI-assisted: yes
2026-11-24 18:04:01 +03:00
bb938f6395 ttpf_assets: the BCPack pass stamp hashes the decoder modules, so a fixed decoder completes old pools again (#6678)
Squash-merged after diff review of PR #6678
2026-11-23 10:59:15 -06:00
fcc0eb7705 make_game: a broken bcpack calibration profile is one ERROR line, not a JSON traceback (EGEN-TTPF-CALIB-PROFILE-BADJSON) (#6827)
Squash-merged after diff review of PR #6827 - make_game: a broken bcpack calibration profile is one ERROR line, not a JSON traceback (EGEN-TTPF-CALIB-PROFILE-BADJSON)
2026-11-23 09:51:40 -06:00
760638c8fd ttpf_assets: a replaced DDS that was in use is removed by the next build
Review (@shdann): a file that could not be removed because it was open
stayed for good. The manifest had already switched away from it and the
pass was stamped, so later builds returned before any cleanup.

The manifest that switches the rows now lists the replaced files under
BCPackReplaced. They are removed after it is published, and the list is
written again with only what could not be removed (dropped when empty).
A build that finds the pass stamped still finishes that list. This also
covers a build stopped between the manifest write and the removal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 22:13:06 +00:00
870e0553d0 ttpf_assets: look at each file once when removing replaced DDS files
Review: the same-file check compared every replaced name with every row's
file, os.path.samefile per pair, so a pool with thousands of rows and
replaced files took minutes to hours. Each row's file is now stat'ed once
into a set of (device, inode), and each replaced name once against it.
The removal moves into remove_replaced(), and a test fails if the check
is done per pair (50 rows and 50 replaced files: at most 100 stats).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 21:52:32 +00:00
e4f028b56b ttpf_assets: never remove the file just published, the manifest or a non-DDS file
Review fixes for the removal of replaced DDS files:
- A row that named the new file in another letter case (the same file on
  Windows and macOS) no longer has it removed: names are compared through
  normcase, and a file that is the same file on disk as one a row names is
  kept.
- Only names that end in .dds are removed, so a row that names
  manifest.json (or anything else) cannot remove it.
- A file that could not be removed is counted, and one line on stderr says
  how many stay next to the full-chain files.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 21:48:49 +00:00
c2d4135ac9 ttpf_assets: remove the lower-mip DDS a full-chain export replaces
complete_pool publishes <index>_bcpack_<method>.dds and switches the
manifest row to it, but left the file the row named before in the pool
folder, named by no row: every texture the pass completes was stored twice.

After the manifest is published, a superseded file that no row names any
more is removed. It stays when the manifest write fails (the row still
names it), when another row names it, and when it can't be removed; only a
plain file name inside the pool's folder is ever removed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 21:44:43 +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
2d44fc8082 Tools: put the script's own directory on sys.path in the two that need it
`python -I` implies `-P`, so the directory of the script is not `sys.path[0]` and a tool that imports the module
next to it dies before `main()`:

    python -I tools/calibrated_texture.py --help
    ModuleNotFoundError: No module named 'bcpack'

`calibrated_texture.py` imports `bcpack`, `bcpack_tables` and `ttpf_mips` and added nothing; `ttpf_assets.py`
imports `bcpack`, `file_mode`, `ttpf_mips` and `calibrated_texture` and added nothing either, so the build's
texture stage tools could only be run through `make_game.py`, never directly as CONTRIBUTING.md documents.

Insert `os.path.dirname(os.path.abspath(__file__))` before the sibling imports, the pattern already used by
`tools/anim_clips.py`. `tests/test_tool_startup.py` derives the affected set from the sources and runs
`python -I <tool> --help` for all of them, so a new tool with a sibling import is covered without editing the
test; without the two fixes it fails exactly on those two tools.

A sweep of `python -I tools/*.py --help` over all 110 tools found no other case.
2026-11-22 16:38:03 +02:00
23fe0a0c3a Complete BCPack DDS entries during the normal assets export 2026-11-22 16:04:49 +08:00