Fix TTPF logical texture addresses above 4 GiB #12

Closed
github-bot wants to merge 2 commits from gh-pr/12/head into gh-pr/12/base
Owner

@⁠techfoundrynz on GitHub · 2026-11-21 13:09 UTC · original
techfoundrynz:fix/ttpf-large-logical-offsets → main · +83 −2 · 2 files · 2 commits · closed without merging

Some TTPF texture descriptors resolve to logical offsets above 4 GiB. Reading the logical size as 32 bits and masking page addresses to 20 bits wraps those addresses and can select incorrect texture data.

Read the 40-bit logical size and preserve all 21 page-address bits. The existing decompression and mip fallback behavior is unchanged. Synthetic fixtures cover both sides of the 4 GiB boundary, high flag bits, and the final texture allocation size without allocating a large file.

Validation: cargo test --offline --locked -- --nocapture passed (28 passed, 3 ignored). With PERCYSTAR_LEVELS_RPF pointing to a local archive, the tests also verified map and vehicle texture descriptors above 4 GiB. No game assets are included.

The Cargo.lock package version is synchronized with the existing 1.3.6 manifest; dependencies are unchanged.

**@⁠techfoundrynz** on GitHub · 2026-11-21 13:09 UTC · [original](https://github.com/rpatty-dev/PercyStar/pull/12) `techfoundrynz:fix/ttpf-large-logical-offsets` → `main` · +83 −2 · 2 files · 2 commits · closed without merging Some TTPF texture descriptors resolve to logical offsets above 4 GiB. Reading the logical size as 32 bits and masking page addresses to 20 bits wraps those addresses and can select incorrect texture data. Read the 40-bit logical size and preserve all 21 page-address bits. The existing decompression and mip fallback behavior is unchanged. Synthetic fixtures cover both sides of the 4 GiB boundary, high flag bits, and the final texture allocation size without allocating a large file. Validation: `cargo test --offline --locked -- --nocapture` passed (28 passed, 3 ignored). With `PERCYSTAR_LEVELS_RPF` pointing to a local archive, the tests also verified map and vehicle texture descriptors above 4 GiB. No game assets are included. The Cargo.lock package version is synchronized with the existing 1.3.6 manifest; dependencies are unchanged.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 02:31:00 +00:00
github-bot closed this pull request 2026-11-27 02:31:00 +00:00
Author
Owner

@⁠rpatty-dev on GitHub · 2026-11-21 13:19 UTC · original

Awesome catch @⁠techfoundrynz! Integrated into main for v1.3.8 with full credit in README & release notes (40-bit TTPF logical size + 21-bit page addresses so >4 GiB map/vehicle textures resolve without wrapping).

**@⁠rpatty-dev** on GitHub · 2026-11-21 13:19 UTC · [original](https://github.com/rpatty-dev/PercyStar/pull/12#issuecomment-7063190676) Awesome catch @⁠techfoundrynz! Integrated into main for v1.3.8 with full credit in README & release notes (40-bit TTPF logical size + 21-bit page addresses so >4 GiB map/vehicle textures resolve without wrapping).

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.