.pak file format of Quake game engine: format specification

Application

Quake game engine

File extension

pak

KS implementation details

License: CC0-1.0

This page hosts a formal specification of .pak file format of Quake game engine using Kaitai Struct. This specification can be automatically translated into a variety of programming languages to get a parsing library.

Block diagram

Format specification in Kaitai Struct YAML

meta:
  id: quake_pak
  file-extension: pak
  application: Quake game engine
  license: CC0-1.0
  endian: le
doc-ref: 'https://quakewiki.org/wiki/.pak#Format_specification'
seq:
  - id: magic
    contents: 'PACK'
  - id: ofs_index
    type: u4
  - id: len_index
    type: u4
instances:
  index:
    pos: ofs_index
    size: len_index
    type: index_struct
types:
  index_struct:
    seq:
      - id: entries
        type: index_entry
        repeat: eos
  index_entry:
    seq:
      - id: name
        type: str
        size: 56
        encoding: UTF-8
        terminator: 0
        pad-right: 0
      - id: ofs
        type: u4
      - id: size
        type: u4
    instances:
      body:
        pos: ofs
        size: size
        io: _root._io