ksys/res: Finish implementing ModelList

This commit is contained in:
Léo Lam
2021-03-19 14:31:19 +01:00
parent c119c0eefa
commit 8c8d9c0e70
9 changed files with 515 additions and 75 deletions
+1
View File
@@ -70,6 +70,7 @@ target_sources(uking PRIVATE
HeapUtil.cpp
HeapUtil.h
InitTimeInfo.h
ParamIO.cpp
ParamIO.h
SafeDelete.h
StrTreeMap.h
+21
View File
@@ -0,0 +1,21 @@
#include "KingSystem/Utils/ParamIO.h"
#include <agl/Utils/aglParameter.h>
namespace ksys {
const char* ParamIO::getString(const agl::utl::ResParameterObj& obj, const char* key,
const char* default_value, void*) const {
const auto param = agl::utl::getResParameter(obj, key);
if (!param.ptr())
return default_value;
return param.getData<const char>();
}
// NON_MATCHING: how the default_value Vec3f is stored on the stack
sead::Vector3f ParamIO::getVec3(const agl::utl::ResParameterObj& obj, const char* key,
sead::Vector3f default_value, void*) const {
const auto param = agl::utl::getResParameter(obj, key);
return param.ptr() ? *param.getData<sead::Vector3f>() : default_value;
}
} // namespace ksys
+6
View File
@@ -2,6 +2,7 @@
#include <agl/Utils/aglParameterIO.h>
#include <hostio/seadHostIONode.h>
#include <math/seadVector.h>
#include <prim/seadSafeString.h>
#include "KingSystem/Utils/Types.h"
@@ -15,6 +16,11 @@ public:
bool applyResourceUpdate(const char* data, const char* data1);
const char* getString(const agl::utl::ResParameterObj& obj, const char* key,
const char* default_value, void* = nullptr) const;
sead::Vector3f getVec3(const agl::utl::ResParameterObj& obj, const char* key,
sead::Vector3f default_value, void* = nullptr) const;
u32 getIdx() const { return mIdx; }
sead::BufferedSafeString& getPath() { return mPath; }
const sead::BufferedSafeString& getPath() const { return mPath; }