ksys/xlink: Add InfoData

This commit is contained in:
Léo Lam 2021-04-26 14:45:37 +02:00
parent f365c0b591
commit caa3dcf548
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
5 changed files with 141 additions and 16 deletions

View File

@ -93854,22 +93854,22 @@
0x000000710123827c,sub_710123827C,40, 0x000000710123827c,sub_710123827C,40,
0x00000071012382a4,sub_71012382A4,104, 0x00000071012382a4,sub_71012382A4,104,
0x000000710123830c,sub_710123830C,4748, 0x000000710123830c,sub_710123830C,4748,
0x0000007101239598,sub_7101239598,100, 0x0000007101239598,sub_7101239598,100,_ZN4ksys5xlink8InfoData18SingletonDisposer_D1Ev
0x00000071012395fc,sub_71012395FC,108, 0x00000071012395fc,sub_71012395FC,108,_ZN4ksys5xlink8InfoData18SingletonDisposer_D0Ev
0x0000007101239668,XLinkInfoData::createInstance,156, 0x0000007101239668,XLinkInfoData::createInstance,156,_ZN4ksys5xlink8InfoData14createInstanceEPN4sead4HeapE
0x0000007101239704,sub_7101239704,60, 0x0000007101239704,sub_7101239704,60,_ZN4ksys5xlink8InfoDataD1Ev
0x0000007101239740,sub_7101239740,68, 0x0000007101239740,sub_7101239740,68,_ZN4ksys5xlink8InfoDataD0Ev
0x0000007101239784,XLinkInfoData::init_,308, 0x0000007101239784,XLinkInfoData::init_,308,_ZN4ksys5xlink8InfoData8loadInfoEPN4sead4HeapE
0x00000071012398b8,XLinkInfoData::init,4, 0x00000071012398b8,XLinkInfoData::init,4,_ZN4ksys5xlink8InfoData4initEPN4sead4HeapE
0x00000071012398bc,XLinkInfoData::getInfoByKey,96, 0x00000071012398bc,XLinkInfoData::getInfoByKey,96,_ZNK4ksys5xlink8InfoData7getIterERKN4sead14SafeStringBaseIcEE
0x000000710123991c,XLinkInfoData::__auto4,84, 0x000000710123991c,XLinkInfoData::__auto4,84,_ZNK4ksys5xlink8InfoData32getXLinkSettingPropertyTableNameERKN2al9ByamlIterE
0x0000007101239970,XLinkInfoData::getXLinkSettingFootStepProcTypeName,84, 0x0000007101239970,XLinkInfoData::getXLinkSettingFootStepProcTypeName,84,_ZNK4ksys5xlink8InfoData35getXLinkSettingFootStepProcTypeNameERKN2al9ByamlIterE
0x00000071012399c4,XLinkInfoData::getXLinkSettingVeloClampThreshold,56, 0x00000071012399c4,XLinkInfoData::getXLinkSettingVeloClampThreshold,56,_ZNK4ksys5xlink8InfoData33getXLinkSettingVeloClampThresholdERKN2al9ByamlIterE
0x00000071012399fc,XLinkInfoData::getXLinkSettingVeloRollClampThreshold,56, 0x00000071012399fc,XLinkInfoData::getXLinkSettingVeloRollClampThreshold,56,_ZNK4ksys5xlink8InfoData37getXLinkSettingVeloRollClampThresholdERKN2al9ByamlIterE
0x0000007101239a34,XLinkInfoData::__auto1,56, 0x0000007101239a34,XLinkInfoData::__auto1,56,_ZNK4ksys5xlink8InfoData36getXLinkSettingIsReactionTargetEnemyERKN2al9ByamlIterE
0x0000007101239a6c,XLinkInfoData::__auto0,56, 0x0000007101239a6c,XLinkInfoData::__auto0,56,_ZNK4ksys5xlink8InfoData40getXLinkSettingIsReactionTargetTinyEnemyERKN2al9ByamlIterE
0x0000007101239aa4,XLinkInfoData::__auto2,56, 0x0000007101239aa4,XLinkInfoData::__auto2,56,_ZNK4ksys5xlink8InfoData37getXLinkSettingIsReactionTargetObjectERKN2al9ByamlIterE
0x0000007101239adc,sub_7101239ADC,112, 0x0000007101239adc,sub_7101239ADC,112,_ZNK4ksys5xlink8InfoData37getXLinkSettingIsIgnoreDamageToObjectERKN4sead14SafeStringBaseIcEE
0x0000007101239b4c,sub_7101239B4C,6436, 0x0000007101239b4c,sub_7101239B4C,6436,
0x000000710123b470,sub_710123B470,4012, 0x000000710123b470,sub_710123B470,4012,
0x000000710123c41c,sub_710123C41C,164, 0x000000710123c41c,sub_710123C41C,164,

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

View File

@ -17,6 +17,7 @@ add_subdirectory(System)
add_subdirectory(Terrain) add_subdirectory(Terrain)
add_subdirectory(Utils) add_subdirectory(Utils)
add_subdirectory(World) add_subdirectory(World)
add_subdirectory(XLink)
target_sources(uking PRIVATE target_sources(uking PRIVATE
ksys.cpp ksys.cpp

View File

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

View File

@ -0,0 +1,84 @@
#include "KingSystem/XLink/xlinkInfoData.h"
#include "KingSystem/Resource/resLoadRequest.h"
namespace ksys::xlink {
SEAD_SINGLETON_DISPOSER_IMPL(InfoData)
InfoData::~InfoData() {
if (mRootIter)
delete mRootIter;
}
void InfoData::loadInfo(sead::Heap* heap) {
res::LoadRequest req;
req.mRequester = "xlink::InfoData";
req._22 = true;
mResHandle.load("Actor/XLink/XLinkInfo.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) {
loadInfo(heap);
}
al::ByamlIter InfoData::getIter(const sead::SafeString& key) const {
const auto iter = mRootIter->getIterByKey(key.cstr());
return al::ByamlIter(iter);
}
sead::SafeString InfoData::getXLinkSettingPropertyTableName(const al::ByamlIter& iter) const {
const char* value = "ActorBasic";
iter.tryGetStringByKey(&value, "XLinkSettingPropertyTableName");
return value;
}
sead::SafeString InfoData::getXLinkSettingFootStepProcTypeName(const al::ByamlIter& iter) const {
const char* value = "None";
iter.tryGetStringByKey(&value, "XLinkSettingFootStepProcTypeName");
return value;
}
float InfoData::getXLinkSettingVeloClampThreshold(const al::ByamlIter& iter) const {
float value = 0.0;
iter.tryGetFloatByKey(&value, "XLinkSettingVeloClampThreshold");
return value;
}
float InfoData::getXLinkSettingVeloRollClampThreshold(const al::ByamlIter& iter) const {
float value = 0.0;
iter.tryGetFloatByKey(&value, "XLinkSettingVeloRollClampThreshold");
return value;
}
bool InfoData::getXLinkSettingIsReactionTargetEnemy(const al::ByamlIter& iter) const {
bool value = false;
iter.tryGetBoolByKey(&value, "XLinkSettingIsReactionTargetEnemy");
return value;
}
bool InfoData::getXLinkSettingIsReactionTargetTinyEnemy(const al::ByamlIter& iter) const {
bool value = false;
iter.tryGetBoolByKey(&value, "XLinkSettingIsReactionTargetTinyEnemy");
return value;
}
bool InfoData::getXLinkSettingIsReactionTargetObject(const al::ByamlIter& iter) const {
bool value = false;
iter.tryGetBoolByKey(&value, "XLinkSettingIsReactionTargetObject");
return value;
}
bool InfoData::getXLinkSettingIsIgnoreDamageToObject(const sead::SafeString& key) const {
const auto iter = getIter(key);
bool value = false;
iter.tryGetBoolByKey(&value, "XLinkSettingIsIgnoreDamageToObject");
return value;
}
} // namespace ksys::xlink

View File

@ -0,0 +1,36 @@
#pragma once
#include <heap/seadDisposer.h>
#include "KingSystem/Resource/resHandle.h"
#include "KingSystem/Utils/Byaml/Byaml.h"
namespace ksys::xlink {
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 getXLinkSettingPropertyTableName(const al::ByamlIter& iter) const;
sead::SafeString getXLinkSettingFootStepProcTypeName(const al::ByamlIter& iter) const;
float getXLinkSettingVeloClampThreshold(const al::ByamlIter& iter) const;
float getXLinkSettingVeloRollClampThreshold(const al::ByamlIter& iter) const;
bool getXLinkSettingIsReactionTargetEnemy(const al::ByamlIter& iter) const;
bool getXLinkSettingIsReactionTargetTinyEnemy(const al::ByamlIter& iter) const;
bool getXLinkSettingIsReactionTargetObject(const al::ByamlIter& iter) const;
bool getXLinkSettingIsIgnoreDamageToObject(const sead::SafeString& key) const;
private:
void loadInfo(sead::Heap* heap);
al::ByamlIter* mRootIter{};
res::Handle mResHandle{};
};
} // namespace ksys::xlink