Quake PAK

From Just Solve the File Format Problem
(Difference between revisions)
Jump to: navigation, search
(Copied a link from the PAK article)
m (Change telparia.com samples link to template)
 
(3 intermediate revisions by 3 users not shown)
Line 34: Line 34:
  
 
== Description ==
 
== Description ==
 
 
This file format is very simple. File starts with <code>PACK</code> magic string (4 octets), then 4-byte offset to file table and 4-byte length (measured in bytes) of it.
 
This file format is very simple. File starts with <code>PACK</code> magic string (4 octets), then 4-byte offset to file table and 4-byte length (measured in bytes) of it.
  
Line 41: Line 40:
 
* file name, including path: 56-byte null-terminated string. No leading slash.
 
* file name, including path: 56-byte null-terminated string. No leading slash.
 
* file contents offset (from beginning of .pak file), 4 bytes
 
* file contents offset (from beginning of .pak file), 4 bytes
* file contents length
+
* file contents length, 4 bytes
  
All numbers are [[Endianness|little-endian]].
+
All numbers are [[Endianness|little-endian]]. Since each file entry of the table consists of 64 bytes, the header's file table length (offset 8 to 11) must always be a multiple of 64, and most likely never 0. If the 4 bytes for the file table offset (offset 4 to 7) would be <code>0x02 0x00 0x00 0x00</code> or <code>0x03 0x00 0x00 0x00</code> it would also match [[Git]]'s .pack files. If the first byte is <code>0x00</code> it would also match [[Packdir]].
  
== Links ==
+
== Software ==
 +
* [http://www.watto.org/game_extractor.html Game Extractor]
 +
* [https://github.com/PascalVault/Lazarus_Unpacker Open-source library in Free Pascal]
  
 +
== Sample files ==
 +
* {{DexvertSamples|archive/quakePAK}}
 +
 +
== Links ==
 
* [https://quakewiki.org/wiki/.pak .pak — Quake Wiki]
 
* [https://quakewiki.org/wiki/.pak .pak — Quake Wiki]
 
* [https://web.archive.org/web/20160711041711/http://debian.fmi.uni-sofia.bg/~sergei/cgsr/docs/pak.txt Quake PAK Format] (from archive.org)
 
* [https://web.archive.org/web/20160711041711/http://debian.fmi.uni-sofia.bg/~sergei/cgsr/docs/pak.txt Quake PAK Format] (from archive.org)

Latest revision as of 02:53, 28 December 2023

File Format
Name Quake PAK
Ontology
Extension(s) .pak
Magic Bytes PACK
Kaitai Struct Spec quake_pak.ksy

Quake .pak is the container file format for storing game assets in versions 1 and 2 of ID Tech game engine and some derivatives of it, including following games:

Later Id Tech games (starting from Quake 3/ID Tech 3) switched to ZIP format with .pk3 extension.

Contents

[edit] Description

This file format is very simple. File starts with PACK magic string (4 octets), then 4-byte offset to file table and 4-byte length (measured in bytes) of it.

File table consists of entries consisting of:

  • file name, including path: 56-byte null-terminated string. No leading slash.
  • file contents offset (from beginning of .pak file), 4 bytes
  • file contents length, 4 bytes

All numbers are little-endian. Since each file entry of the table consists of 64 bytes, the header's file table length (offset 8 to 11) must always be a multiple of 64, and most likely never 0. If the 4 bytes for the file table offset (offset 4 to 7) would be 0x02 0x00 0x00 0x00 or 0x03 0x00 0x00 0x00 it would also match Git's .pack files. If the first byte is 0x00 it would also match Packdir.

[edit] Software

[edit] Sample files

[edit] Links

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox