Module ltr

Module ltr 

Source
Expand description

LTR binary letter-table support. LTR binary reader and writer.

LTR resources store third-order Markov probability tables used by KotOR name generation.

§Format Layout

+------------------------------+ 0x0000
| Header (9 bytes)             |
+------------------------------+ 0x0009
| Singles block                |
| 3 * 28 * f32                 |
+------------------------------+
| Doubles blocks               |
| 28 * (3 * 28 * f32)          |
+------------------------------+
| Triples blocks               |
| 28 * 28 * (3 * 28 * f32)     |
+------------------------------+

§Header (9 bytes)

0x00..0x04  magic         "LTR "
0x04..0x08  version       "V1.0"
0x08..0x09  letter_count  (u8, KotOR expects 28)

Structs§

Ltr
In-memory LTR container.
LtrProbabilityBlock
One LTR probability block.

Enums§

LtrBinaryError
Errors produced while parsing or serializing LTR binary data.

Constants§

LTR_CHARACTER_COUNT
Number of letters in KotOR LTR tables (a-z, ', -).

Functions§

read_ltr
Reads an LTR file from a reader.
read_ltr_from_bytes
Reads an LTR file directly from bytes.
write_ltr
Writes an LTR file to a writer.
write_ltr_to_vec
Serializes an LTR file into a byte vector.