maclarian 0.1.3

Larian file format library for Baldur's Gate 3 - PAK, LSF, LSX, GR2, DDS, and more
Documentation
//! `.loca` localization file format
//!
//!
//!
//! Binary format for Baldur's Gate 3 localization strings.
//! Use `read_loca` / `write_loca` to read and write files,
//! or convert to XML for editing.

mod reader;
mod writer;

pub use reader::{parse_loca_bytes, read_loca};
pub use writer::write_loca;

/// "LOCA" magic signature (little-endian)
pub const LOCA_SIGNATURE: u32 = 0x41434F4C;

/// Size of each entry in the entry table (64 + 2 + 4 = 70 bytes)
pub const ENTRY_SIZE: usize = 70;

/// Size of the key field in each entry
pub const KEY_SIZE: usize = 64;

/// A single localized text entry
#[non_exhaustive]
#[derive(Debug, Clone)]
pub struct LocalizedText {
    /// Unique identifier key (e.g., "h1234567890abcdef...")
    pub key: String,
    /// Version number
    pub version: u16,
    /// The localized text content
    pub text: String,
}

/// A collection of localized text entries
#[non_exhaustive]
#[derive(Debug, Clone, Default)]
pub struct LocaResource {
    /// The localized text entries in this resource.
    pub entries: Vec<LocalizedText>,
}