TOH file format

Applies to:
BG2, BG2: ToB, IWD, IWD:HoW, IWD:TotL

General Description
This file format serves a similar purpose (and has a similar structure to) TLK files. The files work in conjunction with TOT files, and can be used to override text from dialog.tlk. The files are contained in the SAV files in the savegame folders.

IWD: TOT files are used to edit the character biographies during the game (when the characters are not exported)

BG2: TOT files are used to store all custom players comments inside game e.g. custom waypoints on the area map, custom notes in the journal and character biographies

Detailed Description
Header
This section is 14h bytes long.

Offset Size (data type) Description
0x0000 4 (char array) Signature ('TLK ')
0x0004 4 (char array) Empty
0x0008 4 (dword) Unknown
0x000c 4 (dword) Number of strref entries in TOH file
0x0010 4 (dword) Unknown

Strref Entries
These sections have 1Ch bytes.

Offset Size (data type) Description
0x0000 4 (dword) String reference number. Values in TOH files are generally over 3,000,000. Smaller values can be used to override existing dialog.tlk entries
0x0004 4 (dword) Flags
0x0008 8 (resref) WAV/WAVC reference
0x0010 4 (dword) Volume variance
0x0014 4 (dword) Pitch variance
0x0018 4 (dword) Offset to string data inside TOT file