This commit is contained in:
Yanis002
2025-03-20 13:49:10 +01:00
parent d8015068aa
commit e20137b303
6 changed files with 315 additions and 22 deletions
+6 -10
View File
@@ -3,7 +3,7 @@
void func_0203b920(void);
void func_02011da0(void);
void func_0203cdb8(void);
void CallStaticInitializers(void);
void main(void);
void func_02000a78(void);
@@ -93,7 +93,7 @@ ARM void Entry(void) {
func_0203b920();
func_02011da0();
func_0203cdb8();
CallStaticInitializers();
main();
}
@@ -108,11 +108,9 @@ ARM void* func_0200093c(unk32 param1, u32* param2, unk32 param3) {
return param2;
}
void AutoloadCallback(void) {
}
void AutoloadCallback(void) {}
void func_02000b60(void) {
}
void func_02000b60(void) {}
BuildInfo gBuildInfo = {
.mUnk_00 = data_0204cde0,
@@ -125,10 +123,8 @@ BuildInfo gBuildInfo = {
.mUnk_1C = 0x04027539,
.mUnk_20 = 0xDEC00621,
"\xDE\xC0\x06![SDK+NINTENDO:BACKUP]",
"[SDK+MEI:libASR_V1.0.5-CW2.0-SDK4.0]"
"[SDK+MEI:libASR_V1.0.5-CW2.0-SDK4.0]",
};
// non-matching
void main(void) {
data_02049a2c->func_02013394();
}
void main(void) { data_02049a2c->func_02013394(); }
+91
View File
@@ -0,0 +1,91 @@
#include "System/OverlayManager.hpp"
#include "global.h"
#include "nitro/Overlay.h"
struct UnkStruct_020ee698 {
/* 00 */ unk8 mUnk_00[0x2C];
/* 2c */ unk32 mUnk_2c;
/* 30 */
};
extern UnkStruct_020ee698 data_ov000_020ee698;
struct OverlaySetup {
/* 00 */ unk8 mUnk_00;
/* 01 */ unk8 mUnk_01;
/* 02 */ unk8 mUnk_02;
/* 03 */ unk8 mUnk_03;
/* 04 */ OverlayId slot1Overlay;
/* 08 */ OverlayId slot2Overlay;
/* 0c */ OverlayId slot3Overlay;
/* 10 */ OverlayId slot12Overlay;
/* 14 */ void* mUnk_14;
/* 18 */ void* mUnk_18;
/* 1c */
};
extern OverlaySetup gOverlaySetups[];
extern u32* data_027e0ce0[];
extern u32 data_0203e0e8[]; // seems to contain overlay IDs
extern "C" void func_ov007_02102850(u32**);
extern "C" void func_ov007_021028a0(u32**);
THUMB void OverlayManager::LoadIfNotLoaded(OverlayIndex index, OverlayId id) {
OverlayId loadedId = gOverlayManager.mLoadedOverlays[index];
if (id != loadedId) {
this->Unload(index);
this->Load(index, id);
}
}
THUMB void OverlayManager::Load(OverlayIndex index, OverlayId id) {
if (id != OverlayId_None) {
Overlay_Load(NULL, data_0203e0e8[id]);
}
gOverlayManager.mLoadedOverlays[index] = id;
}
THUMB void OverlayManager::Unload(OverlayIndex index) {
OverlayId loadedId = gOverlayManager.mLoadedOverlays[index];
if (loadedId != OverlayId_None) {
Overlay_Unload(NULL, data_0203e0e8[index]);
gOverlayManager.mLoadedOverlays[index] = OverlayId_None;
}
}
//! TODO: solve the .word issue with the overlay IDs
//! both functions should match otherwise
THUMB void OverlayManager::LoadOverlaySetup(s32 index) {
OverlayId overlayId;
OverlaySetup* pSetup;
pSetup = &gOverlaySetups[index];
this->LoadIfNotLoaded(OverlayIndex_1, pSetup->slot1Overlay);
this->LoadIfNotLoaded(OverlayIndex_2, pSetup->slot2Overlay);
if (index == 5) {
func_ov007_02102850(data_027e0ce0);
} else {
overlayId = pSetup->slot12Overlay;
if (index == 6 && data_ov000_020ee698.mUnk_2c == 2) {
overlayId = OverlayId_61;
}
this->Load(OverlayIndex_3, pSetup->slot3Overlay);
this->Load(OverlayIndex_12, overlayId);
}
}
THUMB void OverlayManager::UnloadOverlaySetup() {
this->Unload(OverlayIndex_12);
this->Unload(OverlayIndex_3);
if (this->mLoadedOverlays[2] == OverlayId_07) {
func_ov007_021028a0(data_027e0ce0);
this->Unload(OverlayIndex_2);
}
}