AAMP (Python)¶
Note
Because of the similarities between the C++ APIs and the Python APIs, only the former will be documented in detail. Please refer to the C++ documentation for more information.
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.
Quick usage¶
To read a binary parameter archive:
oead.aamp.ParameterIO.from_binary()
To write a binary parameter archive:
oead.aamp.ParameterIO.to_binary()
To read a YAML text parameter archive:
oead.aamp.ParameterIO.from_text()
To write a YAML text parameter archive:
oead.aamp.ParameterIO.to_text()
import oead
with open("Horse.baiprog", "rb") as f:
pio = oead.aamp.ParameterIO.from_binary(f.read())
pio.version
# 0
pio.type
# "xml"
pio.objects["DemoAIActionIdx"].params["Demo_Wait"]
# Parameter(107)
pio.objects["DemoAIActionIdx"].params["Demo_Wait"].v
# 107
Parameters¶
-
class
oead.aamp.
Parameter
¶ See also
oead::aamp::Parameter
-
class
Type
¶ Members:
Bool
F32
Int
Vec2
Vec3
Vec4
Color
String32
String64
Curve1
Curve2
Curve3
Curve4
BufferInt
BufferF32
String256
Quat
U32
BufferU32
BufferBinary
StringRef
-
Bool
= Type.Bool¶
-
BufferBinary
= Type.BufferBinary¶
-
BufferF32
= Type.BufferF32¶
-
BufferInt
= Type.BufferInt¶
-
BufferU32
= Type.BufferU32¶
-
Color
= Type.Color¶
-
Curve1
= Type.Curve1¶
-
Curve2
= Type.Curve2¶
-
Curve3
= Type.Curve3¶
-
Curve4
= Type.Curve4¶
-
F32
= Type.F32¶
-
Int
= Type.Int¶
-
Quat
= Type.Quat¶
-
String256
= Type.String256¶
-
String32
= Type.String32¶
-
String64
= Type.String64¶
-
StringRef
= Type.StringRef¶
-
U32
= Type.U32¶
-
Vec2
= Type.Vec2¶
-
Vec3
= Type.Vec3¶
-
Vec4
= Type.Vec4¶
-
__init__
(self: oead.aamp.Parameter.Type, arg0: int) → None¶
-
property
name
¶ handle) -> str
- Type
(self
-
-
__init__
(self: oead.aamp.Parameter, arg0: Union[bool, float, int, oead.Vector2f, oead.Vector3f, oead.Vector4f, oead.Color4f, oead.FixedSafeString32, oead.FixedSafeString64, List[oead.Curve[1]], List[oead.Curve[2]], List[oead.Curve[3]], List[oead.Curve[4]], oead.BufferInt, oead.BufferF32, oead.FixedSafeString256, oead.Quatf, oead.U32, oead.BufferU32, oead.Bytes, str]) → None¶
-
type
(self: oead.aamp.Parameter) → oead.aamp.Parameter.Type¶
-
property
v
¶ Value
-
class
-
class
oead.aamp.
Name
¶ See also
oead::aamp::Name
-
__init__
(*args, **kwargs)¶ Overloaded function.
__init__(self: oead.aamp.Name, name_crc32: int) -> None
__init__(self: oead.aamp.Name, name: str) -> None
-
property
hash
¶
-
-
class
oead.aamp.
ParameterMap
¶ Lightweight dict-like object wrapping a
oead::aamp::ParameterMap
.-
__init__
(*args, **kwargs)¶ Overloaded function.
__init__(self: oead.aamp.ParameterMap) -> None
__init__(self: oead.aamp.ParameterMap, iterator: iterator) -> None
__init__(self: oead.aamp.ParameterMap, dictionary: dict) -> None
-
clear
(self: aamp.ParameterMap) → None¶
-
get
(self: aamp.ParameterMap, key: oead.aamp.Name, default: Optional[oead.aamp.Parameter] = None) → Optional[oead.aamp.Parameter]¶
-
items
(self: aamp.ParameterMap) → iterator¶
-
keys
(self: aamp.ParameterMap) → iterator¶
-
-
class
oead.aamp.
ParameterObjectMap
¶ Lightweight dict-like object wrapping a
oead::aamp::ParameterObjectMap
.-
__init__
(*args, **kwargs)¶ Overloaded function.
__init__(self: oead.aamp.ParameterObjectMap) -> None
__init__(self: oead.aamp.ParameterObjectMap, iterator: iterator) -> None
__init__(self: oead.aamp.ParameterObjectMap, dictionary: dict) -> None
-
clear
(self: aamp.ParameterObjectMap) → None¶
-
get
(self: aamp.ParameterObjectMap, key: oead.aamp.Name, default: Optional[oead.aamp.ParameterObject] = None) → Optional[oead.aamp.ParameterObject]¶
-
items
(self: aamp.ParameterObjectMap) → iterator¶
-
keys
(self: aamp.ParameterObjectMap) → iterator¶
-
-
class
oead.aamp.
ParameterListMap
¶ Lightweight dict-like object wrapping a
oead::aamp::ParameterListMap
.-
__init__
(*args, **kwargs)¶ Overloaded function.
__init__(self: oead.aamp.ParameterListMap) -> None
__init__(self: oead.aamp.ParameterListMap, iterator: iterator) -> None
__init__(self: oead.aamp.ParameterListMap, dictionary: dict) -> None
-
clear
(self: aamp.ParameterListMap) → None¶
-
get
(self: aamp.ParameterListMap, key: oead.aamp.Name, default: Optional[oead.aamp.ParameterList] = None) → Optional[oead.aamp.ParameterList]¶
-
items
(self: aamp.ParameterListMap) → iterator¶
-
keys
(self: aamp.ParameterListMap) → iterator¶
-
Note
Just like the C++ oead::aamp::Name
, oead.aamp.Name
can be constructed from either a hash or a string, so it is possible to access elements in a map by name rather than by hash. Both object.params[crc32_hash]
and object.params["NameString"]
will work.
-
class
oead.aamp.
ParameterList
¶ See also
oead::aamp::ParameterList
-
__init__
(self: oead.aamp.ParameterList) → None¶
-
property
lists
¶
-
property
objects
¶
-
-
class
oead.aamp.
ParameterObject
¶ See also
oead::aamp::ParameterObject
-
__init__
(self: oead.aamp.ParameterObject) → None¶
-
property
params
¶
-
Parameter IO¶
-
class
oead.aamp.
ParameterIO
¶ See also
oead::aamp::ParameterIO
-
__init__
(self: oead.aamp.ParameterIO) → None¶
-
static
from_binary
(buffer: BytesLike) → oead.aamp.ParameterIO¶
-
static
from_text
(yml_text: str) → oead.aamp.ParameterIO¶
-
to_binary
(self: oead.aamp.ParameterIO) → oead.Bytes¶
-
to_text
(self: oead.aamp.ParameterIO) → str¶
-
property
type
¶
-
property
version
¶
-
Name utilities¶
Because binary parameter archives only store CRC32 hashes of structure names, recovering the original names – which is useful for converting archives to a human-readable format – requires the use of a name table.
When serializing to YAML, by default oead will use a table that contains strings from Breath of the Wild’s executable.
-
class
oead.aamp.
NameTable
¶ See also
oead::aamp::NameTable
-
__init__
(self: oead.aamp.NameTable, with_botw_strings: bool) → None¶
-
add_name
(self: oead.aamp.NameTable, name: str) → str¶
-
get_name
(self: oead.aamp.NameTable, hash: int, index: int, parent_name_hash: int) → Optional[str]¶
-
Note
For safety reasons, the underlying maps are not exposed.
-
oead.aamp.
get_default_name_table
() → oead.aamp.NameTable¶ Just like in C++, this returns the default instance of the name table. It is modifiable.
See also
oead::aamp::GetDefaultNameTable()