Notes and Conventions
Introduction
This section is an overview of concepts and conventions used throughout the IESDP and serves as a continuation of the Infinity Engine File Format Hacking Project.
General
All versions of the Infinity Engine, except that used in Planescape: Torment, make some internal of the Lua programming language, as developed by TeCGraf at the Pontifical Catholic University of Rio de Janeiro in Brazil. In the Infinity Engine, LUA is primarily used for the cheats/debugging console. The debug console actually allows complete LUA programs to be entered and run, though these programs can only have a very limited affect on the game and the engine. The LUA documentation is available online, though knowledge of LUA is of limited use in IE modding. It should be mentionned, that unlike other engines where LUA is used, the Infinity Engine AI scripts have nothing to do with LUA.
The data types used to describe the file formats used by the Infinity Engine are:
The data types used to describe the file formats used by the Infinity Engine are:
Data type | Description |
---|---|
char array | An array of ASCII characters of a fixed length |
ASCIIZ string | An array of ASCII characters terminated by a NUL character (ASCII 00). Note that the full length of the array need not be used, and may in fact contain garbage data, so long as a NUL character is found earlier in the array to mark the end of valid data. |
word | A little-endian "word" of 16-bits |
dword | A little-endian "double-word" of 32-bits |
point | A point within some reference frame, composed of two 16-bit words; the first is the x-coordinate and the second is the y-coordinate. |
rect | A rectangle within some reference frame, composed of 4 16-bit words; the order of the coordinates is: left , top , right , bottom . Typically this is used to store bounding boxes of various objects. |
strref | A reference into the 'TLK' resource. Stored as a 32-bit number (though the top 8 bits refer to an internal file Id, e.g. 0x01 refers to dialogf.tlk) which can be mapped to a string via a lookup into the TLK table. |
resref | A reference to a specific resource -- a string (max 8 characters) which is mapped to a resource (stored in a BIF file or an override directory) via the KEY file. Note that these are always treated as 8 characters long; unused characters should generally be filled with NUL bytes. |
When bits are numbered, they will be numbered with the least-significant bit as 0, and the most significant bit as 7, 15, or 31, for byte, word, or dword, respectively.
Several file types are used in the Infinity Engine. These file types can be identified in three different ways. First, most file formats have a numerical code (e.g. 0x03e8), called the
resType
. Second, all file formats have a file extension (e.g. 2da), which is used to determine what format the data inside is expected to be. Third, most of the file formats contain a 4-byte signature string in the file header to indicate the file type, and a 4-byte version string to indicate the file format version.ResType | Extension | Format tag | Notes | Description |
---|---|---|---|---|
N/A | .key |
'KEY ' |
A directory of resources, resource locations and resource types. Each game generally have one KEY file, located in the main game directory. | |
N/A | .bif |
'BIFF ' |
Archive containing resources; indexed by the KEY file. | |
N/A | .cbf |
'BIF ' |
zlib compressed BIF file; index by the KEY file. | |
N/A | .tlk |
'TLK ' |
Table in which strings and sounds are looked up by strref. | |
N/A | .acm |
??? | Music. ACM compressed sound files. | |
N/A | .acm |
??? | EE only | Music. Ogg Vorbis compressed sound files. |
N/A | .mus |
N/A | Text format | Music playlist. |
0x0001 | .bmp |
N/A | Microsoft-endorsed standard for static graphics. Often used for storing palettes, in which case the file will be a 1x1 pixel image with a full palette. Only uncompressed BMP files are supported, though the engine supports colour depths of 4, 8, and 24 bits. | |
0x0002 | .mve |
??? | Movie. Proprietary Interplay format. | |
0x0004 | .wav .wac
|
'WAVC ' |
Sound. Note that 'WAVC' and 'RIFF' .wav files are used interchangeably throughout the engine; WAVC is an internal format -- more precisely, an ACM file with a header attached to simplify buffer estimation during file decompression. | |
0x0004 | .wav |
N/A | EE only | Ogg Vorbis compressed sound file. |
0x0004 | .wav |
N/A | RIFF wave files. The Microsoft mmio* routines are not used for WAV reading, meaning files must be simple and straightforward. |
|
0x0005 | .wfx |
'WFX ' |
Wave FX file. WFX files are used to determine variation for playback of wave sounds. | |
0x0006 | .plt |
'PLT ' |
Graphics, specifically paperdolls (as displayed on the inventory screen). | |
0x03e8 | .bam |
'BAM ' |
Graphics, specifically animations though also multi-frame static graphics. The format supports multiple animation cycles, each containing multiple frames. | |
0x03e8 | .bam |
'BAMC ' |
zlib compressed BAM file. | |
0x03e9 | .wed |
'WED ' |
Area region information. | |
0x03ea | .chu |
'CHUI ' |
GUI definition. | |
0x03eb | .tis |
'TIS ' |
Graphics, specifically area art. | |
0x03ec | .mos |
'MOS ' |
Graphics, specifically minimaps and GUI backgrounds. | |
0x03ec | .mos |
'MOSC ' |
zlib compressed MOS file. | |
0x03ed | .itm |
'ITM ' |
Item. | |
0x03ee | .spl |
'SPL ' |
Spell. | |
0x03ef | .bcs |
N/A | Text format | Compiled script. |
0x03f0 | .ids |
N/A | Text format | Identifier tables. Generally a mapping from numbers to text, typically giving descriptive names or labels to engine internals. |
0x03f1 | .cre |
'CRE ' |
Creature. | |
0x03f2 | .are |
'AREA ' |
Area definition, including actor, door, region and container details. | |
0x03f3 | .dlg |
'DLG ' |
Dialog definition. | |
0x03f4 | .2da |
'2DA ' |
Text format. | 2-dimensional array. Note that the signature may not occur at the start of the file; there may be leading spaces, or the file may be encrypted using a XOR encryption scheme. |
0x03f5 | .gam |
'GAME ' |
Saved game, specifically party details. | |
N/A | .sav |
'SAV ' |
Saved game, specifically area and store details. | |
0x03f6 | .sto |
'STOR ' |
Store. | |
0x03f7 | .wmp |
'WMAP ' |
World map. | |
0x03f8 | .eff |
'EFF ' |
ToTSC and IWD and BG2 | Effect; a replacement for the 30-byte effect structure found in CRE and ITM files. The EFF V2.0 format can be found either as a standalone file or embedded in CRE, ITM and SPL files. |
0x03f9 | .bs |
N/A | Text format | Compiled script, for character AI scripts. |
0x03fa | .chr |
'CHR ' |
Character. | |
0x03fb | .vvc |
'VVC ' |
Visual 'spell casting' effect. | |
0x03fc | .vef |
'VEF ' |
Baldur's Gate 2, EE games | Sequence of visual effects. Used by EE games to implement complex effects. |
0x03fd | .pro |
'PRO ' |
Projectile. | |
N/A |
.res |
??? | Text format IWD only |
Character biography. |
0x03fe | .bio |
??? | Text format Baldur's Gate 2 only |
Character biography. |
0x03ff | .wbm |
??? | EE only | WebM Video format. Used for cinematics as well as animations in ARE resources. |
0x0400 | .fnt |
??? | EE only | Proprietary font format used by EE games before patch 2.0. |
0x0402 | .gui |
??? | Text format EE only |
GUI definitions for EE games before patch 2.0. |
0x0403 | .sql |
??? | Text format EE only |
Sql. |
0x0404 | .pvrz |
??? | EE only | Zlib-compressed PVR graphics file; referenced by BAM, MOS and TIS files. |
0x0405 | .glsl |
??? | Text format EE only |
Shader description language. Used for both OpenGL and DirectX shader language variants. |
0x0406 | .tot |
N/A | Icewind Dale / BG2 only | "Talk Table Override Text". This is used to override to specific entries in the TLK file. TOT files are used in conjunction with the TOH file. |
0x0407 | .toh |
'TLK ' |
Icewind Dale / BG2 / EE only | "Talk Table Override Header". This is used to override to specific entries in the TLK file. In the original games TOH files are used in conjunction with the TOT file. In EE games TOH files are self-contained. |
0x0408 | .menu |
??? | Text format EE only |
GUI definitions for EE games since patch 2.0. |
0x0409 | .lua |
??? | Text format EE only |
LUA script file. |
0x040a | .ttf |
??? | EE only | True Type Font. |
0x040b | .png |
??? | EE only | Image file. Supported since EE patch 2.0. |
0x044c | .bah |
??? | Baldur's Gate 2 only | Unknown |
0x0802 | .ini |
N/A | Text format Planescape: Torment, Icewind Dale, EE games |
Quest and spawn information. Also used for creature animation definitions in EE games. |
0x0803 | .src |
N/A | Planescape: Torment, PST:EE | Overhead text. |
0x0804 | .maze |
'MAZE ' |
PST:EE only | Modron Maze layout definition. |
N/A | .baf |
N/A | Text format | Uncompiled script. |
N/A | .var |
N/A | Planescape Torment only | File that stores variables declarations for starting game. |