checkXXXReady

This commit is contained in:
Pistonight 2024-08-07 22:56:19 -07:00
parent f54b9e229e
commit 181a709d09
3 changed files with 42 additions and 5 deletions

View File

@ -88337,8 +88337,8 @@ Address,Quality,Size,Name
0x00000071010a2a70,W,000260,_ZN4ksys2ui17LayoutResourceMgr12loadLangFontEPN4sead4HeapE
0x00000071010a2b74,U,000388,LayoutResourceMgr::__auto0
0x00000071010a2cf8,W,000680,_ZN4ksys2ui17LayoutResourceMgr18loadExtraLangFontsEPN4sead4HeapE
0x00000071010a2fa0,U,000188,LayoutResourceMgr::ready
0x00000071010a305c,U,000136,LayoutResourceMgr::ready_0
0x00000071010a2fa0,O,000188,_ZN4ksys2ui17LayoutResourceMgr18checkLangFontReadyEv
0x00000071010a305c,O,000136,_ZNK4ksys2ui17LayoutResourceMgr24checkExtraLangFontsReadyEv
0x00000071010a30e4,U,000136,LayoutResourceMgr::loadVersion
0x00000071010a316c,U,000372,LayoutResourceMgr::ready_1
0x00000071010a32e0,U,001584,

Can't render this file because it is too large.

View File

@ -117,7 +117,38 @@ void LayoutResourceMgr::loadExtraLangFonts(sead::Heap* heap) {
handle->requestLoad(path, &req, &status);
}
mZeldaGlyphHandle->requestLoad("Font/ZeldaGlyphs-v2-Deco.bfotf", &req, &status);
nn::pl::RequestSharedFontLoad(0);
nn::pl::RequestSharedFontLoad(nn::pl::SharedFontType::Unknown);
}
bool LayoutResourceMgr::checkLangFontReady() {
if (mLangFontResource) {
return true;
}
if (!mLangFontHandle->isReady()) {
return false;
}
mLangFontResource = sead::DynamicCast<sead::DirectResource>(mLangFontHandle->getResource());
return true;
}
bool LayoutResourceMgr::checkExtraLangFontsReady() const {
switch (sead::EnvUtil::getRegionLanguage().value()) {
case sead::RegionLanguageID::KRko:
case sead::RegionLanguageID::CNzh:
case sead::RegionLanguageID::TWzh:
break;
default:
return true;
}
for (const auto& handle : mExtraLangFontHandles) {
if (!handle.isReady()) {
return false;
}
}
if (!mZeldaGlyphHandle || mZeldaGlyphHandle->isReady()) {
return nn::pl::GetSharedFontLoadState(nn::pl::SharedFontType::Unknown) == 1;
}
return false;
}
} // namespace ksys::ui

View File

@ -10,7 +10,11 @@
#include "ArcResourceMgr.h"
namespace nn::pl {
u64 RequestSharedFontLoad(int);
enum SharedFontType : int {
Unknown = 0
};
u64 RequestSharedFontLoad(nn::pl::SharedFontType type);
u32 GetSharedFontLoadState(nn::pl::SharedFontType type);
}
namespace ksys::ui {
@ -26,6 +30,8 @@ public:
u8* loadMsgPack(u32* size);
void loadLangFont(sead::Heap* heap);
void loadExtraLangFonts(sead::Heap* heap);
bool checkLangFontReady();
bool checkExtraLangFontsReady() const;
private:
res::Handle* mMsgPackHandle = nullptr;
@ -34,7 +40,7 @@ private:
sead::FixedPtrArray<res::Handle, 8> mExtraLangFontHandles;
res::Handle* mZeldaGlyphHandle = nullptr;
ArcResourceMgr* mArcResourceMgr = nullptr;
res::Handle* mLangFontRes = nullptr;
sead::DirectResource* mLangFontResource = nullptr;
void* _a8 = nullptr;
void* _b0 = nullptr;
void* _b8 = nullptr;