Expand description
ERF-family archive support. ERF/MOD/HAK binary reader and writer.
This module provides a strict, roundtrip-safe implementation of the KotOR
ERF family container format. Compatibility mode can also parse legacy
non-canonical variants (for example SAV headers).
§Shape of the container
A fixed 160-byte header, a localized string block, then two parallel tables
– keys and resources, both sized by entry_count – and finally the
payload. Key n says what resource n is; resource n says where its
bytes live.
Every block after the header is found by an offset read out of the header
rather than by following on from the block before it. That is why the blank
block some .mod files carry between the two tables costs a reader nothing:
trusting the offsets absorbs it, while assuming the tables are adjacent
reads garbage.
Byte-level field maps for the header and both entry records live in
docs/src/formats/archives/erf.md, with the engine’s own load sequence.
Structs§
- Erf
- In-memory ERF-family container.
- ErfIndex
- A lazily-read ERF-family archive.
- ErfIndex
Entry - One indexed resource: its identity and where its bytes live.
- ErfLocalized
String - One localized ERF description entry.
- ErfRead
Options - Reader options for ERF/MOD/HAK parsing.
- ErfResource
- One resource entry stored in an ERF-family archive.
- ErfWrite
Options - Writer options for ERF-family serialization.
Enums§
- ErfBinary
Error - Errors produced while parsing or serializing ERF binary data.
- ErfFile
Type - Supported ERF-family container signatures.
- ErfRead
Mode - Input-profile behavior for ERF-family readers.
- ErfRewrite
Error - Errors produced while rewriting an ERF-family archive.
- ErfWrite
Mode - Output-profile behavior for ERF-family writers.
- ModLayout
- Layout mode for MOD key/resource table spacing during writes.
Functions§
- read_
erf - Reads an ERF/MOD/HAK archive from a reader.
- read_
erf_ from_ bytes - Reads an ERF/MOD/HAK archive from bytes.
- read_
erf_ from_ bytes_ with_ options - Reads an ERF-family archive from bytes with explicit read options.
- read_
erf_ with_ options - Reads an ERF-family archive from a reader with explicit read options.
- read_
save_ archive - Reads a save archive from a reader.
- read_
save_ archive_ from_ bytes - Reads a save archive directly from bytes.
- rewrite_
erf - Writes
sourcetowriter, replacing the named entries’ bytes. - rewrite_
erf_ to_ vec - Serializes a rewritten archive to bytes.
- write_
erf - Writes an ERF/MOD/HAK archive to a writer.
- write_
erf_ to_ vec - Serializes an ERF/MOD/HAK archive to bytes.
- write_
erf_ to_ vec_ with_ options - Serializes an ERF/MOD/HAK archive to bytes with explicit layout options.
- write_
erf_ with_ options - Writes an ERF/MOD/HAK archive to a writer with explicit layout options.
- write_
save_ archive - Writes a save archive to a writer.
- write_
save_ archive_ to_ vec - Serializes a save archive to bytes.