From ea13bac74ad136aeb3dde81f07ccd62622be94ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Mon, 28 Sep 2026 03:39:31 +0200 Subject: [PATCH] ksys: move AS setting, RootAi and three others to match link order Each file moves to where its code is linked, and namespaces follow the new paths. ASSettingMgr is an unofficial name. | Old | New | |---|---| | act::ASSetting (ActorSystem/actASSetting) | res::ASSettingMgr (Resource/Actor/resResourceASSettingMgr) | | Resource/resResourceASSetting, Resource/Actor/resResourceASResourceExtension | Resource/Actor/resResourceASSetting | | ksys::DebugFinder (System/DebugFinder) | ksys::act::DebugFinder (ActorSystem/actDebugFinder) | | ActorSystem/LOD/actLodState | ActorSystem/actLodState | | ActorSystem/actAiRoot | ActorSystem/aiRootAi | | Map/mapStagePreActorCache | System/StagePreActorCache (ksys) | (AI assisted using Claude Fable 5.1 and Claude Opus 5.5) --- data/uking_functions.csv | 60 +++--- .../Query/queryIsSuccessEndLastDemoAction.cpp | 2 +- src/KingSystem/ActorSystem/CMakeLists.txt | 13 +- src/KingSystem/ActorSystem/actASSetting.cpp | 31 ---- src/KingSystem/ActorSystem/actASSetting.h | 26 --- src/KingSystem/ActorSystem/actActor.cpp | 2 +- .../ActorSystem/actActorEditorNode.cpp | 2 +- .../actActorLinkConstDataAccess.cpp | 2 +- .../ActorSystem/actActorParamMgr.cpp | 8 +- src/KingSystem/ActorSystem/actAiAction.cpp | 2 +- .../ActorSystem/actAiActionBase.cpp | 2 +- src/KingSystem/ActorSystem/actAiAi.cpp | 2 +- src/KingSystem/ActorSystem/actAiBehavior.cpp | 2 +- src/KingSystem/ActorSystem/actAiQuery.cpp | 2 +- .../actDebugFinder.cpp} | 6 +- .../actDebugFinder.h} | 4 +- .../ActorSystem/{LOD => }/actLodState.cpp | 2 +- .../ActorSystem/{LOD => }/actLodState.h | 0 src/KingSystem/ActorSystem/aiForkAI.cpp | 2 +- .../{actAiRoot.cpp => aiRootAi.cpp} | 2 +- .../ActorSystem/{actAiRoot.h => aiRootAi.h} | 0 src/KingSystem/Map/CMakeLists.txt | 2 - src/KingSystem/Map/mapObject.cpp | 2 +- src/KingSystem/Map/mapPlacementAreaMgr.h | 2 +- src/KingSystem/Map/mapPlacementMapMgr.h | 7 +- src/KingSystem/Map/mapStagePreActorCache.cpp | 7 - ...Extension.cpp => resResourceASSetting.cpp} | 174 ++++++++++++++++-- .../{ => Actor}/resResourceASSetting.h | 2 +- .../Resource/Actor/resResourceASSettingMgr.h | 26 +++ src/KingSystem/Resource/CMakeLists.txt | 6 +- .../Resource/resResourceASSetting.cpp | 113 ------------ src/KingSystem/System/CMakeLists.txt | 4 +- src/KingSystem/System/StagePreActorCache.cpp | 7 + .../StagePreActorCache.h} | 10 +- 34 files changed, 263 insertions(+), 271 deletions(-) delete mode 100644 src/KingSystem/ActorSystem/actASSetting.cpp delete mode 100644 src/KingSystem/ActorSystem/actASSetting.h rename src/KingSystem/{System/DebugFinder.cpp => ActorSystem/actDebugFinder.cpp} (55%) rename src/KingSystem/{System/DebugFinder.h => ActorSystem/actDebugFinder.h} (86%) rename src/KingSystem/ActorSystem/{LOD => }/actLodState.cpp (99%) rename src/KingSystem/ActorSystem/{LOD => }/actLodState.h (100%) rename src/KingSystem/ActorSystem/{actAiRoot.cpp => aiRootAi.cpp} (99%) rename src/KingSystem/ActorSystem/{actAiRoot.h => aiRootAi.h} (100%) delete mode 100644 src/KingSystem/Map/mapStagePreActorCache.cpp rename src/KingSystem/Resource/Actor/{resResourceASResourceExtension.cpp => resResourceASSetting.cpp} (70%) rename src/KingSystem/Resource/{ => Actor}/resResourceASSetting.h (97%) create mode 100644 src/KingSystem/Resource/Actor/resResourceASSettingMgr.h delete mode 100644 src/KingSystem/Resource/resResourceASSetting.cpp create mode 100644 src/KingSystem/System/StagePreActorCache.cpp rename src/KingSystem/{Map/mapStagePreActorCache.h => System/StagePreActorCache.h} (74%) diff --git a/data/uking_functions.csv b/data/uking_functions.csv index 69875092..4eb71919 100644 --- a/data/uking_functions.csv +++ b/data/uking_functions.csv @@ -80545,15 +80545,15 @@ Address,Quality,Size,Name 0x0000007100ed8ff0,O,000168,_GLOBAL__sub_I_StageInfo.cpp 0x0000007100ed9098,U,000056, 0x0000007100ed90d0,U,000092, -0x0000007100ed912c,U,000244,StagePreActorCache::createInstance -0x0000007100ed9220,U,000196,StagePreActorCache::init -0x0000007100ed92e4,U,000144,StagePreActorCache::reset -0x0000007100ed9374,U,001032,StagePreActorCache::loadMaps -0x0000007100ed977c,U,000224,StagePreActorCache::isMapTypeEqual -0x0000007100ed985c,U,000008,StagePreActorCache::m2 -0x0000007100ed9864,U,000056,StagePreActorCache::m3 -0x0000007100ed989c,U,000316,StagePreActorCache::m4 -0x0000007100ed99d8,U,000240,StagePreActorCache::m1 +0x0000007100ed912c,U,000244,ksys::StagePreActorCache::createInstance +0x0000007100ed9220,U,000196,ksys::StagePreActorCache::init +0x0000007100ed92e4,U,000144,ksys::StagePreActorCache::reset +0x0000007100ed9374,U,001032,ksys::StagePreActorCache::loadMaps +0x0000007100ed977c,U,000224,ksys::StagePreActorCache::isMapTypeEqual +0x0000007100ed985c,U,000008,ksys::StagePreActorCache::m2 +0x0000007100ed9864,U,000056,ksys::StagePreActorCache::m3 +0x0000007100ed989c,U,000316,ksys::StagePreActorCache::m4 +0x0000007100ed99d8,U,000240,ksys::StagePreActorCache::m1 0x0000007100ed9ac8,O,000052,_ZN5uking6action15EnvSetLensFlareC1ERKN4ksys3act2ai10ActionBase7InitArgE 0x0000007100ed9afc,O,000008,_ZN5uking6action15EnvSetLensFlare5init_EPN4sead4HeapE 0x0000007100ed9b04,W,000028,_ZN5uking6action15EnvSetLensFlare6enter_EPN4ksys3act2ai15InlineParamPackE @@ -94614,11 +94614,11 @@ Address,Quality,Size,Name 0x000000710124a37c,U,000140, 0x000000710124a408,U,000048, 0x000000710124a438,U,000092, -0x000000710124a494,O,000100,_ZN4ksys11DebugFinder18SingletonDisposer_D1Ev -0x000000710124a4f8,O,000108,_ZN4ksys11DebugFinder18SingletonDisposer_D0Ev -0x000000710124a564,O,000292,_ZN4ksys11DebugFinder14createInstanceEPN4sead4HeapE -0x000000710124a688,O,000004,_ZN4ksys11DebugFinderD1Ev -0x000000710124a68c,O,000004,_ZN4ksys11DebugFinderD0Ev +0x000000710124a494,O,000100,_ZN4ksys3act11DebugFinder18SingletonDisposer_D1Ev +0x000000710124a4f8,O,000108,_ZN4ksys3act11DebugFinder18SingletonDisposer_D0Ev +0x000000710124a564,O,000292,_ZN4ksys3act11DebugFinder14createInstanceEPN4sead4HeapE +0x000000710124a688,O,000004,_ZN4ksys3act11DebugFinderD1Ev +0x000000710124a68c,O,000004,_ZN4ksys3act11DebugFinderD0Ev 0x000000710124a690,U,000008, 0x000000710124a698,U,000108, 0x000000710124a704,U,000108, @@ -94628,13 +94628,13 @@ Address,Quality,Size,Name 0x000000710124a9ac,U,000016, 0x000000710124a9bc,U,000044, 0x000000710124a9e8,U,000140, -0x000000710124aa74,U,000056,FarActorMerge::ctor -0x000000710124aaac,U,000036,FarActorMerge::dtor -0x000000710124aad0,U,000240,FarActorMerge::cleanup -0x000000710124abc0,U,000004,FarActorMerge::stubbed -0x000000710124abc4,U,000760,FarActorMerge::loadStuff -0x000000710124aebc,U,000152,FarActorMerge::requestDraw -0x000000710124af54,U,000252,FarActorMerge::x +0x000000710124aa74,U,000056,ksys::act::FarActorMerge::ctor +0x000000710124aaac,U,000036,ksys::act::FarActorMerge::dtor +0x000000710124aad0,U,000240,ksys::act::FarActorMerge::cleanup +0x000000710124abc0,U,000004,ksys::act::FarActorMerge::stubbed +0x000000710124abc4,U,000760,ksys::act::FarActorMerge::loadStuff +0x000000710124aebc,U,000152,ksys::act::FarActorMerge::requestDraw +0x000000710124af54,U,000252,ksys::act::FarActorMerge::x 0x000000710124b050,U,005784,Actor::makeField598 0x000000710124c6e8,m,018196,_ZN4ksys3act8LodStateC1EPN4sead4HeapENS2_7BitFlagIjEEPNS0_5ActorEif 0x0000007101250dfc,m,000112,_ZN4ksys3act8LodState9initFlagsEv @@ -97209,7 +97209,7 @@ Address,Quality,Size,Name 0x00000071012f23a4,O,000132,_ZN4ksys3res12ASExtensionsD1Ev 0x00000071012f2428,O,000508,_ZN4ksys3res12ASExtensions5parseERKNS1_9ParseArgsE 0x00000071012f2624,O,000636,_ZNK4ksys3res12ASExtensions10makeParserERKNS0_13ASParamParser9ParseArgsE -0x00000071012f28a0,m,000428,_ZNK4ksys3act9ASSetting13getBoneParamsERKN4sead14SafeStringBaseIcEE +0x00000071012f28a0,m,000428,_ZNK4ksys3res12ASSettingMgr13getBoneParamsERKN4sead14SafeStringBaseIcEE 0x00000071012f2a4c,O,000080,_ZNK4ksys3res12ASExtensions9getParserENS0_13ASParamParser4TypeE 0x00000071012f2a9c,O,000252,_ZN4ksys3res9ASSettingC1Ev 0x00000071012f2b98,O,000360,_ZN4ksys3res9ASSettingD1Ev @@ -97223,11 +97223,11 @@ Address,Quality,Size,Name 0x00000071012f2d8c,O,001016,_ZN4ksys3res9ASSetting6parse_EPhmPN4sead4HeapE 0x00000071012f3184,O,000376,_ZN4ksys3res17allocBlenderBonesERN4sead6BufferINS0_9ASSetting11BlenderBoneEEEiPNS1_4HeapEi 0x00000071012f32fc,O,000008,_ZThn464_N4ksys3res9ASSetting6parse_EPhmPN4sead4HeapE -0x00000071012f3304,O,000100,_ZN4ksys3act9ASSetting18SingletonDisposer_D1Ev -0x00000071012f3368,O,000108,_ZN4ksys3act9ASSetting18SingletonDisposer_D0Ev -0x00000071012f33d4,O,000152,_ZN4ksys3act9ASSetting14createInstanceEPN4sead4HeapE -0x00000071012f346c,O,000088,_ZN4ksys3act9ASSetting14deleteInstanceEv -0x00000071012f34c4,O,000132,_ZN4ksys3act9ASSetting4initERKN4sead14SafeStringBaseIcEEPNS2_4HeapE +0x00000071012f3304,O,000100,_ZN4ksys3res12ASSettingMgr18SingletonDisposer_D1Ev +0x00000071012f3368,O,000108,_ZN4ksys3res12ASSettingMgr18SingletonDisposer_D0Ev +0x00000071012f33d4,O,000152,_ZN4ksys3res12ASSettingMgr14createInstanceEPN4sead4HeapE +0x00000071012f346c,O,000088,_ZN4ksys3res12ASSettingMgr14deleteInstanceEv +0x00000071012f34c4,O,000132,_ZN4ksys3res12ASSettingMgr4initERKN4sead14SafeStringBaseIcEEPNS2_4HeapE 0x00000071012f3548,O,000204,_ZNK4ksys3res17ASFrameCtrlParser27checkDerivedRuntimeTypeInfoEPKN4sead15RuntimeTypeInfo9InterfaceE 0x00000071012f3614,O,000092,_ZNK4ksys3res17ASFrameCtrlParser18getRuntimeTypeInfoEv 0x00000071012f3670,O,000104,_ZN4ksys3res17ASFrameCtrlParserD2Ev @@ -97262,7 +97262,7 @@ Address,Quality,Size,Name 0x00000071012f47e8,O,000004,_ZN4ksys3res16ASBitIndexParserD0Ev 0x00000071012f47ec,O,000204,_ZNK4ksys3res9ASSetting10BoneParams27checkDerivedRuntimeTypeInfoEPKN4sead15RuntimeTypeInfo9InterfaceE 0x00000071012f48b8,O,000092,_ZNK4ksys3res9ASSetting10BoneParams18getRuntimeTypeInfoEv -0x00000071012f4914,O,000164,_ZN4ksys3res9ASSetting10BoneParamsD1Ev +0x00000071012f4914,O,000164,_ZN4ksys3res9ASSetting10BoneParamsD2Ev 0x00000071012f49b8,O,000128,_ZN4ksys3res9ASSetting10BoneParamsD0Ev 0x00000071012f4a38,O,000008,_ZNK4ksys3res9ASSetting27checkDerivedRuntimeTypeInfoEPKN4sead15RuntimeTypeInfo9InterfaceE 0x00000071012f4a40,O,000092,_ZNK4ksys3res9ASSetting18getRuntimeTypeInfoEv @@ -97270,8 +97270,8 @@ Address,Quality,Size,Name 0x00000071012f4aa4,O,000008,_ZThn464_NK4ksys3res9ASSetting27checkDerivedRuntimeTypeInfoEPKN4sead15RuntimeTypeInfo9InterfaceE 0x00000071012f4aac,O,000092,_ZThn464_NK4ksys3res9ASSetting18getRuntimeTypeInfoEv 0x00000071012f4b08,O,000008,_ZThn464_NK4ksys3res9ASSetting10needsParseEv -0x00000071012f4b10,O,000020,_ZN4ksys3act9ASSettingD1Ev -0x00000071012f4b24,O,000052,_ZN4ksys3act9ASSettingD0Ev +0x00000071012f4b10,O,000020,_ZN4ksys3res12ASSettingMgrD2Ev +0x00000071012f4b24,O,000052,_ZN4ksys3res12ASSettingMgrD0Ev 0x00000071012f4b58,O,000056,_ZN4ksys3resL12factoryImpl_INS0_17ASFrameCtrlParserEEEPNS0_13ASParamParserEPN4sead4HeapE 0x00000071012f4b90,O,000124,_ZN4ksys3resL12factoryImpl_INS0_21ASTriggerEventsParserEEEPNS0_13ASParamParserEPN4sead4HeapE 0x00000071012f4c0c,O,000124,_ZN4ksys3resL12factoryImpl_INS0_18ASHoldEventsParserEEEPNS0_13ASParamParserEPN4sead4HeapE diff --git a/src/Game/Actor/Query/queryIsSuccessEndLastDemoAction.cpp b/src/Game/Actor/Query/queryIsSuccessEndLastDemoAction.cpp index 6c79cdc9..6d9dda5c 100644 --- a/src/Game/Actor/Query/queryIsSuccessEndLastDemoAction.cpp +++ b/src/Game/Actor/Query/queryIsSuccessEndLastDemoAction.cpp @@ -1,7 +1,7 @@ #include "Game/Actor/Query/queryIsSuccessEndLastDemoAction.h" #include #include "KingSystem/ActorSystem/actActor.h" -#include "KingSystem/ActorSystem/actAiRoot.h" +#include "KingSystem/ActorSystem/aiRootAi.h" namespace uking::query { diff --git a/src/KingSystem/ActorSystem/CMakeLists.txt b/src/KingSystem/ActorSystem/CMakeLists.txt index c83f97de..e0b70bfd 100644 --- a/src/KingSystem/ActorSystem/CMakeLists.txt +++ b/src/KingSystem/ActorSystem/CMakeLists.txt @@ -13,9 +13,6 @@ target_sources(uking PRIVATE Awareness/actAwarenessInstance.h - LOD/actLodState.cpp - LOD/actLodState.h - Profiles/actRopeBase.cpp Profiles/actRopeBase.h Profiles/actWeaponBase.cpp @@ -62,10 +59,6 @@ target_sources(uking PRIVATE actAiQuery.h actAiQueries.cpp actAiQueries.h - actAiRoot.cpp - actAiRoot.h - actASSetting.cpp - actASSetting.h actBaseProc.cpp actBaseProc.h actBaseProcAccessor.cpp @@ -99,6 +92,8 @@ target_sources(uking PRIVATE actClusteredRenderer.h actDebug.cpp actDebug.h + actDebugFinder.cpp + actDebugFinder.h actGlobalParameter.cpp actGlobalParameter.h actIDamageManager.cpp @@ -110,6 +105,8 @@ target_sources(uking PRIVATE actInstParamPack.cpp actInstParamPack.h actLifeRecoveryInfo.h + actLodState.cpp + actLodState.h actPhysicsConstraints.cpp actPhysicsConstraints.h actPhysicsUserTag.cpp @@ -134,6 +131,8 @@ target_sources(uking PRIVATE aiFork6AI.h aiForkAI.cpp aiForkAI.h + aiRootAi.cpp + aiRootAi.h behaviorDummyBehavior.cpp behaviorDummyBehavior.h diff --git a/src/KingSystem/ActorSystem/actASSetting.cpp b/src/KingSystem/ActorSystem/actASSetting.cpp deleted file mode 100644 index 2b020cfe..00000000 --- a/src/KingSystem/ActorSystem/actASSetting.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "KingSystem/ActorSystem/actASSetting.h" -#include "KingSystem/Resource/resLoadRequest.h" -#include "KingSystem/Resource/resResourceASSetting.h" - -namespace ksys::act { - -SEAD_SINGLETON_DISPOSER_IMPL(ASSetting) - -ASSetting::~ASSetting() = default; - -void ASSetting::init(const sead::SafeString& config_path, sead::Heap* heap) { - res::LoadRequest req; - req.mRequester = "ASSetting"; - req._22 = true; - mHandle.load(config_path, &req); -} - -// NON_MATCHING: sead::DirectResource to res::ASSetting cast nullptr check; branching for the return -res::ASParamParser* ASSetting::getBoneParams(const sead::SafeString& key) const { - auto* res = sead::DynamicCast(mHandle.getResource()); - if (!res) - return nullptr; - - for (auto& bones : res->getBlenderBones()) { - if (key == bones.mKeyName.ref()) - return &bones.mBoneParams; - } - return nullptr; -} - -} // namespace ksys::act diff --git a/src/KingSystem/ActorSystem/actASSetting.h b/src/KingSystem/ActorSystem/actASSetting.h deleted file mode 100644 index 8c97c85a..00000000 --- a/src/KingSystem/ActorSystem/actASSetting.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include -#include -#include "KingSystem/Resource/resHandle.h" -#include "KingSystem/Resource/resResourceASSetting.h" -#include "KingSystem/Utils/Types.h" - -namespace ksys::act { - -// FIXME: very incomplete -class ASSetting { - SEAD_SINGLETON_DISPOSER(ASSetting) - ASSetting() = default; - virtual ~ASSetting(); - -public: - void init(const sead::SafeString& config_path, sead::Heap* heap); - res::ASParamParser* getBoneParams(const sead::SafeString& key) const; - -private: - res::Handle mHandle; -}; -KSYS_CHECK_SIZE_NX150(ASSetting, 0x78); - -} // namespace ksys::act diff --git a/src/KingSystem/ActorSystem/actActor.cpp b/src/KingSystem/ActorSystem/actActor.cpp index ec7f3ea1..40432678 100644 --- a/src/KingSystem/ActorSystem/actActor.cpp +++ b/src/KingSystem/ActorSystem/actActor.cpp @@ -1,8 +1,8 @@ #include "KingSystem/ActorSystem/actActor.h" #include "KingSystem/ActorSystem/actActorParam.h" -#include "KingSystem/ActorSystem/actAiRoot.h" #include "KingSystem/ActorSystem/actBaseProcLink.h" #include "KingSystem/ActorSystem/actBaseProcMgr.h" +#include "KingSystem/ActorSystem/aiRootAi.h" #include "KingSystem/Physics/System/physInstanceSet.h" namespace ksys::act { diff --git a/src/KingSystem/ActorSystem/actActorEditorNode.cpp b/src/KingSystem/ActorSystem/actActorEditorNode.cpp index 47b6621e..ecb1bf00 100644 --- a/src/KingSystem/ActorSystem/actActorEditorNode.cpp +++ b/src/KingSystem/ActorSystem/actActorEditorNode.cpp @@ -1,5 +1,5 @@ #include "KingSystem/ActorSystem/actActorEditorNode.h" -#include "KingSystem/ActorSystem/actAiRoot.h" +#include "KingSystem/ActorSystem/aiRootAi.h" #include "KingSystem/System/KingEditor.h" namespace ksys::act { diff --git a/src/KingSystem/ActorSystem/actActorLinkConstDataAccess.cpp b/src/KingSystem/ActorSystem/actActorLinkConstDataAccess.cpp index 591df49e..e7ce2c15 100644 --- a/src/KingSystem/ActorSystem/actActorLinkConstDataAccess.cpp +++ b/src/KingSystem/ActorSystem/actActorLinkConstDataAccess.cpp @@ -3,8 +3,8 @@ #include "KingSystem/ActorSystem/actActor.h" #include "KingSystem/ActorSystem/actActorParam.h" #include "KingSystem/ActorSystem/actActorUtil.h" -#include "KingSystem/ActorSystem/actAiRoot.h" #include "KingSystem/ActorSystem/actBaseProc.h" +#include "KingSystem/ActorSystem/aiRootAi.h" #include "KingSystem/Map/mapObject.h" #include "KingSystem/Resource/Actor/resResourceGParamList.h" #include "KingSystem/Resource/GeneralParamList/resGParamListObjectAttack.h" diff --git a/src/KingSystem/ActorSystem/actActorParamMgr.cpp b/src/KingSystem/ActorSystem/actActorParamMgr.cpp index fdf9c870..2ff51d04 100644 --- a/src/KingSystem/ActorSystem/actActorParamMgr.cpp +++ b/src/KingSystem/ActorSystem/actActorParamMgr.cpp @@ -1,11 +1,11 @@ #include "KingSystem/ActorSystem/actActorParamMgr.h" #include -#include "KingSystem/ActorSystem/actASSetting.h" #include "KingSystem/ActorSystem/actActorParam.h" #include "KingSystem/Resource/Actor/resResourceAIProgram.h" #include "KingSystem/Resource/Actor/resResourceAISchedule.h" #include "KingSystem/Resource/Actor/resResourceAS.h" #include "KingSystem/Resource/Actor/resResourceASList.h" +#include "KingSystem/Resource/Actor/resResourceASSettingMgr.h" #include "KingSystem/Resource/Actor/resResourceActorLink.h" #include "KingSystem/Resource/Actor/resResourceAnimInfo.h" #include "KingSystem/Resource/Actor/resResourceAttClient.h" @@ -140,13 +140,13 @@ void ActorParamMgr::init(sead::Heap* heap, sead::Heap* debug_heap) { res::registerEntryFactory(new (mTempHeap) res::EntryFactory(0.0, 0x80000), "bassetting"); - ASSetting::createInstance(mTempHeap); - ASSetting::instance()->init("Actor/ASSetting.bassetting", mTempHeap); + res::ASSettingMgr::createInstance(mTempHeap); + res::ASSettingMgr::instance()->init("Actor/ASSetting.bassetting", mTempHeap); ActorParam::resetDummyResources(); } ActorParamMgr::~ActorParamMgr() { - ASSetting::deleteInstance(); + res::ASSettingMgr::deleteInstance(); } bool ActorParamMgr::checkPath(const sead::SafeString& path) const { diff --git a/src/KingSystem/ActorSystem/actAiAction.cpp b/src/KingSystem/ActorSystem/actAiAction.cpp index 4c57a5e6..721afb09 100644 --- a/src/KingSystem/ActorSystem/actAiAction.cpp +++ b/src/KingSystem/ActorSystem/actAiAction.cpp @@ -2,8 +2,8 @@ #include #include "KingSystem/ActorSystem/actActor.h" #include "KingSystem/ActorSystem/actActorParam.h" -#include "KingSystem/ActorSystem/actAiRoot.h" #include "KingSystem/ActorSystem/actionDummyAction.h" +#include "KingSystem/ActorSystem/aiRootAi.h" #include "KingSystem/Resource/Actor/resResourceAIProgram.h" namespace ksys::act::ai { diff --git a/src/KingSystem/ActorSystem/actAiActionBase.cpp b/src/KingSystem/ActorSystem/actAiActionBase.cpp index 81320ef1..794ec395 100644 --- a/src/KingSystem/ActorSystem/actAiActionBase.cpp +++ b/src/KingSystem/ActorSystem/actAiActionBase.cpp @@ -3,7 +3,7 @@ #include "KingSystem/ActorSystem/actActorParam.h" #include "KingSystem/ActorSystem/actAiAction.h" #include "KingSystem/ActorSystem/actAiInlineParam.h" -#include "KingSystem/ActorSystem/actAiRoot.h" +#include "KingSystem/ActorSystem/aiRootAi.h" #include "KingSystem/Resource/Actor/resResourceAIProgram.h" #include "KingSystem/Utils/InitTimeInfo.h" #include "KingSystem/Utils/Thread/MessageTransceiverId.h" diff --git a/src/KingSystem/ActorSystem/actAiAi.cpp b/src/KingSystem/ActorSystem/actAiAi.cpp index 26949474..7602eb47 100644 --- a/src/KingSystem/ActorSystem/actAiAi.cpp +++ b/src/KingSystem/ActorSystem/actAiAi.cpp @@ -5,8 +5,8 @@ #include "KingSystem/ActorSystem/actAiAction.h" #include "KingSystem/ActorSystem/actAiClassDef.h" #include "KingSystem/ActorSystem/actAiInlineParam.h" -#include "KingSystem/ActorSystem/actAiRoot.h" #include "KingSystem/ActorSystem/aiDummyAi.h" +#include "KingSystem/ActorSystem/aiRootAi.h" #include "KingSystem/Resource/Actor/resResourceAIProgram.h" namespace ksys::act::ai { diff --git a/src/KingSystem/ActorSystem/actAiBehavior.cpp b/src/KingSystem/ActorSystem/actAiBehavior.cpp index 2f868984..d6e31cd4 100644 --- a/src/KingSystem/ActorSystem/actAiBehavior.cpp +++ b/src/KingSystem/ActorSystem/actAiBehavior.cpp @@ -1,7 +1,7 @@ #include "KingSystem/ActorSystem/actAiBehavior.h" #include "KingSystem/ActorSystem/actActor.h" #include "KingSystem/ActorSystem/actActorParam.h" -#include "KingSystem/ActorSystem/actAiRoot.h" +#include "KingSystem/ActorSystem/aiRootAi.h" #include "KingSystem/ActorSystem/behaviorDummyBehavior.h" #include "KingSystem/Resource/Actor/resResourceAIProgram.h" diff --git a/src/KingSystem/ActorSystem/actAiQuery.cpp b/src/KingSystem/ActorSystem/actAiQuery.cpp index 97f9ac33..cbfef6c0 100644 --- a/src/KingSystem/ActorSystem/actAiQuery.cpp +++ b/src/KingSystem/ActorSystem/actAiQuery.cpp @@ -3,7 +3,7 @@ #include "KingSystem/ActorSystem/actActor.h" #include "KingSystem/ActorSystem/actActorParam.h" #include "KingSystem/ActorSystem/actAiClassDef.h" -#include "KingSystem/ActorSystem/actAiRoot.h" +#include "KingSystem/ActorSystem/aiRootAi.h" #include "KingSystem/Resource/Actor/resResourceAIProgram.h" namespace ksys::act::ai { diff --git a/src/KingSystem/System/DebugFinder.cpp b/src/KingSystem/ActorSystem/actDebugFinder.cpp similarity index 55% rename from src/KingSystem/System/DebugFinder.cpp rename to src/KingSystem/ActorSystem/actDebugFinder.cpp index 7e5a1d82..54b4e1f8 100644 --- a/src/KingSystem/System/DebugFinder.cpp +++ b/src/KingSystem/ActorSystem/actDebugFinder.cpp @@ -1,6 +1,6 @@ -#include "KingSystem/System/DebugFinder.h" +#include "KingSystem/ActorSystem/actDebugFinder.h" -namespace ksys { +namespace ksys::act { SEAD_SINGLETON_DISPOSER_IMPL(DebugFinder) @@ -8,4 +8,4 @@ DebugFinder::DebugFinder() = default; DebugFinder::~DebugFinder() = default; -} // namespace ksys +} // namespace ksys::act diff --git a/src/KingSystem/System/DebugFinder.h b/src/KingSystem/ActorSystem/actDebugFinder.h similarity index 86% rename from src/KingSystem/System/DebugFinder.h rename to src/KingSystem/ActorSystem/actDebugFinder.h index 16eb4e4c..3ca020ca 100644 --- a/src/KingSystem/System/DebugFinder.h +++ b/src/KingSystem/ActorSystem/actDebugFinder.h @@ -3,7 +3,7 @@ #include #include -namespace ksys { +namespace ksys::act { class DebugFinder { SEAD_SINGLETON_DISPOSER(DebugFinder) @@ -16,4 +16,4 @@ private: u32 unused_3 = 0; }; -} // namespace ksys +} // namespace ksys::act diff --git a/src/KingSystem/ActorSystem/LOD/actLodState.cpp b/src/KingSystem/ActorSystem/actLodState.cpp similarity index 99% rename from src/KingSystem/ActorSystem/LOD/actLodState.cpp rename to src/KingSystem/ActorSystem/actLodState.cpp index 3b11296b..8625ab45 100644 --- a/src/KingSystem/ActorSystem/LOD/actLodState.cpp +++ b/src/KingSystem/ActorSystem/actLodState.cpp @@ -1,4 +1,4 @@ -#include "KingSystem/ActorSystem/LOD/actLodState.h" +#include "KingSystem/ActorSystem/actLodState.h" #include "KingSystem/ActorSystem/actActor.h" #include "KingSystem/ActorSystem/actActorParam.h" #include "KingSystem/ActorSystem/actActorUtil.h" diff --git a/src/KingSystem/ActorSystem/LOD/actLodState.h b/src/KingSystem/ActorSystem/actLodState.h similarity index 100% rename from src/KingSystem/ActorSystem/LOD/actLodState.h rename to src/KingSystem/ActorSystem/actLodState.h diff --git a/src/KingSystem/ActorSystem/aiForkAI.cpp b/src/KingSystem/ActorSystem/aiForkAI.cpp index d8cd4249..5989bdba 100644 --- a/src/KingSystem/ActorSystem/aiForkAI.cpp +++ b/src/KingSystem/ActorSystem/aiForkAI.cpp @@ -1,5 +1,5 @@ #include "KingSystem/ActorSystem/aiForkAI.h" -#include "KingSystem/ActorSystem/actAiRoot.h" +#include "KingSystem/ActorSystem/aiRootAi.h" namespace ksys::act::ai { diff --git a/src/KingSystem/ActorSystem/actAiRoot.cpp b/src/KingSystem/ActorSystem/aiRootAi.cpp similarity index 99% rename from src/KingSystem/ActorSystem/actAiRoot.cpp rename to src/KingSystem/ActorSystem/aiRootAi.cpp index 0aa8f4ac..2706a208 100644 --- a/src/KingSystem/ActorSystem/actAiRoot.cpp +++ b/src/KingSystem/ActorSystem/aiRootAi.cpp @@ -1,4 +1,4 @@ -#include "KingSystem/ActorSystem/actAiRoot.h" +#include "KingSystem/ActorSystem/aiRootAi.h" #include "KingSystem/ActorSystem/actActor.h" #include "KingSystem/ActorSystem/actAiClassDef.h" #include "KingSystem/Utils/InitTimeInfo.h" diff --git a/src/KingSystem/ActorSystem/actAiRoot.h b/src/KingSystem/ActorSystem/aiRootAi.h similarity index 100% rename from src/KingSystem/ActorSystem/actAiRoot.h rename to src/KingSystem/ActorSystem/aiRootAi.h diff --git a/src/KingSystem/Map/CMakeLists.txt b/src/KingSystem/Map/CMakeLists.txt index b201b701..52a8c659 100644 --- a/src/KingSystem/Map/CMakeLists.txt +++ b/src/KingSystem/Map/CMakeLists.txt @@ -26,6 +26,4 @@ target_sources(uking PRIVATE mapPlacementTree.h mapRail.cpp mapRail.h - mapStagePreActorCache.cpp - mapStagePreActorCache.h ) diff --git a/src/KingSystem/Map/mapObject.cpp b/src/KingSystem/Map/mapObject.cpp index a22274f2..c5e838a7 100644 --- a/src/KingSystem/Map/mapObject.cpp +++ b/src/KingSystem/Map/mapObject.cpp @@ -6,7 +6,7 @@ #include "KingSystem/Graphics/gfxForestRenderer.h" #include "KingSystem/Map/mapObjectLink.h" #include "KingSystem/Map/mapPlacementMgr.h" -#include "KingSystem/Map/mapStagePreActorCache.h" +#include "KingSystem/System/StagePreActorCache.h" #include "KingSystem/Terrain/teraSystem.h" #include "KingSystem/Utils/Debug.h" diff --git a/src/KingSystem/Map/mapPlacementAreaMgr.h b/src/KingSystem/Map/mapPlacementAreaMgr.h index dee435f5..e040c417 100644 --- a/src/KingSystem/Map/mapPlacementAreaMgr.h +++ b/src/KingSystem/Map/mapPlacementAreaMgr.h @@ -6,8 +6,8 @@ #include #include -#include "KingSystem/Map/mapStagePreActorCache.h" #include "KingSystem/Map/mapTypes.h" +#include "KingSystem/System/StagePreActorCache.h" #include "KingSystem/Utils/Types.h" namespace ksys::gdt { diff --git a/src/KingSystem/Map/mapPlacementMapMgr.h b/src/KingSystem/Map/mapPlacementMapMgr.h index 913c419a..6fb6d848 100644 --- a/src/KingSystem/Map/mapPlacementMapMgr.h +++ b/src/KingSystem/Map/mapPlacementMapMgr.h @@ -8,11 +8,14 @@ #include "KingSystem/Resource/resHandle.h" #include "KingSystem/Utils/Types.h" +namespace ksys::act { +class FarActorMerge; +} // namespace ksys::act + namespace ksys::map { class MapProperties; class Placement18; -class FarActorMerge; class PlacementActors; class PlacementMap; @@ -49,7 +52,7 @@ private: s32 _18; s32 _1c; PlacementMapArray mMapArray; - FarActorMerge* mFarActorMerge; + act::FarActorMerge* mFarActorMerge; s32 mNeedLoadDynMap; s32 mNeedLoadDynMapPhysics; bool mIsShrineOrDivineBeast; diff --git a/src/KingSystem/Map/mapStagePreActorCache.cpp b/src/KingSystem/Map/mapStagePreActorCache.cpp deleted file mode 100644 index cc853e2a..00000000 --- a/src/KingSystem/Map/mapStagePreActorCache.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "KingSystem/Map/mapStagePreActorCache.h" - -namespace ksys::map { - -SEAD_SINGLETON_DISPOSER_IMPL(StagePreActorCache) - -} // namespace ksys::map diff --git a/src/KingSystem/Resource/Actor/resResourceASResourceExtension.cpp b/src/KingSystem/Resource/Actor/resResourceASSetting.cpp similarity index 70% rename from src/KingSystem/Resource/Actor/resResourceASResourceExtension.cpp rename to src/KingSystem/Resource/Actor/resResourceASSetting.cpp index c44948f1..915bd1c4 100644 --- a/src/KingSystem/Resource/Actor/resResourceASResourceExtension.cpp +++ b/src/KingSystem/Resource/Actor/resResourceASSetting.cpp @@ -1,9 +1,10 @@ -#include "KingSystem/Resource/Actor/resResourceASResourceExtension.h" +#include "KingSystem/Resource/Actor/resResourceASSetting.h" #include #include #include -#include "KingSystem/ActorSystem/actASSetting.h" -#include "KingSystem/Resource/resResourceASSetting.h" +#include "KingSystem/Resource/Actor/resResourceASResourceExtension.h" +#include "KingSystem/Resource/Actor/resResourceASSettingMgr.h" +#include "KingSystem/Resource/resLoadRequest.h" namespace ksys::res { @@ -211,13 +212,41 @@ bool ASBitIndexParser::parse(const ASParamParser::ParseArgs& args) { return true; } -template -static ASParamParser* factoryImpl_(sead::Heap* heap) { - return new (heap) T; +bool ASSetting::BoneParams::parse(const ASParamParser::ParseArgs& args) { + const auto num_objects = args.res_list.getResParameterObjNum(); + if (num_objects == 0) + return true; + + if (!mBuffer.tryAllocBuffer(num_objects, args.heap)) + return false; + + auto it = mBuffer.begin(); + const auto end = mBuffer.end(); + + sead::FixedSafeString<32> obj_name{"BoneParam"}; + const auto obj_name_base_len = obj_name.calcLength(); + + auto res_it = args.res_list.objBegin(); + const auto res_end = args.res_list.objEnd(); + + for (; it != end && res_it != res_end; ++it, ++res_it) { + it->mBone.init("", "Bone", "ボーン名", "", &it->mObj); + it->mWeight.init(0.0, "Weight", "ウェイト値", "Min=0.f,Max=1.f", &it->mObj); + + obj_name.trim(obj_name_base_len); + obj_name.appendWithFormat("%d", res_it.getIndex()); + mList.addObj(&it->mObj, obj_name); + } + + return true; } -static ASParamParser* dummyASParserFactoryImpl_(sead::Heap*) { - return nullptr; +f32 ASSetting::BoneParams::getBoneWeight(const sead::SafeString& name) const { + for (const auto& param : mBuffer) { + if (name == *param.mBone) + return *param.mWeight; + } + return 1.0; } namespace { @@ -226,17 +255,7 @@ struct Factory { ASParamParser* (*make)(sead::Heap* heap); }; -sead::SafeArray sASFactories{{ - {"FrameCtrl", factoryImpl_}, - {"TriggerEvents", factoryImpl_}, - {"HoldEvents", factoryImpl_}, - {"StringArray", factoryImpl_}, - {"Ranges", factoryImpl_}, - {"FloatArray", factoryImpl_}, - {"IntArray", factoryImpl_}, - {"BitIndex", factoryImpl_}, - {"BlenderBone", dummyASParserFactoryImpl_}, -}}; +extern sead::SafeArray sASFactories; } // namespace ASExtensions::~ASExtensions() { @@ -304,7 +323,7 @@ ASParamParser* ASExtensions::makeParser(const ASParamParser::ParseArgs& args) co const auto obj = args.res_list.getResParameterObj(0); if (obj.getNum() > 0) { const sead::SafeString name = obj.getResParameter(0).getData(); - return act::ASSetting::instance()->getBoneParams(name); + return ASSettingMgr::instance()->getBoneParams(name); } } @@ -326,6 +345,19 @@ ASParamParser* ASExtensions::makeParser(const ASParamParser::ParseArgs& args) co return parser; } +// NON_MATCHING: sead::DirectResource to res::ASSetting cast nullptr check; branching for the return +ASParamParser* ASSettingMgr::getBoneParams(const sead::SafeString& key) const { + auto* res = sead::DynamicCast(mHandle.getResource()); + if (!res) + return nullptr; + + for (auto& bones : res->getBlenderBones()) { + if (key == bones.mKeyName.ref()) + return &bones.mBoneParams; + } + return nullptr; +} + ASParamParser* ASExtensions::getParser(ASParamParser::Type type) const { for (int i = 0, n = mParsers.size(); i < n; ++i) { auto* parser = mParsers[i]; @@ -335,4 +367,106 @@ ASParamParser* ASExtensions::getParser(ASParamParser::Type type) const { return nullptr; } +ASSetting::ASSetting() { + mType = "assetting"; + mVersion = 0; +} + +ASSetting::~ASSetting() { + mBlenderBones.freeBuffer(); +} + +void ASSetting::doCreate_(u8* buffer, u32 buffer_size, sead::Heap* heap) {} + +bool allocBlenderBones(sead::Buffer& buffer, int size, sead::Heap* heap, + int align = sizeof(void*)); + +bool ASSetting::parse_(u8* data, size_t size, sead::Heap* heap) { + if (!data) + return true; + + agl::utl::ResParameterArchive archive{data}; + const auto root = archive.getRootList(); + + addList(&mBlenderBoneList, "BlenderBone"); + + const auto lists = agl::utl::getResParameterList(root, "BlenderBone"); + if (!lists.ptr()) + return true; + + const auto num_blender_bones = lists.getResParameterListNum(); + if (num_blender_bones == 0) + return true; + + if (!allocBlenderBones(mBlenderBones, num_blender_bones, heap)) + return false; + + auto res_it = lists.listBegin(); + const auto res_it_end = lists.listEnd(); + sead::FixedSafeString<32> list_name{"BlenderBone"}; + const auto list_name_base_len = list_name.calcLength(); + + ASParamParser::ParseArgs args; + args.res_list = {}; + args.heap = heap; + + auto it = mBlenderBones.begin(); + const auto end = mBlenderBones.end(); + for (; it != end && res_it != res_it_end; ++it, ++res_it) { + list_name.trim(list_name_base_len); + list_name.appendWithFormat("%d", it.getIndex()); + mBlenderBoneList.addList(&it->mList, list_name); + + it->mKeyName.init("", "KeyName", "キー名", "", &it->mNameParamObj); + it->mList.addObj(&it->mNameParamObj, "NameParam"); + it->mList.addList(&it->mBoneParams.getList(), "BoneParam"); + + const auto list = *res_it; + args.list = &it->mList; + args.res_list = agl::utl::getResParameterList(list, "BoneParam"); + if (!it->mBoneParams.parse(args)) + return false; + } + + applyResParameterArchive(archive); + return true; +} + +bool allocBlenderBones(sead::Buffer& buffer, int size, sead::Heap* heap, + int align) { + return buffer.tryAllocBuffer(size, heap, align); +} + +SEAD_SINGLETON_DISPOSER_IMPL(ASSettingMgr) + +void ASSettingMgr::init(const sead::SafeString& config_path, sead::Heap* heap) { + LoadRequest req; + req.mRequester = "ASSetting"; + req._22 = true; + mHandle.load(config_path, &req); +} + +template +static ASParamParser* factoryImpl_(sead::Heap* heap) { + return new (heap) T; +} + +static ASParamParser* dummyASParserFactoryImpl_(sead::Heap*) { + return nullptr; +} + +namespace { +sead::SafeArray sASFactories{{ + {"FrameCtrl", factoryImpl_}, + {"TriggerEvents", factoryImpl_}, + {"HoldEvents", factoryImpl_}, + {"StringArray", factoryImpl_}, + {"Ranges", factoryImpl_}, + {"FloatArray", factoryImpl_}, + {"IntArray", factoryImpl_}, + {"BitIndex", factoryImpl_}, + {"BlenderBone", dummyASParserFactoryImpl_}, +}}; +} // namespace + } // namespace ksys::res diff --git a/src/KingSystem/Resource/resResourceASSetting.h b/src/KingSystem/Resource/Actor/resResourceASSetting.h similarity index 97% rename from src/KingSystem/Resource/resResourceASSetting.h rename to src/KingSystem/Resource/Actor/resResourceASSetting.h index c9462199..84575fc4 100644 --- a/src/KingSystem/Resource/resResourceASSetting.h +++ b/src/KingSystem/Resource/Actor/resResourceASSetting.h @@ -29,7 +29,7 @@ public: SEAD_RTTI_OVERRIDE(BoneParams, ASParamParser) public: BoneParams() : ASParamParser(Type::BlenderBone) {} - ~BoneParams() override; + ~BoneParams() override { mBuffer.freeBuffer(); } bool parse(const ParseArgs& args) override; f32 getBoneWeight(const sead::SafeString& name) const; diff --git a/src/KingSystem/Resource/Actor/resResourceASSettingMgr.h b/src/KingSystem/Resource/Actor/resResourceASSettingMgr.h new file mode 100644 index 00000000..e4d16984 --- /dev/null +++ b/src/KingSystem/Resource/Actor/resResourceASSettingMgr.h @@ -0,0 +1,26 @@ +#pragma once + +#include +#include +#include "KingSystem/Resource/Actor/resResourceASSetting.h" +#include "KingSystem/Resource/resHandle.h" +#include "KingSystem/Utils/Types.h" + +namespace ksys::res { + +// FIXME: very incomplete +class ASSettingMgr { + SEAD_SINGLETON_DISPOSER(ASSettingMgr) + ASSettingMgr() = default; + virtual ~ASSettingMgr() = default; + +public: + void init(const sead::SafeString& config_path, sead::Heap* heap); + ASParamParser* getBoneParams(const sead::SafeString& key) const; + +private: + Handle mHandle; +}; +KSYS_CHECK_SIZE_NX150(ASSettingMgr, 0x78); + +} // namespace ksys::res diff --git a/src/KingSystem/Resource/CMakeLists.txt b/src/KingSystem/Resource/CMakeLists.txt index 1a9e5b28..825fe47a 100644 --- a/src/KingSystem/Resource/CMakeLists.txt +++ b/src/KingSystem/Resource/CMakeLists.txt @@ -128,8 +128,6 @@ target_sources(uking PRIVATE resResource.cpp resResource.h - resResourceASSetting.cpp - resResourceASSetting.h resResourceArchive.cpp resResourceArchive.h resResourceGameData.cpp @@ -153,8 +151,10 @@ target_sources(uking PRIVATE Actor/resResourceASList.h Actor/resResourceASResource.cpp Actor/resResourceASResource.h - Actor/resResourceASResourceExtension.cpp Actor/resResourceASResourceExtension.h + Actor/resResourceASSetting.cpp + Actor/resResourceASSetting.h + Actor/resResourceASSettingMgr.h Actor/resResourceAttCheck.cpp Actor/resResourceAttCheck.h Actor/resResourceAttClient.cpp diff --git a/src/KingSystem/Resource/resResourceASSetting.cpp b/src/KingSystem/Resource/resResourceASSetting.cpp deleted file mode 100644 index be0a3865..00000000 --- a/src/KingSystem/Resource/resResourceASSetting.cpp +++ /dev/null @@ -1,113 +0,0 @@ -#include "KingSystem/Resource/resResourceASSetting.h" - -namespace ksys::res { - -ASSetting::ASSetting() { - mType = "assetting"; - mVersion = 0; -} - -ASSetting::~ASSetting() { - mBlenderBones.freeBuffer(); -} - -void ASSetting::doCreate_(u8* buffer, u32 buffer_size, sead::Heap* heap) {} - -bool allocBlenderBones(sead::Buffer& buffer, int size, sead::Heap* heap, - int align = sizeof(void*)) { - return buffer.tryAllocBuffer(size, heap, align); -} - -bool ASSetting::parse_(u8* data, size_t size, sead::Heap* heap) { - if (!data) - return true; - - agl::utl::ResParameterArchive archive{data}; - const auto root = archive.getRootList(); - - addList(&mBlenderBoneList, "BlenderBone"); - - const auto lists = agl::utl::getResParameterList(root, "BlenderBone"); - if (!lists.ptr()) - return true; - - const auto num_blender_bones = lists.getResParameterListNum(); - if (num_blender_bones == 0) - return true; - - if (!allocBlenderBones(mBlenderBones, num_blender_bones, heap)) - return false; - - auto res_it = lists.listBegin(); - const auto res_it_end = lists.listEnd(); - sead::FixedSafeString<32> list_name{"BlenderBone"}; - const auto list_name_base_len = list_name.calcLength(); - - ASParamParser::ParseArgs args; - args.res_list = {}; - args.heap = heap; - - auto it = mBlenderBones.begin(); - const auto end = mBlenderBones.end(); - for (; it != end && res_it != res_it_end; ++it, ++res_it) { - list_name.trim(list_name_base_len); - list_name.appendWithFormat("%d", it.getIndex()); - mBlenderBoneList.addList(&it->mList, list_name); - - it->mKeyName.init("", "KeyName", "キー名", "", &it->mNameParamObj); - it->mList.addObj(&it->mNameParamObj, "NameParam"); - it->mList.addList(&it->mBoneParams.getList(), "BoneParam"); - - const auto list = *res_it; - args.list = &it->mList; - args.res_list = agl::utl::getResParameterList(list, "BoneParam"); - if (!it->mBoneParams.parse(args)) - return false; - } - - applyResParameterArchive(archive); - return true; -} - -ASSetting::BoneParams::~BoneParams() { - mBuffer.freeBuffer(); -} - -bool ASSetting::BoneParams::parse(const ASParamParser::ParseArgs& args) { - const auto num_objects = args.res_list.getResParameterObjNum(); - if (num_objects == 0) - return true; - - if (!mBuffer.tryAllocBuffer(num_objects, args.heap)) - return false; - - auto it = mBuffer.begin(); - const auto end = mBuffer.end(); - - sead::FixedSafeString<32> obj_name{"BoneParam"}; - const auto obj_name_base_len = obj_name.calcLength(); - - auto res_it = args.res_list.objBegin(); - const auto res_end = args.res_list.objEnd(); - - for (; it != end && res_it != res_end; ++it, ++res_it) { - it->mBone.init("", "Bone", "ボーン名", "", &it->mObj); - it->mWeight.init(0.0, "Weight", "ウェイト値", "Min=0.f,Max=1.f", &it->mObj); - - obj_name.trim(obj_name_base_len); - obj_name.appendWithFormat("%d", res_it.getIndex()); - mList.addObj(&it->mObj, obj_name); - } - - return true; -} - -f32 ASSetting::BoneParams::getBoneWeight(const sead::SafeString& name) const { - for (const auto& param : mBuffer) { - if (name == *param.mBone) - return *param.mWeight; - } - return 1.0; -} - -} // namespace ksys::res diff --git a/src/KingSystem/System/CMakeLists.txt b/src/KingSystem/System/CMakeLists.txt index 333d110d..81b08666 100644 --- a/src/KingSystem/System/CMakeLists.txt +++ b/src/KingSystem/System/CMakeLists.txt @@ -15,8 +15,6 @@ target_sources(uking PRIVATE CoreInfo.h CurrentResNameMgr.cpp CurrentResNameMgr.h - DebugFinder.cpp - DebugFinder.h DebugMessage.h GameConfig.h HavokWorkerMgr.cpp @@ -48,6 +46,8 @@ target_sources(uking PRIVATE Revision.h StageInfo.cpp StageInfo.h + StagePreActorCache.cpp + StagePreActorCache.h StarterPackMgr.cpp StarterPackMgr.h StringBoard.h diff --git a/src/KingSystem/System/StagePreActorCache.cpp b/src/KingSystem/System/StagePreActorCache.cpp new file mode 100644 index 00000000..0b4a6484 --- /dev/null +++ b/src/KingSystem/System/StagePreActorCache.cpp @@ -0,0 +1,7 @@ +#include "KingSystem/System/StagePreActorCache.h" + +namespace ksys { + +SEAD_SINGLETON_DISPOSER_IMPL(StagePreActorCache) + +} // namespace ksys diff --git a/src/KingSystem/Map/mapStagePreActorCache.h b/src/KingSystem/System/StagePreActorCache.h similarity index 74% rename from src/KingSystem/Map/mapStagePreActorCache.h rename to src/KingSystem/System/StagePreActorCache.h index 666779e8..2b9927ff 100644 --- a/src/KingSystem/Map/mapStagePreActorCache.h +++ b/src/KingSystem/System/StagePreActorCache.h @@ -8,8 +8,10 @@ class ForestRenderer; } namespace ksys::map { - class LazyTraverseList; +} + +namespace ksys { // TODO class StagePreActorCache { @@ -17,13 +19,13 @@ class StagePreActorCache { StagePreActorCache(); public: - LazyTraverseList* getObjects() const { return mObjects; } + map::LazyTraverseList* getObjects() const { return mObjects; } auto* getForestRenderer() { return mForestRenderer; } private: char _0[0x20]; - LazyTraverseList* mObjects; + map::LazyTraverseList* mObjects; gfx::ForestRenderer* mForestRenderer; }; -} // namespace ksys::map +} // namespace ksys