Module gff

Module gff 

Source
Expand description

GFF binary container support. GFF V3.2 binary reader and writer.

GFF is a typed, table-backed binary graph format used for most KotOR game data objects (UTC, UTI, ARE, DLG, and others).

§Format Layout

+------------------------------+ 0x0000
| Header (56 bytes)            |
| file_type + version +        |
| offsets/counts for tables    |
+------------------------------+ struct_offset
| Struct table                 |
| 12 bytes * struct_count      |
+------------------------------+ field_offset
| Field table                  |
| 12 bytes * field_count       |
+------------------------------+ label_offset
| Label table                  |
| 16 bytes * label_count       |
+------------------------------+ field_data_offset
| Field data blob              |
+------------------------------+ field_indices_offset
| Field indices array (u32)    |
+------------------------------+ list_indices_offset
| List indices array (u32)     |
+------------------------------+

§Logical Data Model

Gff
 `-- root GffStruct
      `-- [GffField(label, GffValue)]
           `-- nested structs/lists recursively reference tables

Offsets in struct and field records reference table locations or blob offsets depending on field type. This module keeps those rules explicit and validates all ranges before decoding.

Structs§

Gff
In-memory representation of a binary GFF file.
GffField
One labeled GFF field.
GffLabel
Canonicalized GFF field label.
GffLocalizedString
CExoLocString payload.
GffLocalizedSubstring
One localized substring entry.
GffStruct
One GFF struct node.

Enums§

GffBinaryError
Errors produced while parsing or writing binary GFF data.
GffLabelError
Error returned when constructing a GffLabel fails validation.
GffValue
Runtime value for one GFF field.

Constants§

MAX_GFF_LABEL_LEN
Maximum number of ASCII characters for a GFF field label.

Functions§

read_gff
Reads a binary GFF file from a reader.
read_gff_from_bytes
Reads a binary GFF file from bytes.
write_gff
Writes a GFF in binary V3.2 format.
write_gff_to_vec
Serializes a GFF to a byte vector.