The GTA VI RPF9 archive format (Xbox Series 1.0.2.1) How GTA VI packs its game files: the RPF9 archive that replaced GTA V's RPF7 (the format OpenIV opens). The header, the encrypted table of contents and its RSA signature, the column store that replaced the entry table, hashed names and types, AES-256 CTR over file data, and zlib chunks. Decoded for vicerpf, which reads and writes these archives; the same text is docs/FORMAT.md in https://github.com/0x000NULL/vicerpf, where the tools named below (tools/rpfdump, docs/rpf9.hexpat) also live. Decoded from game_scarlett_master.exe (static analysis plus one run under VIctory that dumped the TOC buffers the game parses; tool in tools/rpfdump). Addresses are virtual addresses at the image's preferred base, 0x140000000. No key material is stored here: vicerpf reads it from the user's own executable. Header (0x40 bytes, plain) -------------------------- Offset Type Meaning 0x00 char[4] 9FPR 0x04 u32 header + TOC + trailer size (what is read up front) 0x08 u32 TOC end (start of the trailer) 0x0C u32 build metadata the game does not use (below): a multiple of 16, 0x30 to 0x1D2E0 over the 4,373 archives 0x10 u64 archive id (compared by "9VFPR" link records) 0x18 u16, u16 0x7A00, section-A entry count (4 or 5) 0x1C u32 section-B size (0x150 with chunks 1, 5, 6, 9) 0x20 u16 column count 0x22 u16 trailer column count (the last ones) 0x24 u32 entry count 0x28 u32 build metadata the game does not use (below): a class of archive by the entry types it holds, one of ten values 0x2C u8 index width: 1, 2 or 4 bytes 0x2D u8 bit 0: sections 16-aligned (always set) 0x2E u8 TOC cipher: >> 1 = descriptor (4: key 0x10000001, IV @0x1462FD470; 1: key 1, IV @0x1462FD460), bit 0 = A and B as one CBC stream 0x30 u32 bytes of section B after the signature chunk (0x10 when only chunk 9 follows it): left out of the A+B stream, decrypted by the second one Header +0x0C and +0x28: neither is used by the game; both are covered by the signature like the rest of [0, 0x10) and [0x18, TOC end). - The archive code reads only the other fields. Opening (0x141FB2600) reads the first 16 bytes and uses +0x04 or +0x08 (by mode: the whole TOC, or up to the trailer, the trailer then read into its own buffer); the layout (0x14087AF70 -> 0x14087AFF0) reads +0x1A, +0x1C, +0x20, +0x22, +0x24, +0x2C and +0x2D; decryption (0x140A34890) +0x1A, +0x1C, +0x2E and +0x30. - None of +0x28's ten values occurs in the executable, as a constant or otherwise (either byte order). - In the game (Xbox 1.0.2.1 under VIctory, 2026-12-01), a rebuilt common.rpf with both fields set to 0 mounted and was used: the changed data/version.txt became the game's version string. What they hold, from the 4,373 archives of 1.0.2.1: - +0x28 is a function of the set of entry types (chunk 9): no type set has two values. One type: c0a92754 for types 2-17 (and 73), da72573e for the others (11, 67, 70, 74, 87, 255, ...); two types: c0a92754, d98004d5 or 5a5b4c6f; three: abe9b070, 1c1945bb or d5c19f6b; four: 1481d21e or 333761b4; five: e7642d58. It is not a hash of the type list, of the column set (the same set appears under three values), or of any string of the executable (joaat, MurmurHash3). It reads as a class the build tool assigns. - +0x0C is a size: a multiple of 16, 48 or 64 for most single-entry archives, up to 0x1D2E0 for levels.rpf. It is not a function of the TOC (sizes, entry count, chunk or cipher counts: a linear fit over all archives misses by 10 KB at the median), nor of an archive's single entry (two archives of one type-74 entry of similar size have 48 and 64). Most likely an allocation the build tool computed for a structure the game no longer builds. Sections (layout: 0x14087AFF0) ------------------------------ 0x40 A chunk directory: n x { u16 id, u16 0, u32 offset into B }, padded to 16 B chunk data, by id: 1 { u32 key, u16 alg, iv[16] }: key and IV of the rest of the TOC and the trailer 3 linked "\0\0\09VFPR" files { name[0x100], u64 id } 4 { u32 count, u32 2, u64[count] } sorted 64-bit hashes (1,398 archives) 5 { u32 key 0x10000003, u16 alg 0x10, iv[16] }, the same in every archive; its use is unknown 6 signature (below) 7, 8, 11, 12 in some archives; not decoded 9 { u8 count, u8 types[count] }: the types of the archive's entries, sorted, 0xFF for untyped (data.rpf: 03 00 0b 0e = rpf, zmt, zdatb); types past 0x12 are registered at run time. 8 or 16 bytes. align16 C column descriptors: { u64 name hash, u32 distinct values, u32 data offset, u16 stride, u16, u32 } align(width) D per entry, per main column: index of its value (all ones = none) align8 E column values (main columns) TOC end trailer: per entry, per trailer column: index; then align8: trailer column values A value: base + offset + stride * index (0x1455B2600), base = E for the first columns - trailer columns columns, the trailer data otherwise. Encryption of the TOC (0x1408EC200 -> 0x140A34890, 0x1406BD040) --------------------------------------------------------------- - [0x40, A end + B size - header +0x30) : AES-256-CBC, key 0x10000001, fixed IV. - [that, TOC end) : AES-256-CBC with the key and IV of chunk 1 (per archive). No chunk 1: plain. - [TOC end, header +0x04) (the trailer) : a second AES-256-CBC stream with chunk 1's key and IV, starting over from the IV (0x1408EC360). Signature (chunk 6; 0x1408EC210 -> 0x1428CE530 -> 0x140DAED40 -> 0x140DAED80) ----------------------------------------------------------------------------- Chunk 6 = { u8 scheme (1), u8 0, u16 key id (1), sig[0x100], 12 zero bytes }. The key is entry id << 32 | 5 << 24 of the key table: a 294-byte DER RSA-2048 public key (e = 65537) at 0x1466FD4B0. The signature is RSA PKCS#1 v1.5 with SHA-256 over a 32-byte message that is itself a SHA-256: signature = RSA-sign( SHA-256( SHA-256( TOC[0, 0x10) || TOC[0x18, sig) || TOC[sig + 0x100, TOC end) || TOC[TOC end, header +0x04) ) ) ) - The regions are built by 0x141FB2380 (scheme 1's builder; vtable 0x1462FE760: build, size 0x20, fill 0x1428CE8A0 = SHA-256 of the regions). Header [0x10, 0x18) (the archive id) and the 256 signature bytes are left out; the 12 zero bytes after the signature are in. - The verifier (vtable 0x1462FE540, set up at 0x140DAEF80) is given that 32-byte digest as its message and hashes it again, hence the double SHA-256. - The bytes are hashed as the game holds them at that point (0x1408EC210: 0x140A34890 decrypts, then 0x1428CE530 checks, then 0x1406BD040 and 0x1408EC360 decrypt the rest): the first stream [0x40, A+B end) decrypted; chunk 1's stream [A+B end, TOC end) and the trailer still as on disk. All 4,373 archives of 1.0.2.1 (nested ones included) verify this way, and vicerpf verify checks it. A rebuilt archive cannot carry a valid signature without Rockstar's private key. The check only runs when bit 0 of the mounting device's flags is clear (0x1408EC200: mov al,[rdx+8]; test al,1; sete dl), and a failed check fails the open; vicerpf's mod loader turns sete dl into xor dl,dl in memory so rebuilt archives load. Columns ------- Hash Stride Meaning 0x73BCB72DCE74F11F 8 name: low 64 bits of MurmurHash3 x64_128 (seed 0) of the lowercase name 0xB7076B6245D35FB5 4 joaat of the same name (resources, and entries looked up by 32-bit hash) 0x33F70DFAF2C50989 24 location: offset = (u64[0] & 2^40-1) << 4, stored = (u64[1] & 2^40-1) << 4, size = u64[2] & 2^44-1, type = byte +5 0xBA180AFB232D1B4B 20 resource location: offset = u32[3] << 4, stored = u32[2] << 4, size = (u32[1] & ~0xF) + (u32[0] & 0x7FFFFFF0), type = byte +0x10 0x4EAA16DD829995BC 16 location: offset = u32[1] << 4, stored = u32[0] << 4, size = u64[1] & 2^48-1, type = byte +0xE 0x286030A358A789FB 64 file cipher: { u32 key, u16 alg 0x11, iv[16], u16, u64 head, u64 enc, u64 skip, u64 tail, u32 flags } 0xE0C12D7A5D4884C5 8 chunks: { u32 offset of the chunk table from this value, u16 count, u8, u8 format } 0xB6F5BDB2C66DA2E9 8 (trailer) u64 per entry, not identified. Not of the decoded contents alone: in common.rpf eight entries decode to the same 1398 bytes and have eight different values (each is encrypted with its own IV). Not xxh64, XXH3-64/128, MurmurHash3, FNV-1a, CRC32/Adler or a truncated MD5/SHA-1/2/3/ BLAKE2 of the stored or decoded bytes, unseeded or seeded with the name hash. The game never looks the column up (its hash is not in the executable); the signature covers it Location readers: 0x1400C6950 (offset), 0x141330AD0 (stored), 0x141331670 (size), 0x14056ED70 (type). Names and types --------------- An entry is found by its type and either its 64-bit name hash or its joaat (0x14056F130, 0x14056EC70). Names are paths relative to the archive's mount point (data/ui/loose/map/data/gps), or bare names in most nested archives (picador), lowercase. A typed entry's name has no extension: the type supplies it from the table of char* at 0x1462FCD30 (row 0, Xbox Series: rpf zmf zdr zft zdd ztd zbn zbd zpd zbs zsd zmt zsc zcs zdatb zbdr zbdd zbft zvert for types 0 to 0x12; 0x144EBBC60). Type 0xFF = none: the name keeps its own extension (setup2.xml). Nested archives are type 0. The archives hold no names; the game keeps hash -> string tables only at run time (0x14553D070, 0x144DA8040). File data (0x1428CD3B0, 0x1413307E0) ------------------------------------ 1. Read stored bytes at offset (relative to the archive's start; nested archives are entries stored raw, opened in place). 2. If the stored bytes are longer than the chunks (sum of stored + pad), the chunks are at the end (16 zero bytes ahead of them in the entries seen). 3. File cipher (alg 0x11): AES-256-CTR, 128-bit big-endian counter from the IV, over the chunk data (length L): the first head bytes, then enc of every enc + skip up to max(L - tail, head), then all of the last tail bytes (0x1428CEBC0, 0x141616150); the counter follows the byte position. Descriptor: head, enc, skip, tail = u64s at +0x18, +0x20, +0x28, +0x30. Entries without a chunk table whose size exceeds their stored size are one raw deflate stream. 4. Chunks (0x14550DB40), per format: - 2: pad = (d >> 58) & 0xF, total = (d >> 28) & 0xFFFFFF0, size = (d & 0xFFFFFF) << 4, codec = d >> 62 - 3: stored = 0x10000 - (d >> 16 & 0xFFFF), pad = d >> 16 & 0xF, size = 0x10000 - (d & 0xFFFF), codec = d >> 60 & 3 - 4: pad = (d >> 52) & 0xF, total = (d >> 24) & 0xFFFFFF0, size = d & 0xFFFFFFF, codec = d >> 56 & 3 Codec 3 = zlib, 0 = stored. Decompression goes through DirectStorage (zlib, BCPack). The cipher ---------- AES-256 (14 rounds) in table form: 0x145642C50 decrypts, 0x1456437C0 encrypts. Static input-byte tables (16 x 256) and T-tables (16 x 1 KB) are at 0x146036F30 / 0x146037F30 (decrypt) and 0x146040F30 / 0x146041F30 (encrypt). Each key is a 4340-byte blob: u32 magic (0x4E3B9B8E decrypt, 0x2718CE5D encrypt), 60 round-key words, 16 x 256 last-round output tables. Key table: 24 entries of { u64 id << 32 | flags << 24, u64 blob, u64 length } at 0x1466E5900 (filled by 0x1456C9600). Writing (vicerpf's choices, not the game's format) -------------------------------------------------- - The TOC is written in the clear: header +0x2E = 0, and chunk 1 dropped, since the game decrypts the rest of a TOC whenever chunk 1 is there (0x1408EC210 -> 0x1406BD050). Other chunks are kept. - Columns keep the archive's own set and order (sorted by hash, trailer columns last, flagged 1 in the descriptor's u16). Header +0x0C and +0x28 are kept as they were (the game ignores them). - Values are dictionaries: equal values share a row, except locations and chunk values (each points at its own chunk table, written after the main column values). Index width: the smallest of 1, 2 or 4 bytes whose all-ones value is above every row number. - New contents: format-3 chunks of 64 KB (zlib when smaller, else stored), each padded to 16; chunk values { rel u32, count u16, 8, 3 } as in every 1.0.2.1 archive. Entries keep the alignment of their old offset (up to 64 KB); new ones are aligned to 4 KB. Looking at a TOC ---------------- vicerpf toc archive.rpf > toc.bin writes the header, TOC and trailer decrypted; docs/rpf9.hexpat is an ImHex pattern for such a dump (header, chunk directory, the known chunks, column descriptors, indices, and the name, joaat, location, chunk and cipher values). Checked with ImHex 1.38.1's pattern-language runner on common.rpf's dump (imhex --pl format -i toc.bin -p docs/rpf9.hexpat -o out.json -I /includes): its 418 names and joaats are the ones vicerpf ls reads, and its first location is data/glass/0x0_crack_0.txt (offset 0x81430, stored 48, size 92). Chunks an archive lacks (chunk 1 in a rebuilt one) come out as empty arrays. Entry formats convert reads --------------------------- These are the formats inside the entries, not RPF9 itself; each module of vicerpf's source has the details. - Texture dictionaries (.ztd, src/texture.rs): pgDictionary in the virtual block, grcTexture headers (width +0x38, height +0x3A, depth +0x3C, DXGI +0x3F, tile mode +0x40, levels +0x42 & 0x1F, elements +0x08, pixels +0x18 in the physical block, which follows the virtual block: the resource location's u32[0] & 0x7FFFFFF0 bytes). Every Xbox texture seen uses tile mode 5, Gfx10 4 KiB tiles with the mip tail of bcpack-rs; element bit patterns (lowest address bit first): 16-byte blocks yyxxyxyx, 8-byte blocks xyyxxyxyx, 4-byte pixels xxyyyxyxyx, 2-byte pixels xxxyyyxyxyx. - Text tables (data/lang, src/texttable.rs): a resource with 0DRP at +0x10 and regions listed at +0x38 (count +0x48): strings (kind 0x10), values (0xA8478889; string offset << 20 | 4) and a hash map (0x0101; slots { u32 label hash, u32 0, u64 value index << 24 | 1 }). - AWC (src/awc.rs): codec 0x0B is Opus, as u16 length + packet in 2 KiB pages (20 ms CELT fullband frames seen), with 312 samples of encoder delay and up to a packet of padding past the header's sample count. Header changes from GTA V: with flag 0x10000 a u16 per stream gives its first tag, followed by (2n + 1) u32 and the tags; flag 0x400000 adds a u32 before them.