User Tools

Site Tools


Sidebar

Torchmodders Site


Wiki Navigation

file_formats

File Formats


Byte-by-byte descriptions for various binary data formats used by the game. Useful if you want to compile to bin, decompile to text, pack, or unpack without using GUTS, or to see why a particular file displeases GUTS. Complete descriptions for .bindat and .raw formats. Nearly complete descriptions for .pak, .pak.man, and .mod formats.

Archive Formats

.pak

4 - Largest Compressed File Size
4 - ???
[] - Files

File:
	4 - Uncompressed Size
	4 - Compressed Size
	[] - zlib Stream

.pak.man

2 - ??? (0)
2:2[] - ??? (MEDIA/)
4 - ??? (not the number of files)
4:[] - Directories

Directory:
	2:2[] - Directory Name (full path)
	4:[] - Files

File:
	4 - CRC32
	1 - File Type
	2:2[] - Name
	4* - Offset (.pak file)
	4 - Uncompressed Size
	8 - Windows File Time

.mod

2 - ??? (4)
2 - Version
8 - ??? (01 00 17 00 05 00 05 00)
4* - .pak section
4* - Manifest
2:2[] - Name
2:2[] - Author
2:2[] - Description
2:2[] - Website
2:2[] - Download URL
8 - Mod ID
14 - ??? (0)
2:2[]:2[] - Removed Files

Manifest:
	6 - ???
	n - .pak.man section (without leading 2 bytes)

File Types

0  = Data File (.dat, .template) (.bindat format)
1  = .layout (.BINLAYOUT format)
2  = .mesh
3  = .skeleton
4  = .dds
5  = .png
6  = Audio (.ogg, .wav)
7  = Directory
8  = .material
9  = .raw
11 = .imageset
12 = .ttf
13 = .font
16 = .animation (.bindat format)
17 = .hie (.bindat format)
18 = 'Removed' Directory
19 = .scheme
20 = .looknfeel
21 = .mpp
24 = .jpg

Notes

  • Forward slashes are used as directory seperators.
  • All names are uppercase (may only be ASCII characters like in TL1).
  • Directories have all properties set to 0 (CRC32, Offset, Size, Timestamp).
  • If the offset property of a non-directory file has an offset of zero, it is a removed file.
  • Removed directories replace directories when they contain only removed files.
  • .jpg files are not compressed

Data Files

.bindat (.dat.bindat, .hie.bindat, .template.bindat, .animation.bindat)

4 - Version (2)
4:[] - String Table
n - Block

Table Entry:
	4 - Key
	2:2[] - Value

Block:
	4 - Name Hash
	4:[] - Fields
	4:[] - Blocks

Field:
	4 - Name Hash
	4 - Value Type
	4|8 - Value (Size dependent on type)

Hash Function:

hash := string.length
foreach(char in string)
    hash := rol(hash, 5) ^ char

Value Types:

INTEGER:
	ID = 1
	Size = 4
	Textual = [+|-]?[0-9]*
FLOAT:
	ID = 2
	Size = 4
	Textual = (+|-)?[0-9]*(.[0-9]*)?(E(+|-)?[0-9]*)?
DOUBLE:
	ID = 3
	Size = 8
	Textual = (+|-)?[0-9]*(.[0-9]*)?(E(+|-)?[0-9]*)?
UNSIGNED INT:
	ID = 4
	Size = 4
	Textual = [0-9]*
STRING:
	ID = 5
	Size = 4 (Key for the string table)
BOOL:
	ID = 6
	Size = 4 (0 is false)
	Textual = (1|0)|(true|false)
INTEGER64:
	ID = 7
	Size = 8
	Textual = [+|-]?[0-9]*
TRANSLATE:
	ID = 8
	Size = 4 (Key for the string table)

.layout.binlayout

1 - ??? (Always the same value)
1 - Version
4* - ??? (Some extra data, 0 for none)
2:[] - Objects

Object:
	4 - Length (inclusive)
	1 - Type ID
	8 - GUID
	1:[] Properties
	4:1[] - Logic (Formatted data for Timelines and Logic Groups)
	4:[] - Child Objects

Property:
	2 - Length (in bytes)
	1 - Type ID
	1[] - Data (Length - 1)

Logic Group Logic:
	1:[] - Logic Group Objects

Logic Group Object:
	1 - ID
	8 - Object GUID
	4 - X Position (for editor)
	4 - Y Position (for editor)
	4 - ???
	1:[] Logic links

Logic Link:
	1 - Linking To (ID)
	2:2[] - Output Name
	2:2[] - Input Name
		
Timeline Logic:
	1:[] - Timeline Objects

Timeline Object:
	8 - Object GUID
	1:[] - Timeline Object Properties/Events

Timeline Object Property/Event:
	2:2[] - Object Property Name (If this is an non-empty string, this is a property; otherwise, this is an event. Exactly one of these two names should be non-empty)
	2:2[] - Object Event Name
	4 - Time Percent
	1 - Timeline Interpolation (0 = Linear, 1 = Linear Round, 2 = Linear Round Down, 3 = Linear Round Up, 4 = Spline, 5 = Quaternion, 6 = No Interpolation, 7 = Use Timeline Default)
	2:2[] - Value (For properties only)

Raw Formats

affixes.raw

2:[] - Affix Files

Affix File:
	2:2[] - File
	2:2[] - Name
	4 - Min Spawn Range
	4 - Max Spawn Range
	4 - Weigth
	4 - Difficulties Allowed (defaults to -1)
	1:2[]:2[] - Unittypes
	1:2[]:2[] - Not-Unittypes

missiles.raw

2:[] Missile Files

Missile File:
	2:2[] File
	1:2[]:2[] - Missiles

roompieces.raw

4:2[]:2[] - Levelset Files
4[]:8[] - Levelset Files' GUIDs (one set for each file, in the same order)

skills.raw

4:[] - Skill Files

Skill File:
	2:2[] - Name
	2:2[] - File
	8 - Unique GUID

triggerables.raw

2:[] - Triggerable Files

Triggerable File:
	2:2[] - File
	2:2[] - Name

ui.raw

4:[] - Menu Files

Menu File:
	2:2[] - Menu Name
	2:2[] - File
	4 - Type
	4 - Game State
	1 - Create On Load
	1 - Multiplayer Only
	1 - Singleplayer Only 
	2:2[] - Key Binding

unitdata.raw
Notes:

  • If a unit is specified “DONTCREATE” it does not appear in this file
  • Basefiles are taken into account
  • DONTCREATE is not inherited
4:[] - Item Files
4:[] - Monster Files
4:[] - Player Files
4:[] - Prop Files

Unit File:
	8B: GUID
	2:2[] - Name
	2:2[] - File
	1 - ??? (bitfield? 1 = CREATEAS:EQUIPMENT, 2 = Part of a set)
	4 - Level (defaults to 1)
	4 - Min level
	4 - Max Level
	4 - Rarity (defaults to 1)
	4 - Rarity HC (defaults to Rarity)
	2:2[] - Unittype

Reference

file_formats.txt · Last modified: 2015/09/04 11:51 by chthon