diff --git a/data/uking_functions.csv b/data/uking_functions.csv index 2df9b93c..63dac135 100644 --- a/data/uking_functions.csv +++ b/data/uking_functions.csv @@ -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, diff --git a/src/KingSystem/CMakeLists.txt b/src/KingSystem/CMakeLists.txt index f3f89a44..0e19ed21 100644 --- a/src/KingSystem/CMakeLists.txt +++ b/src/KingSystem/CMakeLists.txt @@ -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) diff --git a/src/KingSystem/Effect/CMakeLists.txt b/src/KingSystem/Effect/CMakeLists.txt new file mode 100644 index 00000000..e64a5800 --- /dev/null +++ b/src/KingSystem/Effect/CMakeLists.txt @@ -0,0 +1,4 @@ +target_sources(uking PRIVATE + eftInfoData.cpp + eftInfoData.h +) diff --git a/src/KingSystem/Effect/eftInfoData.cpp b/src/KingSystem/Effect/eftInfoData.cpp new file mode 100644 index 00000000..298ef99f --- /dev/null +++ b/src/KingSystem/Effect/eftInfoData.cpp @@ -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(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 diff --git a/src/KingSystem/Effect/eftInfoData.h b/src/KingSystem/Effect/eftInfoData.h new file mode 100644 index 00000000..684b44b8 --- /dev/null +++ b/src/KingSystem/Effect/eftInfoData.h @@ -0,0 +1,28 @@ +#pragma once + +#include +#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