#pragma once #include #include "KingSystem/Utils/Byaml/Byaml.h" #include "KingSystem/Utils/Byaml/ByamlHashIter.h" namespace al { struct ByamlData { ByamlData(); explicit ByamlData(const ByamlHashPair* pair) : ByamlData{} { set(pair); } template T getValue() const { return *reinterpret_cast(&mValue); } ByamlType getType() const { return mType; } void set(const ByamlHashPair* pair) { mType = pair->getType(); mValue = pair->getValue(); } template void set(const ByamlType& type, const T& value) { mType = type; mValue = *reinterpret_cast(&value); } void setType(const ByamlType& type) { mType = type; } template void setValue(const T& value) { mValue = *reinterpret_cast(&value); } void clear() { mValue = 0; mType = ByamlType::Invalid; } private: u32 mValue = 0; sead::SizedEnum mType = ByamlType::Invalid; }; } // namespace al