diff --git a/data/uking_functions.csv b/data/uking_functions.csv index f6f94977..b22818ff 100644 --- a/data/uking_functions.csv +++ b/data/uking_functions.csv @@ -88328,8 +88328,8 @@ Address,Quality,Size,Name 0x00000071010a2294,U,000008, 0x00000071010a229c,U,000040, 0x00000071010a22c4,U,000372, -0x00000071010a2438,U,000112, -0x00000071010a24a8,U,000120, +0x00000071010a2438,W,000112,_ZN4ksys2ui17LayoutResourceMgr18SingletonDisposer_D0Ev +0x00000071010a24a8,W,000120,_ZN4ksys2ui17LayoutResourceMgr18SingletonDisposer_D1Ev 0x00000071010a2520,O,000284,_ZN4ksys2ui17LayoutResourceMgr14createInstanceEPN4sead4HeapE 0x00000071010a263c,O,000268,_ZN4ksys2ui17LayoutResourceMgr4initEPN4sead4HeapE 0x00000071010a2748,O,000424,_ZN4ksys2ui17LayoutResourceMgr11loadMsgPackEPj @@ -88339,20 +88339,20 @@ Address,Quality,Size,Name 0x00000071010a2cf8,W,000680,_ZN4ksys2ui17LayoutResourceMgr18loadExtraLangFontsEPN4sead4HeapE 0x00000071010a2fa0,O,000188,_ZN4ksys2ui17LayoutResourceMgr18checkLangFontReadyEv 0x00000071010a305c,O,000136,_ZNK4ksys2ui17LayoutResourceMgr24checkExtraLangFontsReadyEv -0x00000071010a30e4,U,000136,LayoutResourceMgr::loadVersion +0x00000071010a30e4,O,000136,_ZN4ksys2ui17LayoutResourceMgr11loadVersionEv 0x00000071010a316c,U,000372,LayoutResourceMgr::ready_1 -0x00000071010a32e0,U,001584, +0x00000071010a32e0,U,001584,LayoutResourceMgr::loadALotOfResources 0x00000071010a3910,W,000064,_ZN4sead12PerfJobQueue13measureEndRunEv 0x00000071010a3950,U,000072,LayoutResourceMgr::loadLayoutCommonArchive 0x00000071010a3998,U,000288,LayoutResourceMgr::loadArcResource -0x00000071010a3ab8,U,000104, -0x00000071010a3b20,U,000208, -0x00000071010a3bf0,U,000016, -0x00000071010a3c00,U,000104, +0x00000071010a3ab8,U,000104,LayoutResourceMgr::deleteSOmething +0x00000071010a3b20,U,000208,LayoutResourceMgr::loadTitleResource +0x00000071010a3bf0,U,000016,LayoutResourceMgr::loadTitleResource2 +0x00000071010a3c00,U,000104,LayoutResourceMgr::deleteSomethingElse 0x00000071010a3c68,U,000264,LayoutResourceMgr::x -0x00000071010a3d70,U,000076, -0x00000071010a3dbc,U,000068, -0x00000071010a3e00,U,000168, +0x00000071010a3d70,U,000076,LayoutResourceMgr::x_0 +0x00000071010a3dbc,U,000068,LayoutResourceMgr::checkHorse +0x00000071010a3e00,U,000168,LayoutResourceMgr::pending 0x00000071010a3ea8,U,000104,ScreenLoadSaveIcon::ctor 0x00000071010a3f10,U,000044, 0x00000071010a3f3c,U,000048, diff --git a/src/KingSystem/System/UI/ArcResource.h b/src/KingSystem/System/UI/ArcResource.h new file mode 100644 index 00000000..152855bd --- /dev/null +++ b/src/KingSystem/System/UI/ArcResource.h @@ -0,0 +1,21 @@ +#pragma once + +#include +#include +#include "KingSystem/System/UI/ArcResourceMgr.h" + +namespace ksys::ui { + +class ArcResourceMgr; + +class ArcResource : public sead::IDisposer { +private: + void* _20; + void* _28; + ArcResourceMgr* mArcResourceMgr; + sead::FixedSafeString<0x40> mName; + u8* mData; + void* mResource; +}; + +} diff --git a/src/KingSystem/System/UI/LayoutResourceMgr.cpp b/src/KingSystem/System/UI/LayoutResourceMgr.cpp index 1dd667b2..b2e098e8 100644 --- a/src/KingSystem/System/UI/LayoutResourceMgr.cpp +++ b/src/KingSystem/System/UI/LayoutResourceMgr.cpp @@ -9,6 +9,7 @@ namespace ksys::ui { SEAD_SINGLETON_DISPOSER_IMPL(LayoutResourceMgr) +LayoutResourceMgr::~LayoutResourceMgr() = default; void LayoutResourceMgr::init(sead::Heap* heap) { mMsgPackHandle = new (heap) res::Handle; @@ -75,13 +76,14 @@ void LayoutResourceMgr::loadLangFont(sead::Heap* heap) { mLangFontHandle->load(path, &req, nullptr); } -constexpr const char* cExtraFontFiles[12] = { - "AsiaKCUBE-R", "AsiaKDREAM2R", "AsiaKDREAM4R", "AsiaKDREAM7R", "DFP_GBZY9", "DFP_GB_H3", - "DFP_GB_H5", "DFHEI5A", "DFT_ZY9", "DFT_B3", "DFT_B5", "DFT_B9"}; +constexpr const char* cExtraFontFiles[3][4] = { + {"AsiaKCUBE-R", "AsiaKDREAM2R", "AsiaKDREAM4R", "AsiaKDREAM7R"}, + {"DFP_GBZY9", "DFP_GB_H3", "DFP_GB_H5", "DFHEI5A", }, + { "DFT_ZY9", "DFT_B3", "DFT_B5", "DFT_B9"}}; void LayoutResourceMgr::loadExtraLangFonts(sead::Heap* heap) { sead::RegionLanguageID lang_id = sead::EnvUtil::getRegionLanguage(); - const char* const* fonts = cExtraFontFiles; + auto* fonts = cExtraFontFiles; for (int i = 0; i <= 2; i++) { if (lang_id.value() == sead::RegionLanguageID::KRko + i) { break; @@ -89,7 +91,7 @@ void LayoutResourceMgr::loadExtraLangFonts(sead::Heap* heap) { if (i == 2) { return; } - fonts += 4; + fonts++; } res::LoadRequest req; @@ -104,6 +106,7 @@ void LayoutResourceMgr::loadExtraLangFonts(sead::Heap* heap) { path.format("Font/Font_%s.bfttf", fonts[i]); handle->requestLoad(path, &req, &status); } + mZeldaGlyphHandle->requestLoad("Font/ZeldaGlyphs-v2-Deco.bfotf", &req, &status); nn::pl::RequestSharedFontLoad(nn::pl::SharedFontType::Unknown); } @@ -139,4 +142,12 @@ bool LayoutResourceMgr::checkExtraLangFontsReady() const { return false; } +void LayoutResourceMgr::loadVersion() { + res::LoadRequest req; + req.mRequester = "LayoutResourceMgr"; + req._26 = false; + + mVersionHandle->requestLoad("System/Version.txt", &req, nullptr); +} + } // namespace ksys::ui diff --git a/src/KingSystem/System/UI/LayoutResourceMgr.h b/src/KingSystem/System/UI/LayoutResourceMgr.h index 838f2d3e..76f36d65 100644 --- a/src/KingSystem/System/UI/LayoutResourceMgr.h +++ b/src/KingSystem/System/UI/LayoutResourceMgr.h @@ -23,14 +23,24 @@ class LayoutResourceMgr { virtual ~LayoutResourceMgr(); public: + void init(sead::Heap* heap); u8* loadMsgPack(u32* size); void loadLangFont(sead::Heap* heap); void loadExtraLangFonts(sead::Heap* heap); bool checkLangFontReady(); bool checkExtraLangFontsReady() const; + void loadVersion(); private: + + class Archive { + public: + res::Handle* mHandle = nullptr; + void* _8 = nullptr; + void* _sizeA8Buf = nullptr; + }; + res::Handle* mMsgPackHandle = nullptr; res::Handle* mLangFontHandle = nullptr; res::Handle* mVersionHandle = nullptr; @@ -38,19 +48,13 @@ private: res::Handle* mZeldaGlyphHandle = nullptr; ArcResourceMgr* mArcResourceMgr = nullptr; sead::DirectResource* mLangFontResource = nullptr; - void* _a8 = nullptr; - void* _b0 = nullptr; - void* _b8 = nullptr; - void* mTitleLayoutArchiveTodo = nullptr; - void* _c8 = nullptr; - u64 mSizexA8BufTodo = 0; - res::Handle* mHorseLayoutResu = nullptr; - u64 _e0 = 0; - u64 _e8 = 0; + Archive _a8; + Archive mTitleLayout; + Archive mHorseLayout; u16 mMaxDefArtLen = 0; u16 mMaxIndefArtLen = 0; sead::FixedSafeString<16> mVersionString; - int _120 = 0; + int mHorseLayoutLoadCount = 0; sead::CriticalSection mCriticalSection; }; KSYS_CHECK_SIZE_NX150(LayoutResourceMgr, 0x168);