Kub Format
A custom archive format for storing multiple files with compression in the oldest demo.
This document contains information about the format structure of Kub files. If you are interested in using tools to create your own, please visit here.
Overview
The first demo of the game uses a custom archive format for storing multiple compressed files into one file. This format was eventually superseded by the .PAK format used in later versions of the game, with the only differences being that the Kub doesn't store filenames and uses a different compression algorithm. It is worth noting that the .PIC file is in the exact same format.
All values are in little endian, and the following data types will be used:
Encoding | Description |
---|---|
u32 | Unsigned 32-bit integer |
Structure
The format is comprised of the following structure:
- File count
- Offset and compressed size of each file
- Compressed file data
Header
Offset(h) | Size | Type | Field | Description |
---|---|---|---|---|
0x00 | 4 | u32 | file_count | Number of files in the archive |
File Table
Starting at offset 0x04, each file entry is 8 bytes:
Offset(h) | Size | Type | Field | Description |
---|---|---|---|---|
+0x00 | 4 | u32 | offset | Absolute offset to compressed file data |
+0x04 | 4 | u32 | size | Size of compressed file in bytes |
File Data
The file data starts immediately after the table, with each buffer starting with a null 4-byte value. Each file is compressed using lzrw3a, an old and somewhat obscure compression algorithm.