DAT1 - Tkachov/ALERT GitHub Wiki
dat1.py | Overstrike: DAT1.cs | rivet's format doc
Universal container format almost all of game's assets are wrapped into. Contains arbitrary amount of sections, each section having its own binary format. Sections with the same tag share format, and typically present only in assets of the same type. Some sections are always present in assets of a type, others can be missing if asset is not supposed to have corresponding data.
Sample of DAT1 asset, viewed in 010 Editor with binary template.
Typically, first 32-bit integer determines asset's type, second is file size. The rest are either zeroes, or offsets to some parts of the asset, depending on asset's type. Type and size are repeated in DAT1 header, and size does not include these 36 bytes.
DAT1 itself can be LZ4-compressed (similarly to DSAR). // can't recall where such assets were met
It consists of header, strings block and sections data.
// little-endian
uint32 magic; // 0x44415431 aka DAT1
uint32 type;
uint32 filesize;
uint16 sectionCount;
uint16 unknownCount;
Section sections[sectionCount]; // 12 bytes per section
Unknown unknowns[unknownCount]; // 8 bytes per unknown
Starts with 1TAD FourCC. This magic is the reason we call it DAT1 (not 1TAD simply because programming languages usually don't allow names to start with digits, and because "DAT" resembles "data").
Then goes asset type and file size, also 32-bit integers.
Then, 16-bit integer for number of sections and 16-bit integer for number of some unknown things.
Each section is defined by three 32-bit integers:
- tag, which is CRC32 of section name, and determines section format;
- offset to the start of the section, relative to DAT1 magic;
- size of the section.
Unknown things are rarely met, and are 8 bytes each. // can't recall where such assets were met
◆ Sections data — everything that comes after strings block. Use sections offset/size information from header to determine which part is which. Sections are aligned to 16 bytes (relative to DAT1 magic, not file start, if it includes asset header).