Module roead::aamp

source ·
Expand description

Port of the oead::aamp module.

Only version 2, little endian and UTF-8 binary parameter archives are supported. All parameter types including buffers are supported.
The YAML output is compatible with the pure Python aamp library.

The main type is the ParameterIO, which will usually be constructed from binary data of a YAML document. Some sample usage:

let data = std::fs::read("test/aamp/Lizalfos.bphysics")?;
let pio = ParameterIO::from_binary(&data)?; // Parse AAMP from binary data
// A parameter IO is to an extent interchangeable with its root list.
for (hash, list) in pio.lists().iter() {
    // Do stuff with lists
}
if let Some(demo_obj) = pio.object("DemoAIActionIdx") {
    // Access a parameter object
    for (hash, parameter) in demo_obj.iter() {
        // Do stuff with parameters
    }
}
// Dumps YAML representation to a String
// let yaml_dump: String = pio.to_text();

All parameter map structures (ParameterObject, ParameterObjectMap, ParameterListMap) can take either a name or a hash for key-based operations, and likewise can be indexed by the same. As usual, indexing into a non-existent key will panic.

Macros§

Structs§

  • Parameter structure name. This is a wrapper around a CRC32 hash.
  • A table of names that is used to recover original names in binary parameter archives which store only name hashes.
  • Parameter IO. This is the root parameter list and the only structure that can be serialized to or deserialized from a binary parameter archive.
  • Parameter list. This is essentially a dictionary of parameter objects and a dictionary of parameter lists.
  • Newtype map of parameter lists.
  • Parameter object. This is essentially a dictionary of parameters.
  • Newtype map of parameter objects.

Enums§

Traits§

Functions§

  • Returns the default instance of the name table, which is automatically populated with Breath of the Wild strings. It is initialised on first use and has interior mutability.
  • CRC hash function matching that used in BOTW.