-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LayoutResourceMgr #130
LayoutResourceMgr #130
Conversation
sorry for the delay in reviewing this! could you rebase and fix the build failure? |
a6cf11f
to
15ecc89
Compare
Need open-ead/nnheaders#33 for one extra function, I will rebase again with the lib update |
137f40f
to
1fdcd46
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 3 files at r6, 1 of 4 files at r7, 2 of 6 files at r11, 2 of 4 files at r12, 1 of 1 files at r16, 1 of 3 files at r17, 2 of 3 files at r18, all commit messages.
Reviewable status: 10 of 12 files reviewed, 10 unresolved discussions (waiting on @Pistonight)
src/KingSystem/ksys.h
line 21 at r18 (raw file):
// 0x0000007100f3a8d8 void preInitializeApp(InitParams* params);
can this be a const ref instead of a pointer?
src/KingSystem/ksys.cpp
line 35 at r18 (raw file):
void preInitializeApp(InitParams* params) { ksys::BasicProfiler::push("ksys::PreInitializeApp");
nit: could you use ksys::BasicProfiler::Scope instead of pushing/popping manually?
src/KingSystem/System/UI/ArcResourceMgr.h
line 20 at r18 (raw file):
virtual void sub_10(); virtual void loadArchive(sead::ExpHeap* heap, const sead::SafeString& path);
are you sure this takes an ExpHeap and not a Heap? I'd be inclined to make this a Heap unless there's evidence that we need to use an ExpHeap (e.g. calling an ExpHeap member function).
src/KingSystem/System/UI/LayoutResourceMgr.h
line 15 at r18 (raw file):
namespace ksys::ui { class LayoutResourceMgr final : sead::hostio::Node {
public sead::hostio::Node
src/KingSystem/System/UI/LayoutResourceMgr.h
line 96 at r18 (raw file):
}; KSYS_CHECK_SIZE_NX150(LayoutResourceMgr, 0x168); constexpr const char* sExtraLangFontFiles[LayoutResourceMgr::cExtraLangCount *
can this be moved to the .cpp?
src/KingSystem/System/UI/LayoutResourceMgr.cpp
line 156 at r18 (raw file):
if (mVersionHandle->isReady()) { auto* resource = sead::DynamicCast<sead::DirectResource>(mVersionHandle->getResource()); instance()->mVersionString.copy(reinterpret_cast<const char*>(resource->getRawData()),
wait what? they used the singleton instance pointer instead of just... setting mVersionString directly? lol
src/KingSystem/System/UI/LayoutResourceMgr.cpp
line 214 at r18 (raw file):
bool LayoutResourceMgr::loadHorseLayoutResource() { sead::ScopedLock<sead::CriticalSection> lock(&mCriticalSection);
nit: use sead::makeScopedLock so you don't have to write sead::ScopedLock<sead::CriticalSection>
(ideally this would be sead::ScopedLock lock(...)
but CTAD is a C++17 feature that unfortunately isn't implemented in Clang 4.0...)
src/KingSystem/System/UI/LayoutResourceMgr.cpp
line 228 at r18 (raw file):
bool LayoutResourceMgr::unloadHorseLayout() { sead::ScopedLock<sead::CriticalSection> lock(&mCriticalSection);
nit: sead::makeScopedLock
src/KingSystem/System/UI/LayoutResourceMgr.cpp
line 240 at r18 (raw file):
bool LayoutResourceMgr::loadArcResource(Archive& archive, const char* name) { if (!archive.getResource()) {
nit: can we invert some of these if statements to return early?
tools/format_data_symbols.py
line 13 at r18 (raw file):
if not line: continue hex = "0x" + (line[2:18].upper())
the parsing is a bit rough here heh - consider using the (built-in) csv module?
1fdcd46
to
c2321b7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 5 of 12 files reviewed, 8 unresolved discussions (waiting on @leoetlino)
src/KingSystem/System/UI/ArcResourceMgr.h
line 20 at r18 (raw file):
Previously, leoetlino (Léo Lam) wrote…
are you sure this takes an ExpHeap and not a Heap? I'd be inclined to make this a Heap unless there's evidence that we need to use an ExpHeap (e.g. calling an ExpHeap member function).
It's only used in new and assigning to sead::ResourceMgr::LoadArg. Will change to Heap
src/KingSystem/System/UI/LayoutResourceMgr.h
line 15 at r18 (raw file):
Previously, leoetlino (Léo Lam) wrote…
public sead::hostio::Node
Done.
src/KingSystem/System/UI/LayoutResourceMgr.h
line 96 at r18 (raw file):
Previously, leoetlino (Léo Lam) wrote…
can this be moved to the .cpp?
Done.
src/KingSystem/System/UI/LayoutResourceMgr.cpp
line 156 at r18 (raw file):
Previously, leoetlino (Léo Lam) wrote…
wait what? they used the singleton instance pointer instead of just... setting mVersionString directly? lol
yes, I checked specifically using mVersionString does not match
tools/format_data_symbols.py
line 13 at r18 (raw file):
Previously, leoetlino (Léo Lam) wrote…
the parsing is a bit rough here heh - consider using the (built-in) csv module?
Done.
c2321b7
to
dcff8f3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 5 of 12 files reviewed, 7 unresolved discussions (waiting on @leoetlino)
src/KingSystem/ksys.h
line 21 at r18 (raw file):
Previously, leoetlino (Léo Lam) wrote…
can this be a const ref instead of a pointer?
Yeah, doesn't look like it's mutated in the function
src/KingSystem/System/UI/LayoutResourceMgr.cpp
line 240 at r18 (raw file):
Previously, leoetlino (Léo Lam) wrote…
nit: can we invert some of these if statements to return early?
Simplied 1 level of nesting
dcff8f3
to
c4e0a55
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 3 files at r18, 5 of 5 files at r19, 3 of 3 files at r20, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @Pistonight)
All LayoutResourceMgr functions should match except for 3 that depend on
eui
which are undecompiledNeeds open-ead/sead#143 for
sead::EnvUtil::getRegion
Needs #129 for
nn::pl
- then the forward decl I added temporarily can be deletedAlso sorted
data_symbols.py
by address and added a script to do thatThis change is