Expand description
Talk table (TLK) binary support. TLK V3.0 binary reader and writer.
TLK is the global talk table format used for localized game strings. Entries store flags, optional voice-over resrefs, and text offsets into a shared string blob.
§Format Layout
+------------------------------+ 0x0000
| Header (20 bytes) |
| magic/version/language/count |
+------------------------------+ 0x0014
| Entry table |
| 40 bytes * entry_count |
+------------------------------+ entries_offset
| Text blob |
| concatenated string bytes |
+------------------------------+§Header (20 bytes)
0x00..0x04 magic ("TLK ")
0x04..0x08 version ("V3.0")
0x08..0x0C language_id (u32)
0x0C..0x10 entry_count (u32)
0x10..0x14 entries_offset (u32, text blob start)§Entry Record (40 bytes)
0x00..0x04 flags (u32)
0x04..0x14 sound_resref (16-byte field)
0x14..0x18 volume var (u32, reserved)
0x18..0x1C pitch var (u32, reserved)
0x1C..0x20 text_offset (u32, relative to text blob start)
0x20..0x24 text_length (u32)
0x24..0x28 sound_length (f32)Text encoding is selected from language_id and enforced strictly for
lossless behavior.
Structs§
- Tlk
- In-memory representation of a TLK talk table.
- TlkEntry
- One TLK string entry and its metadata flags.
Enums§
- TlkBinary
Error - Errors produced while parsing or serializing TLK binary data.
Functions§
- read_
tlk - Reads a TLK from a reader.
- read_
tlk_ from_ bytes - Reads a TLK from in-memory bytes.
- write_
tlk - Writes a TLK to a writer in KotOR TLK V3.0 binary format.
- write_
tlk_ to_ vec - Serializes a TLK to a byte vector in KotOR TLK V3.0 format.