Skip to content
Bananarchist edited this page Oct 29, 2012 · 5 revisions

The DAR file format is a container format.

Structure

The DAR file format consists of a 16 byte header, followed by a set of null-terminated filename strings, then a set of 16 byte file descriptors, and then the files themselves. Filenames preserve paths. As an example, in the US release of Gungnir, in ini.dar, there are filenames prefixed with 'px/' indicating they are in the 'px' directory.

Header

0x00-0x03: File count
0x04-0x07: File data block starting offset
0x08-0x0B: Filename strings block starting offset
0x0C-0x0F: File descriptors block starting offset

File Descriptors

There will be exactly as many of these as the File count entry in the Header says.

0x00-0x03: Filename string starting offset
0x04-0x07: Compressed size, or zero if uncompressed
0x08-0x0B: Uncompressed size, or file size if uncompressed
0x0C-0x0F: File data starting offset

Compression

All compressed files thus far encountered in DAR archives are compressed using zlib and easily decompressed using the same library.

DAR_File

The DAR_File python class has three functioning methods and a constructor.

init

Keyword arguments:

file: object created with open() command, in rb mode.
filename: a string representing the path to a DAR file, will be opened in __init__ using open()

info()

Returns a formatted string containing information on the DAR file and contained files.

extractFile()

Arguments:

fileindex: the index of the file, as determined by the listing order in the DAR container

Keyword Arguments:

initialindex: the starting index, defaults to zero, useful only for minimal translation between UI and code
directory: where to output the file to, defaults to CWD, will still generate relative path if necessary

extractFiles()

Iterates through each file in DAR container, calling extractFile() for each one. Keyword Arguments:

directory: directory to output to, defaults to a directory in the CWD named after the DAR file 
Clone this wiki locally