BYML¶
v2, v3 and v4 binary documents are supported. Those versions are used by The Legend of Zelda: Breath of the Wild, Super Mario Odyssey and other recent games.
All parameter types are supported. This includes 64-bit node types that are used in Super Mario Odyssey.
Both little endian and big endian are supported. Switch assets are little-endian.
The YAML output is fully compatible with the pure Python byml-v2 library.
#include <oead/byml.h>
Reference¶
-
class
Byml¶ BYML value class. This represents a generic value (array, dict, bool, float, u32, etc.)
Public Types
-
enum
Type¶ Values:
-
Null= 0¶
-
String¶
-
Binary¶
-
Array¶
-
Hash¶
-
Bool¶
-
Int¶
-
Float¶
-
UInt¶
-
Int64¶
-
UInt64¶
-
Double¶
-
-
using
Null= std::nullptr_t
-
using
String= std::string
-
using
Array= std::vector<Byml>
-
using
Hash= absl::btree_map<std::string, Byml>
Public Functions
-
Byml()¶
-
auto &
GetVariant()¶
-
const auto &
GetVariant() const¶
-
std::vector<u8>
ToBinary(bool big_endian, int version = 2) const¶ Serialize the document to BYML with the specified endianness and version number. This can only be done for Null, Array or Hash nodes.
-
std::string
ToText() const¶ Serialize the document to YAML. This can only be done for Null, Array or Hash nodes.
-
std::vector<u8> &
GetBinary()¶
-
const std::vector<u8> &
GetBinary() const¶
-
bool
GetBool() const¶
-
s32
GetInt() const¶
-
u32
GetUInt() const¶
-
f32
GetFloat() const¶
-
s64
GetInt64() const¶
-
u64
GetUInt64() const¶
-
f64
GetDouble() const¶
Public Static Functions
-
template<typename
T>
structReference¶ Get an item from a map/hash.
-
enum
Note
The typed getters mirror the behaviour of Nintendo’s BYML library. Some of them will perform type conversions automatically. If value types are incorrect, a TypeError exception is thrown.