Skip to content
Faye edited this page Nov 18, 2016 · 5 revisions

This page provides an overview of the structure of the archive format. Code to unpack an archive can be found in the ArchiveToolsLib project included in this repository. This is designed as a (nearly) complete spec of the file format. The loading code is written with this in mind, thus the loading code will often skip over fields.

Header

The header of an archive is padded out to be 64/0x40 bytes long. All offsets listed below are the offsets minus 0x20 (possibly minus the value at offset 0x08). It contains the following properties:

/*0x00*/ char[4]; // 'R','A', 'R', 'C'
/*0x04*/ int FileSize;
/*0x08*/ int ConstInt20A; // Always 0x20
/*0x0C*/ int FileDataOffset;
/*0x10*/ int FileDataSize1; // No idea why these are duplicated. They always appear to be the same
/*0x14*/ int FileDataSize2; // Same as above.
/*0x18*/ int Padding1;
/*0x1C*/ int Padding2;
/*0x20*/ int NodeCount; // Number of Nodes within an Archive
/*0x24*/ int NodeOffset; // Where the node definitions start
/*0x28*/ int FileEntryCount;
/*0x2C*/ int FileEntriesOffset;
/*0x30*/ int StringTableLength;
/*0x34*/ int StringTableOffset;
/*0x38*/ short ShortFileEntryCount;
/*0x3A*/ byte UnknownByte1; // Always 1. Could be a bool of some sort, or a version number?
/*0x3B*/ byte UnknownByte2; // Probably padding for the previous byte.
/*0x3C*/ int HeaderPadding;

Node

Nodes are 16/0x10 bytes long. They represent every directory in the archive, and can be viewed as a 1:1 representation of the archive's directory structure. They have the following properties:

/*0x00*/ char[4] Type; // "ROOT", "DZB", "DZR", "DZS", "TIMG", "BLO", etc. Usually file type that the folder holds.
/*0x04*/ int NameOffset;
/*0x08*/ short NameHash;
/*0x0A*/ short FileEntryCount;
/*0x0C*/ int FirstFileEntryIndex;

#File Entry

File entries are padded out to be 20/0x14 bytes long. They represent the flattened structure of the archive. Most of them are actual directories or files. However, each directory has two additional file entries to hold references to the current directory (named ".") and its parent directory (named ".."), similar to Unix-like systems and Windows. File entries have the following properties:

/*0x00*/ short FileID; // 0xFFFF = Directory, Otherwise used by game's engine to load specific files.
/*0x02*/ short NameHash;
/*0x04*/ byte Type;
/*0x05*/ byte TypePadding;
/*0x06*/ short NameOffset;
/*0x08*/ int DataOffset; // If this is a directory, index of directory's Node. If file, offset to file's data.
/*0x0C*/ int DataSize; // If this is a directory, 16/0x10, the size of a Node. If file, the size of the file's data.
/*0x10*/ int EntryPadding;

Clone this wiki locally