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 featurebzf.
Structs§
- Bif
- In-memory BIF archive.
- BifRead
Options - BIF reader option set.
- BifResource
- One resource entry stored in a BIF archive.
Enums§
- BifBinary
Error - Errors produced while parsing or serializing BIF binary data.
- BifContainer
- BIF container kind.
- BifRead
Mode - BIF reader input policy.
- BifResource
Storage - 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.