Divinity Original Sin Wiki

We've Moved! Just as Gamepedia has joined forces with Fandom, this wiki had joined forces with our Fandom equivalent. The wiki has been archived and we ask that readers and editors move to the now combined wiki on Fandom. Click to go to the new wiki.

READ MORE

Divinity Original Sin Wiki
Line 19: Line 19:
 
| 0x08 || int32 || 4 || Number of archive files, including the primary.
 
| 0x08 || int32 || 4 || Number of archive files, including the primary.
 
|-
 
|-
| 0x0C || int32 || 4 || Length of the file metadata in bytes. This does not include the archive metadata.
+
| 0x0C || int32 || 4 || Length of the file metadata in bytes. This does not include the size of the archive metadata.
 
|-
 
|-
 
| 0x10 || bool || 1 || Unknown. Maybe an "affects checksum" flag.
 
| 0x10 || bool || 1 || Unknown. Maybe an "affects checksum" flag.

Revision as of 18:16, 1 July 2014

Overview

The PAK format appears to be encoded in little-endian format. A PAK archive consists of one or more archive files: a primary file, e.g. Main.pak, and perhaps a number of secondary files, e.g. Main_1.pak.

PAK header

The header only appears in the primary archive file.

Archive metadata

The archive metadata is 0x15 (21) bytes long.

Offset Type Size (bytes) Field
0x00 int32 4 Format version number? Appears to be always 0x7.
0x04 int32 4 Offset to the start of the data section in bytes. This should be a multiple of 0x800 (32 KiB).
0x08 int32 4 Number of archive files, including the primary.
0x0C int32 4 Length of the file metadata in bytes. This does not include the size of the archive metadata.
0x10 bool 1 Unknown. Maybe an "affects checksum" flag.
0x11 int32 4 Number of files in the archive.

File metadata

Following the archive metadata are the file metadata as a sequence of records. Each file record is 0x110 (272) bytes long.

Offset Type Size (bytes) Field
0x000 char* 256 File name
0x100 int32 4 File offset within the archive file, not including the archive header if the file is in the primary archive file. This should be a multiple of 0x800 (32 KiB).
0x104 int32? 4? File size in bytes?
0x108 int32? 4? ?
0x10C int32 4 Index of the archive file the file is located in.

The remainder between the end of the file metadata and the start of the data section is padded with 0xAD bytes.

Data section

Files are laid out in the data section according to their record in the header. Any space between the end of a file and the start of the next file is padded with 0xAD bytes.