From 62f972da86113c76ba30f63c68cce387a7cb20e8 Mon Sep 17 00:00:00 2001 From: Pistonight Date: Wed, 7 Aug 2024 22:58:56 -0700 Subject: [PATCH] LayoutResourceMgr part in ksys::PreInit --- data/uking_functions.csv | 2 +- src/KingSystem/ksys.cpp | 20 ++++++++++++++++++++ src/KingSystem/ksys.h | 7 +++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/data/uking_functions.csv b/data/uking_functions.csv index 4aaf0f1f1..f6f94977b 100644 --- a/data/uking_functions.csv +++ b/data/uking_functions.csv @@ -81790,7 +81790,7 @@ Address,Quality,Size,Name 0x0000007100f3a528,U,000016, 0x0000007100f3a538,U,000756,ui::init 0x0000007100f3a82c,U,000172,createRegionLanguageMgr -0x0000007100f3a8d8,U,002276,ksys::PreInitializeApp +0x0000007100f3a8d8,W,002276,_ZN4ksys16preInitializeAppEPNS_10InitParamsE 0x0000007100f3b1bc,U,000132,checkPreInitializeResourcesStillLoading 0x0000007100f3b240,U,007612,ksys::InitializeApp 0x0000007100f3cffc,O,000388,_ZN4ksys15initBaseProcMgrEPN4sead4HeapE diff --git a/src/KingSystem/ksys.cpp b/src/KingSystem/ksys.cpp index e370b0038..f85048890 100644 --- a/src/KingSystem/ksys.cpp +++ b/src/KingSystem/ksys.cpp @@ -4,7 +4,9 @@ #include "KingSystem/ActorSystem/actBaseProcCreateTaskSelector.h" #include "KingSystem/ActorSystem/actBaseProcInitializer.h" #include "KingSystem/ActorSystem/actBaseProcMgr.h" +#include "KingSystem/System/BasicProfiler.h" #include "KingSystem/System/HavokWorkerMgr.h" +#include "KingSystem/System/UI/LayoutResourceMgr.h" namespace ksys { @@ -29,4 +31,22 @@ void initBaseProcMgr(sead::Heap* heap) { act::BaseProcMgr::sConstant4 = u32(act::JobType::Calc4); } +void preInitializeApp(InitParams* params) { + ksys::BasicProfiler::push("ksys::PreInitializeApp"); + + // TODO - other parts + + ksys::BasicProfiler::push("RequestFontLoad"); + // TODO: FontMgr::createInstance() + ui::LayoutResourceMgr::createInstance(params->king_sys_heap); + ui::LayoutResourceMgr::instance()->init(params->king_sys_heap); + ui::LayoutResourceMgr::instance()->loadLangFont(params->king_sys_heap); + ui::LayoutResourceMgr::instance()->loadExtraLangFonts(params->king_sys_heap); + ksys::BasicProfiler::pop("RequestFontLoad"); + + // TODO - other parts + + ksys::BasicProfiler::pop("ksys::PreInitializeApp"); +} + } // namespace ksys diff --git a/src/KingSystem/ksys.h b/src/KingSystem/ksys.h index 4775ea4f4..4c5285819 100644 --- a/src/KingSystem/ksys.h +++ b/src/KingSystem/ksys.h @@ -6,6 +6,10 @@ class Heap; namespace ksys { +struct InitParams { + sead::Heap* king_sys_heap; +}; + // 0x0000007100f3a4e4 bool isGameOver(); // 0x0000007100f3a4f0 @@ -13,4 +17,7 @@ void setIsGameOver(bool is_game_over); void initBaseProcMgr(sead::Heap* heap); +// 0x0000007100f3a8d8 +void preInitializeApp(InitParams* params); + } // namespace ksys