mirror of https://github.com/zeldaret/botw.git
ksys: Decompile ByamlUtil
And fix some declarations in Byaml.h
This commit is contained in:
parent
bad90bc5d8
commit
fc306aa5f0
|
@ -52,6 +52,7 @@ add_executable(uking
|
|||
src/KingSystem/Utils/Byaml.h
|
||||
src/KingSystem/Utils/ByamlLocal.cpp
|
||||
src/KingSystem/Utils/ByamlLocal.h
|
||||
src/KingSystem/Utils/ByamlUtil.cpp
|
||||
src/KingSystem/Utils/Debug.h
|
||||
src/KingSystem/Utils/StrTreeMap.h
|
||||
src/KingSystem/Utils/Types.h
|
||||
|
|
|
@ -60421,10 +60421,10 @@
|
|||
0x0000007100aacbbc,_ZNK2al13ByamlHashIter12getDataByKeyEPNS_9ByamlDataEi,168,
|
||||
0x0000007100aacc64,_ZNK2al13ByamlHashIter8findPairEi,92,
|
||||
0x0000007100aaccc0,_ZNK2al13ByamlHashIter14getPairByIndexEi,80,
|
||||
0x0000007100aacd10,_ZN2al14tryGetByamlS32EPiRKNS_9ByamlIterEPKc,16,
|
||||
0x0000007100aacd20,_ZN2al14tryGetByamlU32EPjRKNS_9ByamlIterEPKc,64,
|
||||
0x0000007100aacd60,_ZN2al14tryGetByamlF32EPfRKNS_9ByamlIterEPKc,72,
|
||||
0x0000007100aacda8,_ZN2al14tryGetByamlV3fEPN4sead7Vector3IfEERKNS_9ByamlIterEPKc,192,
|
||||
0x0000007100aacd10,_ZN2al14tryGetByamlS32EPiRKNS_9ByamlIterEPKc,16,_ZN2al14tryGetByamlS32EPiRKNS_9ByamlIterEPKc
|
||||
0x0000007100aacd20,_ZN2al14tryGetByamlU32EPjRKNS_9ByamlIterEPKc,64,_ZN2al14tryGetByamlU32EPjRKNS_9ByamlIterEPKc
|
||||
0x0000007100aacd60,_ZN2al14tryGetByamlF32EPfRKNS_9ByamlIterEPKc,72,_ZN2al14tryGetByamlF32EPfRKNS_9ByamlIterEPKc
|
||||
0x0000007100aacda8,_ZN2al14tryGetByamlV3fEPN4sead7Vector3IfEERKNS_9ByamlIterEPKc,192,_ZN2al14tryGetByamlV3fEPN4sead7Vector3IfEERKNS_9ByamlIterEPKc
|
||||
0x0000007100aace68,_ZN2nn4init19InitializeAllocatorEPvm,84,
|
||||
0x0000007100aacebc,malloc,88,
|
||||
0x0000007100aacf14,free,28,
|
||||
|
|
Can't render this file because it is too large.
|
|
@ -33,7 +33,7 @@ enum class ByamlType {
|
|||
|
||||
class ByamlIter {
|
||||
public:
|
||||
ByamlIter() = default;
|
||||
ByamlIter();
|
||||
explicit ByamlIter(const u8* data);
|
||||
ByamlIter(const u8* data, const u8* root_node);
|
||||
ByamlIter(const ByamlIter& other);
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
#include "KingSystem/Utils/Byaml.h"
|
||||
|
||||
namespace al {
|
||||
|
||||
bool tryGetByamlS32(s32* value, const ByamlIter& iter, const char* key) {
|
||||
return iter.tryGetIntByKey(value, key);
|
||||
}
|
||||
|
||||
bool tryGetByamlU32(u32* value, const ByamlIter& iter, const char* key) {
|
||||
s32 v{};
|
||||
bool ret = iter.tryGetIntByKey(&v, key);
|
||||
if (ret)
|
||||
*value = v;
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool tryGetByamlF32(f32* value, const ByamlIter& iter, const char* key) {
|
||||
f32 v{};
|
||||
bool ret = iter.tryGetFloatByKey(&v, key);
|
||||
if (!ret)
|
||||
return false;
|
||||
*value = v;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool tryGetByamlV3f(sead::Vector3f* value, const ByamlIter& iter, const char* key) {
|
||||
f32 x, y, z;
|
||||
ByamlIter vec_iter;
|
||||
if (!iter.tryGetIterByKey(&vec_iter, key))
|
||||
return false;
|
||||
|
||||
x = 0;
|
||||
bool ok = vec_iter.tryGetFloatByKey(&x, "X");
|
||||
y = 0;
|
||||
ok |= vec_iter.tryGetFloatByKey(&y, "Y");
|
||||
z = 0;
|
||||
ok |= vec_iter.tryGetFloatByKey(&z, "Z");
|
||||
|
||||
*value = {x, y, z};
|
||||
return ok;
|
||||
}
|
||||
|
||||
} // namespace al
|
Loading…
Reference in New Issue