DAT Format (Bullfrog)

From ModdingWiki
Jump to navigation Jump to search
DAT Format (Bullfrog)
Format typeArchive
Max filesUnlimited
File Allocation Table (FAT)End
Filenames?Yes, 15/16 chars max
Metadata?None
Supports compression?No
Supports encryption?No
Supports subdirectories?Yes
Hidden data?Yes
Games

The DAT Format is used by Hi Octane for storing some game data.

File format

Structure

At the very end of the file there is a "folder-FAT" which lists offsets and sizes of groups of files, which are referred to here as "folders". The folders do not have names. Each folder has its own FAT which contains names, offsets and sizes of each file within that folder.

Signature

The last four bytes in the archive are a UINT32LE value containing the offset of the folder-FAT. Assuming this offset is valid, reading eight bytes here should match the signature 01 00 01 00 01 00 01 00.

Subtracting 8 from the offset (for the signature) and subtracting a further 4 (for the folder-FAT offset field itself) will reveal the size of the valid folder-FAT data. This must be a multiple of 16 (the size of each folder-FAT entry.)

Folder entry

The last four bytes in the archive are a UINT32LE called offFolders. At the offset given by offFolders skip the first eight bytes (the signature), the following structure is repeated until arriving at four bytes from the end of the archive again.

Alternatively a folder count can be calculated as numFolders = (lenArchive - offFolders - 8 - 4) / 16

Data type Name Description
UINT32LE offFAT Offset of the FAT for this folder
UINT32LE offData Offset of the first file's data
UINT32LE lenFAT Length of the FAT, in bytes
UINT32LE lenData Length of the folder's data, not including the FAT

File entry

At offFAT, the following structure is repeated once for each file. The number of files is obtained either by reading lenFAT bytes, or precalculating the amount as numFiles = (lenFAT / 32) - 1.

Data type Name Description
char[18] filename Filename, null terminated/padded
UINT32LE offset File offset, relative to start of folder (offData in folder entry)
UINT32LE unknown Unknown, always 0
UINT32LE size File size, in byte
UINT32LE flags Unknown, always 0x5A for normal files, 0x00 for first entry (see below)
! In Hi Octane it is an UINT16LE (MUSIC.DAT)

The first file entry in the FAT is a kind of header and should be ignored when reading. When writing, use an empty filename (all 0x00), set the unknown value, flags and offset to 0, and the size to the same value as lenData from the folder entry.

Tools

The following tools are able to work with files in this format.

Name PlatformExtract files? Decompress on extract? Create new? Modify? Compress on insert? Access hidden data? Edit metadata? Notes
Camoto Linux/WindowsYesN/AYesYesN/ANoN/A

Credits

This file format was reverse engineered by Malvineous. If you find this information helpful in a project you're working on, please give credit where credit is due. (A link back to this wiki would be nice too!)