summaryrefslogtreecommitdiff
path: root/src/KingSystem/ActorSystem
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2026-09-28 03:39:31 +0200
committerLéo Lam <leo@leolam.fr>2026-10-06 03:19:39 +0200
commit9d6a597e91fac5ecdca3f9903f90c7bdf5accd96 (patch)
tree0019b105b53ec817ebf677e484e475a0bc2cedf2 /src/KingSystem/ActorSystem
parent98f0c80f1d0b9d3ca19f0b38efcb597ee65d9dc0 (diff)
Actor: ActorFactory is game, CurrentResNameMgr is ksys
ActorFactory's static initialiser fills its table with uking actor ctors. CurrentResNameMgr (0x71010b770c) links in KingSystem/System right before GameConfig. (AI assisted using Claude Fable 5.1 and Claude Opus 5.5)
Diffstat (limited to 'src/KingSystem/ActorSystem')
-rw-r--r--src/KingSystem/ActorSystem/CMakeLists.txt2
-rw-r--r--src/KingSystem/ActorSystem/actActorCreator.h13
-rw-r--r--src/KingSystem/ActorSystem/actActorFactory.cpp21
-rw-r--r--src/KingSystem/ActorSystem/actActorFactory.h29
4 files changed, 10 insertions, 55 deletions
diff --git a/src/KingSystem/ActorSystem/CMakeLists.txt b/src/KingSystem/ActorSystem/CMakeLists.txt
index 258cde69..1a549493 100644
--- a/src/KingSystem/ActorSystem/CMakeLists.txt
+++ b/src/KingSystem/ActorSystem/CMakeLists.txt
@@ -31,8 +31,6 @@ target_sources(uking PRIVATE
actActorCreator.h
actActorEditorNode.cpp
actActorEditorNode.h
- actActorFactory.cpp
- actActorFactory.h
actActorHeapUtil.cpp
actActorHeapUtil.h
actActorLimiter.cpp
diff --git a/src/KingSystem/ActorSystem/actActorCreator.h b/src/KingSystem/ActorSystem/actActorCreator.h
index 7560230d..cc1d1657 100644
--- a/src/KingSystem/ActorSystem/actActorCreator.h
+++ b/src/KingSystem/ActorSystem/actActorCreator.h
@@ -17,11 +17,18 @@ class Object;
namespace ksys::act {
class Actor;
-class ActorFactory;
+struct ActorCreateArg;
class BaseProc;
struct BaseProcCreateArg;
class BaseProcHandle;
+class IActorFactory {
+public:
+ virtual void dummy() = 0;
+ virtual BaseProc* createActor(const ActorCreateArg& arg) = 0;
+ virtual void dummy2() = 0;
+};
+
class ActorCreator {
SEAD_SINGLETON_DISPOSER(ActorCreator)
ActorCreator();
@@ -39,7 +46,7 @@ public:
void enableDistanceUnloadChecks();
void eraseActor(Actor* actor);
- void setActorFactory(ActorFactory* factory) { mActorFactory = factory; }
+ void setActorFactory(IActorFactory* factory) { mActorFactory = factory; }
bool get5a() const { return _5a; }
sead::OffsetList<Actor>& getActorList() { return mActorList; }
@@ -81,7 +88,7 @@ private:
this, &ActorCreator::doCreateProc};
TaskRemoveCallbackT<ActorCreator> mTaskRemovedDelegate{this, &ActorCreator::onTaskRemoved};
sead::CriticalSection mActorListCS;
- ActorFactory* mActorFactory;
+ IActorFactory* mActorFactory;
};
KSYS_CHECK_SIZE_NX150(ActorCreator, 0xf0);
diff --git a/src/KingSystem/ActorSystem/actActorFactory.cpp b/src/KingSystem/ActorSystem/actActorFactory.cpp
deleted file mode 100644
index 6a835f3f..00000000
--- a/src/KingSystem/ActorSystem/actActorFactory.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-#include "KingSystem/ActorSystem/actActorFactory.h"
-#include "KingSystem/ActorSystem/actActorCreator.h"
-
-namespace ksys::act {
-
-SEAD_SINGLETON_DISPOSER_IMPL(ActorFactoryHolder)
-
-void ActorFactory::dummy() {}
-
-void ActorFactory::dummy2() {}
-
-ActorFactoryHolder::~ActorFactoryHolder() {
- ActorCreator::deleteInstance();
-}
-
-void ActorFactoryHolder::init(sead::Heap* heap) {
- ActorCreator::createInstance(heap);
- ActorCreator::instance()->setActorFactory(&mFactory);
-}
-
-} // namespace ksys::act
diff --git a/src/KingSystem/ActorSystem/actActorFactory.h b/src/KingSystem/ActorSystem/actActorFactory.h
deleted file mode 100644
index 6fed82f4..00000000
--- a/src/KingSystem/ActorSystem/actActorFactory.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#pragma once
-
-#include <heap/seadDisposer.h>
-
-namespace ksys::act {
-
-struct ActorCreateArg;
-class BaseProc;
-
-class ActorFactory {
-public:
- virtual void dummy();
- virtual BaseProc* createActor(const ActorCreateArg& arg);
- virtual void dummy2();
-};
-
-class ActorFactoryHolder {
- SEAD_SINGLETON_DISPOSER(ActorFactoryHolder)
- ActorFactoryHolder() = default;
- virtual ~ActorFactoryHolder();
-
-public:
- void init(sead::Heap* heap);
-
-private:
- ActorFactory mFactory;
-};
-
-} // namespace ksys::act