.pak file format of Quake game engine: GraphViz block diagram (.dot) source

Application

Quake game engine

File extension

pak

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.

GraphViz block diagram source

quake_pak.dot

digraph {
	rankdir=LR;
	node [shape=plaintext];
	subgraph cluster__quake_pak {
		label="QuakePak";
		graph[style=dotted];

		quake_pak__seq [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
			<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
			<TR><TD PORT="magic_pos">0</TD><TD PORT="magic_size">4</TD><TD>50 41 43 4B</TD><TD PORT="magic_type">magic</TD></TR>
			<TR><TD PORT="index_ofs_pos">4</TD><TD PORT="index_ofs_size">4</TD><TD>u4le</TD><TD PORT="index_ofs_type">index_ofs</TD></TR>
			<TR><TD PORT="index_size_pos">8</TD><TD PORT="index_size_size">4</TD><TD>u4le</TD><TD PORT="index_size_type">index_size</TD></TR>
		</TABLE>>];
		quake_pak__inst__index [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
			<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
			<TR><TD PORT="index_pos">index_ofs</TD><TD PORT="index_size">index_size</TD><TD>IndexStruct</TD><TD PORT="index_type">index</TD></TR>
		</TABLE>>];
		subgraph cluster__index_struct {
			label="QuakePak::IndexStruct";
			graph[style=dotted];

			index_struct__seq [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
				<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
				<TR><TD PORT="entries_pos">0</TD><TD PORT="entries_size">64</TD><TD>IndexEntry</TD><TD PORT="entries_type">entries</TD></TR>
				<TR><TD COLSPAN="4" PORT="entries__repeat">repeat to end of stream</TD></TR>
			</TABLE>>];
		}
		subgraph cluster__index_entry {
			label="QuakePak::IndexEntry";
			graph[style=dotted];

			index_entry__seq [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
				<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
				<TR><TD PORT="name_pos">0</TD><TD PORT="name_size">56</TD><TD>str(UTF-8)</TD><TD PORT="name_type">name</TD></TR>
				<TR><TD PORT="ofs_pos">56</TD><TD PORT="ofs_size">4</TD><TD>u4le</TD><TD PORT="ofs_type">ofs</TD></TR>
				<TR><TD PORT="size_pos">60</TD><TD PORT="size_size">4</TD><TD>u4le</TD><TD PORT="size_type">size</TD></TR>
			</TABLE>>];
			index_entry__inst__body [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
				<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
				<TR><TD PORT="body_pos">ofs</TD><TD PORT="body_size">size</TD><TD></TD><TD PORT="body_type">body</TD></TR>
			</TABLE>>];
		}
	}
	quake_pak__seq:index_ofs_type -> quake_pak__inst__index:index_pos [color="#404040"];
	quake_pak__seq:index_size_type -> quake_pak__inst__index:index_size [color="#404040"];
	quake_pak__inst__index:index_type -> index_struct__seq [style=bold];
	index_struct__seq:entries_type -> index_entry__seq [style=bold];
	index_entry__seq:ofs_type -> index_entry__inst__body:body_pos [color="#404040"];
	index_entry__seq:size_type -> index_entry__inst__body:body_size [color="#404040"];
}