From 1b280ba633c327523ecba7556ba21b28194f04a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Sat, 3 Apr 2021 15:33:44 +0200 Subject: [PATCH] ksys: Implement KingEditor (stubbed) --- data/uking_functions.csv | 18 +++++++++--------- src/KingSystem/System/CMakeLists.txt | 1 + src/KingSystem/System/KingEditor.cpp | 27 +++++++++++++++++++++++++++ src/KingSystem/System/KingEditor.h | 27 +++++++++++++++++++++++++-- 4 files changed, 62 insertions(+), 11 deletions(-) create mode 100644 src/KingSystem/System/KingEditor.cpp diff --git a/data/uking_functions.csv b/data/uking_functions.csv index a23558fe..a3aea111 100644 --- a/data/uking_functions.csv +++ b/data/uking_functions.csv @@ -93741,15 +93741,15 @@ 0x000000710122d9f8,sub_710122D9F8,284, 0x000000710122db14,_ZN3aal8ShapeMgr12findTemplateERKN4sead14SafeStringBaseIcEE,332, 0x000000710122dc60,sub_710122DC60,72, -0x000000710122dca8,sub_710122DCA8,96, -0x000000710122dd08,sub_710122DD08,104, -0x000000710122dd70,KingEditor::createInstance,168, -0x000000710122de18,sub_710122DE18,92, -0x000000710122de74,KingEditor::initStubbed,4, -0x000000710122de78,nullsub_4715,4, -0x000000710122de7c,KingEditor::stubbed,4, -0x000000710122de80,KingEditor::stubbed_0,4, -0x000000710122de84,updateResourceStuff,12, +0x000000710122dca8,sub_710122DCA8,96,_ZN4ksys10KingEditor18SingletonDisposer_D2Ev +0x000000710122dd08,sub_710122DD08,104,_ZN4ksys10KingEditor18SingletonDisposer_D0Ev +0x000000710122dd70,KingEditor::createInstance,168,_ZN4ksys10KingEditor14createInstanceEPN4sead4HeapE +0x000000710122de18,sub_710122DE18,92,_ZN4ksys10KingEditor14deleteInstanceEv +0x000000710122de74,KingEditor::initStubbed,4,_ZN4ksys10KingEditor4initEPN4sead4HeapE +0x000000710122de78,nullsub_4715,4,_ZN4ksys10KingEditor4calcEv +0x000000710122de7c,KingEditor::stubbed,4,_ZN4ksys10KingEditor17registerComponentEPNS_19KingEditorComponentE +0x000000710122de80,KingEditor::stubbed_0,4,_ZN4ksys10KingEditor3logEPKcS2_Pvi +0x000000710122de84,updateResourceStuff,12,_ZNK4ksys19KingEditorComponent3logEPKcPvi 0x000000710122de90,sub_710122DE90,392, 0x000000710122e018,sub_710122E018,1364, 0x000000710122e56c,sub_710122E56C,380, diff --git a/src/KingSystem/System/CMakeLists.txt b/src/KingSystem/System/CMakeLists.txt index acf93ce8..b4b01526 100644 --- a/src/KingSystem/System/CMakeLists.txt +++ b/src/KingSystem/System/CMakeLists.txt @@ -4,6 +4,7 @@ target_sources(uking PRIVATE DebugMessage.h HavokWorkerMgr.cpp HavokWorkerMgr.h + KingEditor.cpp KingEditor.h OverlayArena.cpp OverlayArena.h diff --git a/src/KingSystem/System/KingEditor.cpp b/src/KingSystem/System/KingEditor.cpp new file mode 100644 index 00000000..7ceed38c --- /dev/null +++ b/src/KingSystem/System/KingEditor.cpp @@ -0,0 +1,27 @@ +#include "KingSystem/System/KingEditor.h" + +namespace ksys { + +SEAD_SINGLETON_DISPOSER_IMPL(KingEditor) + +void KingEditor::init(sead::Heap* heap) { + // Stubbed in release. +} + +void KingEditor::calc() { + // Stubbed in release. +} + +void KingEditor::registerComponent(KingEditorComponent* component) { + // Stubbed in release. +} + +void KingEditor::log(const char* system, const char* message, void*, int) { + // Stubbed in release. +} + +void KingEditorComponent::log(const char* message, void* x, int y) const { + KingEditor::instance()->log(getName(), message, x, y); +} + +} // namespace ksys diff --git a/src/KingSystem/System/KingEditor.h b/src/KingSystem/System/KingEditor.h index c5ac181b..e2a3afca 100644 --- a/src/KingSystem/System/KingEditor.h +++ b/src/KingSystem/System/KingEditor.h @@ -1,6 +1,9 @@ #pragma once +#include #include +#include +#include "KingSystem/Utils/Types.h" namespace ksys { @@ -9,8 +12,12 @@ public: virtual const char* getName() const = 0; virtual void syncData(const char* data) = 0; - void* _8 = nullptr; - void* _10 = nullptr; + void log(const char* message, void* x = {}, int y = {}) const; + + static constexpr size_t getListNodeOffset() { return offsetof(KingEditorComponent, mListNode); } + +private: + sead::ListNode mListNode; }; // FIXME @@ -19,8 +26,24 @@ class KingEditor { KingEditor() = default; public: + void init(sead::Heap* heap); + void calc(); void registerComponent(KingEditorComponent* component); void log(const char* system, const char* message, void* = {}, int = {}); + +private: + sead::OffsetList mComponents; + sead::ListNode mListNode; + sead::CriticalSection mCS; + u32 _88 = 0; + u32 _8c = 0; + void* _90 = nullptr; + u32 _98 = 0; + void* _a0 = nullptr; + void* _a8 = nullptr; + void* mPlayerLink = nullptr; + bool _b8 = false; }; +KSYS_CHECK_SIZE_NX150(KingEditor, 0xc0); } // namespace ksys