Decompile overlay 17 (CourseExec Part 2) (#155)

* UnkStruct_027e09b4_017 (part 1?) OK

* code_020c0b24_017 68%

* rename file

* AdventureModeManager_15C_20_00_017 96%

* AdventureModeManager_15C_017 OK

* match remaining .init, .ctor and .bss

* fix build issues on other versions

* UnkStruct_027e0cec_017 OK

* UnkStruct_027e0cf8_017 OK

* UnkStruct_ov024_020d86a0_017 OK

* UnkStruct_027e09c0_017 OK

* UnkStruct_027e0cec_18_017 OK

* fix other versions build

* code_020c201c_017 OK

* SaveManager_017 OK

* remove extern "C"s

* port progression to the other versions

* ninja format

* fix regressions
This commit is contained in:
Yanis
2026-10-07 00:35:38 +02:00
committed by GitHub
parent 46f5ed79bf
commit 6d7abbdfec
138 changed files with 5134 additions and 2810 deletions
+13 -17
View File
@@ -3,13 +3,13 @@
#include "Unknown/UnkStruct_02049b80.hpp"
#include "Unknown/UnkStruct_02049bd4.hpp"
#include <cstddef>
#include <nitro/card.h>
#include <wstring.h>
extern "C" {
unk32 func_020328c8(void *, void *, size_t);
bool func_ov000_020a0a90(size_t param1, void *param2, size_t param3);
void func_ov000_020a0b58();
};
const size_t data_ov019_020d1bd4[] = {
@@ -39,7 +39,7 @@ void SaveManager::func_ov019_020d086c(u16 param1) {
if (gSaveManager.mUnk_210 != 2) {
gSaveManager.mUnk_210 = 0;
} else {
func_ov000_020a0b58();
gSaveManager.func_ov000_020a0b58();
}
}
@@ -201,9 +201,8 @@ void SaveFile::func_ov019_020d0d50() {
CARD_WriteAndVerifyFlashAsync((u32) stack, (void *) (SAVE_DATA_SIZE * 2), sizeof(stack_struct) * 2, NULL, NULL);
}
// https://decomp.me/scratch/gJJbb
void SaveFile::func_ov019_020d0e18(unk32 param1) {
size_t offset = param1 * SAVE_DATA_SIZE;
size_t offset = SAVE_FILE_OFFSET(param1);
SaveSlot *puVar3 = &this->mSlots[param1];
if (!func_ov000_020a0a90(offset + offsetof(SaveSlot, mInfoData), &puVar3->mInfoData, sizeof(puVar3->mInfoData))) {
@@ -249,9 +248,8 @@ void SaveSlot::func_ov019_020d1400(SaveFile_00000_2600_Data *param1) {
MI_CpuCopyFast(param1, (u8 *) param1 + sizeof(SaveFile_00000_2600_Data), sizeof(SaveFile_00000_2600_Data));
}
// non-matching
void SaveFile::func_ov019_020d1434() {
size_t offset = this->mSaveSlotIndex * SAVE_DATA_SIZE;
size_t offset = SAVE_FILE_OFFSET(this->mSaveSlotIndex);
SaveSlot::func_ov019_020d14fc(this->mSlots[this->mSaveSlotIndex].mInfoData);
if (!func_ov000_020a0a90(offset, &this->mSlots[this->mSaveSlotIndex].mInfoData,
@@ -278,20 +276,18 @@ void SaveSlot::func_ov019_020d14fc(SaveInfoData *param1) {
MI_CpuCopyFast(param1, (u8 *) param1 + sizeof(SaveInfoData), sizeof(SaveInfoData));
}
//! TODO: weird sizeof
void SaveFile::func_ov019_020d1538() {
size_t offset;
offset = this->mSaveSlotIndex * SAVE_DATA_SIZE;
size_t offset = this->mSaveSlotIndex * SAVE_DATA_SIZE;
SaveSlot::func_ov019_020d1600(this->mSlots[this->mSaveSlotIndex].mTreasureData);
if (!func_ov000_020a0a90(offset + offsetof(SaveSlot, mTreasureData), &this->mSlots[this->mSaveSlotIndex].mTreasureData,
0x1C00)) {
sizeof(SaveInfoData) * 2)) {
return;
}
SaveSlot::func_ov019_020d15cc(this->mSlots[this->mSaveSlotIndex].mUnk_2500);
if (!func_ov000_020a0a90(offset + offsetof(SaveSlot, mUnk_2500), &this->mSlots[this->mSaveSlotIndex].mUnk_2500, 0x800)) {
if (!func_ov000_020a0a90(offset + offsetof(SaveSlot, mUnk_2500), &this->mSlots[this->mSaveSlotIndex].mUnk_2500,
sizeof(SaveFile_00000_1D00_Data) * 2)) {
return;
}
@@ -304,14 +300,14 @@ void SaveSlot::func_ov019_020d15cc(SaveFile_00000_2500_Data *param1) {
}
void SaveSlot::func_ov019_020d1600(SaveTreasureData *param1) {
param1->unk_7E = func_020328c8(&gSaveManager.mUnk_004, param1, offsetof(SaveTreasureData, unk_7E));
param1->unk_5C.unk_22 = func_020328c8(&gSaveManager.mUnk_004, param1,
offsetof(SaveTreasureData, unk_5C) + offsetof(TreasureManager_5C, unk_22));
MI_CpuCopyFast(param1, (u8 *) param1 + sizeof(SaveTreasureData), sizeof(SaveTreasureData));
}
// https://decomp.me/scratch/ibnQS
void SaveFile::func_ov019_020d1634() {
SaveSlot *pSlot = &this->mSlots[this->mSaveSlotIndex];
size_t offset = this->mSaveSlotIndex * SAVE_DATA_SIZE;
size_t offset = SAVE_FILE_OFFSET(this->mSaveSlotIndex);
for (int i = 0; i < NUM_UNK_BLOCKS; i++) {
if (GET_FLAG(pSlot->mInfoData[0].unk_C84.unk_00, i)) {
@@ -342,7 +338,7 @@ void SaveFile::func_ov019_020d16d0() {
for (int i = 0; i < NUM_UNK_BLOCKS; i++) {
if (pSub2->mInfoData[i >> 5].unk_C84.unk_00[0] & (1 << (i & 0x1F))) {
func_ov000_020a0a90(saveSlotIndex * SAVE_DATA_SIZE + i * SIZE_UNK_BLOCK + sizeof(SaveSlot),
func_ov000_020a0a90(SAVE_FILE_OFFSET(saveSlotIndex) + i * SIZE_UNK_BLOCK + sizeof(SaveSlot),
&this->mUnk_04E0C[i * SIZE_UNK_BLOCK], SIZE_UNK_BLOCK);
}
}
@@ -377,7 +373,7 @@ void SaveFile::func_ov019_020d1808(unk32 param1) {
stack1[SaveDataIndex_Treasures].mUnk_00 =
func_020328c8(&gSaveManager.mUnk_004, &pSub2->mTreasureData[i], sizeof(SaveTreasureData) - sizeof(u16));
stack1[SaveDataIndex_Treasures].mUnk_04 =
pSub2->mTreasureData[i].unk_7E == stack1[SaveDataIndex_Treasures].mUnk_00 ? true : false;
pSub2->mTreasureData[i].unk_5C.unk_22 == stack1[SaveDataIndex_Treasures].mUnk_00 ? true : false;
stack1[SaveDataIndex_02].mUnk_00 =
func_020328c8(&gSaveManager.mUnk_004, &pSub2->mUnk_1D00[i], sizeof(SaveFile_00000_1D00_Data) - sizeof(u16));