diff --git a/data/uking_functions.csv b/data/uking_functions.csv index eb1ae88f..43f1d3e7 100644 --- a/data/uking_functions.csv +++ b/data/uking_functions.csv @@ -89504,14 +89504,14 @@ 0x00000071011bb7f4,sub_71011BB7F4,52, 0x00000071011bb828,sub_71011BB828,92, 0x00000071011bb884,sub_71011BB884,32, -0x00000071011bb8a4,BaseProcHandle::ctor,12, -0x00000071011bb8b0,BaseProcHandle::actorReady,32, +0x00000071011bb8a4,BaseProcHandle::ctor,12,_ZN4ksys3act14BaseProcHandleC1Ev +0x00000071011bb8b0,BaseProcHandle::actorReady,32,_ZN4ksys3act14BaseProcHandle9procReadyEv 0x00000071011bb8d0,BaseProcHandle::hasActorAndFlags5,84, 0x00000071011bb924,BaseProcHandle::x,52, 0x00000071011bb958,BaseProcHandle::deleteActor,112, -0x00000071011bb9c8,BaseProcHandle::dtor,56, +0x00000071011bb9c8,BaseProcHandle::dtor,56,_ZN4ksys3act14BaseProcHandleD1Ev 0x00000071011bba00,BaseProcUnit::deleteActor,316, -0x00000071011bbb3c,BaseProcHandle::getActor,24, +0x00000071011bbb3c,BaseProcHandle::getActor,24,_ZN4ksys3act14BaseProcHandle7getProcEv 0x00000071011bbb54,BaseProcHandle::setProcStateFlag8000,184, 0x00000071011bbc0c,BaseProcHandle::wakeUpActorAndReleaseUnit,184, 0x00000071011bbcc4,BaseProcHandle::getBaseProcEvent,48, diff --git a/src/Game/Action/actionSetInstEventFlag.h b/src/Game/Action/actionSetInstEventFlag.h index e37778d3..7dac0a32 100644 --- a/src/Game/Action/actionSetInstEventFlag.h +++ b/src/Game/Action/actionSetInstEventFlag.h @@ -12,7 +12,6 @@ public: ~SetInstEventFlagAction() override; void oneShot() override; - }; KSYS_CHECK_SIZE_NX150(SetInstEventFlagAction, 0x20); diff --git a/src/KingSystem/ActorSystem/actBaseProc.h b/src/KingSystem/ActorSystem/actBaseProc.h index 0411b834..c7636998 100644 --- a/src/KingSystem/ActorSystem/actBaseProc.h +++ b/src/KingSystem/ActorSystem/actBaseProc.h @@ -9,9 +9,9 @@ #include #include #include +#include "KingSystem/ActorSystem/actBaseProcHandle.h" #include "KingSystem/ActorSystem/actBaseProcJob.h" #include "KingSystem/ActorSystem/actBaseProcMap.h" -#include "KingSystem/ActorSystem/actBaseProcHandle.h" #include "KingSystem/Utils/StrTreeMap.h" #include "KingSystem/Utils/Types.h" diff --git a/src/KingSystem/ActorSystem/actBaseProcHandle.cpp b/src/KingSystem/ActorSystem/actBaseProcHandle.cpp index e69de29b..5603b5be 100644 --- a/src/KingSystem/ActorSystem/actBaseProcHandle.cpp +++ b/src/KingSystem/ActorSystem/actBaseProcHandle.cpp @@ -0,0 +1,29 @@ +#include "KingSystem/ActorSystem/actBaseProcHandle.h" + +namespace ksys::act { + +BaseProcHandle::BaseProcHandle() { + mUnit = nullptr; + mFlag = 0; +} + +BaseProcHandle::~BaseProcHandle() { + if (mUnit) { + mUnit->deleteProc(0, this); + mUnit = nullptr; + } + mFlag = 0; +} + +bool BaseProcHandle::procReady() { + return mUnit && mUnit->isReady(); +} + +BaseProc* BaseProcHandle::getProc() { + if (mUnit) + return mUnit->getProc(); + + return nullptr; +} + +} // namespace ksys::act \ No newline at end of file diff --git a/src/KingSystem/ActorSystem/actBaseProcHandle.h b/src/KingSystem/ActorSystem/actBaseProcHandle.h index 031e9923..c0a74ee0 100644 --- a/src/KingSystem/ActorSystem/actBaseProcHandle.h +++ b/src/KingSystem/ActorSystem/actBaseProcHandle.h @@ -1,19 +1,26 @@ #pragma once #include -#include "actBaseProcUnit.h" +#include "KingSystem/ActorSystem/actBaseProc.h" +#include "KingSystem/ActorSystem/actBaseProcUnit.h" #include "KingSystem/Utils/Types.h" namespace ksys::act { class BaseProcUnit; +class BaseProc; class BaseProcHandle { public: BaseProcHandle(); ~BaseProcHandle(); - static BaseProcHandle sDummyBaseProcHandle; + bool procReady(); + + BaseProc* getProc(); + + static BaseProcHandle sDummyHandle; + private: BaseProcUnit* mUnit; u8 mFlag; diff --git a/src/KingSystem/ActorSystem/actBaseProcUnit.cpp b/src/KingSystem/ActorSystem/actBaseProcUnit.cpp index 8f8b3919..09bd6c81 100644 --- a/src/KingSystem/ActorSystem/actBaseProcUnit.cpp +++ b/src/KingSystem/ActorSystem/actBaseProcUnit.cpp @@ -4,6 +4,7 @@ #include "KingSystem/ActorSystem/actActorLinkConstDataAccess.h" #include "KingSystem/ActorSystem/actBaseProc.h" #include "KingSystem/Utils/Debug.h" + namespace ksys::act { // NON_MATCHING: Equivalent but branches are off. @@ -15,7 +16,7 @@ bool BaseProcUnit::setProc(BaseProc* proc) { if (mProc) mProc = nullptr; - if (mHandle == &BaseProcHandle::sDummyBaseProcHandle) + if (mHandle == &BaseProcHandle::sDummyHandle) return false; if (mHandle) { @@ -51,7 +52,7 @@ bool BaseProcUnit::setProc(BaseProc* proc) { } bool BaseProcUnit::isParentHandleDefault() const { - return mHandle == &BaseProcHandle::sDummyBaseProcHandle; + return mHandle == &BaseProcHandle::sDummyHandle; } } // namespace ksys::act \ No newline at end of file diff --git a/src/KingSystem/ActorSystem/actBaseProcUnit.h b/src/KingSystem/ActorSystem/actBaseProcUnit.h index 81d8ec4b..f3ef3f34 100644 --- a/src/KingSystem/ActorSystem/actBaseProcUnit.h +++ b/src/KingSystem/ActorSystem/actBaseProcUnit.h @@ -1,9 +1,10 @@ #pragma once #include +#include #include #include "KingSystem/ActorSystem/actBaseProcHandle.h" -#include + namespace ksys::act { class BaseProc; @@ -11,12 +12,15 @@ class BaseProcHandle; class BaseProcUnit { public: - bool deleteProc(void*, BaseProcHandle* handle); + bool deleteProc(u32, BaseProcHandle* handle); bool setProc(BaseProc* proc); void unlinkProc(BaseProc* proc); void cleanUp(BaseProc* proc, bool set_flag_5); bool isParentHandleDefault() const; + BaseProc* getProc() const { return mProc; } + bool isReady() const { return mFlags == 2; } + private: u32 mFlags; sead::Atomic mHandle;