summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2021-04-23 00:30:30 +0200
committerLéo Lam <leo@leolam.fr>2021-04-23 12:53:04 +0200
commit201d2ff06fd9ee9a1aac0ce914b23effae9c8f22 (patch)
treef9ff0055a38c0ec094410e7f738d6f68a4e4dfe2 /src
parent52196c4b75f84444bca3b9c19302146235bf8f6a (diff)
ksys/act: Finish implementing ActorParamMgr
Diffstat (limited to 'src')
-rw-r--r--src/KingSystem/ActorSystem/actASSetting.cpp2
-rw-r--r--src/KingSystem/ActorSystem/actASSetting.h2
-rw-r--r--src/KingSystem/ActorSystem/actActorParam.h6
-rw-r--r--src/KingSystem/ActorSystem/actActorParamMgr.cpp144
-rw-r--r--src/KingSystem/ActorSystem/actActorParamMgr.h8
-rw-r--r--src/KingSystem/Resource/resResourceAIProgram.cpp2
-rw-r--r--src/KingSystem/Resource/resResourceAIProgram.h2
-rw-r--r--src/KingSystem/Resource/resResourceAttClient.cpp6
-rw-r--r--src/KingSystem/Resource/resResourceAttClient.h2
-rw-r--r--src/KingSystem/Resource/resResourceAttClientList.h2
-rw-r--r--src/KingSystem/Resource/resResourceAwareness.cpp2
-rw-r--r--src/KingSystem/Resource/resResourceAwareness.h2
-rw-r--r--src/KingSystem/Resource/resResourceDamageParam.cpp2
-rw-r--r--src/KingSystem/Resource/resResourceDamageParam.h4
-rw-r--r--src/KingSystem/Resource/resResourceGParamList.cpp91
-rw-r--r--src/KingSystem/Resource/resResourceGParamList.h2
-rw-r--r--src/KingSystem/Resource/resResourceLifeCondition.cpp2
-rw-r--r--src/KingSystem/Resource/resResourceLifeCondition.h2
-rw-r--r--src/KingSystem/Resource/resResourceLod.cpp4
-rw-r--r--src/KingSystem/Resource/resResourceLod.h4
-rw-r--r--src/KingSystem/Resource/resResourceModelList.h7
21 files changed, 260 insertions, 38 deletions
diff --git a/src/KingSystem/ActorSystem/actASSetting.cpp b/src/KingSystem/ActorSystem/actASSetting.cpp
index 7c3d82e2..2b020cfe 100644
--- a/src/KingSystem/ActorSystem/actASSetting.cpp
+++ b/src/KingSystem/ActorSystem/actASSetting.cpp
@@ -8,7 +8,7 @@ SEAD_SINGLETON_DISPOSER_IMPL(ASSetting)
ASSetting::~ASSetting() = default;
-void ASSetting::init(const sead::SafeString& config_path) {
+void ASSetting::init(const sead::SafeString& config_path, sead::Heap* heap) {
res::LoadRequest req;
req.mRequester = "ASSetting";
req._22 = true;
diff --git a/src/KingSystem/ActorSystem/actASSetting.h b/src/KingSystem/ActorSystem/actASSetting.h
index 399ad201..8c97c85a 100644
--- a/src/KingSystem/ActorSystem/actASSetting.h
+++ b/src/KingSystem/ActorSystem/actASSetting.h
@@ -15,7 +15,7 @@ class ASSetting {
virtual ~ASSetting();
public:
- void init(const sead::SafeString& config_path);
+ void init(const sead::SafeString& config_path, sead::Heap* heap);
res::ASParamParser* getBoneParams(const sead::SafeString& key) const;
private:
diff --git a/src/KingSystem/ActorSystem/actActorParam.h b/src/KingSystem/ActorSystem/actActorParam.h
index 70b399d5..2d395965 100644
--- a/src/KingSystem/ActorSystem/actActorParam.h
+++ b/src/KingSystem/ActorSystem/actActorParam.h
@@ -16,7 +16,7 @@ namespace ksys {
namespace res {
class AIProgram;
class AISchedule;
-class AnimationInfo;
+class AnimInfo;
class ASList;
class AttClientList;
class Awareness;
@@ -107,7 +107,7 @@ public:
res::BoneControl* mBoneControl;
res::LifeCondition* mLifeCondition;
res::UMii* mUMii;
- res::AnimationInfo* mAnimationInfo;
+ res::AnimInfo* mAnimationInfo;
};
sead::SafeArray<void*, 25> mArray;
};
@@ -144,7 +144,7 @@ private:
void setEventSignal();
void waitForEvent();
bool isSignalSet() const;
- void updateResource(const char* name, const char* data, const char* data1);
+ int updateResource(const char* data, const char* data1, const char* data2);
res::Handle* allocHandle();
void freeLastHandle();
diff --git a/src/KingSystem/ActorSystem/actActorParamMgr.cpp b/src/KingSystem/ActorSystem/actActorParamMgr.cpp
index cf595074..9409ea15 100644
--- a/src/KingSystem/ActorSystem/actActorParamMgr.cpp
+++ b/src/KingSystem/ActorSystem/actActorParamMgr.cpp
@@ -2,6 +2,7 @@
#include <prim/seadScopedLock.h>
#include "KingSystem/ActorSystem/actASSetting.h"
#include "KingSystem/ActorSystem/actActorParam.h"
+#include "KingSystem/Resource/resEntryFactory.h"
#include "KingSystem/Resource/resLoadRequest.h"
#include "KingSystem/Resource/resResourceAIProgram.h"
#include "KingSystem/Resource/resResourceAISchedule.h"
@@ -32,6 +33,7 @@
#include "KingSystem/Resource/resSystem.h"
#include "KingSystem/Resource/resTempResourceLoader.h"
#include "KingSystem/Utils/Debug.h"
+#include "KingSystem/Utils/HeapUtil.h"
#include "KingSystem/Utils/ParamIO.h"
namespace ksys::act {
@@ -43,6 +45,108 @@ using User = res::ActorLink::User;
ActorParamMgr::ActorParamMgr() = default;
+void ActorParamMgr::init(sead::Heap* heap, sead::Heap* debug_heap) {
+ mTempHeap = util::DualHeap::create(0x300000, "TmpActorParamMgr", heap, debug_heap,
+ sizeof(void*), sead::Heap::cHeapDirection_Forward, false);
+ mTempHeap->enableLock(true);
+ mDebugHeap = debug_heap;
+
+ mParams = new (mTempHeap) ActorParam[NumParams];
+
+ res::registerEntryFactory(new (mTempHeap) res::EntryFactory<res::ActorLink>(1.0, 0x1000),
+ "bxml");
+ res::registerEntryFactory(new (mTempHeap) res::EntryFactory<res::GParamList>(
+ 1.0, res::GParamList::getResourceFactoryFallbackSize() + 0x800),
+ "bgparamlist");
+ res::registerEntryFactory(new (mTempHeap) res::EntryFactory<res::ModelList>(2.0), "bmodellist");
+ res::registerEntryFactory(new (mTempHeap) res::EntryFactory<res::ASList>(0.0, 0x80000),
+ "baslist");
+ res::registerEntryFactory(new (mTempHeap) res::EntryFactory<res::AIProgram>(1.0, 0x300000),
+ "baiprog");
+ res::registerEntryFactory(new (mTempHeap) res::EntryFactory<res::Physics>(6.0), "bphysics");
+ res::registerEntryFactory(new (mTempHeap) res::EntryFactory<res::Chemical>(0.0, 0x2000),
+ "bchemical");
+ res::registerEntryFactory(new (mTempHeap) res::EntryFactory<res::AS>(0.0, 0x80000), "bas");
+ res::registerEntryFactory(new (mTempHeap) res::EntryFactory<res::AttClientList>(1.0, 0x2000),
+ "batcllist");
+ res::registerEntryFactory(new (mTempHeap) res::EntryFactory<res::AttClient>(1.0, 0x2000),
+ "batcl");
+ res::registerEntryFactory(new (mTempHeap) res::EntryFactory<res::AISchedule>(1.0, 0x800),
+ "baischedule");
+ res::registerEntryFactory(new (mTempHeap) res::EntryFactory<res::DamageParam>(1.0, 0x20000),
+ "bdmgparam");
+ res::registerEntryFactory(
+ new (mTempHeap) res::EntryFactory<res::RagdollConfigList>(1.0, 0x2000), "brgconfiglist");
+ res::registerEntryFactory(new (mTempHeap) res::EntryFactory<res::RagdollConfig>(1.0, 0x20000),
+ "brgconfig");
+ res::registerEntryFactory(
+ new (mTempHeap) res::EntryFactory<res::RagdollBlendWeight>(1.0, 0x20000), "brgbw");
+ res::registerEntryFactory(new (mTempHeap) res::EntryFactory<res::Awareness>, "bawareness");
+ res::registerEntryFactory(new (mTempHeap) res::EntryFactory<res::Drop>(1.0, 0x5000), "bdrop");
+ res::registerEntryFactory(new (mTempHeap) res::EntryFactory<res::Shop>(1.0, 0x20000), "bshop");
+ res::registerEntryFactory(new (mTempHeap) res::EntryFactory<res::Recipe>(1.0, 0x20000),
+ "brecipe");
+ res::registerEntryFactory(new (mTempHeap) res::EntryFactory<res::Lod>(1.0, 0x20000), "blod");
+ res::registerEntryFactory(new (mTempHeap) res::EntryFactory<res::BoneControl>(1.0, 0x40000),
+ "bbonectrl");
+ res::registerEntryFactory(new (mTempHeap) res::EntryFactory<res::LifeCondition>(1.0, 0x20000),
+ "blifecondition");
+ res::registerEntryFactory(new (mTempHeap) res::EntryFactory<res::UMii>, "bumii");
+ res::registerEntryFactory(new (mTempHeap) res::EntryFactory<res::AnimInfo>(1.5), "baniminfo");
+ res::registerEntryFactory(new (mTempHeap) res::EntryFactory<sead::DirectResource>, "byaml");
+
+ {
+ using ResType = ActorParam::ResourceType;
+ res::LoadRequest req;
+ req.mRequester = "tapActorParamMgr";
+
+ getDummyResHandle(ResType::AIProgram).load("Actor/AIProgram/Dummy.baiprog", &req);
+ getDummyResHandle(ResType::ASList).load("Actor/ASList/Dummy.baslist", &req);
+ getDummyResHandle(ResType::AttClientList).load("Actor/AttClientList/Dummy.batcllist", &req);
+ getDummyResHandle(ResType::ModelList).load("Actor/ModelList/Dummy.bmodellist", &req);
+ getDummyResHandle(ResType::Physics).load("Actor/Physics/Dummy.bphysics", &req);
+ getDummyResHandle(ResType::Chemical).load("Actor/Chemical/Dummy.bchemical", &req);
+ getDummyResHandle(ResType::AISchedule).load("Actor/AISchedule/Dummy.baischedule", &req);
+ getDummyResHandle(ResType::EventFlow).load("EventFlow/Dummy.bfevfl", &req);
+ getDummyResHandle(ResType::AS).load("Actor/AS/Dummy.bas", &req);
+ getDummyResHandle(ResType::AttClient).load("Actor/AttClient/Dummy.batcl", &req);
+ getDummyResHandle(ResType::DamageParam).load("Actor/DamageParam/Dummy.bdmgparam", &req);
+ getDummyResHandle(ResType::RagdollConfigList)
+ .load("Actor/RagdollConfigList/Dummy.brgconfiglist", &req);
+ getDummyResHandle(ResType::RagdollConfig).load("Actor/RagdollConfig/Dummy.brgconfig", &req);
+ getDummyResHandle(ResType::RagdollBlendWeight)
+ .load("Actor/RagdollBlendWeight/Dummy.brgbw", &req);
+ getDummyResHandle(ResType::Awareness).load("Actor/Awareness/Dummy.bawareness", &req);
+ getDummyResHandle(ResType::DropTable).load("Actor/DropTable/Dummy.bdrop", &req);
+ getDummyResHandle(ResType::ShopData).load("Actor/ShopData/Dummy.bshop", &req);
+ getDummyResHandle(ResType::Recipe).load("Actor/Recipe/Dummy.brecipe", &req);
+ getDummyResHandle(ResType::Lod).load("Actor/LOD/Dummy.blod", &req);
+ getDummyResHandle(ResType::BoneControl).load("Actor/BoneControl/Dummy.bbonectrl", &req);
+ getDummyResHandle(ResType::LifeCondition)
+ .load("Actor/LifeCondition/Dummy.blifecondition", &req);
+ getDummyResHandle(ResType::UMii).load("Actor/UMii/Dummy.bumii", &req);
+ getDummyResHandle(ResType::AnimationInfo).load("Actor/AnimationInfo/Dummy.baniminfo", &req);
+
+ auto* dummy_gparam_factory = new (mTempHeap) res::EntryFactory<res::DummyGParamList>(
+ 1.0, res::GParamList::getResourceFactoryFallbackSize() + 0x1400);
+ req.mEntryFactory = dummy_gparam_factory;
+ getDummyResHandle(ResType::GParamList)
+ .load("Actor/GeneralParamList/Dummy.bgparamlist", &req);
+ if (dummy_gparam_factory)
+ delete dummy_gparam_factory;
+
+ auto* modellist = static_cast<res::ModelList*>(
+ getDummyResHandle(ResType::ModelList).getResourceUnchecked());
+ modellist->markAsDummy();
+ }
+
+ res::registerEntryFactory(new (mTempHeap) res::EntryFactory<res::ASSetting>(0.0, 0x80000),
+ "bassetting");
+ ASSetting::createInstance(mTempHeap);
+ ASSetting::instance()->init("Actor/ASSetting.bassetting", mTempHeap);
+ ActorParam::resetDummyResources();
+}
+
ActorParamMgr::~ActorParamMgr() {
ASSetting::deleteInstance();
}
@@ -93,7 +197,7 @@ ActorParam* ActorParamMgr::loadParam(const char* actor_name, res::Handle* pack_h
ActorParam* param = allocParam(actor_name, &allocated_new);
if (allocated_new) {
- loadFiles(param, mTmpActorParamMgrHeap, pack_handle, x, load_req_c);
+ loadFiles(param, mTempHeap, pack_handle, x, load_req_c);
param->setEventSignal();
} else {
param->waitForEvent();
@@ -157,7 +261,7 @@ ActorParam* ActorParamMgr::loadParamAsync(const char* actor_name, res::Handle* p
return param;
param->deleteResHandles();
- param->allocResHandles(mTmpActorParamMgrHeap, 0, ActorParam::NumResourceTypes + 1);
+ param->allocResHandles(mTempHeap, 0, ActorParam::NumResourceTypes + 1);
param->mActiveBufferIdx = 0;
loadFileAsync<res::ActorLink>(param, Type::ActorLink, "Actor/ActorLink", "xml",
@@ -385,7 +489,7 @@ void ActorParamMgr::loadExtraResAsync(ActorParam* param, res::Handle* pack_handl
const auto num_att = atcllist ? atcllist->getClients().size() : 0;
const auto num_rg = rgconfiglist ? rgconfiglist->getImpulseParams().size() : 0;
- param->allocResHandles(mTmpActorParamMgrHeap, 1, num_as + num_att + num_rg);
+ param->allocResHandles(mTempHeap, 1, num_as + num_att + num_rg);
param->mActiveBufferIdx = 1;
if (aslist) {
@@ -779,6 +883,40 @@ T* ActorParamMgr::loadFile(ActorParam* param, ActorParam::ResourceType type, con
return res;
}
+void ActorParamMgr::syncData(char* data) {
+ auto lock = sead::makeScopedLock(mCS);
+
+ char* data1 = data;
+ while (*data1++ != ' ')
+ continue;
+ data1[-1] = 0;
+
+ while (*data1++ != '[')
+ continue;
+
+ char* data2 = data1;
+ while (*data2++ != ']')
+ continue;
+ data2[-1] = 0;
+
+ for (int i = 0; i < NumParams; ++i) {
+ auto& param = mParams[i];
+ if (param.getActorName().isEmpty())
+ continue;
+
+ param.waitForEvent();
+ const int ret = param.updateResource(data, data1, data2);
+ if (ret == 0)
+ return;
+ if (ret == 1) {
+ sead::FixedSafeString<64> message;
+ message.format("[UpdateResource]%s", data);
+ log(message.cstr());
+ return;
+ }
+ }
+}
+
res::GParamList* ActorParamMgr::getDummyGParamList() const {
return static_cast<res::GParamList*>(
mDummyResources[u32(ActorParam::ResourceType::GParamList)].getResourceUnchecked());
diff --git a/src/KingSystem/ActorSystem/actActorParamMgr.h b/src/KingSystem/ActorSystem/actActorParamMgr.h
index c39c4709..3704dce3 100644
--- a/src/KingSystem/ActorSystem/actActorParamMgr.h
+++ b/src/KingSystem/ActorSystem/actActorParamMgr.h
@@ -34,7 +34,7 @@ public:
DebugMessage& getDebugMessage() { return mDebugMessage; }
sead::Heap* getDebugHeap() const { return mDebugHeap; }
- sead::Heap* getTmpActorParamMgrHeap() const { return mTmpActorParamMgrHeap; }
+ sead::Heap* getTmpActorParamMgrHeap() const { return mTempHeap; }
bool checkPath(const sead::SafeString& path) const;
@@ -95,6 +95,10 @@ private:
void allocExtraResHandles(ActorParam* param, sead::Heap* heap) const;
+ res::Handle& getDummyResHandle(ActorParam::ResourceType type) {
+ return mDummyResources[int(type)];
+ }
+
static constexpr s32 NumParams = 0x400;
sead::TypedBitFlag<Flag> mFlags{};
@@ -103,7 +107,7 @@ private:
void* _e0 = nullptr;
void* _e8 = nullptr;
sead::Heap* mDebugHeap = nullptr;
- sead::Heap* mTmpActorParamMgrHeap = nullptr;
+ sead::Heap* mTempHeap = nullptr;
sead::SafeArray<res::Handle, ActorParam::NumResourceTypes> mDummyResources;
mutable sead::CriticalSection mCS;
};
diff --git a/src/KingSystem/Resource/resResourceAIProgram.cpp b/src/KingSystem/Resource/resResourceAIProgram.cpp
index 2d5ceef4..bce91bf7 100644
--- a/src/KingSystem/Resource/resResourceAIProgram.cpp
+++ b/src/KingSystem/Resource/resResourceAIProgram.cpp
@@ -8,8 +8,6 @@
namespace ksys::res {
-AIProgram::AIProgram() : ParamIO("aiprog", 0) {}
-
AIProgram::~AIProgram() = default;
const sead::Buffer<AIProgram::AIActionDef>&
diff --git a/src/KingSystem/Resource/resResourceAIProgram.h b/src/KingSystem/Resource/resResourceAIProgram.h
index 01421ee7..c7a646bf 100644
--- a/src/KingSystem/Resource/resResourceAIProgram.h
+++ b/src/KingSystem/Resource/resResourceAIProgram.h
@@ -56,7 +56,7 @@ public:
struct QueryDef : Definition {};
KSYS_CHECK_SIZE_NX150(QueryDef, 0x98);
- AIProgram();
+ AIProgram() : ParamIO("aiprog", 0) {}
~AIProgram() override;
const sead::Buffer<AIActionDef>& getActionsOrAIs(act::ai::ActionType type) const;
diff --git a/src/KingSystem/Resource/resResourceAttClient.cpp b/src/KingSystem/Resource/resResourceAttClient.cpp
index 2bbe4f26..5038bfac 100644
--- a/src/KingSystem/Resource/resResourceAttClient.cpp
+++ b/src/KingSystem/Resource/resResourceAttClient.cpp
@@ -1,7 +1,3 @@
#include "KingSystem/Resource/resResourceAttClient.h"
-namespace ksys::res {
-
-AttClient::AttClient() : ParamIO("atcl", 0) {}
-
-} // namespace ksys::res
+namespace ksys::res {} // namespace ksys::res
diff --git a/src/KingSystem/Resource/resResourceAttClient.h b/src/KingSystem/Resource/resResourceAttClient.h
index 808b8c81..6f9ee041 100644
--- a/src/KingSystem/Resource/resResourceAttClient.h
+++ b/src/KingSystem/Resource/resResourceAttClient.h
@@ -16,7 +16,7 @@ class AttClient : public ParamIO, public Resource {
public:
struct Check {};
- AttClient();
+ AttClient() : ParamIO("atcl", 0) {}
~AttClient() override;
act::AttType getAttType() const { return mAttType; }
diff --git a/src/KingSystem/Resource/resResourceAttClientList.h b/src/KingSystem/Resource/resResourceAttClientList.h
index 7ad3ade9..d336fc7a 100644
--- a/src/KingSystem/Resource/resResourceAttClientList.h
+++ b/src/KingSystem/Resource/resResourceAttClientList.h
@@ -16,6 +16,8 @@ class AttClientList : public ParamIO, public Resource {
SEAD_RTTI_OVERRIDE(AttClientList, Resource)
public:
struct AttPos {
+ AttPos();
+
agl::utl::Parameter<sead::SafeString> _0;
agl::utl::Parameter<sead::Vector3f> _28;
agl::utl::Parameter<sead::Vector3f> _50;
diff --git a/src/KingSystem/Resource/resResourceAwareness.cpp b/src/KingSystem/Resource/resResourceAwareness.cpp
index 855d7a9a..9c66ded8 100644
--- a/src/KingSystem/Resource/resResourceAwareness.cpp
+++ b/src/KingSystem/Resource/resResourceAwareness.cpp
@@ -2,8 +2,6 @@
namespace ksys::res {
-Awareness::Awareness() : ParamIO("awareness", 0) {}
-
bool Awareness::parse_(u8* data, size_t, sead::Heap*) {
addObj(&mBasisObj, "Basis");
addObj(&mSightObj, "Sight");
diff --git a/src/KingSystem/Resource/resResourceAwareness.h b/src/KingSystem/Resource/resResourceAwareness.h
index 07c1b86c..80fe11a0 100644
--- a/src/KingSystem/Resource/resResourceAwareness.h
+++ b/src/KingSystem/Resource/resResourceAwareness.h
@@ -10,7 +10,7 @@ namespace ksys::res {
class Awareness : public ParamIO, public Resource {
SEAD_RTTI_OVERRIDE(Awareness, Resource)
public:
- Awareness();
+ Awareness() : ParamIO("awareness", 0) {}
~Awareness() override = default;
bool needsParse() const override { return true; }
diff --git a/src/KingSystem/Resource/resResourceDamageParam.cpp b/src/KingSystem/Resource/resResourceDamageParam.cpp
index 60d52b25..bf051e0f 100644
--- a/src/KingSystem/Resource/resResourceDamageParam.cpp
+++ b/src/KingSystem/Resource/resResourceDamageParam.cpp
@@ -2,8 +2,6 @@
namespace ksys::res {
-DamageParam::DamageParam() : ParamIO("dmgparam", 0) {}
-
bool DamageParam::parse_(u8* data, size_t, sead::Heap* heap) {
mDamageRateBuffer.allocBufferAssert(DamageSource::size(), heap);
mDamageTypeBuffer.allocBufferAssert(DamageSource::size() * DamageSize::size(), heap);
diff --git a/src/KingSystem/Resource/resResourceDamageParam.h b/src/KingSystem/Resource/resResourceDamageParam.h
index a6258094..01ac1971 100644
--- a/src/KingSystem/Resource/resResourceDamageParam.h
+++ b/src/KingSystem/Resource/resResourceDamageParam.h
@@ -11,8 +11,8 @@ class DamageParam : public ParamIO, public Resource {
SEAD_RTTI_OVERRIDE(DamageParam, Resource)
public:
- DamageParam();
- ~DamageParam() = default;
+ DamageParam() : ParamIO("dmgparam", 0) {}
+ ~DamageParam() override = default;
bool needsParse() const override { return true; }
bool ParamIO_m0() override { return false; }
diff --git a/src/KingSystem/Resource/resResourceGParamList.cpp b/src/KingSystem/Resource/resResourceGParamList.cpp
index c59b3d0c..adab0db8 100644
--- a/src/KingSystem/Resource/resResourceGParamList.cpp
+++ b/src/KingSystem/Resource/resResourceGParamList.cpp
@@ -203,6 +203,97 @@ bool GParamList::parse_(u8* data, size_t, sead::Heap* heap) {
void GParamList::finalize_() {}
+static constexpr size_t getResourceFactoryFallbackSizeConst() {
+ size_t size = 0;
+ size += sizeof(GParamListObjectSystem);
+ size += sizeof(GParamListObjectGeneral);
+ size += sizeof(GParamListObjectEnemy);
+ size += sizeof(GParamListObjectEnemyLevel);
+ size += sizeof(GParamListObjectEnemyRace);
+ size += sizeof(GParamListObjectAttackInterval);
+ size += sizeof(GParamListObjectEnemyShown);
+ size += sizeof(GParamListObjectBindBone);
+ size += sizeof(GParamListObjectAttack);
+ size += sizeof(GParamListObjectWeaponCommon);
+ size += sizeof(GParamListObjectWeaponThrow);
+ size += sizeof(GParamListObjectSandworm);
+ size += sizeof(GParamListObjectSmallSword);
+ size += sizeof(GParamListObjectRod);
+ size += sizeof(GParamListObjectLargeSword);
+ size += sizeof(GParamListObjectSpear);
+ size += sizeof(GParamListObjectShield);
+ size += sizeof(GParamListObjectBow);
+ size += sizeof(GParamListObjectWeaponOption);
+ size += sizeof(GParamListObjectMasterSword);
+ size += sizeof(GParamListObjectGuardianMiniWeapon);
+ size += sizeof(GParamListObjectPlayer);
+ size += sizeof(GParamListObjectCamera);
+ size += sizeof(GParamListObjectGrab);
+ size += sizeof(GParamListObjectArmor);
+ size += sizeof(GParamListObjectArmorEffect);
+ size += sizeof(GParamListObjectArmorHead);
+ size += sizeof(GParamListObjectArmorUpper);
+ size += sizeof(GParamListObjectShiekerStone);
+ size += sizeof(GParamListObjectSeriesArmor);
+ size += sizeof(GParamListObjectLiftable);
+ size += sizeof(GParamListObjectItem);
+ size += sizeof(GParamListObjectRupee);
+ size += sizeof(GParamListObjectArrow);
+ size += sizeof(GParamListObjectBullet);
+ size += sizeof(GParamListObjectCureItem);
+ size += sizeof(GParamListObjectCookSpice);
+ size += sizeof(GParamListObjectLumberjackTree);
+ size += sizeof(GParamListObjectNpc);
+ size += sizeof(GParamListObjectNpcEquipment);
+ size += sizeof(GParamListObjectZora);
+ size += sizeof(GParamListObjectTraveler);
+ size += sizeof(GParamListObjectPrey);
+ size += sizeof(GParamListObjectAnimalFollowOffset);
+ size += sizeof(GParamListObjectExtendedEntity);
+ size += sizeof(GParamListObjectBindActor);
+ size += sizeof(GParamListObjectEatTarget);
+ size += sizeof(GParamListObjectAnimalUnit);
+ size += sizeof(GParamListObjectInsect);
+ size += sizeof(GParamListObjectFish);
+ size += sizeof(GParamListObjectRope);
+ size += sizeof(GParamListObjectHorse);
+ size += sizeof(GParamListObjectHorseUnit);
+ size += sizeof(GParamListObjectHorseObject);
+ size += sizeof(GParamListObjectHorseRider);
+ size += sizeof(GParamListObjectHorseCreator);
+ size += sizeof(GParamListObjectGiantArmorSlot);
+ size += sizeof(GParamListObjectGiantArmor);
+ size += sizeof(GParamListObjectGuardian);
+ size += sizeof(GParamListObjectMonsterShop);
+ size += sizeof(GParamListObjectSwarm);
+ size += sizeof(GParamListObjectGelEnemy);
+ size += sizeof(GParamListObjectNest);
+ size += sizeof(GParamListObjectWizzrobe);
+ size += sizeof(GParamListObjectStalEnemy);
+ size += sizeof(GParamListObjectGuardianMini);
+ size += sizeof(GParamListObjectClothReaction);
+ size += sizeof(GParamListObjectGlobal);
+ size += sizeof(GParamListObjectBeam);
+ size += sizeof(GParamListObjectAutoGen);
+ size += sizeof(GParamListObjectChemicalType);
+ size += sizeof(GParamListObjectGolem);
+ size += sizeof(GParamListObjectHorseTargetedInfo);
+ size += sizeof(GParamListObjectWolfLink);
+ size += sizeof(GParamListObjectEvent);
+ size += sizeof(GParamListObjectGolemIK);
+ size += sizeof(GParamListObjectPictureBook);
+ size += sizeof(GParamListObjectAirWall);
+ size += sizeof(GParamListObjectMotorcycle);
+ size += sizeof(GParamList);
+ return size;
+}
+
+u32 GParamList::getResourceFactoryFallbackSize() {
+ constexpr size_t size = getResourceFactoryFallbackSizeConst();
+ static_assert(size == static_cast<u32>(size));
+ return static_cast<u32>(size);
+}
+
void DummyGParamList::doCreate_(u8*, u32, sead::Heap*) {}
bool DummyGParamList::parse_(u8* data, size_t size, sead::Heap* heap) {
diff --git a/src/KingSystem/Resource/resResourceGParamList.h b/src/KingSystem/Resource/resResourceGParamList.h
index 5294575d..39e8f6ec 100644
--- a/src/KingSystem/Resource/resResourceGParamList.h
+++ b/src/KingSystem/Resource/resResourceGParamList.h
@@ -19,6 +19,8 @@ public:
void doCreate_(u8* buffer, u32 bufferSize, sead::Heap* heap) override;
bool needsParse() const override { return true; }
+ static u32 getResourceFactoryFallbackSize();
+
template <GParamListObjType Type>
const auto* get() const {
using Traits = GParamListObjTypeTraits<Type>;
diff --git a/src/KingSystem/Resource/resResourceLifeCondition.cpp b/src/KingSystem/Resource/resResourceLifeCondition.cpp
index c32f7e02..09a1bd91 100644
--- a/src/KingSystem/Resource/resResourceLifeCondition.cpp
+++ b/src/KingSystem/Resource/resResourceLifeCondition.cpp
@@ -2,8 +2,6 @@
namespace ksys::res {
-LifeCondition::LifeCondition() : ParamIO("lifecondition", 0) {}
-
// NON_MATCHING: two instructions swapped
bool LifeCondition::parse_(u8* data, size_t, sead::Heap* heap) {
if (!data)
diff --git a/src/KingSystem/Resource/resResourceLifeCondition.h b/src/KingSystem/Resource/resResourceLifeCondition.h
index 46bc3440..f3107f5f 100644
--- a/src/KingSystem/Resource/resResourceLifeCondition.h
+++ b/src/KingSystem/Resource/resResourceLifeCondition.h
@@ -11,7 +11,7 @@ namespace ksys::res {
class LifeCondition : public ParamIO, public Resource {
SEAD_RTTI_OVERRIDE(LifeCondition, Resource)
public:
- LifeCondition();
+ LifeCondition() : ParamIO("lifecondition", 0) {}
~LifeCondition() override = default;
bool needsParse() const override { return true; }
diff --git a/src/KingSystem/Resource/resResourceLod.cpp b/src/KingSystem/Resource/resResourceLod.cpp
index 6ed71226..baa7545f 100644
--- a/src/KingSystem/Resource/resResourceLod.cpp
+++ b/src/KingSystem/Resource/resResourceLod.cpp
@@ -2,10 +2,6 @@
namespace ksys::res {
-Lod::Lod() : ParamIO("lod", 0) {}
-
-Lod::~Lod() = default;
-
bool Lod::parse_(u8* data, size_t, sead::Heap*) {
mDisableOutScreenCalcStop.init(false, "DisableOutScreenCalcStop", "", &mHeader);
mDisableXLinkSkip.init(false, "DisableXLinkSkip", "", &mHeader);
diff --git a/src/KingSystem/Resource/resResourceLod.h b/src/KingSystem/Resource/resResourceLod.h
index ca933f5c..059ef0cc 100644
--- a/src/KingSystem/Resource/resResourceLod.h
+++ b/src/KingSystem/Resource/resResourceLod.h
@@ -11,8 +11,8 @@ namespace ksys::res {
class Lod : public ParamIO, public Resource {
SEAD_RTTI_OVERRIDE(Lod, Resource)
public:
- Lod();
- ~Lod() override;
+ Lod() : ParamIO("lod", 0) {}
+ ~Lod() override = default;
bool ParamIO_m0() override { return true; }
void doCreate_(u8*, u32, sead::Heap*) override {}
diff --git a/src/KingSystem/Resource/resResourceModelList.h b/src/KingSystem/Resource/resResourceModelList.h
index d614ade5..1d399f46 100644
--- a/src/KingSystem/Resource/resResourceModelList.h
+++ b/src/KingSystem/Resource/resResourceModelList.h
@@ -11,7 +11,6 @@
namespace ksys::res {
-// FIXME: incomplete
class ModelList : public ParamIO, public Resource {
SEAD_RTTI_OVERRIDE(ModelList, Resource)
public:
@@ -137,7 +136,9 @@ public:
const Attention& getAttention() const { return mAttention.ref(); }
const sead::Buffer<ModelData>& getModelData() const { return mModelData; }
const sead::Buffer<AnmTarget>& getAnmTargets() const { return mAnmTargets; }
- bool is7C8() const { return _7c8; }
+
+ bool isDummy() const { return mIsDummy; }
+ void markAsDummy() { mIsDummy = true; }
int getNumAnmTargets() const;
void getModelDataInfo(ModelDataInfo* info) const;
@@ -161,7 +162,7 @@ private:
agl::utl::ParameterList mModelDataList;
sead::Buffer<AnmTarget> mAnmTargets;
agl::utl::ParameterList mAnmTargetList;
- bool _7c8 = false;
+ bool mIsDummy = false;
};
KSYS_CHECK_SIZE_NX150(ModelList, 0x7d0);