Skip to content

Commit

Permalink
fixed mismatches
Browse files Browse the repository at this point in the history
  • Loading branch information
Pistonight committed Aug 11, 2024
1 parent aca7f8d commit 9ffec4e
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 51 deletions.
32 changes: 16 additions & 16 deletions data/uking_functions.csv
Original file line number Diff line number Diff line change
Expand Up @@ -39763,7 +39763,7 @@ Address,Quality,Size,Name
0x0000007100654244,U,000076,apQueryNavMeshFace
0x0000007100654290,U,000008,apQueryUnknown
0x0000007100654298,U,000916,sinitSomeBfevflStrings
0x000000710065462c,U,000100,_ZN4sead15DebugFontMgrNvn18SingletonDisposer_D1Ev
0x000000710065462c,O,000100,_ZN4sead15DebugFontMgrNvn18SingletonDisposer_D1Ev
0x0000007100654690,U,000108,
0x00000071006546fc,W,000140,_ZN4ksys3map16AutoPlacementMgr14createInstanceEPN4sead4HeapE
0x0000007100654788,O,000088,_ZN4ksys3map16AutoPlacementMgr14deleteInstanceEv
Expand Down Expand Up @@ -54787,7 +54787,7 @@ Address,Quality,Size,Name
0x00000071009221ec,U,000012,
0x00000071009221f8,U,000012,
0x0000007100922204,U,000008,
0x000000710092220c,U,000008,_ZNK4sead15DebugFontMgrNvn12getCharWidthEDs
0x000000710092220c,O,000008,_ZNK4sead15DebugFontMgrNvn12getCharWidthEDs
0x0000007100922214,U,000008,
0x000000710092221c,U,000012,
0x0000007100922228,U,000012,
Expand Down Expand Up @@ -63192,33 +63192,33 @@ Address,Quality,Size,Name
0x0000007100afe640,U,000024,
0x0000007100afe658,U,000100,
0x0000007100afe6bc,U,000108,
0x0000007100afe728,U,000168,_ZN4sead19DebugFontMgrJis1Nvn14createInstanceEPNS_4HeapE
0x0000007100afe728,M,000168,_ZN4sead19DebugFontMgrJis1Nvn14createInstanceEPNS_4HeapE
0x0000007100afe7d0,U,000004,nullsub_3181
0x0000007100afe7d4,U,000004,j__ZdlPv_592
0x0000007100afe7d8,U,000300,_ZN4sead19DebugFontMgrJis1Nvn10initializeEPNS_4HeapEPKcS4_S4_j
0x0000007100afe7d8,M,000300,_ZN4sead19DebugFontMgrJis1Nvn10initializeEPNS_4HeapEPKcS4_S4_j
0x0000007100afe904,U,001252,
0x0000007100afede8,U,000044,_ZN4sead19DebugFontMgrJis1Nvn22swapUniformBlockBufferEv
0x0000007100afee14,U,000008,_ZNK4sead19DebugFontMgrJis1Nvn9getHeightEv
0x0000007100afee1c,U,000008,_ZNK4sead19DebugFontMgrJis1Nvn8getWidthEv
0x0000007100afee24,U,000024,_ZNK4sead19DebugFontMgrJis1Nvn12getCharWidthEDs
0x0000007100afede8,O,000044,_ZN4sead19DebugFontMgrJis1Nvn22swapUniformBlockBufferEv
0x0000007100afee14,O,000008,_ZNK4sead19DebugFontMgrJis1Nvn9getHeightEv
0x0000007100afee1c,O,000008,_ZNK4sead19DebugFontMgrJis1Nvn8getWidthEv
0x0000007100afee24,O,000024,_ZNK4sead19DebugFontMgrJis1Nvn12getCharWidthEDs
0x0000007100afee3c,U,000008,
0x0000007100afee44,U,000044,_ZNK4sead19DebugFontMgrJis1Nvn5beginEPNS_11DrawContextE
0x0000007100afee44,O,000044,_ZNK4sead19DebugFontMgrJis1Nvn5beginEPNS_11DrawContextE
0x0000007100afee70,U,000004,_ZN2nn4ui2d13FontContainerD2Ev
0x0000007100afee74,U,000836,_ZNK4sead19DebugFontMgrJis1Nvn5printEPNS_11DrawContextERKNS_10ProjectionERKNS_6CameraERKNS_8Matrix34IfEERKNS_7Color4fEPKvi
0x0000007100aff1b8,U,000008,
0x0000007100aff1c0,U,000100,
0x0000007100aff224,U,000108,
0x0000007100aff290,U,000164,_ZN4sead15DebugFontMgrNvn14createInstanceEPNS_4HeapE
0x0000007100aff290,O,000164,_ZN4sead15DebugFontMgrNvn14createInstanceEPNS_4HeapE
0x0000007100aff334,U,000004,nullsub_3183
0x0000007100aff338,U,000004,j__ZdlPv_593
0x0000007100aff33c,U,000240,_ZN4sead15DebugFontMgrNvn10initializeEPNS_4HeapEPKcS4_j
0x0000007100aff33c,O,000240,_ZN4sead15DebugFontMgrNvn10initializeEPNS_4HeapEPKcS4_j
0x0000007100aff42c,U,001188,_ZN4sead15DebugFontMgrNvn20initializeFromBinaryEPNS_4HeapEPvmS3_mj
0x0000007100aff8d0,U,000044,_ZN4sead15DebugFontMgrNvn22swapUniformBlockBufferEv
0x0000007100aff8fc,U,000008,_ZNK4sead15DebugFontMgrNvn9getHeightEv
0x0000007100aff8d0,O,000044,_ZN4sead15DebugFontMgrNvn22swapUniformBlockBufferEv
0x0000007100aff8fc,O,000008,_ZNK4sead15DebugFontMgrNvn9getHeightEv
0x0000007100aff904,U,000008,
0x0000007100aff90c,U,000008,
0x0000007100aff914,U,000008,
0x0000007100aff91c,U,000044,_ZNK4sead15DebugFontMgrNvn5beginEPNS_11DrawContextE
0x0000007100aff91c,O,000044,_ZNK4sead15DebugFontMgrNvn5beginEPNS_11DrawContextE
0x0000007100aff948,U,000004,nullsub_3184
0x0000007100aff94c,U,000716,_ZNK4sead15DebugFontMgrNvn5printEPNS_11DrawContextERKNS_10ProjectionERKNS_6CameraERKNS_8Matrix34IfEERKNS_7Color4fEPKvi
0x0000007100affc18,U,000008,
Expand Down Expand Up @@ -64200,7 +64200,7 @@ Address,Quality,Size,Name
0x0000007100b2e4b8,U,000092,sead::MethodTreeMgr::rtti2
0x0000007100b2e514,U,000028,_ZN3agl3utl16DebugTexturePageD2Ev
0x0000007100b2e530,U,000004,nullsub_6141
0x0000007100b2e534,U,000008,_ZN4sead15DrawLockContext4lockEv
0x0000007100b2e534,O,000008,_ZN4sead15DrawLockContext4lockEv
0x0000007100b2e53c,U,000008,
0x0000007100b2e544,U,000012,
0x0000007100b2e550,U,000004,nullsub_3254
Expand Down Expand Up @@ -88336,7 +88336,7 @@ Address,Quality,Size,Name
0x00000071010a28f0,U,000384,LayoutResourceMgr::loadGrammarArticleMaxLen
0x00000071010a2a70,O,000260,_ZN4ksys2ui17LayoutResourceMgr12loadLangFontEPN4sead4HeapE
0x00000071010a2b74,U,000388,LayoutResourceMgr::initializeFontMgr
0x00000071010a2cf8,W,000680,_ZN4ksys2ui17LayoutResourceMgr18loadExtraLangFontsEPN4sead4HeapE
0x00000071010a2cf8,O,000680,_ZN4ksys2ui17LayoutResourceMgr18loadExtraLangFontsEPN4sead4HeapE
0x00000071010a2fa0,O,000188,_ZN4ksys2ui17LayoutResourceMgr18checkLangFontReadyEv
0x00000071010a305c,O,000136,_ZNK4ksys2ui17LayoutResourceMgr24checkExtraLangFontsReadyEv
0x00000071010a30e4,O,000136,_ZN4ksys2ui17LayoutResourceMgr11loadVersionEv
Expand Down
37 changes: 14 additions & 23 deletions src/KingSystem/System/UI/LayoutResourceMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ void LayoutResourceMgr::init(sead::Heap* heap) {
mMsgPackHandle = new (heap) res::Handle;
mLangFontHandle = new (heap) res::Handle;
mVersionHandle = new (heap) res::Handle;

int count;
// value() needed because operator int() is volatile
switch (sead::EnvUtil::getRegionLanguage().value()) {
case sead::RegionLanguageID::KRko:
case sead::RegionLanguageID::CNzh:
case sead::RegionLanguageID::TWzh:
count = 4;
count = cExtraLangFontCount;
break;
default:
count = 0;
Expand Down Expand Up @@ -69,49 +69,41 @@ void LayoutResourceMgr::loadLangFont(sead::Heap* heap) {
req._26 = false;

sead::FixedSafeString<0x20> path;
path.format("Font/Font_%s.bfarc", sead::EnvUtil2::getRegion().text());
path.format("Font/Font_%s.bfarc", sead::EnvUtil::getRegion().text());

mLangFontHandle->requestLoad(path, &req, nullptr);
}

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();
auto* fonts = cExtraFontFiles;
for (int i = 0; i <= 2; i++) {
auto* fonts = sExtraLangFontFiles;
for (int i = 0; i <= cExtraLangCount; i++) {
if (lang_id.value() == sead::RegionLanguageID::KRko + i) {
break;
}
if (i == 2) {
if (i == cExtraLangCount - 1) {
return;
}
fonts++;
fonts += cExtraLangFontCount;
}

res::LoadRequest req;
req.mRequester = "ui::LayoutResourceMgr";
req._26 = false;

// non-matching: reordering
res::Handle::Status status = res::Handle::Status::NoFile;
for (int i = 0; i < 4; ++i) {
for (int i = 0; i < cExtraLangFontCount; ++i) {
auto* handle = mExtraLangFontHandles[i];
sead::FixedSafeString<0x20> path;
path.format("Font/Font_%s.bfttf", fonts[i]);
#ifdef MATCHING_HACK_NX_CLANG
asm("");
#endif
path.format("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);
nn::pl::RequestSharedFontLoad(nn::pl::SharedFontType::STANDARD);
}

bool LayoutResourceMgr::checkLangFontReady() {
Expand Down Expand Up @@ -140,7 +132,7 @@ bool LayoutResourceMgr::checkExtraLangFontsReady() const {
}
}
if (!mZeldaGlyphHandle || mZeldaGlyphHandle->isReady()) {
return nn::pl::GetSharedFontLoadState(nn::pl::SharedFontType::Unknown) == 1;
return nn::pl::GetSharedFontLoadState(nn::pl::SharedFontType::STANDARD) == 1;
}
return false;
}
Expand All @@ -153,7 +145,6 @@ void LayoutResourceMgr::loadVersion() {
mVersionHandle->requestLoad("System/Version.txt", &req, nullptr);
}

// non-matching
bool LayoutResourceMgr::checkVersionReady() {
if (!mVersionHandle) {
return true;
Expand Down
23 changes: 11 additions & 12 deletions src/KingSystem/System/UI/LayoutResourceMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <container/seadObjArray.h>
#include <heap/seadDisposer.h>
#include <hostio/seadHostIONode.h>
#include <prim/seadSafeString.h>
#include <thread/seadCriticalSection.h>
#include "KingSystem/Resource/resHandle.h"
Expand All @@ -10,26 +11,22 @@
#include "KingSystem/Utils/Types.h"

namespace nn::pl {
enum SharedFontType : int { Unknown = 0 };
enum SharedFontType : int { STANDARD = 0 };
u64 RequestSharedFontLoad(nn::pl::SharedFontType type);
u32 GetSharedFontLoadState(nn::pl::SharedFontType type);
} // namespace nn::pl
#include "prim/seadEnum.h"
namespace sead {
SEAD_ENUM(RegionID, Unknown);
class EnvUtil2 {
public:
static RegionID getRegion();
};
} // namespace sead

namespace ksys::ui {

class LayoutResourceMgr {
class LayoutResourceMgr final : sead::hostio::Node {
SEAD_SINGLETON_DISPOSER(LayoutResourceMgr)
LayoutResourceMgr() = default;
~LayoutResourceMgr() = default;

public:
static constexpr int cExtraLangFontCount = 4;
static constexpr int cExtraLangCount = 3;

private:
class Archive {
friend class LayoutResourceMgr;
Expand Down Expand Up @@ -63,8 +60,6 @@ class LayoutResourceMgr {
};

public:
virtual void this_class_has_vtable();

void init(sead::Heap* heap);
u8* loadMsgPack(u32* size);
void loadLangFont(sead::Heap* heap);
Expand Down Expand Up @@ -104,5 +99,9 @@ class LayoutResourceMgr {
sead::CriticalSection mCriticalSection;
};
KSYS_CHECK_SIZE_NX150(LayoutResourceMgr, 0x168);
constexpr const char* sExtraLangFontFiles[LayoutResourceMgr::cExtraLangCount *
LayoutResourceMgr::cExtraLangFontCount] = {
"AsiaKCUBE-R", "AsiaKDREAM2R", "AsiaKDREAM4R", "AsiaKDREAM7R", "DFP_GBZY9", "DFP_GB_H3",
"DFP_GB_H5", "DFHEI5A", "DFT_ZY9", "DFT_B3", "DFT_B5", "DFT_B9"};

} // namespace ksys::ui

0 comments on commit 9ffec4e

Please sign in to comment.