Deathtrack Chunk Format

From ModdingWiki
Jump to navigation Jump to search
Deathtrack Chunk Format
Format typeArchive
Max filesUnlimited
File Allocation Table (FAT)Embedded
Filenames?No
Metadata?None
Supports compression?Yes
Supports encryption?No
Supports subdirectories?Yes
Hidden data?No
Games

The Dynamix resource chunk container is used by almost every data file in Deathtrack: bitmaps (.BMP), full-screen images (.SCR), the multi-resource .BLK files, music (.MUS), the title script (.TTM) and the activisi logo file. A file is a sequence of top-level chunks; chunks flagged as containers hold further chunks, forming a tree at most five levels deep.

Only the files listed above use this framing. The .MAP, .TRK, .TBL, HI_SCORE and .RCT files do not use it.

The leaf payloads of many chunks are wrapped in the compression envelope.

File format

Chunk header

Data type Name Description
char[4] tag ASCII tag that ends in a colon, e.g. BMP:
UINT32LE size Bit 31 set: the chunk is a container and its payload is a list of child chunks. Bits 0–30: payload length in bytes, excluding this 8-byte header
BYTE[size & 0x7FFFFFFF] payload Child chunks (container) or raw data (leaf)

A file may contain several top-level chunks one after the other (for example PALS.BLK or BITMAPS.BLK). The next sibling starts at offset + 8 + length.

Tags

A path through the tree is written by concatenating the tags, e.g. BMP:INF:. The game's chunk library searches for such paths.

Path Leaf? Contents
BMP:INF: yes Frame count, widths, heights (raw)
BMP:BIN: yes Packed 4-bpp pixels (enveloped)
BMP:VGA: – Only read when a VGA flag is set; never present in the shipped files
SCR:BIN: yes 320×200 screen (enveloped)
FNT: yes Font (raw, no envelope)
PAL:EGA: yes 64 EGA palette words (raw)
PAL:CGA: yes CGA mapping data (162 bytes; not read on EGA)
SND:INF: yes Sound-effect bank header
SND:IBM: yes PC-speaker effect programs (enveloped)
SND:ITM: yes Optional; absent in the shipped PALS.BLK
SND: (leaf) yes In .MUS files: Standard MIDI file (enveloped)
TTM: yes Title script (enveloped)

Searching

The game's search routine (chunkSeek, 1ff8:4ade) does a depth-first walk and has some constraints that matter when writing a parser:

  • The path must have a length that is a multiple of four.
  • A chunk whose length is zero makes the whole search fail.
  • A chunk's length must be strictly less than the file length.
  • At most five levels of nesting are supported.
  • Several resources of the same type are read in file order (PALS.BLK holds SND:, PAL:, PAL:, BMP:).

Source code

From re-deathtrack, the open-source browser port:

Credits

This file format was reverse engineered by VorticonCmdr. 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!)