DAT files

24,629pages on
this wiki
Add New Page
Talk0 Share

DAT files are archive files in which most of the files used in Fallout and Fallout 2 are stored.

DAT1 vs DAT2Edit

There were two different DAT file formats used for the Fallout games. Both Fallout 1 and Fallout 2 used different formats but used the same file ending: *.dat. To avoid misunderstandings we will refer to DAT1 (for the Fallout 1 DAT format) and DAT2 (for the Fallout 2 version) in this document. It's important that DAT2 is not an improved DAT1 version but more a complete rewrite that does not have much in common with DAT1.


Lack of documentationEdit

Unfortunately there is no known documentation about the DAT1 format, but on the other side TeamX wrote a DAT1 parser.


DAT2 specs DocumentEdit

You can see Fallout's DAT2 files as if they were common ZIPs, they're used to store the files that will be used later inside the game, you can store anything you want, compressed or not, having the length you want from a common TXT to an immense MVE, and if you want, you can include a nice but useless DLL file. At the bottom of the DAT is all the included information about each one of these files and some information about the DAT itself.

The DAT2 FormatEdit

DAT2 files are divided in 3 parts, Data Block, Directory Tree and Fixed DAT Information block. Data Blocks contains all the files stored in the DAT, some of them needs to be GZipped, others don't. The Directory Tree contains all the information about each file stored in Data Block, as well as the offset where it's located, if it's compressed or not, packed/unpacked sizes, etc. And finally the Fixed DAT Information block that contains the size in bytes of both full DAT and the Directory Tree. Here you can see a small scheme of how DAT's structure:

Part Location Description
DataBlock .............

............. X

Files stored in the archive
FilesTotal X+1 Number of files in the archive
DirTree X+5

............. Z

Tree information about the files stored in the archive
TreeSize Z+1 Size of DirTree in bytes
DataSize Z+5 Full size of the archive in bytes
  • FilesTotal + DirTree corresponds to Directory Tree block
    • TreeSize + DataSize corresponds to Fixed DAT Information block

The Data BlockEdit

The Data Block contains just plain files, their technical information is located in the Directory Tree. Data Block starts from the very beginning of a DAT file. They can be compressed or not, (Fallout engine uses zlib stream data compression), if they're compressed the signature 0x78DA appears at the begin of the file, if not, there is no signature, the file starts without signature. The 0x78DA compression signature has an integer (2 bytes/WORD) nature. 0x78DA in ASCII is "xÚ" as char is 120 for 'x' and 218 for 'Ú' Compressed files are "zlib stream data" (RFC-1950(zlib format), RFC-1951(deflate format), RFC-1952(gzip format)). However, if you attach this header 1F 8B 08 08 9F E8 B7 36 02 03 to the file, such file could been easily decompressed with WinZip.

The Directory TreeEdit

Directory Tree contains entries that specifies about a file stored in the Data Block. These entries can be varying depending on the FilenameSize of the file (Path + Filename). Like you saw in the scheme located at the beginning of this document, Directory Tree has been divided into 2 parts, FilesTotal and the DirTree. FilesTotal contains how many files are stored in the DAT, DirTree contains all the information about these files. FilesTotal is declared as a DWORD (4 bytes/Long) type and is readed in INTEL L-H format. Format of DirTree entries DirTree has a private structure. The length of this structure can vary depending on the length of the Filename (path + filename). All the entries are DWord types unless it's specified. At the end of this chapter you can find a scheme on the structure and the way it's declared on C and Visual Basic programming languages. All the directories and files are stored in DOS 8.3 format, that is 8 characters for the file name and 3 characters for the file extension. All the entries are sorted alphabetically in a descendent direction. Structure scheme: all Dwords are readed in INTEL L-H format.

Name Type Description
FilenameSize Dword Length of the ASCII filename.
Filename String Path and name of the file, For example, "text\english\game\WORLDMP.MSG".

The length of the Filename is FilenameSize.

Type Byte Compression boolean:

1 = Compressed 0 = Decompressed

RealSize Dword Size of the file without compression.
PackedSize Dword Size of the compressed file.
Offset Dword Address/Location of the file.
  • Dword stands for 4 bytes/long integers 0xNN NN NN NN
  • Word stands for 2 bytes integers 0xNN NN
  • Byte stands for 1 byte integer 0xNN
  • String stands for common string bytes "ABCDEF123456!@#$%/][\", etc.

Declaration of a DirEntry

  • C decorated structure:
 struct DirEntry
     DWORD FilenameSize;
     char Filename[FilenameSize];
     BYTE Type;
     DWORD RealSize;
     DWORD PackedSize;
     DWORD Offset;
  • Visual Basic decorated structure:
 Type DirEntryId
     FilenameSize As Long
     Filename As String * 255
 End Type
 Type DirEntry
     Type As Byte
     RealSize As Long
     PackedSize As Long
     Offset As Long
 End Type 

Entry Example

Offset Values Description
13CC46AD 16 00 00 00 FilenameSize, that is, 0x16
13CC46B1 61 72 74 5C

62 61 63 6B 67 72 6E 64 5C 41 64 6F 62 65 2E 66 72 6D

ASCII Filename, in this case:


13CC46C7 01 Type: 0x1 = compressed
13CC46C8 6A 2F 01 00 RealSize
13CC46CC 94 85 00 00 PackedSize
13CC46D0 00 00 00 00 Offset, location of the file. 0x00 1st file
  • This exact example can be found on the Team X DAT specs document.

How to find a DirTreeAddr (starting location of Directory Tree)

To find the beginning of Directory Tree you can use this calculation:

DirTreeAddr = DataSize - TreeSize - 4 


  • TeamX
  • FIFEwiki
  • Copyright 2000 by MatuX ( unless it's specified.