diff --git a/data/uking_functions.csv b/data/uking_functions.csv index 6417839f..81517480 100644 --- a/data/uking_functions.csv +++ b/data/uking_functions.csv @@ -89046,11 +89046,11 @@ 0x00000071011856c0,sub_71011856C0,156, 0x000000710118575c,sub_710118575C,8, 0x0000007101185764,sub_7101185764,8, -0x000000710118576c,memsetSomeMemory,36, -0x0000007101185790,ActorParam::Event::ctor,244, -0x0000007101185884,sub_7101185884,60, +0x000000710118576c,memsetSomeMemory,36,_ZN4ksys3act10ActorParam19resetDummyResourcesEv +0x0000007101185790,ActorParam::Event::ctor,244,_ZN4ksys3act10ActorParamC1Ev +0x0000007101185884,sub_7101185884,60,_ZN4ksys3act10ActorParamD1Ev 0x00000071011858c0,ActorParam::Data::doUnload,440, -0x0000007101185a78,sub_7101185A78,68, +0x0000007101185a78,sub_7101185A78,68,_ZN4ksys3act10ActorParamD0Ev 0x0000007101185abc,ActorParam::Load::deleteRes2,164, 0x0000007101185b60,ActorParam::Load::isDummyParamResource,136, 0x0000007101185be8,ActorParam::Load::constructRes2,188, diff --git a/src/KingSystem/ActorSystem/CMakeLists.txt b/src/KingSystem/ActorSystem/CMakeLists.txt index a72504fa..3eb27a0f 100644 --- a/src/KingSystem/ActorSystem/CMakeLists.txt +++ b/src/KingSystem/ActorSystem/CMakeLists.txt @@ -8,6 +8,8 @@ target_sources(uking PRIVATE actActorFactory.h actActorLinkConstDataAccess.cpp actActorLinkConstDataAccess.h + actActorParam.cpp + actActorParam.h actActorParamMgr.h actAiAction.cpp actAiAction.h diff --git a/src/KingSystem/ActorSystem/actActorParam.cpp b/src/KingSystem/ActorSystem/actActorParam.cpp new file mode 100644 index 00000000..a615f2db --- /dev/null +++ b/src/KingSystem/ActorSystem/actActorParam.cpp @@ -0,0 +1,21 @@ +#include "KingSystem/ActorSystem/actActorParam.h" + +namespace ksys::act { + +ActorParam::Resources ActorParam::sDummyResources; + +void ActorParam::resetDummyResources() { + sDummyResources = {}; +} + +ActorParam::ActorParam() { + mRes = {}; + mNumHandles1 = mNumHandles2 = 0; + mEvent.resetSignal(); +} + +ActorParam::~ActorParam() { + finalize(); +} + +} // namespace ksys::act diff --git a/src/KingSystem/ActorSystem/actActorParam.h b/src/KingSystem/ActorSystem/actActorParam.h new file mode 100644 index 00000000..cba01e0a --- /dev/null +++ b/src/KingSystem/ActorSystem/actActorParam.h @@ -0,0 +1,106 @@ +#pragma once + +#include +#include +#include +#include +#include +#include "KingSystem/ActorSystem/actBaseProcJob.h" +#include "KingSystem/Resource/resHandle.h" +#include "KingSystem/Utils/Thread/Event.h" + +namespace ksys { + +namespace res { +class ActorLink; +class AIProgram; +class AISchedule; +class AnimationInfo; +class ASList; +class AttClientList; +class Awareness; +class BoneControl; +class Chemical; +class DamageParam; +class Drop; +class EventFlow; +class GParamList; +class LifeCondition; +class Lod; +class ModelList; +class Physics; +class RagdollBlendWeight; +class RagdollConfig; +class RagdollConfigList; +class Recipe; +class Shop; +class UMii; +} // namespace res + +namespace act { + +// FIXME: incomplete +class ActorParam : public sead::hostio::Node { +public: + struct Resources { + res::ActorLink* mActorLink; + res::ModelList* mModelList; + res::ASList* mASList; + res::AIProgram* mAIProgram; + res::GParamList* mGParamList; + res::Physics* mPhysics; + res::Chemical* mChemical; + res::AttClientList* mAttClientList; + res::AISchedule* mAISchedule; + res::EventFlow* mEventFlow; + res::DamageParam* mDamageParam; + res::RagdollConfigList* mRagdollConfigList; + res::RagdollBlendWeight* mRagdollBlendWeight; + res::Awareness* mAwareness; + void* mResource14; + void* mResource15; + void* mResource16; + res::Drop* mDropTable; + res::Shop* mShopData; + res::Recipe* mRecipe; + res::Lod* mLod; + res::BoneControl* mBoneControl; + res::LifeCondition* mLifeCondition; + res::UMii* mUMii; + res::AnimationInfo* mAnimationInfo; + }; + KSYS_CHECK_SIZE_NX150(Resources, 0xc8); + + ActorParam(); + virtual ~ActorParam(); + + u16 _8 = 0; + u8 _a = 0; + sead::FixedSafeString<64> mActorName; + sead::SafeString mProfile; + const char* mClassName{}; + Priority mPriority = Priority::AllAfter; + u32 _74 = 2; + Resources mRes; + sead::Buffer mHandles1; + sead::Buffer mHandles2; + s32 mNumHandles1; + s32 mNumHandles2; + u32 _168{}; + + static void resetDummyResources(); + + static Resources sDummyResources; + +private: + void finalize(); + + sead::CriticalSection mCS{nullptr}; + util::Event mEvent{nullptr, + sead::IDisposer::HeapNullOption::DoNotAppendDisposerIfNoHeapSpecified, true}; +}; +KSYS_CHECK_SIZE_NX150(ActorParam, 0x200); + +} // namespace act + +} // namespace ksys diff --git a/src/KingSystem/ActorSystem/actActorParamMgr.h b/src/KingSystem/ActorSystem/actActorParamMgr.h index faae022a..df1e5cac 100644 --- a/src/KingSystem/ActorSystem/actActorParamMgr.h +++ b/src/KingSystem/ActorSystem/actActorParamMgr.h @@ -6,33 +6,10 @@ namespace ksys { namespace res { class GParamList; -} +} // namespace res namespace act { -// FIXME: incomplete -class ActorParam { -public: - // FIXME: incomplete - struct Data { - public: - u8 TEMP1[0xA0]; - - res::GParamList* mGParamList; - u8 TEMP2[0x18]; - void* mDamageParam; - u8 TEMP3[0x128]; - }; - KSYS_CHECK_SIZE_NX150(ActorParam::Data, 0x1F0); - - // vtable is still unknown - virtual void TEMP_VTABLE(); - - u64 TEMP; // Unknown number of fields(2+) - Data mData; -}; -KSYS_CHECK_SIZE_NX150(ActorParam, 0x200); - // FIXME: incomplete class ActorParamMgr { SEAD_SINGLETON_DISPOSER(ActorParamMgr) diff --git a/src/KingSystem/ActorSystem/actBaseProcJob.h b/src/KingSystem/ActorSystem/actBaseProcJob.h index bd30b23e..be5a219d 100644 --- a/src/KingSystem/ActorSystem/actBaseProcJob.h +++ b/src/KingSystem/ActorSystem/actBaseProcJob.h @@ -7,7 +7,7 @@ namespace ksys::act { class BaseProc; -enum class Priority : u8 { +enum class Priority { PlayerBefore = 0, Player = 2, PlayerAfter = 2, diff --git a/src/KingSystem/Damage/dmgDamageManagerBase.cpp b/src/KingSystem/Damage/dmgDamageManagerBase.cpp index 15332a97..68fe41a8 100644 --- a/src/KingSystem/Damage/dmgDamageManagerBase.cpp +++ b/src/KingSystem/Damage/dmgDamageManagerBase.cpp @@ -2,7 +2,7 @@ #include "Game/DLC/aoc2.h" #include "KingSystem/ActorSystem/actActor.h" #include "KingSystem/ActorSystem/actActorConstDataAccess.h" -#include "KingSystem/ActorSystem/actActorParamMgr.h" +#include "KingSystem/ActorSystem/actActorParam.h" #include "KingSystem/ActorSystem/actLifeRecoveryInfo.h" #include "KingSystem/Resource/GeneralParamList/resGParamListObjectGeneral.h" #include "KingSystem/Resource/resResourceGParamList.h" @@ -104,7 +104,7 @@ void DamageManagerBase::removeDamageCallback(DamageCallback* callback) { } bool DamageManagerBase::applyDamage(s32& life) { - auto* param_list = mActor->mActorParam->mData.mGParamList; + auto* param_list = mActor->mActorParam->mRes.mGParamList; const res::GParamListObjectGeneral& params = param_list->getGeneral(); if (params.mIsLifeInfinite.ref()) {