Daggerfall Mod:PAK file formats

Mod / Daggerfall: Daggerfall Mod: File Formats(Redirected from Daggerfall:PAK file formats)

PAK is a compression format very similar to RLE, except there are no uncompressed "runs". Since there are no uncompressed "runs", it is not suitable for arbitrary data. This format is used by CLIMATE.PAK and POLITIC.PAK.

General FormatEdit

A stream of PAK-compressed data is composed of a contiguous list of one or more PakRun structures.

PakFileEdit

A PakFile is merely a contiguous list of one or more PakRun structures.

PakRunEdit

The 3 byte long PakRun structure is composed of a UInt16 Count field, immediately followed by a single UInt8 Value. This value is to be repeated Count times.

PakRun structure
Offset Type Name Description
0-1 UInt16 Count The number of times the Value field must be copied.
2 UInt8 Value The value to be copied to the output buffer.

Reading PAK filesEdit

To read a PakFile, one merely reads PakRun and processes structures until one has run out of file.