Discovery: offset bit 32 enables archives >64 GiB (levels.rpf) #25

Open
opened 2026-11-27 18:40:38 +00:00 by github-bot · 0 comments
Owner

@⁠nineforge0 on GitHub · 2026-11-27 18:36 UTC · original

The 24-byte record flags field carries the 33rd bit of the offset

Archives larger than 64 GiB (such as levels.rpf at 70.9 GiB) previously failed with "no table records recovered" because the 32-bit offset field overflows at 4 GiB × 16 = 64 GiB.

Finding

Bit 0 of the flags word in the 24-byte TOC record is not a flag — it is the 33rd bit of the offset:

let offset = (u64::from(units) | u64::from(flags & 1) << 32) * 16;
let flags = flags & !1;  // strip the offset bit before interpreting flags

Result

  • levels.rpf now opens: 2,078 entries, key #2, 0.7 seconds
  • 6,982 PSIN entries found across nested archives
  • Contains world/map data: buildings, props, terrain, NPC spawn schedules

Code

src/rpf9/entry.rs — decode() and encode_location()

No other public tool documents this. The common workaround is payload carving, which misses the TOC structure entirely.

**@⁠nineforge0** on GitHub · 2026-11-27 18:36 UTC · [original](https://github.com/nineforge0/forge9/issues/25) ## The 24-byte record flags field carries the 33rd bit of the offset Archives larger than 64 GiB (such as levels.rpf at 70.9 GiB) previously failed with "no table records recovered" because the 32-bit offset field overflows at 4 GiB × 16 = 64 GiB. ### Finding Bit 0 of the `flags` word in the 24-byte TOC record is **not a flag** — it is the 33rd bit of the offset: ```rust let offset = (u64::from(units) | u64::from(flags & 1) << 32) * 16; let flags = flags & !1; // strip the offset bit before interpreting flags ``` ### Result - levels.rpf now opens: **2,078 entries**, key #2, 0.7 seconds - 6,982 PSIN entries found across nested archives - Contains world/map data: buildings, props, terrain, NPC spawn schedules ### Code `src/rpf9/entry.rs` — `decode()` and `encode_location()` No other public tool documents this. The common workaround is payload carving, which misses the TOC structure entirely.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 18:40:39 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.