diff options
| author | Léo Lam <leo@leolam.fr> | 2026-10-13 10:39:03 +0200 |
|---|---|---|
| committer | Léo Lam <leo@leolam.fr> | 2026-10-15 01:59:46 +0200 |
| commit | 8eca2642b01591ccbfbee98e66181d8ad5982cd3 (patch) | |
| tree | deede94dd7b37cea5ccc651b22dd7cc58a7b77c5 /src/KingSystem/ActorSystem | |
| parent | e78c02499d0f108ae9c00158198289764c5980fe (diff) | |
ksys, uking: move four definitions to match link order
calc_ goes before leave_ in ForceSetCameraPos and InWaterSelForkASPlay,
and RailRoute's dtor goes after getCheckPointName (an unnamed row
there is likely its D0).
BaseProcJobHandler's ctor is linked right before BaseProc's ctor, so it
moves into actBaseProc.cpp, and the class moves into actBaseProc.h so
that its declaration stays with its definition.
(AI assisted using Claude Opus 5.5)
Diffstat (limited to 'src/KingSystem/ActorSystem')
| -rw-r--r-- | src/KingSystem/ActorSystem/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/KingSystem/ActorSystem/actActor.h | 1 | ||||
| -rw-r--r-- | src/KingSystem/ActorSystem/actBaseProc.cpp | 3 | ||||
| -rw-r--r-- | src/KingSystem/ActorSystem/actBaseProc.h | 43 | ||||
| -rw-r--r-- | src/KingSystem/ActorSystem/actBaseProcJobHandler.cpp | 8 | ||||
| -rw-r--r-- | src/KingSystem/ActorSystem/actBaseProcJobHandler.h | 51 | ||||
| -rw-r--r-- | src/KingSystem/ActorSystem/actBaseProcMgr.cpp | 2 |
7 files changed, 46 insertions, 64 deletions
diff --git a/src/KingSystem/ActorSystem/CMakeLists.txt b/src/KingSystem/ActorSystem/CMakeLists.txt index e0b70bfd..71080f19 100644 --- a/src/KingSystem/ActorSystem/CMakeLists.txt +++ b/src/KingSystem/ActorSystem/CMakeLists.txt @@ -77,8 +77,6 @@ target_sources(uking PRIVATE actBaseProcInitializer.h actBaseProcJob.cpp actBaseProcJob.h - actBaseProcJobHandler.cpp - actBaseProcJobHandler.h actBaseProcJobQue.cpp actBaseProcJobQue.h actBaseProcLink.cpp diff --git a/src/KingSystem/ActorSystem/actActor.h b/src/KingSystem/ActorSystem/actActor.h index 2749d091..dcd0515d 100644 --- a/src/KingSystem/ActorSystem/actActor.h +++ b/src/KingSystem/ActorSystem/actActor.h @@ -11,7 +11,6 @@ #include <xlink2/xlink2Handle.h> #include "KingSystem/ActorSystem/actActorEditorNode.h" #include "KingSystem/ActorSystem/actBaseProc.h" -#include "KingSystem/ActorSystem/actBaseProcJobHandler.h" #include "KingSystem/ActorSystem/actBaseProcLink.h" #include "KingSystem/ActorSystem/actPhysicsConstraints.h" #include "KingSystem/ActorSystem/actPhysicsUserTag.h" diff --git a/src/KingSystem/ActorSystem/actBaseProc.cpp b/src/KingSystem/ActorSystem/actBaseProc.cpp index cce31c21..97b1b5b1 100644 --- a/src/KingSystem/ActorSystem/actBaseProc.cpp +++ b/src/KingSystem/ActorSystem/actBaseProc.cpp @@ -3,7 +3,6 @@ #include <time/seadTickSpan.h> #include "KingSystem/ActorSystem/actBaseProcAccessor.h" #include "KingSystem/ActorSystem/actBaseProcHandle.h" -#include "KingSystem/ActorSystem/actBaseProcJobHandler.h" #include "KingSystem/ActorSystem/actBaseProcLink.h" #include "KingSystem/ActorSystem/actBaseProcMgr.h" #include "KingSystem/Terrain/teraSystem.h" @@ -13,6 +12,8 @@ namespace ksys::act { static util::InitTimeInfo sInfo; +BaseProcJobHandler::BaseProcJobHandler(BaseProc* proc) : mLink(proc, proc->getPriority()) {} + BaseProc::BaseProc(const CreateArg& arg) : mName(arg.actor_name), mPriority(arg.class_info->priority) { BaseProcMgr* mgr = BaseProcMgr::instance(); diff --git a/src/KingSystem/ActorSystem/actBaseProc.h b/src/KingSystem/ActorSystem/actBaseProc.h index 48c99176..7e76335f 100644 --- a/src/KingSystem/ActorSystem/actBaseProc.h +++ b/src/KingSystem/ActorSystem/actBaseProc.h @@ -5,6 +5,7 @@ #include <container/seadSafeArray.h> #include <math/seadMathCalcCommon.h> #include <prim/seadBitFlag.h> +#include <prim/seadDelegate.h> #include <prim/seadRuntimeTypeInfo.h> #include <prim/seadSafeString.h> #include <prim/seadTypedBitFlag.h> @@ -332,4 +333,46 @@ private: }; KSYS_CHECK_SIZE_NX150(BaseProc, 0x180); +class BaseProcJobHandler { +public: + explicit BaseProcJobHandler(BaseProc* proc); + virtual ~BaseProcJobHandler() = default; + virtual void invoke() = 0; + virtual void invokeSpecial() {} + + BaseProcJobLink& getLink() { return mLink; } + const BaseProcJobLink& getLink() const { return mLink; } + +protected: + BaseProcJobLink mLink; +}; +KSYS_CHECK_SIZE_NX150(BaseProcJobHandler, 0x30); + +/// For binding actor member functions. +template <typename T> +class BaseProcJobHandlerT : public BaseProcJobHandler { +public: + BaseProcJobHandlerT(T* proc, void (T::*fn)()) : BaseProcJobHandler(proc), mDelegate(proc, fn) {} + + void invoke() override { mDelegate.invoke(); } + +private: + sead::Delegate<T> mDelegate; +}; + +/// For binding two actor member functions. +template <typename T> +class BaseProcJobHandlerDualT : public BaseProcJobHandler { +public: + BaseProcJobHandlerDualT(T* proc, void (T::*fn)(), void (T::*fn_special)()) + : BaseProcJobHandler(proc), mDelegate(proc, fn), mDelegateSpecial(proc, fn_special) {} + + void invoke() override { mDelegate.invoke(); } + void invokeSpecial() override { mDelegateSpecial.invoke(); } + +private: + sead::Delegate<T> mDelegate; + sead::Delegate<T> mDelegateSpecial; +}; + } // namespace ksys::act diff --git a/src/KingSystem/ActorSystem/actBaseProcJobHandler.cpp b/src/KingSystem/ActorSystem/actBaseProcJobHandler.cpp deleted file mode 100644 index b74fcb1f..00000000 --- a/src/KingSystem/ActorSystem/actBaseProcJobHandler.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "KingSystem/ActorSystem/actBaseProcJobHandler.h" -#include "KingSystem/ActorSystem/actBaseProc.h" - -namespace ksys::act { - -BaseProcJobHandler::BaseProcJobHandler(BaseProc* proc) : mLink(proc, proc->getPriority()) {} - -} // namespace ksys::act diff --git a/src/KingSystem/ActorSystem/actBaseProcJobHandler.h b/src/KingSystem/ActorSystem/actBaseProcJobHandler.h deleted file mode 100644 index 4ba4c1d4..00000000 --- a/src/KingSystem/ActorSystem/actBaseProcJobHandler.h +++ /dev/null @@ -1,51 +0,0 @@ -#pragma once - -#include <prim/seadDelegate.h> -#include "KingSystem/ActorSystem/actBaseProcJob.h" -#include "KingSystem/Utils/Types.h" - -namespace ksys::act { - -class BaseProcJobHandler { -public: - explicit BaseProcJobHandler(BaseProc* proc); - virtual ~BaseProcJobHandler() = default; - virtual void invoke() = 0; - virtual void invokeSpecial() {} - - BaseProcJobLink& getLink() { return mLink; } - const BaseProcJobLink& getLink() const { return mLink; } - -protected: - BaseProcJobLink mLink; -}; -KSYS_CHECK_SIZE_NX150(BaseProcJobHandler, 0x30); - -/// For binding actor member functions. -template <typename T> -class BaseProcJobHandlerT : public BaseProcJobHandler { -public: - BaseProcJobHandlerT(T* proc, void (T::*fn)()) : BaseProcJobHandler(proc), mDelegate(proc, fn) {} - - void invoke() override { mDelegate.invoke(); } - -private: - sead::Delegate<T> mDelegate; -}; - -/// For binding two actor member functions. -template <typename T> -class BaseProcJobHandlerDualT : public BaseProcJobHandler { -public: - BaseProcJobHandlerDualT(T* proc, void (T::*fn)(), void (T::*fn_special)()) - : BaseProcJobHandler(proc), mDelegate(proc, fn), mDelegateSpecial(proc, fn_special) {} - - void invoke() override { mDelegate.invoke(); } - void invokeSpecial() override { mDelegateSpecial.invoke(); } - -private: - sead::Delegate<T> mDelegate; - sead::Delegate<T> mDelegateSpecial; -}; - -} // namespace ksys::act diff --git a/src/KingSystem/ActorSystem/actBaseProcMgr.cpp b/src/KingSystem/ActorSystem/actBaseProcMgr.cpp index 7d9b3120..73502ab7 100644 --- a/src/KingSystem/ActorSystem/actBaseProcMgr.cpp +++ b/src/KingSystem/ActorSystem/actBaseProcMgr.cpp @@ -3,10 +3,10 @@ #include <prim/seadScopedLock.h> #include <thread/seadThread.h> #include "KingSystem/ActorSystem/actActorSystem.h" +#include "KingSystem/ActorSystem/actBaseProc.h" #include "KingSystem/ActorSystem/actBaseProcDeleter.h" #include "KingSystem/ActorSystem/actBaseProcHeapMgr.h" #include "KingSystem/ActorSystem/actBaseProcInitializer.h" -#include "KingSystem/ActorSystem/actBaseProcJobHandler.h" #include "KingSystem/ActorSystem/actBaseProcJobQue.h" #include "KingSystem/ActorSystem/actBaseProcLink.h" |
