-
Notifications
You must be signed in to change notification settings - Fork 8
Format Overview
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.
The header of an archive is padded out to be 64/0x40 bytes long. It contains the following properties:
/*0x00*/ char[4]; // 'R','A', 'R', 'C'
/*0x04*/ int FileSize;
/*0x08*/ int Unknown1; // 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 Unknown2; //Always 0x20
/*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;
Nodes are 16/0x10 bytes long. They represent every directory in the archive. They are not a 1:1 indication of the directories contained within the archive as the archive uses specially named nodes ('.', '..'). 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 structure of the archive, and can either be a file or a sub-directory. They 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;