From 88620ca9af1fa9570ba012da5b95df78e729fede Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Mon, 16 Nov 2020 15:19:49 +0100 Subject: [PATCH] ksys/act: Add several more InfoData functions --- data/uking_functions.csv | 50 ++-- lib/sead | 2 +- src/KingSystem/ActorSystem/actInfoData.cpp | 321 +++++++++++++++++++++ src/KingSystem/ActorSystem/actInfoData.h | 43 ++- src/KingSystem/Utils/Byaml/ByamlData.h | 2 + 5 files changed, 388 insertions(+), 30 deletions(-) diff --git a/data/uking_functions.csv b/data/uking_functions.csv index a12cee28..184ab2ca 100644 --- a/data/uking_functions.csv +++ b/data/uking_functions.csv @@ -73358,7 +73358,7 @@ 0x0000007100d2e224,sub_7100D2E224,96,_ZN4ksys3act8InfoDataD1Ev 0x0000007100d2e284,sub_7100D2E284,84,_ZN4ksys3act8InfoDataD0Ev 0x0000007100d2e2d8,ActorInfoData::init,628,_ZN4ksys3act8InfoData4initEPhPN4sead4HeapES5_ -0x0000007100d2e54c,ActorInfoData::getActorScaleColorModelBfres,820, +0x0000007100d2e54c,ActorInfoData::getActorScaleColorModelBfres,820,_ZNK4ksys3act8InfoData12getModelInfoEPKcRNS1_9ModelInfoE 0x0000007100d2e880,ActorInfoData::getActorDataIter,208,_ZNK4ksys3act8InfoData12getActorIterEPN2al9ByamlIterEPKcb 0x0000007100d2e950,ActorInfoData::isNotMergedGrudgeOrArmor50OrWeaponSwordDemoCheck,348, 0x0000007100d2eaac,ActorInfoData::x,1484,_ZNK4ksys3act8InfoData13getRecipeInfoEPKcRNS1_10RecipeInfoE @@ -73366,42 +73366,42 @@ 0x0000007100d2f0b0,bymlGetString,84,_ZN4ksys3act8InfoData14getStringByKeyERKN2al9ByamlIterEPKcRKN4sead14SafeStringBaseIcEE 0x0000007100d2f104,sub_7100D2F104,608,_ZNK4ksys3act8InfoData11getLocatorsEPKcRNS1_8LocatorsE 0x0000007100d2f364,sub_7100D2F364,348,_ZNK4ksys3act8InfoData12getHomeAreasEPKcRNS1_9HomeAreasE -0x0000007100d2f4c0,ActorInfoData::x_1,560, -0x0000007100d2f6f0,ActorInfoData::hasTagByName,232, -0x0000007100d2f7d8,ActorInfoData::hasTagWithIter,296, -0x0000007100d2f900,ActorInfoData::hasTag,224, +0x0000007100d2f4c0,ActorInfoData::x_1,560,_ZNK4ksys3act8InfoData24getInvalidLifeConditionsEPKcRNS1_21InvalidLifeConditionsE +0x0000007100d2f6f0,ActorInfoData::hasTagByName,232,_ZNK4ksys3act8InfoData6hasTagEPKcS3_ +0x0000007100d2f7d8,ActorInfoData::hasTagWithIter,296,_ZNK4ksys3act8InfoData6hasTagERKN2al9ByamlIterEj +0x0000007100d2f900,ActorInfoData::hasTag,224,_ZNK4ksys3act8InfoData6hasTagEPKcj 0x0000007100d2f9e0,ActorInfoData::getActorSameGroupActorName,256,_ZNK4ksys3act8InfoData21getSameGroupActorNameEPKc -0x0000007100d2fae0,ActorInfoData::__auto1,136, -0x0000007100d2fb68,ActorInfoData::getTerrainTextures,452, -0x0000007100d2fd2c,ActorInfoData::getDrops,228, -0x0000007100d2fe10,sub_7100D2FE10,72, +0x0000007100d2fae0,ActorInfoData::__auto1,136,_ZNK4ksys3act8InfoData21getSameGroupActorNameERKN2al9ByamlIterE +0x0000007100d2fb68,ActorInfoData::getTerrainTextures,452,_ZNK4ksys3act8InfoData18getTerrainTexturesEPKcRNS1_15TerrainTexturesE +0x0000007100d2fd2c,ActorInfoData::getDrops,228,_ZNK4ksys3act8InfoData8getDropsEPN2al9ByamlIterEPKc +0x0000007100d2fe10,sub_7100D2FE10,72,_ZNK4ksys3act8InfoData7getNameEPKc 0x0000007100d2fe58,ActorInfoData::getActorString,288,_ZNK4ksys3act8InfoData9getStringEPKcS3_RKN4sead14SafeStringBaseIcEEb -0x0000007100d2ff78,sub_7100D2FF78,8, +0x0000007100d2ff78,sub_7100D2FF78,8,_ZNK4ksys3act8InfoData10getUnknownEPKcj 0x0000007100d2ff80,ActorInfoData::getSlinkUser,236,_ZNK4ksys3act8InfoData12getSLinkUserEPKc 0x0000007100d3006c,ActorInfoData::getElinkAndSlink,328,_ZNK4ksys3act8InfoData21getSLinkAndELinkUsersEPKcPS3_S4_ 0x0000007100d301b4,sub_7100D301B4,72,_ZNK4ksys3act8InfoData12getXLinkUserEPKc 0x0000007100d301fc,ActorInfoData::getActorProfile,276,_ZNK4ksys3act8InfoData15getActorProfileEPPKcS3_ -0x0000007100d30310,ActorInfoData::getProfile,132, +0x0000007100d30310,ActorInfoData::getProfile,132,_ZNK4ksys3act8InfoData15getActorProfileEPPKcRKN2al9ByamlIterE 0x0000007100d30394,ActorInfoData::getActorInt,252,_ZNK4ksys3act8InfoData6getIntEPKcS3_ib 0x0000007100d30490,ActorInfoData::getActorFloat,252,_ZNK4ksys3act8InfoData8getFloatEPKcS3_fb 0x0000007100d3058c,ActorInfoData::getBool,260,_ZNK4ksys3act8InfoData7getBoolEPKcS3_bb 0x0000007100d30690,act::getBymlPropertyFloat,56,_ZN4ksys3act8InfoData13getFloatByKeyERKN2al9ByamlIterEPKcf 0x0000007100d306c8,act::getBymlPropertyBool,68,_ZN4ksys3act8InfoData12getBoolByKeyERKN2al9ByamlIterEPKcb -0x0000007100d3070c,ActorInfoData::getActorIterByHash,168, -0x0000007100d307b4,sub_7100D307B4,104, -0x0000007100d3081c,sub_7100D3081C,252, +0x0000007100d3070c,ActorInfoData::getActorIterByHash,168,_ZNK4ksys3act8InfoData12getActorIterEPN2al9ByamlIterEjb +0x0000007100d307b4,sub_7100D307B4,104,_ZN4ksys3act8InfoData16hasBurnableParamERKN2al9ByamlIterE +0x0000007100d3081c,sub_7100D3081C,252,_ZNK4ksys3act8InfoData17hasCapaciterParamEPKc 0x0000007100d30918,ActorInfoData::getActorScale,20,_ZNK4ksys3act8InfoData8getScaleEPKc -0x0000007100d3092c,ActorInfoData::getLookAtOffsetY,272, -0x0000007100d30a3c,ActorInfoData::getCursorOffsetY,20, -0x0000007100d30a50,ActorInfoData::getTraverseDist,20, -0x0000007100d30a64,ActorInfoData::getYLimitAlgorithm,104, -0x0000007100d30acc,ActorInfoData::getAabbDistance,124, -0x0000007100d30b48,ActorInfoData::getAabbMinMax,364, -0x0000007100d30cb4,ActorInfoData::getSortKey,20, -0x0000007100d30cc8,ActorInfoData::getBoundingForTraverse,20, -0x0000007100d30cdc,sub_7100D30CDC,132, -0x0000007100d30d60,ActorInfoData::getIsHasFar,20, -0x0000007100d30d74,ActorInfoData::isAmiiboDrop,92, +0x0000007100d3092c,ActorInfoData::getLookAtOffsetY,272,_ZNK4ksys3act8InfoData24getAdjustedLookAtOffsetYEPKc +0x0000007100d30a3c,ActorInfoData::getCursorOffsetY,20,_ZNK4ksys3act8InfoData16getCursorOffsetYEPKc +0x0000007100d30a50,ActorInfoData::getTraverseDist,20,_ZNK4ksys3act8InfoData15getTraverseDistEPKc +0x0000007100d30a64,ActorInfoData::getYLimitAlgorithm,104,_ZNK4ksys3act8InfoData18getYLimitAlgorithmEPPKcS3_ +0x0000007100d30acc,ActorInfoData::getAabbDistance,124,_ZNK4ksys3act8InfoData11getAabbNormEPKcb +0x0000007100d30b48,ActorInfoData::getAabbMinMax,364,_ZNK4ksys3act8InfoData13getAAbbMinMaxEPKcPN4sead7Vector3IfEES7_b +0x0000007100d30cb4,ActorInfoData::getSortKey,20,_ZNK4ksys3act8InfoData10getSortKeyEPKc +0x0000007100d30cc8,ActorInfoData::getBoundingForTraverse,20,_ZNK4ksys3act8InfoData22getBoundingForTraverseEPKc +0x0000007100d30cdc,sub_7100D30CDC,132,_ZNK4ksys3act8InfoData15getAabbNormHalfEPKc +0x0000007100d30d60,ActorInfoData::getIsHasFar,20,_ZNK4ksys3act8InfoData8isHasFarEPKc +0x0000007100d30d74,ActorInfoData::isAmiiboDrop,92,_ZNK4ksys3act8InfoData12hasDropEntryEPKcS3_ 0x0000007100d30dd0,ActorInfoData::getActorInstSize,20, 0x0000007100d30de4,ActorInfoData::getBugMask,20, 0x0000007100d30df8,sub_7100D30DF8,64, diff --git a/lib/sead b/lib/sead index 6d0d19ac..21eecd7d 160000 --- a/lib/sead +++ b/lib/sead @@ -1 +1 @@ -Subproject commit 6d0d19ac628c26622c75c38dde8e1cbd93f3a854 +Subproject commit 21eecd7d3246e50249320890c1053989f8a24f77 diff --git a/src/KingSystem/ActorSystem/actInfoData.cpp b/src/KingSystem/ActorSystem/actInfoData.cpp index 54499e40..af03b8a3 100644 --- a/src/KingSystem/ActorSystem/actInfoData.cpp +++ b/src/KingSystem/ActorSystem/actInfoData.cpp @@ -1,6 +1,8 @@ #include "KingSystem/ActorSystem/actInfoData.h" +#include #include #include +#include "KingSystem/Event/evtManager.h" #include "KingSystem/Utils/Byaml/Byaml.h" #include "KingSystem/Utils/Byaml/ByamlArrayIter.h" #include "KingSystem/Utils/Byaml/ByamlData.h" @@ -63,6 +65,58 @@ void InfoData::init(u8* data, sead::Heap* heap, sead::Heap* debug_heap) { mSystemSameGroupActorNameIdx = mRootIter->getKeyIndex("systemSameGroupActorName"); } +void InfoData::getModelInfo(const char* actor, InfoData::ModelInfo& info) const { + const char** ptr; + al::ByamlIter iter; + if (!getActorIter(&iter, actor)) { + static_cast(logFailure(actor)); + ptr = &info.bfres; + } else { + const auto getFloat = [&](f32* value, const char* key, float default_) { + if (!iter.tryGetFloatByKey(value, key)) + *value = default_; + }; + + getFloat(&info.baseScale.x, "baseScaleX", 1.0); + getFloat(&info.baseScale.y, "baseScaleY", 1.0); + getFloat(&info.baseScale.z, "baseScaleZ", 1.0); + + getFloat(&info.addColor.r, "addColorR", 0.0); + getFloat(&info.addColor.g, "addColorG", 0.0); + getFloat(&info.addColor.b, "addColorB", 0.0); + getFloat(&info.addColor.a, "addColorA", 0.0); + + getFloat(&info.mulColor.r, "mulColorR", 1.0); + getFloat(&info.mulColor.g, "mulColorG", 1.0); + getFloat(&info.mulColor.b, "mulColorB", 1.0); + getFloat(&info.mulColor.a, "mulColorA", 1.0); + + if (!iter.tryGetStringByKey(&info.bfres, "bfres")) + info.bfres = nullptr; + + if (!iter.tryGetStringByKey(&info.mainModel, "mainModel")) + info.mainModel = nullptr; + + if (!info.bfres) + return; + + if (info.mainModel) { + const char* model_resource = + res::ModelResourceDivide::instance()->getModelResource(info.bfres, info.mainModel); + if (model_resource) + info.bfres = model_resource; + } + + if (!info.bfres || sead::SafeString(info.bfres) != "dammy_data") + return; + + info.bfres = nullptr; + ptr = &info.mainModel; + } + + *ptr = nullptr; +} + bool InfoData::getActorIter(al::ByamlIter* iter, const char* actor, bool x) const { const u32 hash = sead::HashCRC32::calcStringHash(actor); @@ -193,6 +247,93 @@ void InfoData::getHomeAreas(const char* actor, HomeAreas& info) const { } } +void InfoData::getInvalidLifeConditions(const char* actor, InvalidLifeConditions& info) const { + al::ByamlIter iter; + if (!getActorIter(&iter, actor)) + return; + + al::ByamlData data; + al::ByamlHashIter hash_iter{iter.getRootNode()}; + + if (hash_iter.getDataByKey(&data, mInvalidTimesIdx)) { + al::ByamlIter it{iter.getData(), iter.getData() + data.getValue()}; + for (s32 i = 0, n = it.getSize(); i < n; ++i) { + const char* time = nullptr; + if (!it.tryGetStringByIndex(&time, i)) + continue; + + info.times[info.num_times] = time; + ++info.num_times; + } + } + + if (hash_iter.getDataByKey(&data, mInvalidWeathersIdx)) { + al::ByamlIter it{iter.getData(), iter.getData() + data.getValue()}; + for (s32 i = 0, n = it.getSize(); i < n; ++i) { + const char* weather = nullptr; + if (!it.tryGetStringByIndex(&weather, i)) + continue; + + info.weathers[info.num_weathers] = weather; + ++info.num_weathers; + } + } +} + +bool InfoData::hasTag(const char* actor, const char* tag) const { + al::ByamlIter iter; + return getActorIter(&iter, actor) && hasTag(iter, sead::HashCRC32::calcStringHash(tag)); +} + +bool InfoData::hasTag(const al::ByamlIter& actor_iter, u32 tag) const { + al::ByamlHashIter tags_iter{actor_iter.getRootNode()}; + al::ByamlData data; + if (!tags_iter.getDataByKey(&data, mTagsIdx)) + return false; + + al::ByamlIter iter{actor_iter.getData(), actor_iter.getData() + data.getValue()}; + if (!iter.isValid()) + return false; + + // Binary search. + + s32 a = 0; + s32 b = iter.getSize(); + if (b <= 0) + return false; + + al::ByamlHashIter hash_iter{iter.getRootNode()}; + const auto pair_table = hash_iter.getPairTable(); + + while (a < b) { + const s32 idx = (a + b) / 2; + + const auto* pair = &pair_table[idx]; + if (!pair) + break; + + al::ByamlData hash_data{pair}; + u32 hash; + if (!iter.tryConvertUInt(&hash, &hash_data)) + break; + + if (hash == tag) + return true; + + if (hash >= tag) + b = idx; + else + a = idx + 1; + } + + return false; +} + +bool InfoData::hasTag(const char* actor, u32 tag_hash) const { + al::ByamlIter iter; + return getActorIter(&iter, actor) && hasTag(iter, tag_hash); +} + const char* InfoData::getSameGroupActorName(const char* actor) const { al::ByamlIter iter; return [&] { @@ -209,6 +350,52 @@ const char* InfoData::getSameGroupActorName(const char* actor) const { }(); } +const char* InfoData::getSameGroupActorName(const al::ByamlIter& iter) const { + al::ByamlHashIter hash_iter{iter.getRootNode()}; + al::ByamlData data; + if (hash_iter.getDataByKey(&data, mSystemSameGroupActorNameIdx)) { + const char* name; + if (iter.tryConvertString(&name, &data)) + return name; + } + return sead::SafeString::cEmptyString.cstr(); +} + +s32 InfoData::getTerrainTextures(const char* actor, InfoData::TerrainTextures& info) const { + al::ByamlIter iter; + if (!getActorIter(&iter, actor)) + return 0; + + al::ByamlIter textures_iter; + if (!iter.tryGetIterByKey(&textures_iter, "terrainTextures")) + return 0; + + s32 count = 0; + for (s32 i = 0; i < textures_iter.getSize(); ++i) { + u32 value; + textures_iter.tryGetUIntByIndex(&value, i); + + if (u8(value) != 0xFF) + info.textures[count++] = u8(value); + if (u8(value >> 8) != 0xFF) + info.textures[count++] = u8(value >> 8); + if (u8(value >> 16) != 0xFF) + info.textures[count++] = u8(value >> 16); + if (u8(value >> 24) != 0xFF) + info.textures[count++] = u8(value >> 24); + } + return count; +} + +bool InfoData::getDrops(al::ByamlIter* drops_iter, const char* actor) const { + al::ByamlIter iter; + return getActorIter(&iter, actor) && iter.tryGetIterByKey(drops_iter, "drops"); +} + +const char* InfoData::getName(const char* actor) const { + return getString(actor, "name", ""); +} + const char* InfoData::getString(const char* actor, const char* key, const sead::SafeString& default_, bool x) const { al::ByamlIter iter; @@ -218,6 +405,10 @@ const char* InfoData::getString(const char* actor, const char* key, return getStringByKey(iter, key, default_); } +const char* InfoData::getUnknown(const char* actor, u32) const { + return actor; +} + const char* InfoData::getSLinkUser(const char* actor) const { al::ByamlIter iter; if (!getActorIter(&iter, actor)) @@ -255,6 +446,15 @@ bool InfoData::getActorProfile(const char** profile, const char* actor) const { return false; } +bool InfoData::getActorProfile(const char** profile, const al::ByamlIter& iter) const { + al::ByamlHashIter hash_iter{iter.getRootNode()}; + al::ByamlData data; + if (hash_iter.getDataByKey(&data, mProfileIdx)) + return iter.tryConvertString(profile, &data); + *profile = "Dummy"; + return false; +} + s32 InfoData::getInt(const char* actor, const char* key, s32 default_, bool x) const { al::ByamlIter iter; if (!getActorIter(&iter, actor, x)) @@ -289,8 +489,129 @@ bool InfoData::getBoolByKey(const al::ByamlIter& iter, const char* key, bool def return iter.tryGetBoolByKey(&value, key) ? value != 0 : default_; } +bool InfoData::getActorIter(al::ByamlIter* iter, u32 hash, bool x) const { + // Perform a binary search. + s32 a = 0; + s32 b = mNumActors; + while (a < b) { + const s32 idx = (a + b) / 2; + const u32 hash_i = mHashes[idx]; + + if (hash_i == hash) { + *iter = al::ByamlIter(mActorsBytes, mActorsBytes + mActorOffsets[idx]); + return true; + } + + if (hash_i >= hash) + b = idx; + else + a = idx + 1; + } + + if (x) + static_cast(evt::Manager::instance()->getActiveEvent()); + + return false; +} + +bool InfoData::hasBurnableParam(const al::ByamlIter& iter) { + al::ByamlIter chemical_it; + if (!iter.tryGetIterByKey(&chemical_it, "Chemical")) + return false; + s32 dummy = 0; + return chemical_it.tryGetIntByKey(&dummy, "Burnable"); +} + +bool InfoData::hasCapaciterParam(const al::ByamlIter& iter) { + al::ByamlIter chemical_it; + if (!iter.tryGetIterByKey(&chemical_it, "Chemical")) + return false; + s32 dummy = 0; + return chemical_it.tryGetIntByKey(&dummy, "Capaciter"); +} + +bool InfoData::hasCapaciterParam(const char* actor) const { + al::ByamlIter iter; + return getActorIter(&iter, actor) && hasCapaciterParam(iter); +} + f32 InfoData::getScale(const char* actor) const { return getFloat(actor, "actorScale", 1.0); } +f32 InfoData::getAdjustedLookAtOffsetY(const char* actor) const { + al::ByamlIter iter; + if (!getActorIter(&iter, actor)) + return 0.0; + + return iter.getFloatByKey("lookAtOffsetY") + iter.getFloatByKey("rigidBodyCenterY"); +} + +f32 InfoData::getCursorOffsetY(const char* actor) const { + return getFloat(actor, "cursorOffsetY", 0.0, false); +} + +f32 InfoData::getTraverseDist(const char* actor) const { + return getFloat(actor, "traverseDist", 0.0); +} + +bool InfoData::getYLimitAlgorithm(const char** algorithm, const char* actor) const { + *algorithm = getString(actor, "yLimitAlgorithm", "NoLimit"); + return algorithm != nullptr; +} + +f32 InfoData::getAabbNorm(const char* actor, bool x) const { + sead::Vector3f min, max; + if (getAAbbMinMax(actor, &min, &max, x)) + return sead::norm2(max - min); + return 0.0; +} + +bool InfoData::getAAbbMinMax(const char* actor, sead::Vector3f* min, sead::Vector3f* max, + bool x) const { + al::ByamlIter iter; + if (!getActorIter(&iter, actor, x)) + return false; + + bool min_ok, max_ok; + + if (al::tryGetByamlV3f(min, iter, "aabbMin")) { + min_ok = true; + } else { + *min = sead::Vector3f::zero; + min_ok = false; + } + + if (al::tryGetByamlV3f(max, iter, "aabbMax")) { + max_ok = true; + } else { + *max = sead::Vector3f::zero; + max_ok = false; + } + + return min_ok && max_ok; +} + +s32 InfoData::getSortKey(const char* actor) const { + return getInt(actor, "sortKey", 0, false); +} + +f32 InfoData::getBoundingForTraverse(const char* actor) const { + return getFloat(actor, "boundingForTraverse", 0, false); +} + +f32 InfoData::getAabbNormHalf(const char* actor) const { + return getAabbNorm(actor, true) * 0.5f; +} + +bool InfoData::isHasFar(const char* actor) const { + return getBool(actor, "isHasFar", false, false); +} + +bool InfoData::hasDropEntry(const char* actor, const char* key) const { + al::ByamlIter iter; + getDrops(&iter, actor); + return iter.isExistKey(key); +} + } // namespace ksys::act diff --git a/src/KingSystem/ActorSystem/actInfoData.h b/src/KingSystem/ActorSystem/actInfoData.h index 56a84e6f..a576bc74 100644 --- a/src/KingSystem/ActorSystem/actInfoData.h +++ b/src/KingSystem/ActorSystem/actInfoData.h @@ -6,6 +6,7 @@ #include #include #include +#include "KingSystem/ActorSystem/actTag.h" #include "KingSystem/Utils/Types.h" namespace al { @@ -68,6 +69,19 @@ public: }; KSYS_CHECK_SIZE_NX150(HomeAreas, 0x18); + struct InvalidLifeConditions { + s32 num_times; + sead::SafeArray times; + s32 num_weathers; + sead::SafeArray weathers; + }; + KSYS_CHECK_SIZE_NX150(InvalidLifeConditions, 0x210); + + struct TerrainTextures { + sead::SafeArray textures; + }; + KSYS_CHECK_SIZE_NX150(TerrainTextures, 0x20); + void init(u8* data, sead::Heap* heap, sead::Heap* debug_heap); void getModelInfo(const char* actor, ModelInfo& info) const; @@ -76,16 +90,37 @@ public: void getRecipeInfo(const char* actor, RecipeInfo& info) const; void getLocators(const char* actor, Locators& info) const; void getHomeAreas(const char* actor, HomeAreas& info) const; - // TODO: invalid time function - // TODO: tag functions + void getInvalidLifeConditions(const char* actor, InvalidLifeConditions& info) const; + bool hasTag(const char* actor, const char* tag) const; + bool hasTag(const al::ByamlIter& actor_iter, u32 tag_hash) const; + bool hasTag(const char* actor, u32 tag_hash) const; const char* getSameGroupActorName(const char* actor) const; - // TODO: more functions + const char* getSameGroupActorName(const al::ByamlIter& iter) const; + s32 getTerrainTextures(const char* actor, TerrainTextures& info) const; + bool getDrops(al::ByamlIter* drops_iter, const char* actor) const; + const char* getName(const char* actor) const; + const char* getUnknown(const char* actor, u32 x) const; const char* getSLinkUser(const char* actor) const; bool getSLinkAndELinkUsers(const char* actor, const char** elink, const char** slink) const; const char* getXLinkUser(const char* actor) const; bool getActorProfile(const char** profile, const char* actor) const; - // TODO: more functions + bool getActorProfile(const char** profile, const al::ByamlIter& iter) const; + bool getActorIter(al::ByamlIter* iter, u32 actor_name_hash, bool x = true) const; + static bool hasBurnableParam(const al::ByamlIter& iter); + static bool hasCapaciterParam(const al::ByamlIter& iter); + bool hasCapaciterParam(const char* actor) const; f32 getScale(const char* actor) const; + f32 getAdjustedLookAtOffsetY(const char* actor) const; + f32 getCursorOffsetY(const char* actor) const; + f32 getTraverseDist(const char* actor) const; + bool getYLimitAlgorithm(const char** algorithm, const char* actor) const; + f32 getAabbNorm(const char* actor, bool x) const; + bool getAAbbMinMax(const char* actor, sead::Vector3f* min, sead::Vector3f* max, bool x) const; + s32 getSortKey(const char* actor) const; + f32 getBoundingForTraverse(const char* actor) const; + f32 getAabbNormHalf(const char* actor) const; + bool isHasFar(const char* actor) const; + bool hasDropEntry(const char* actor, const char* key) const; const char* getString(const char* actor, const char* key, const sead::SafeString& default_, bool x = true) const; diff --git a/src/KingSystem/Utils/Byaml/ByamlData.h b/src/KingSystem/Utils/Byaml/ByamlData.h index ed41dc82..8a9747f2 100644 --- a/src/KingSystem/Utils/Byaml/ByamlData.h +++ b/src/KingSystem/Utils/Byaml/ByamlData.h @@ -9,6 +9,8 @@ namespace al { struct ByamlData { ByamlData(); + explicit ByamlData(const ByamlHashPair* pair) : ByamlData{} { set(pair); } + template T getValue() const { return *reinterpret_cast(&mValue);