package check: name a right-sized .ttpf whose contents are damaged #2448

Open
github-bot wants to merge 1 commit from github-bot/gh-2448 into main AGit
Owner

@⁠HyperRamzey on GitHub · 2026-11-29 13:09 UTC · original
HyperRamzey:pr/ttpf-content-preflight → main · +328 −9 · 2 files · 1 commits · open

What

A download paused and resumed leaves files of the right size with zeroed blocks. check_package passed them on size alone, the title started, and stopped minutes later at +0x3e42541 with nothing saying why (#1622, #421, #595). Right-sized .ttpf files are now also checked by content:

  • RDS5 container: entry 0's low 32 bits shifted left 8 are the first extent's file offset; entry 1's 4 KB page minus entry 0's gives the extent's length. The layer at that offset must be a valid ETPF.
  • a bare ETPF at offset 0 is accepted too.
  • an ETPF layer: magic, flags with mask 2 set, a layer count at most 0xFFFF, and a 24-byte-per-entry table (0x10 + 24 x count) inside the extent and inside the file.

A damaged file is printed as damaged files <path> is the right size but <why> and stops the run like a missing one, naming the file and the skip switch (VICTORY_SKIP_FILE_CHECK=1). victory run's preflight message now reads "incomplete or damaged".

The check was written from the dump's own loader (sub_143BDD340 reads the ETPF header: 0x10 bytes, magic, flags & 2, count <= 0xFFFF; entries 24 bytes), and validated against the real package: ttdb_graphics.ttpf (34,411,776 bytes) is RDS5 with 1550 entries, entry 0 = 0x31 -> extent at 0x3100, ETPF flags 0x27A, 912 layers, table 0x5590 bytes <= the 0xC000-byte extent.

Tests

crates/victory-game/src/lib.rs: a zeroed right-sized .ttpf, a valid RDS5, a layer that is not ETPF, a layer count over 0xFFFF, a truncated entry table, and a bare ETPF. apps/victory/src/run.rs: a full package of right-sized zeroed files stops the run and the message names the file, the reason and VICTORY_SKIP_FILE_CHECK=1, with the skip honoured and a non-executing run not stopped.

All pass under Wine (cargo xwin test); sabotage-checked: returning early from ttpf_problem makes four of them fail.

Resolves / relates

  • Extends #1872 (which added the size preflight) to contents.
  • Relates #1622, #421, #595, #345, #1234, and #1250 (the same right-sized-zeroed failure found by hashing).
**@⁠HyperRamzey** on GitHub · 2026-11-29 13:09 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2448) `HyperRamzey:pr/ttpf-content-preflight` → `main` · +328 −9 · 2 files · 1 commits · open ## What A download paused and resumed leaves files of the right size with zeroed blocks. `check_package` passed them on size alone, the title started, and stopped minutes later at `+0x3e42541` with nothing saying why (#1622, #421, #595). Right-sized `.ttpf` files are now also checked by content: - `RDS5` container: entry 0's low 32 bits shifted left 8 are the first extent's file offset; entry 1's 4 KB page minus entry 0's gives the extent's length. The layer at that offset must be a valid `ETPF`. - a bare `ETPF` at offset 0 is accepted too. - an `ETPF` layer: magic, flags with mask 2 set, a layer count at most 0xFFFF, and a 24-byte-per-entry table (0x10 + 24 x count) inside the extent and inside the file. A damaged file is printed as `damaged files <path> is the right size but <why>` and stops the run like a missing one, naming the file and the skip switch (`VICTORY_SKIP_FILE_CHECK=1`). `victory run`'s preflight message now reads "incomplete or damaged". The check was written from the dump's own loader (`sub_143BDD340` reads the ETPF header: 0x10 bytes, magic, flags & 2, count <= 0xFFFF; entries 24 bytes), and validated against the real package: `ttdb_graphics.ttpf` (34,411,776 bytes) is RDS5 with 1550 entries, entry 0 = 0x31 -> extent at 0x3100, ETPF flags 0x27A, 912 layers, table 0x5590 bytes <= the 0xC000-byte extent. ## Tests `crates/victory-game/src/lib.rs`: a zeroed right-sized `.ttpf`, a valid RDS5, a layer that is not ETPF, a layer count over 0xFFFF, a truncated entry table, and a bare ETPF. `apps/victory/src/run.rs`: a full package of right-sized zeroed files stops the run and the message names the file, the reason and `VICTORY_SKIP_FILE_CHECK=1`, with the skip honoured and a non-executing run not stopped. All pass under Wine (`cargo xwin test`); sabotage-checked: returning early from `ttpf_problem` makes four of them fail. ## Resolves / relates - Extends #1872 (which added the size preflight) to contents. - Relates #1622, #421, #595, #345, #1234, and #1250 (the same right-sized-zeroed failure found by hashing).
A download paused and resumed leaves files of the right size with zeroed
blocks. The size check passed them, and the title stopped later with
nothing saying why (data\ttdb\graphics\ttdb_graphics.ttpf: #1622, #421,
#595). `check_package` now reads the container header of a right-sized
`.ttpf` too: RDS5 entry 0 << 8 is the first extent, entry 1 in 4 KB pages
gives its end; an ETPF layer must start with the magic, have flag 2 set,
a layer count at most 0xFFFF and a 24-byte-per-entry table inside the
extent. A failure is reported by content, and stops the run like a
missing file (VICTORY_SKIP_FILE_CHECK=1 still skips).

Tests cover zeroed, valid RDS5, a non-ETPF layer, a count over the limit,
a truncated table and a bare ETPF; the run preflight test writes a
right-sized zeroed package and asserts the stop names the file, the
reason and the skip switch.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 13:11:52 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2448/head:github-bot/gh-2448'
git switch 'github-bot/gh-2448'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2448'
git switch 'github-bot/gh-2448'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2448'
git switch 'github-bot/gh-2448'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2448'
git switch 'main'
git merge --squash 'github-bot/gh-2448'
git switch 'main'
git merge --ff-only 'github-bot/gh-2448'
git switch 'main'
git merge 'github-bot/gh-2448'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!2448
No description provided.