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

Open
HyperRamzey wants to merge 1 commit from upstream-pr/2448 into main
HyperRamzey commented 2026-11-29 13:09:59 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by HyperRamzey on 2026-11-29T13:09:59Z.


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).
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5551023985 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2448). Originally posted by [HyperRamzey](https://github.com/HyperRamzey) on 2026-11-29T13:09:59Z. --- ## 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).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2448:upstream-pr/2448'
git switch 'upstream-pr/2448'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2448'
git switch 'upstream-pr/2448'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2448'
git switch 'upstream-pr/2448'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2448'
git switch 'main'
git merge --squash 'upstream-pr/2448'
git switch 'main'
git merge --ff-only 'upstream-pr/2448'
git switch 'main'
git merge 'upstream-pr/2448'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

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