ksys/eft: Add InfoData

This commit is contained in:
Léo Lam 2021-04-26 14:25:44 +02:00
parent b493f4cb5c
commit 450f559602
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
5 changed files with 83 additions and 8 deletions

View File

@ -94456,14 +94456,14 @@
0x00000071012708f0,j__ZdlPv_1273,4,
0x00000071012708f4,sub_71012708F4,52,
0x0000007101270928,sub_7101270928,92,
0x0000007101270984,sub_7101270984,100,
0x00000071012709e8,sub_71012709E8,108,
0x0000007101270a54,EffectInfoData::createInstance,156,
0x0000007101270af0,sub_7101270AF0,60,
0x0000007101270b2c,sub_7101270B2C,68,
0x0000007101270b70,EffectInfoData::init_,308,
0x0000007101270ca4,EffectInfoData::init,4,
0x0000007101270ca8,EffectInfoData::getUserName,148,
0x0000007101270984,sub_7101270984,100,_ZN4ksys3eft8InfoData18SingletonDisposer_D1Ev
0x00000071012709e8,sub_71012709E8,108,_ZN4ksys3eft8InfoData18SingletonDisposer_D0Ev
0x0000007101270a54,EffectInfoData::createInstance,156,_ZN4ksys3eft8InfoData14createInstanceEPN4sead4HeapE
0x0000007101270af0,sub_7101270AF0,60,_ZN4ksys3eft8InfoDataD1Ev
0x0000007101270b2c,sub_7101270B2C,68,_ZN4ksys3eft8InfoDataD0Ev
0x0000007101270b70,EffectInfoData::init_,308,_ZN4ksys3eft8InfoData14loadEffectInfoEPN4sead4HeapE
0x0000007101270ca4,EffectInfoData::init,4,_ZN4ksys3eft8InfoData4initEPN4sead4HeapE
0x0000007101270ca8,EffectInfoData::getUserName,148,_ZNK4ksys3eft8InfoData24getEffectSettingUserNameERKN4sead14SafeStringBaseIcEE
0x0000007101270d3c,sub_7101270D3C,596,
0x0000007101270f90,sub_7101270F90,1096,
0x00000071012713d8,sub_71012713D8,100,

Can't render this file because it is too large.

View File

@ -6,6 +6,7 @@ add_subdirectory(ActorSystem)
add_subdirectory(Chemical)
add_subdirectory(Cooking)
add_subdirectory(Ecosystem)
add_subdirectory(Effect)
add_subdirectory(Event)
add_subdirectory(Framework)
add_subdirectory(Map)

View File

@ -0,0 +1,4 @@
target_sources(uking PRIVATE
eftInfoData.cpp
eftInfoData.h
)

View File

@ -0,0 +1,42 @@
#include "KingSystem/Effect/eftInfoData.h"
#include "KingSystem/Resource/resLoadRequest.h"
namespace ksys::eft {
SEAD_SINGLETON_DISPOSER_IMPL(InfoData)
InfoData::~InfoData() {
if (mRootIter)
delete mRootIter;
}
void InfoData::loadEffectInfo(sead::Heap* heap) {
res::LoadRequest req;
req.mRequester = "eft::InfoData";
req._22 = true;
mResHandle.load("Actor/Effect/EffectInfo.byml", &req);
auto* resource = sead::DynamicCast<sead::DirectResource>(mResHandle.getResource());
if (mRootIter)
delete mRootIter;
mRootIter = new (heap) al::ByamlIter(resource->getRawData());
}
void InfoData::init(sead::Heap* heap) {
loadEffectInfo(heap);
}
al::ByamlIter InfoData::getIter(const sead::SafeString& key) const {
const auto iter = mRootIter->getIterByKey(key.cstr());
return al::ByamlIter(iter);
}
sead::SafeString InfoData::getEffectSettingUserName(const sead::SafeString& key) const {
const auto iter = getIter(key);
const char* value = "Dummy";
iter.tryGetStringByKey(&value, "EffectSettingUserName");
return value;
}
} // namespace ksys::eft

View File

@ -0,0 +1,28 @@
#pragma once
#include <heap/seadDisposer.h>
#include "KingSystem/Resource/resHandle.h"
#include "KingSystem/Utils/Byaml/Byaml.h"
namespace ksys::eft {
class InfoData {
SEAD_SINGLETON_DISPOSER(InfoData)
InfoData()=default;
virtual ~InfoData();
public:
void init(sead::Heap* heap);
al::ByamlIter getIter(const sead::SafeString& key) const;
sead::SafeString getEffectSettingUserName(const sead::SafeString& key) const;
private:
void loadEffectInfo(sead::Heap* heap);
al::ByamlIter* mRootIter{};
res::Handle mResHandle{};
};
} // namespace ksys::eft