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.
§Shape of the container
A 9-byte header, then three probability blocks of first, second and third
Markov order. Nothing points anywhere: every size falls out of the header’s
letter_count, so the whole file is positional.
The recurring factor of three is position within a name – start, middle and
end each carry their own distribution. At KotOR’s 28 letters the blocks are
3 x 28, 28 x (3 x 28) and 28 x 28 x (3 x 28) floats, which makes every
file exactly 273,177 bytes. The engine closes its read by asserting the final
offset equals the buffer length, so there is no slack: a file a byte off is
rejected rather than partially accepted.
Byte-level field maps live in docs/src/formats/text/ltr.md, with the
engine’s own load sequence.
Structs§
- Ltr
- In-memory LTR container.
- LtrProbability
Block - One LTR probability block.
Enums§
- LtrBinary
Error - 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.