Module rim

Module rim 

Source
Expand description

RIM archive support. RIM binary reader and writer.

RIM is a compact resource archive format used by KotOR module assets. This module implements strict parsing plus deterministic serialization.

§Format Layout

+------------------------------+ 0x0000
| Header (120 bytes)           |
+------------------------------+ keys_offset
| Key table                    |
| 32 bytes * entry_count       |
+------------------------------+ offsets from key entries
| Resource payload blob        |
| (concatenated file data)     |
+------------------------------+

§Header (120 bytes)

0x00..0x04  magic          ("RIM ")
0x04..0x08  version        ("V1.0")
0x08..0x0C  reserved_0x08  (u32, preserved verbatim)
0x0C..0x10  entry_count    (u32)
0x10..0x14  keys_offset    (u32)
0x14..0x18  reserved_0x14  (u32, preserved verbatim)
0x18..0x78  reserved_0x18  (96 bytes, preserved verbatim)

§Key Entry (32 bytes)

0x00..0x10  resref[16]   (null padded)
0x10..0x14  type_id      (u32; validated to u16 range)
0x14..0x18  resource_id  (u32)
0x18..0x1C  data_offset  (u32)
0x1C..0x20  data_size    (u32)

Structs§

Rim
In-memory RIM archive.
RimReadOptions
Reader options for RIM parsing.
RimResource
One resource entry stored in a RIM archive.

Enums§

RimBinaryError
Errors produced while parsing or serializing RIM binary data.
RimReadMode
Input-profile behavior for RIM readers.

Functions§

read_rim
Reads a RIM archive from a reader.
read_rim_from_bytes
Reads a RIM archive from bytes.
read_rim_from_bytes_with_options
Reads a RIM archive from bytes with explicit read options.
read_rim_with_options
Reads a RIM archive from a reader with explicit read options.
write_rim
Writes a RIM archive to a writer.
write_rim_to_vec
Serializes a RIM archive to bytes.