Module bif

Module bif 

Source
Expand description

BIF archive support. BIF binary reader and writer.

BIF (BIFF) files are archive containers referenced by KEY indexes. Each entry stores only (resource_id, type_id, payload); names/resrefs are resolved through KEY metadata.

§Format Layout

+------------------------------+ 0x0000
| Header (20 bytes)            |
+------------------------------+ variable_table_offset
| Variable resource table      |
| 16 bytes * resource_count    |
+------------------------------+ (optional)
| Fixed resource table         |
| 20 bytes * fixed_count       |
+------------------------------+ offsets from table
| Resource payload blob        |
| (aligned to 4-byte boundary) |
+------------------------------+

§Variable Resource Entry (16 bytes)

0x00..0x04  resource_id  (u32)
0x04..0x08  data_offset  (u32)
0x08..0x0C  data_size    (u32)
0x0C..0x10  type_id      (u32; validated to u16 range)

§Fixed Resource Entry (20 bytes)

0x00..0x04  resource_id  (u32)
0x04..0x08  data_offset  (u32)
0x08..0x0C  part_count   (u32)
0x0C..0x10  data_size    (u32)
0x10..0x14  type_id      (u32; validated to u16 range)

Notes:

  • Vanilla KotOR BIFs typically use only variable-resource entries (fixed_count == 0), but files with fixed-table entries are accepted.
  • BZF (BZF ) compressed variant support is optional and gated behind the crate feature bzf.

Structs§

Bif
In-memory BIF archive.
BifReadOptions
BIF reader option set.
BifResource
One resource entry stored in a BIF archive.

Enums§

BifBinaryError
Errors produced while parsing or serializing BIF binary data.
BifContainer
BIF container kind.
BifReadMode
BIF reader input policy.
BifResourceStorage
Storage table kind for a BifResource.

Functions§

read_bif
Reads a BIF archive from a reader.
read_bif_from_bytes
Reads a BIF archive from bytes.
read_bif_from_bytes_with_options
Reads a BIF archive from bytes with explicit options.
read_bif_with_options
Reads a BIF archive from a reader with explicit options.
write_bif
Writes a BIF archive to a writer.
write_bif_to_vec
Serializes a BIF archive to bytes.