TBG File Format

Applies to:
BG1, BG1: TotS, BG2, BG2: ToB, PST, IWD, IWD:HoW, IWD:TotL, IWD2

General Description
This file format allows files to be transferred between IE installations, while keeping strrefs intact. TBG V4.0 handles most filetypes (including ITM, SPL, CRE and DLG).
Naming conventions are as follows:
* *.TBG - Item TBG Files
* *-A.TBG - Area TBG Files
* *-B.TBG - Script TBG Files
* *-C.TBG - Creature TBG Files
* *-D.TBG - Dialog TBG Files
* *-H.TBG - CHUI TBG Files
* *-N.TBG - NPC TBG Files
* *-P.TBG - SRC TBG Files
* *-S.TBG - Spell TBG Files
* *-T.TBG - Store TBG Files
* *-E.TBG - Effect TBG Files

Detailed Description


Offset Size (datatype) Description
0x0000 4 (char array) Signature ("TBG4")
0x0004 4 (dword) Null
0x0008 12 (char array) Filename
0x0014 4 (dword) File offset
0x0018 4 (dword) File length
0x001C 4 (dword) Infinity Engine ID
  • value 0x01- Baldur's Gate
  • value 0x02- Planescape: Torment
  • value 0x03- Icewind Dale
  • value 0x04- Baldur's Gate II: Shadows of Amn
0x0020 4 (dword) Text Entries Offset
0x0024 4 (dword) Count of Text Headers
0x0028 4 (dword) Text Headers Offset
0x002C 4 (dword) Count of strrefs
0x0030 4 (dword) StrRefs Offset
0x0034 4 (dword) Number of ASCII entries
0x0038 4 (dword) ASCII Locations Offset


Offset Size (datatype) Description
0x0000 4 (dword) Offset (from start of text entries) to text
0x0004 4 (dword) Length of text
0x0008 8 (char array) Associated sound filename
0x0010 4 (dword) Volume variance of sound file
0x0014 4 (dword) Pitch variance of sound file
0x0018 2 (word) Entry type into dialog.tlk file:
  • value 0x00- unused entry
  • value 0x02- unused entry
  • value 0x03- normal text
  • value 0x07- Parse special character strings in text (BG2 only all others auto-parse with a value of 0x03)
0x001A 4 (dword) Offest in strref locations for text entry (Long) in File:
  • 0xFFFFFFFF- No strref locations
0x001E 4 (dword) Count of strref locations for text entry (Long) in File
0x0022 4 (dword) Offest in strref locations for text entry (ASCII) in File:
  • 0xFFFFFFFF- No StrRefs Locations
0x0026 4 (dword) Count of StrRefs Locations for text entry (ASCII) in File
0x002A 4 (dword) Offest in ASCII Locations for length incrementation in File:
  • 0xFFFFFFFF- No ASCII Locations
0x002E 4 (dword) Count of ASCII locations for length incremenataion in File


This is simply a group of dwords holding the offsets for the locations in the File to put the new strref values from the imported Text Entries.


This is simply a group of dwords holding the offsets for the locations in the File to increment by the length of the new StrRef values from the imported Text Entries.


This is the actual file that is to be transferred.


This is all the actual text that will be actually imported into the Infinity Engine game.