Misc Stuff 2 (#33)

* match UnkStruct_ov000_020b4f84_00_Base

* lots of random stuff

* match other funcs from game.cpp

* data_02049a2c -> gGame, UnkStruct_02049a2c -> Game

* match operator new

* fix regressions

* fix some warnings

* another round of random things

* another round of random things 2

* complete slots column in overlays.md

* add scene indices

* gamemode stuff

* misc stuff

* fix build issues

* document random things

* fix regressions

* final round of random things (for now)
This commit is contained in:
Yanis
2026-02-18 22:23:42 +01:00
committed by GitHub
parent 0b367ecdfb
commit 804b25cb90
72 changed files with 1758 additions and 553 deletions
+6 -6
View File
@@ -98,7 +98,7 @@ THUMB void ActorManager::func_ov001_020bb018(UnkStruct_func_ov001_020bb018_param
int aligned0A = ALIGN_NEXT(unk_0A, 8);
int aligned08 = ALIGN_NEXT(unk_08, 8);
int iVar5 = data_027e09a0->func_ov000_020702a8(data_027e09a4->mUnk_00)->mUnk_20;
int iVar5 = data_027e09a0->func_ov000_020702a8(data_027e09a4->mSceneIndex)->mUnk_20;
s32 allocCount;
if (data_027e09a4->mUnk_60 == 0) {
@@ -124,7 +124,7 @@ THUMB void ActorManager::func_ov001_020bb018(UnkStruct_func_ov001_020bb018_param
unk32 iVar5;
if (func_01ffd3b0() != 0) {
iVar5 = data_027e09a4->mUnk_00;
iVar5 = data_027e09a4->mSceneIndex;
if (iVar5 == 0x3E) {
this->mUnk_34 = 0xFFFFECCD; // ~0x1332
@@ -199,7 +199,7 @@ THUMB void ActorManager::func_ov001_020bb018(UnkStruct_func_ov001_020bb018_param
}
}
if (data_027e09a4->UnkCheck(data_027e09a4->mUnk_00)) {
if (data_027e09a4->UnkCheck(data_027e09a4->mSceneIndex)) {
func_ov071_0215e8d4();
}
@@ -212,7 +212,7 @@ THUMB void ActorManager::func_ov001_020bb018(UnkStruct_func_ov001_020bb018_param
THUMB void ActorManager::func_ov001_020bb414(ActorManager *instance) {
func_ov001_020ba59c(&data_0204999c);
if (data_027e09a4->UnkCheck(data_027e09a4->mUnk_00)) {
if (data_027e09a4->UnkCheck(data_027e09a4->mSceneIndex)) {
instance->func_ov001_020bb844();
}
@@ -244,7 +244,7 @@ THUMB void ActorManager::func_ov001_020bb488() {
data_027e0cf4->func_ov021_020f8cdc();
}
if (data_027e09a4->UnkCheck(data_027e09a4->mUnk_00)) {
if (data_027e09a4->UnkCheck(data_027e09a4->mSceneIndex)) {
data_027e0d70->func_ov068_0215e8f8();
}
}
@@ -264,7 +264,7 @@ THUMB void ActorManager::func_ov001_020bb548() {
i++;
}
unk32 value = data_027e09a4->mUnk_00;
unk32 value = data_027e09a4->mSceneIndex;
if (data_027e09a4->UnkCheck(value)) {
data_027e0d70->func_ov071_0215e9ac();
+23 -24
View File
@@ -1,8 +1,8 @@
#include "Game/GameModeStartUp.hpp"
#include "Game/Game.hpp"
#include "System/OverlayManager.hpp"
#include "System/SysFault.hpp"
#include "System/SysNew.hpp"
#include "Unknown/UnkStruct_02049a2c.hpp"
#include "Unknown/UnkStruct_02049b80.hpp"
#include "Unknown/UnkStruct_0204a110.hpp"
#include "Unknown/UnkStruct_0204e5f8.hpp"
@@ -12,7 +12,6 @@
#include "regs.h"
extern "C" {
void func_02013768(void *param1);
void func_020261f0(unk32 param1, void *param2);
void func_0201245c();
void func_02027a28(void *param1, unk32 param2);
@@ -51,24 +50,24 @@ ARM void SysFault::func_ov018_020c4840() {
this->mUnk_04 = 0;
}
ARM UnkStruct_02049a2c::UnkStruct_02049a2c() :
mUnk_00(NULL),
mUnk_04(0),
mUnk_08(0),
mUnk_10(0),
mUnk_14(0),
mUnk_18(0) {}
ARM Game::Game() :
mpCurrentGameMode(NULL),
createCallback(NULL),
mUnk_08(NULL),
mpSaveFile(NULL),
mUnk_14(NULL),
mUnk_18(NULL) {}
ARM void UnkStruct_02049a2c::func_ov018_020c48a4(unk32 param1) {
ARM void Game::func_ov018_020c48a4() {
func_020261f0(1, func_02013184);
func_020263bc(1);
func_020234d4(1);
func_02026ef0(&this->mUnk_20);
func_02026ef0(&this->mUnk_1C.mUnk_04);
func_02031e48(func_020131b0);
this->func_02013724(UnkStruct_02049a2c::func_ov018_020c4ba8);
this->TrySetCreateCallback((GameModeCreateCallback) Game::func_ov018_020c4ba8);
}
ARM void UnkStruct_02049a2c::func_ov018_020c48f8() {
ARM void Game::func_ov018_020c48f8() {
if (gOverlayManager.mLoadedOverlays[OverlaySlot_Second] != OverlayIndex_Second) {
data_02049ba0.LoadIfNotLoaded(OverlaySlot_Second, OverlayIndex_Second);
data_0204999c.func_ov018_020c4a5c();
@@ -80,12 +79,12 @@ ARM void UnkStruct_02049a2c::func_ov018_020c48f8() {
ARM UnkStruct_02049b18::UnkStruct_02049b18() {
this->mUnk_58 = 0;
this->mUnk_5A = 0;
func_02013768(this);
this->func_02013768();
}
ARM void UnkStruct_02011e10::func_ov018_020c4980() {
unk32 iVar1 = func_02027818(0);
unk32 iVar2 = func_0202780c(0);
unk32 arenaLo = func_02027818(0);
unk32 arenaHi = func_0202780c(0);
for (int i = 0; i < HeapIndex_Max; i++) {
this->mUnk_00[i] = NULL;
@@ -95,9 +94,9 @@ ARM void UnkStruct_02011e10::func_ov018_020c4980() {
this->mUnk_24[i] = 0;
}
this->mUnk_00[HeapIndex_0] = func_020012e0(iVar1, iVar2 - iVar1, 2);
unk32 length = func_0202d624(NULL, 0);
void *ptr = ::operator new(length, 0);
this->mUnk_00[HeapIndex_Main] = func_020012e0(arenaLo, arenaHi - arenaLo, 2);
unk32 length = func_0202d624(NULL, 0);
void *ptr = ::operator new(length, 0);
func_0202d624(ptr, length);
ptr = ::operator new(0xBE000, 0);
void *uVar3 = func_02001fd4(ptr, 0xBE000);
@@ -170,7 +169,7 @@ ARM UnkStruct_0204e64c::UnkStruct_0204e64c() {
this->mUnk_16 = 0;
}
ARM GameModeStartUp *UnkStruct_02049a2c::func_ov018_020c4ba8() {
ARM GameModeStartUp *Game::func_ov018_020c4ba8() {
static GameModeStartUp data_ov018_020c5bd4;
return &data_ov018_020c5bd4;
}
@@ -202,10 +201,10 @@ ARM GameModeStartUp::GameModeStartUp() {
ARM void GameModeStartUp::vfunc_0C() {
if (this->mUnk_04.mUnk_0D == this->mUnk_04.mUnk_10) {
if (this->mUnk_28 == 0) {
this->mUnk_2C = SHARED_WORK_C3C;
data_02049a2c.func_ov018_020c48f8();
} else if (!this->mUnk_2A && (SHARED_WORK_C3C - this->mUnk_2C) >= 0x3C) {
this->mUnk_2A = data_0204a060.func_020183d4(false, UnkStruct_0204a060::func_020183b8, 1);
this->mUnk_2C = REG_FRAME_COUNTER;
gGame.func_ov018_020c48f8();
} else if (!this->mUnk_2A && (REG_FRAME_COUNTER - this->mUnk_2C) >= 0x3C) {
this->mUnk_2A = data_0204a060.func_020183d4(false, (GameModeCreateCallback) UnkStruct_0204a060::func_020183b8, 1);
if (data_ov018_020c5bc0 != 0) {
data_0204a060.func_0201bb84(1, 0, 1);
+8 -8
View File
@@ -56,7 +56,7 @@ ARM void func_ov018_020c4e8c(void) {
}
THUMB UnkStruct_0204a060::UnkStruct_0204a060() {
this->callback = NULL;
this->createCallback = NULL;
}
ARM UnkStruct_ov000_020b4eec::UnkStruct_ov000_020b4eec() {
@@ -69,10 +69,10 @@ ARM UnkStruct_ov000_020b4f84::UnkStruct_ov000_020b4f84() {
int *arg0 = 0;
this->mUnk_C0 = (int) arg0 + 1;
this->func_ov000_0206667c(0, 0);
this->func_ov000_0206667c(FontIndex_DSZ2_msg, 0);
if (func_02014fe0() == 0) {
this->func_ov000_0206667c(1, 0);
this->func_ov000_0206667c(FontIndex_LC_Font_s, 0);
}
}
@@ -84,7 +84,7 @@ ARM UnkStruct_ov000_020b504c::UnkStruct_ov000_020b504c() :
Fill32(0, this->mUnk_05C, sizeof(this->mUnk_05C));
this->mUnk_06F = 0;
this->mUnk_000 = new(HeapIndex_0) UnkStruct_ov000_020b504c_Sub3(0x21);
this->mUnk_000 = new(HeapIndex_Main) UnkStruct_ov000_020b504c_Sub3(0x21);
Fill32(0, this->mUnk_00C, sizeof(this->mUnk_00C));
@@ -176,7 +176,7 @@ ARM UnkStruct_0204a110::UnkStruct_0204a110() :
mUnk_000(0),
mUnk_008(-1),
mUnk_00C(-1),
mUnk_DEC(0),
mUnk_DEC(NULL),
mUnk_DF2(-1),
mUnk_DF3(-1),
mUnk_DFC(0),
@@ -275,15 +275,15 @@ ARM UnkStruct_0204a110_Sub7::UnkStruct_0204a110_Sub7() {
this->mUnk_00 = 0;
this->mUnk_01 = 0;
this->mUnk_0C = data_027e0120;
this->mUnk_04 = new(HeapIndex_0) UnkSystem2_UnkSubSystem9();
this->mUnk_08 = new(HeapIndex_0) UnkStruct_0204a110_Sub7_08();
this->mUnk_04 = new(HeapIndex_Main) UnkSystem2_UnkSubSystem9();
this->mUnk_08 = new(HeapIndex_Main) UnkStruct_0204a110_Sub7_08();
}
ARM UnkStruct_0204a110_Sub8::UnkStruct_0204a110_Sub8() {
this->mUnk_00 = 1;
this->mUnk_04 = 0;
this->mUnk_08 = 0;
this->mUnk_0C = new(HeapIndex_0) UnkSystem2_UnkSubSystem9();
this->mUnk_0C = new(HeapIndex_Main) UnkSystem2_UnkSubSystem9();
}
ARM UnkStruct_02049f04::UnkStruct_02049f04() {
+5 -5
View File
@@ -1,7 +1,7 @@
#include "FileSelect/FileSelect.hpp"
#include "Game/Game.hpp"
#include "Game/GameModeFileSelect.hpp"
#include "Save/SaveManager.hpp"
#include "Unknown/UnkStruct_02049a2c.hpp"
#include "Unknown/UnkStruct_0204a088.hpp"
#include "Unknown/UnkStruct_0204a110.hpp"
#include "Unknown/UnkStruct_0204af1c.hpp"
@@ -1131,7 +1131,7 @@ ARM void FileSelectMain::vfunc_08(Input *pButtons, TouchControl *pTouchControl)
}
ARM void FileSelectMain::func_ov019_020c8290() {
if ((data_02049a2c.GetUnk00_FileSelect()->mUnk_04.mUnk_08 & 0xFFFF) == 0xFFFF) {
if ((gGame.GetGameModeFileSelect()->mUnk_04.mUnk_08 & 0xFFFF) == 0xFFFF) {
this->SetState(FileSelectState_Init);
}
}
@@ -1342,7 +1342,7 @@ ARM void FileSelectMain::func_ov019_020c9c70() {
break;
case BTN_ID_FILE_SELECT_CONTACT_MODE:
this->SetState(FileSelectState_ChooseModeToContactMode);
data_02049a2c.GetUnk00_FileSelect()->LoadContactMode(this->mSaveSlotIndex);
gGame.GetGameModeFileSelect()->LoadContactMode(this->mSaveSlotIndex);
data_ov000_020b5214.func_ov000_0206db44(0x1C);
break;
case BTN_ID_FILE_SELECT_OPTIONS:
@@ -1405,10 +1405,10 @@ ARM void FileSelectMain::func_ov019_020c9e08() {
this->mUnk_155C.func_ov000_020609c4();
if (this->mExitMode == FileSelectExitMode_AdventureMode && this->mUnk_00BC.mUnk_0C) {
data_02049a2c.GetUnk00_FileSelect()->LoadAdventureMode(this->mSaveSlotIndex);
gGame.GetGameModeFileSelect()->LoadAdventureMode(this->mSaveSlotIndex);
this->mExitMode = FileSelectExitMode_Unk_3;
} else if (this->mExitMode == FileSelectExitMode_BattleMode && this->mUnk_00BC.mUnk_0C) {
data_02049a2c.GetUnk00_FileSelect()->LoadBattleMode(this->mSaveSlotIndex);
gGame.GetGameModeFileSelect()->LoadBattleMode(this->mSaveSlotIndex);
this->mExitMode = FileSelectExitMode_Unk_3;
}
}
+3 -3
View File
@@ -75,9 +75,9 @@ ARM void FileSelectSubScreen::vfunc_08(Input *pButtons, TouchControl *pTouchCont
this->mUnk_0024 = this->mUnk_0020;
this->mUnk_0020 += 0x800;
REG_BG1HOFS_SUB = ROUND_Q20(this->mUnk_0020) & 0x1FF;
REG_BG2HOFS_SUB = (ROUND_Q20(this->mUnk_0020) + 0x100) & 0x1FF;
REG_BG3HOFS_SUB = (ROUND_Q20(this->mUnk_0020) / 2) & 0x1FF;
REG_BG1OFS_SUB = ROUND_Q20(this->mUnk_0020) & 0x1FF;
REG_BG2OFS_SUB = (ROUND_Q20(this->mUnk_0020) + 0x100) & 0x1FF;
REG_BG3OFS_SUB = (ROUND_Q20(this->mUnk_0020) / 2) & 0x1FF;
if (!(ROUND_Q20(this->mUnk_0020) % 256) && (ROUND_Q20(this->mUnk_0024) % 256)) {
switch (this->mUnk_001C) {
+4 -4
View File
@@ -1,7 +1,7 @@
#include "Game/GameModeFileSelect.hpp"
#include "FileSelect/FileSelect.hpp"
#include "Game/Game.hpp"
#include "Save/AdventureFlags.hpp"
#include "Unknown/UnkStruct_02049a2c.hpp"
#include "Unknown/UnkStruct_02049bd4.hpp"
#include "Unknown/UnkStruct_0204a060.hpp"
#include "Unknown/UnkStruct_0204a088.hpp"
@@ -58,15 +58,15 @@ ARM void GameModeFileSelect::vfunc_20() {}
ARM void GameModeFileSelect::LoadAdventureMode(u16 saveSlotIndex) {
this->mSaveSlotIndex = saveSlotIndex;
data_0204a060.func_020183d4(gSaveManager.GetSaveSlot(saveSlotIndex)->GetAdventureFlag(AdventureFlag_WatchedIntroCS),
func_ov001_020be054, 1);
(GameModeCreateCallback) func_ov001_020be054, 1);
}
ARM void GameModeFileSelect::LoadBattleMode(u16 saveSlotIndex) {
this->mSaveSlotIndex = saveSlotIndex;
data_0204a060.func_020183d4(true, func_ov001_020be0ec, 1);
data_0204a060.func_020183d4(true, (GameModeCreateCallback) func_ov001_020be0ec, 1);
}
ARM void GameModeFileSelect::LoadContactMode(u16 saveSlotIndex) {
this->mSaveSlotIndex = saveSlotIndex;
data_0204a060.func_020183d4(true, func_ov001_020be0d8, 1);
data_0204a060.func_020183d4(true, (GameModeCreateCallback) func_ov001_020be0d8, 1);
}
+2 -2
View File
@@ -1,6 +1,6 @@
#include "Game/GameModeTitleScreen.hpp"
#include "Game/Game.hpp"
#include "TitleScreen/TitleScreen.hpp"
#include "Unknown/UnkStruct_02049a2c.hpp"
#include "Unknown/UnkStruct_0204a088.hpp"
#include "Unknown/UnkStruct_0204a110.hpp"
#include "Unknown/UnkStruct_027e09a4.hpp"
@@ -22,7 +22,7 @@ UnkStruct_ov000_020a782c *func_ov000_020a782c(unk32 param1);
ARM GameModeTitleScreen::GameModeTitleScreen() {
func_0201659c();
data_02049a2c.func_02013370(2);
gGame.func_02013370(2);
data_0204a110.func_ov001_020bd514(0, TitleScreenManager::Create, 0, 1);
func_ov001_020b6520(2);
}
+2 -1
View File
@@ -1,4 +1,5 @@
#include "TitleScreen/TitleScreen.hpp"
#include "Game/GameMode.hpp"
#include "Unknown/UnkStruct_02049be0.hpp"
#include "Unknown/UnkStruct_0204a060.hpp"
#include "Unknown/UnkStruct_0204aeac.hpp"
@@ -277,7 +278,7 @@ void TitleScreen::func_ov025_020c55e4(Input *pButtons, TouchControl *pTouchContr
return;
}
data_0204a060.func_020183d4(true, UnkStruct_0204a060::func_02018424, 1);
data_0204a060.func_020183d4(true, (GameModeCreateCallback) UnkStruct_0204a060::func_02018424, 1);
}
void TitleScreen::vfunc_14(unk8 *param1) {
+6 -6
View File
@@ -17,7 +17,7 @@ ARM void TitleScreenManager::vfunc_14() {
this->mUnk_004.func_0201c00c(0x24, 1);
TitleScreen *pTitleScreen = new(HeapIndex_1) TitleScreen();
this->mpTitleScreen = pTitleScreen;
this->mpGameMode = (GameModeBase *) pTitleScreen;
this->mUnk_104.mList.func_020166cc(pTitleScreen->GetNode());
pTitleScreen->vfunc_18();
}
@@ -25,8 +25,8 @@ ARM void TitleScreenManager::vfunc_14() {
ARM void TitleScreenManager::vfunc_18() {
this->mUnk_004.func_ov001_020bd784();
delete this->mpTitleScreen;
this->mpTitleScreen = NULL;
delete this->mpGameMode;
this->mpGameMode = NULL;
}
ARM void TitleScreenManager::vfunc_24() {
@@ -45,14 +45,14 @@ ARM void TitleScreenManager::vfunc_2C(unk8 *param1) {
this->func_02018830(param1);
}
ARM void TitleScreenManager::vfunc_38() {}
ARM void TitleScreenManager::vfunc_38(unk32 param1, unk32 param2, unk32 param3, unk32 param4) {}
ARM void TitleScreenManager::func_ov025_020c4c20() {
this->mpTitleScreen->func_ov025_020c4e6c();
((TitleScreen *) this->mpGameMode)->func_ov025_020c4e6c();
}
ARM void TitleScreenManager::func_ov025_020c4c30() {
this->mpTitleScreen->func_ov025_020c4e90();
((TitleScreen *) this->mpGameMode)->func_ov025_020c4e90();
}
TitleScreenManager::~TitleScreenManager() {}
+1 -1
View File
@@ -660,7 +660,7 @@ ARM void PlayerGet::vfunc_10(unk32 param1) {
break;
case ItemId_RecruitUniform2:
case ItemId_EngineerUniform:
if (data_027e09a4->mUnk_00 == 0x2F) {
if (data_027e09a4->mSceneIndex == SceneIndex_f_first) {
this->mUnk_28->func_ov058_02152a24();
}
break;
+172
View File
@@ -0,0 +1,172 @@
#include "Game/Game.hpp"
#include "System/OverlayManager.hpp"
#include "System/Random.hpp"
#include "Unknown/UnkStruct_02049b74.hpp"
#include "Unknown/UnkStruct_02049bd4.hpp"
#include "Unknown/UnkStruct_0204a110.hpp"
#include "Unknown/UnkStruct_0204e64c.hpp"
#include "Unknown/UnkStruct_027e0208.hpp"
#include "Unknown/UnkStruct_ov000_020b50c0.hpp"
#include "regs.h"
#include "versions.h"
extern "C" void func_020196fc();
extern "C" unk32 func_02031e58();
extern "C" void func_02031e68();
extern "C" void func_01ff8d38();
extern "C" void func_020132c8();
extern "C" void func_020132dc();
extern "C" void func_02013354();
extern "C" void func_0201328c();
extern "C" int func_020280ec();
extern "C" void func_02028100(int enabled);
extern Mat3p data_027e02c4;
struct SomeSaveFileStruct {
/* 00 */ SaveFile *mpSaveFiles[MAX_SAVE_SLOTS];
SomeSaveFileStruct(unk32 param1);
~SomeSaveFileStruct();
};
ARM void Game::func_02013370(unk32 param1) {
data_0204a110.func_02018c78(param1);
data_ov000_020b50c0.mUnk_9C = param1;
}
ARM void Game::Run() {
this->func_ov018_020c48a4();
do {
// initialization of the next game mode
if (this->createCallback != NULL) {
data_0204999c.func_02013014();
{
SomeSaveFileStruct local_28(0x1300);
this->mpSaveFile = local_28.mpSaveFiles[0];
if (this->mpCurrentGameMode != NULL) {
delete this->mpCurrentGameMode;
}
func_020196fc();
data_02049b18.func_02013768();
this->mFrameCounter = REG_FRAME_COUNTER;
this->mpCurrentGameMode = this->createCallback();
this->createCallback = NULL;
this->mpCurrentGameMode->vfunc_08();
this->mpSaveFile = NULL;
}
data_0204999c.func_02013070();
}
// update of the current game mode
if (this->mpCurrentGameMode != NULL) {
if (this->mUnk_08 != NULL) {
this->mUnk_08();
this->mUnk_08 = NULL;
}
if (func_02031e58() != 0) {
func_02031e68();
}
data_02049bd4.func_02014d98();
data_0204a110.func_02019300(data_0204a110.mUnk_DF8);
gRandom.UpdateRandomValue();
unk32 uVar4 = data_0204a110.func_02019300(data_0204a110.mUnk_DF8);
data_02049b74.func_02013a44(data_0204a110.mUnk_004);
if (this->mUnk_14 == NULL) {
data_02049b18.func_02013840(data_0204a110.mUnk_004, uVar4);
} else {
data_02049b18.func_020138f4(uVar4);
}
data_0204e64c.func_020201c4(1);
data_0204a110.func_02019350();
if (data_0204a110.func_02019514() == 0 && data_0204e64c.mUnk_00.mUnk_0B == 0) {
this->mpCurrentGameMode->vfunc_0C();
}
data_027e0208.mUnk_0EC = 0x1000;
data_027e0208.mUnk_0F0 = 0x1000;
data_027e0208.mUnk_0F4 = 0x1000;
data_027e0208.mUnk_0E0 = 0;
data_027e0208.mUnk_0E4 = 0;
data_027e0208.mUnk_0E8 = 0;
Mat3p_InitIdentity(&data_027e02c4);
data_027e0208.mUnk_0FC = 0;
func_01ff8d38();
this->mpCurrentGameMode->vfunc_18();
data_0204a110.func_020194dc();
if (data_0204a110.func_02019514() == 0) {
this->mpCurrentGameMode->vfunc_10();
}
#if IS_JP
func_01ff8d38();
#endif
if (data_0204e64c.mUnk_00.mUnk_0B == 0) {
data_0204a110.func_02019408();
}
this->mpCurrentGameMode->vfunc_1C();
func_01ff8d38();
data_0204a110.func_02019454();
this->mpCurrentGameMode->vfunc_20();
if (gOverlayManager.mLoadedOverlays[OverlaySlot_Second] == OverlayIndex_Second) {
this->func_ov000_020576d0();
this->func_ov000_0205770c();
}
}
if (this->mFrameCounter + data_0204a110.mUnk_004 - (s32) REG_FRAME_COUNTER > 1) {
func_0201328c();
}
while (this->mFrameCounter + data_0204a110.mUnk_004 - (s32) REG_FRAME_COUNTER > 1) {
func_020132c8();
}
{
int enabled = func_020280ec();
this->mUnk_1C.func_02013e18(func_020132dc, 0);
REG_SWAP_BUFFERS = 3;
func_02028100(enabled);
}
func_020132c8();
if (this->mUnk_18 != NULL) {
while (this->mUnk_18() != 0) {
while (this->mUnk_1C.func_02013e18(func_02013354, 0) == 0) {
}
func_020132c8();
}
}
this->mFrameCounter = REG_FRAME_COUNTER;
} while (true);
}
bool Game::TrySetCreateCallback(GameModeCreateCallback createCallback) {
if (this->createCallback == NULL) {
this->createCallback = createCallback;
return true;
}
return false;
}
+1 -1
View File
@@ -76,7 +76,7 @@ ARM void GameModeManagerBase::vfunc_30(unk32 param1) {
}
}
ARM void GameModeManagerBase::vfunc_34() {}
ARM void GameModeManagerBase::vfunc_34(unk32 param1, unk32 param2) {}
struct UnkStruct3 {
unk32 mUnk_00;
+10 -9
View File
@@ -1,4 +1,4 @@
#include "Unknown/UnkStruct_02049a2c.hpp"
#include "Game/Game.hpp"
#include "global.h"
#include "regs.h"
#include "types.h"
@@ -6,7 +6,6 @@
void func_0203b920(void);
void func_02011da0(void);
void CallStaticInitializers(void);
void main(void);
void func_02000a78(void);
void *func_0200093c(unk32, u32 *, unk32);
@@ -14,6 +13,8 @@ void func_020009fc(void);
void func_02000950(unk32 *);
void func_01ffbd70(void);
void main();
#define UNK_027FFF9C (*(u32 *) 0x027FFF9C)
typedef void (*UnkStruct_027e0000_Callback)(void);
@@ -44,7 +45,7 @@ struct RomBuildInfo {
extern RomBuildInfo BuildInfo;
// non-matching
ARM void Entry(void) {
extern "C" ARM void Entry(void) {
unk32 *puVar1;
unk32 *puVar2;
u32 uVar3;
@@ -57,8 +58,8 @@ ARM void Entry(void) {
func_02000a78();
func_0200093c(0, (u32 *) data_027e0000, 0x4000);
func_0200093c(0, RAM_PALETTES, 0x400);
func_0200093c(0x200, RAM_OAM, 0x400);
func_0200093c(0, &REG_PALETTE_A, 0x400);
func_0200093c(0x200, &REG_OAM_A, 0x400);
func_02000950(BuildInfo.mUnk_14);
func_020009fc();
puVar4 = BuildInfo.mUnk_10;
@@ -98,9 +99,9 @@ ARM void *func_0200093c(unk32 param1, u32 *param2, unk32 param3) {
return param2;
}
void AutoloadCallback(void) {}
extern "C" void AutoloadCallback(void) {}
void func_02000b60(void) {}
extern "C" void func_02000b60(void) {}
RomBuildInfo BuildInfo = {
.mUnk_00 = data_0204cde0,
@@ -116,6 +117,6 @@ RomBuildInfo BuildInfo = {
"[SDK+MEI:libASR_V1.0.5-CW2.0-SDK4.0]",
};
void main(void) {
data_02049a2c.Run();
void main() {
gGame.Run();
}
+207
View File
@@ -0,0 +1,207 @@
#include "System/SysFault.hpp"
#include "System/OverlayManager.hpp"
#include "Unknown/Common.hpp"
#include "Unknown/UnkMemFuncs.h"
#include "Unknown/UnkStruct_02049b18.hpp"
#include "Unknown/UnkStruct_ov000_02067bc4.hpp"
#include "Unknown/UnkStruct_ov000_020b4f84.hpp"
#include "Unknown/UnkStruct_ov000_020b50c0.hpp"
#include "global.h"
#include "regs.h"
extern "C" void func_0202851c();
extern "C" void func_020131ec();
extern "C" void func_02013214();
extern "C" void func_ov020_020c86d8(void *);
extern "C" void func_02014d38(void *, int);
extern "C" void func_020196fc();
extern "C" void func_02023770(int);
extern "C" void func_02023fb0(int);
extern "C" void func_02023f8c(int);
extern "C" void GX_SetGraphicsMode(int, int, int);
extern "C" void GXS_SetGraphicsMode(int);
extern "C" unk32 func_ov000_02068504(int);
extern "C" unk32 func_020147a8();
extern "C" void *func_020244f8();
extern "C" void func_0201b278(bool, bool);
extern "C" void func_0201b180(bool, bool);
extern "C" void func_02025050(void *, int, int);
extern "C" void SetBrightColor(void *, int);
extern int data_02049bd4;
extern u16 data_0203e0c4[];
extern int data_0203e0be;
extern int data_ov020_20e8580;
struct struct_aStack_2e0 {
int mUnk_00;
struct_aStack_2e0(void *, int);
};
struct struct_aStack_2d8 {
struct_aStack_2d8();
void func_ov000_020685cc();
void func_ov000_0206869c();
void func_ov000_020686a4(int);
void func_ov000_02068fec();
void func_ov000_0206878c();
void func_ov000_020628e4(int, int, int, int, int, int, int, int, int);
u8 pad[0x20];
Font_UnkStruct1 *mUnk_20;
};
THUMB void SysFault::func_020127f0(unk32 param1) {
bool doDraw = false;
func_02013214();
func_02014d38(&data_02049bd4, 0);
func_02014d38(&data_02049bd4, 1);
func_02014d38(&data_02049bd4, 3);
func_020196fc();
func_02023770(2);
func_02023fb0(4);
func_02023f8c(0x100);
GX_SetGraphicsMode(1, 0, 0);
GXS_SetGraphicsMode(0);
REG_DISPCNT = ((REG_DISPCNT & ~0x1F00) | 0x100);
REG_DISPCNT_SUB = (REG_DISPCNT_SUB & ~0x1F00) | 0x100;
REG_BG0CNT = (REG_BG0CNT & 0x43) | 4;
REG_BG0CNT_SUB = (REG_BG0CNT_SUB & 0x43) | 4;
if (this->mUnk_05 < 0xFF) {
this->mUnk_05 = 0xFF;
switch (param1) {
case 0:
case 1:
func_0201b180(true, true);
// fallthrough
case 2:
case 3:
this->mUnk_04 = 0;
break;
default:
break;
}
}
while (!doDraw) {
func_020131ec();
bool sequenceComplete = false;
switch (param1) {
case 0:
case 1:
data_02049b18.mButtons.func_02013b24(data_02049b18.mButtons.func_02013bbc());
u16 expected = data_0203e0c4[this->mUnk_04];
if (data_02049b18.mButtons.press & expected) {
if ((data_02049b18.mButtons.press & (~(expected & 0x3FF))) == 0) {
this->mUnk_04++;
if (this->mUnk_04 > 10) {
doDraw = true;
break;
}
} else {
this->mUnk_04 = 0;
}
} else {
if (data_02049b18.mButtons.press & 0x3FF) {
this->mUnk_04 = 0;
}
}
doDraw = false;
break;
case 2:
case 3:
default:
doDraw = true;
break;
}
}
while (true) {
func_020131ec();
switch (param1) {
case 0:
case 1:
func_0201b278(true, true);
break;
case 2: {
// "data could not be read" error
struct_aStack_2d8 aStack_2d8;
func_02025050(&data_0203e0be, func_ov000_02068504(0) << 1, 6);
Fill32(0, func_020244f8(), 0x800);
aStack_2d8.mUnk_20 = &data_ov000_020b4f84.mUnk_00[FontIndex_DSZ2_msg].mUnk_14;
aStack_2d8.func_ov000_020628e4(0, 0, 256, 192, 0, 0, 1, 0, 0);
{
UnkSystem2_UnkSubSystem5_Base_10 aStack_278;
aStack_2d8.func_ov000_0206869c();
struct_aStack_2e0 uStack_2e0(data_ov000_020b504c.mUnk_000, 0x25);
aStack_2d8.func_ov000_020686a4(uStack_2e0.mUnk_00);
aStack_2d8.func_ov000_02068fec();
aStack_2d8.func_ov000_0206878c();
}
break;
}
case 3: {
// "data could not be written" error
struct_aStack_2d8 aStack_2d8;
func_02025050(&data_0203e0be, func_ov000_02068504(0) << 1, 6);
Fill32(0, func_020244f8(), 0x800);
aStack_2d8.mUnk_20 = &data_ov000_020b4f84.mUnk_00[FontIndex_DSZ2_msg].mUnk_14;
aStack_2d8.func_ov000_020628e4(0, 0, 256, 192, 0, 0, 1, 0, 0);
{
UnkSystem2_UnkSubSystem5_Base_10 aStack_278;
aStack_2d8.func_ov000_0206869c();
struct_aStack_2e0 uStack_2e0(data_ov000_020b504c.mUnk_000, 0x26);
aStack_2d8.func_ov000_020686a4(uStack_2e0.mUnk_00);
aStack_2d8.func_ov000_02068fec();
aStack_2d8.func_ov000_0206878c();
}
break;
}
default:
break;
}
SetBrightColor((void *) &REG_MASTER_BRIGHT, 0);
SetBrightColor((void *) &REG_MASTER_BRIGHT_SUB, 0);
if (gOverlayManager.mLoadedOverlays[OverlaySlot_4] == OverlayIndex_WirelessCommon) {
func_ov020_020c86d8(&data_ov020_20e8580);
}
if (func_020147a8() != 0) {
data_ov000_020b50c0.func_ov000_02069f58();
}
int waitTimer = 0;
while (waitTimer < 0x7FFFFFFF) {
int limit = (waitTimer < 2) ? 0x3C : 0x7FFFFFFF;
if (waitTimer >= limit) {
break;
}
func_020131ec();
waitTimer++;
}
this->mUnk_05 = 0;
func_0202851c();
}
}
+16 -24
View File
@@ -1,35 +1,33 @@
#include "System/SysNew.hpp"
#include "System/SysFault.hpp"
#include "global.h"
extern "C" {
void *func_02001654(void);
void *func_02001654(void *);
void *func_020145b0(UnkId *, s32);
void *func_020010c0(void);
void *func_02001308(void);
void *func_020010c0(void *);
void *func_02001308(void *);
UnkId *func_02001488(void);
UnkId *func_02014704(void);
UnkId *func_02014704();
UnkId *func_020011c8(UnkId *, void *);
UnkId *func_02014630(UnkId *, void *);
UnkId *func_02001684(UnkId *, void *);
void func_020011f4(void *);
unk32 func_020011f4(void *);
}
extern char *data_0204372c[];
// non-matching
ARM void *SysNew(UnkStruct_02011e10_Sub1 *param1, s32 length, s32 param3) {
void *newPtr = NULL;
void *ret;
switch (param1->mId) {
case UnkId_EXPH:
newPtr = func_020010c0();
newPtr = func_020010c0(param1);
break;
case UnkId_FRMH:
newPtr = func_02001308();
newPtr = func_02001308(param1);
break;
case UnkId_UNTH:
newPtr = func_02001654();
newPtr = func_02001654(param1);
break;
case UnkId_UNSH:
newPtr = func_020145b0(func_02014704(), length);
@@ -71,24 +69,22 @@ ARM void *func_02011f30(s32 length) {
return func_02011f10(length);
}
// non-matching
ARM void *operator new(unsigned long length, u32 id, u32 idLength) {
void *pvVar1;
char *uVar2;
u16 line;
char *uVar4;
UnkStruct_02011e10_Sub1 *pUVar5;
pUVar5 = data_0204999c.mUnk_00[id];
pvVar1 = SysNew(pUVar5, length, idLength);
if (pvVar1 == NULL) {
if (id == 1) {
func_020011f4(pUVar5);
data_02049984.func_020125a4(__FILE__, 183, "%sノメモリガタリマセン.\nサイズ=%d\nノコリ =%d", data_0204372c[id],
length);
} else if (id == 0) {
data_02049984.func_020125a4(__FILE__, 187, "%sノメモリガタリマセン.\nサイズ=%d", data_0204372c[id], length);
switch (id) {
case HeapIndex_1:
GAME_ASSERT(pvVar1 != NULL, 183, "%sノメモリガタリマセン.\nサイズ=%d\nノコリ =%d", data_0204372c[id], length,
func_020011f4(pUVar5));
break;
default:
GAME_ASSERT(pvVar1 != NULL, 187, "%sノメモリガタリマセン.\nサイズ=%d", data_0204372c[id], length);
break;
}
}
@@ -102,7 +98,3 @@ ARM void operator delete(void *ptr) {
ARM void SysObject::operator delete[](void *ptr) {
SysDelete(ptr);
}
void dummy() {
::operator new(1, 1);
}
+11 -8
View File
@@ -1,13 +1,15 @@
#include "Unknown/UnkStruct_0204a060.hpp"
#include "Game/Game.hpp"
#include "Game/GameMode.hpp"
#include "Game/GameModeFileSelect.hpp"
#include "System/OverlayManager.hpp"
#include "Unknown/UnkStruct_02049a2c.hpp"
#include "Unknown/UnkStruct_0204e5f8.hpp"
#include "Unknown/UnkStruct_ov000_020b51b8.hpp"
extern "C" void func_ov001_020be078();
THUMB bool UnkStruct_0204a060::vfunc_0C(void) {
return data_02049a2c.func_02013724(this->callback);
return gGame.TrySetCreateCallback(this->createCallback);
}
THUMB void UnkStruct_0204a060::func_020183b8(void) {
@@ -15,16 +17,16 @@ THUMB void UnkStruct_0204a060::func_020183b8(void) {
}
THUMB void UnkStruct_0204a060::func_020183c0(void) {
this->func_020183d4(false, func_ov001_020be078, 1);
this->func_020183d4(false, (GameModeCreateCallback) func_ov001_020be078, 1);
}
THUMB bool UnkStruct_0204a060::func_020183d4(bool param1, void *param2, unk32 param3) {
THUMB bool UnkStruct_0204a060::func_020183d4(bool param1, GameModeCreateCallback createFunc, unk32 param3) {
if (this->mUnk_0C) {
return false;
}
this->mUnk_14 = param1 ? 0x00010000 : 0xFFFF0000;
this->callback = param2;
this->mUnk_14 = param1 ? 0x00010000 : 0xFFFF0000;
this->createCallback = createFunc;
this->func_0201bb84(0x20, 4, 0x20);
if (param3 != 0) {
@@ -35,8 +37,9 @@ THUMB bool UnkStruct_0204a060::func_020183d4(bool param1, void *param2, unk32 pa
return true;
}
THUMB void UnkStruct_0204a060::func_02018424(void) {
data_02049ba0.func_020148d0(0x18)->func_ov018_020c4840();
THUMB GameModeFileSelect *UnkStruct_0204a060::func_02018424(void) {
data_02049ba0.func_020148d0(OverlayIndex_MainSelect);
return GameModeFileSelect::Create();
}
ARM UnkStruct_0204a060::~UnkStruct_0204a060() {}
@@ -0,0 +1,61 @@
#include "System/SysNew.hpp"
#include "Unknown/UnkStruct_ov000_020b4f84.hpp"
extern "C" void *func_02012ec8(unk32, unk16, void *, size_t *, unk32, u8);
extern "C" size_t func_020010e0(UnkStruct_02011e10_Sub1 *heapID, void *pFile, unk32 param3);
THUMB void UnkStruct_ov000_020b4f84_00_Base::func_02015528() {}
THUMB void UnkStruct_ov000_020b4f84_00_Base::func_0201552c() {
this->mpFile = NULL;
this->mFileSize = 0;
}
THUMB unk32 UnkStruct_ov000_020b4f84_00_Base::func_02015534() {
return this->mFileSize;
}
THUMB UnkStruct_ov000_020b4f84_00_Base::UnkStruct_ov000_020b4f84_00_Base() {
this->mUnk_04 = NULL;
this->mpFile = NULL;
this->mFileSize = 0;
this->mHeapIndex = HeapIndex_1;
this->mUnk_12 = 0;
}
THUMB UnkStruct_ov000_020b4f84_00_Base::UnkStruct_ov000_020b4f84_00_Base(void *param1, unk32 param2, unk32 param3, u8 param4) :
UnkStruct_ov000_020b4f84_00_Base2(param1, param3) {
this->mUnk_12 = param4;
}
THUMB UnkStruct_ov000_020b4f84_00_Base::~UnkStruct_ov000_020b4f84_00_Base() {
this->vfunc_0C();
this->func_02015528();
}
THUMB void *UnkStruct_ov000_020b4f84_00_Base::vfunc_08(unk32 param1) {
if (this->mpFile == NULL) {
this->mpFile = func_02012ec8(0, this->mHeapIndex, this->mUnk_04, &this->mFileSize, param1, this->mUnk_12);
}
return this->mpFile;
}
THUMB void UnkStruct_ov000_020b4f84_00_Base::vfunc_0C(void) {
if (this->mpFile2 != NULL) {
delete this->mpFile;
this->func_0201552c();
}
}
THUMB size_t UnkStruct_ov000_020b4f84_00_Base::vfunc_10(unk32 param1) {
size_t prevFileSize = this->mFileSize;
if (this->mpFile2 != NULL && param1 < this->mFileSize) {
if (data_0204999c.mUnk_00[this->mHeapIndex]->mId == UnkId_EXPH) {
this->mFileSize = func_020010e0(data_0204999c.mUnk_00[this->mHeapIndex], this->mpFile, param1);
}
}
return prevFileSize;
}
+77
View File
@@ -0,0 +1,77 @@
#include "Unknown/UnkMemFuncs.h"
#include "regs.h"
#include "types.h"
extern "C" void GX_SetGraphicsMode(int, int, int);
extern "C" void GXS_SetGraphicsMode(int);
extern "C" void func_02024934(void *, void *, int, int, int, int);
extern "C" void func_020242a0();
extern "C" void func_020241f4();
extern "C" void func_0202421c();
extern "C" void func_0202428c();
extern "C" void func_02024208();
extern "C" void func_02024240();
extern "C" void func_020242b4();
extern "C" void func_020242dc();
extern "C" void func_020242c8();
extern "C" void func_02024304();
extern "C" void func_02024264();
extern "C" void func_02024278();
extern "C" void func_02023f8c(int);
extern "C" void func_020243ec();
extern int data_027e0120;
extern "C" void func_020196fc() {
GX_SetGraphicsMode(1, 0, 0);
GXS_SetGraphicsMode(0);
REG_BG0OFS = 0;
REG_BG1OFS = 0;
REG_BG2OFS = 0;
REG_BG3OFS = 0;
REG_BG0OFS_SUB = 0;
REG_BG1OFS_SUB = 0;
REG_BG2OFS_SUB = 0;
REG_BG3OFS_SUB = 0;
func_02024934(&REG_BG2PA, &data_027e0120, 0x80, 0x60, 0, 0);
func_02024934(&REG_BG3PA, &data_027e0120, 0x80, 0x60, 0, 0);
func_02024934(&REG_BG2PA_SUB, &data_027e0120, 0x80, 0x60, 0, 0);
func_02024934(&REG_BG3PA_SUB, &data_027e0120, 0x80, 0x60, 0, 0);
REG_BG0CNT = REG_BG0CNT & 0xffbf;
REG_BG1CNT = REG_BG1CNT & 0xffbf;
REG_BG2CNT = REG_BG2CNT & 0xffbf;
REG_BG3CNT = REG_BG3CNT & 0xffbf;
REG_BG0CNT_SUB = REG_BG0CNT_SUB & 0xffbf;
REG_BG1CNT_SUB = REG_BG1CNT_SUB & 0xffbf;
REG_BG2CNT_SUB = REG_BG2CNT_SUB & 0xffbf;
REG_BG3CNT_SUB = REG_BG3CNT_SUB & 0xffbf;
REG_MOSAIC = 0;
REG_MOSAIC_SUB = 0;
REG_OBJMOSAIC = 0;
REG_OBJMOSAIC_SUB = 0;
REG_BLDCNT = 0;
REG_BLDCNT_SUB = 0;
REG_DISPCNT &= 0xffff1fff;
REG_DISPCNT_SUB &= 0xffff1fff;
func_020242a0();
func_020241f4();
func_0202421c();
func_0202428c();
func_02024208();
func_02024240();
func_020242b4();
func_020242dc();
func_020242c8();
func_02024304();
func_02024264();
func_02024278();
func_02023f8c(0x1ff);
Fill256(0, &REG_VRAM, 0xa4000);
func_020243ec();
Fill256(0xc0, &REG_OAM_A, 0x400);
Fill256(0, &REG_PALETTE_A, 0x400);
Fill256(0xc0, &REG_OAM_B, 0x400);
Fill256(0, &REG_PALETTE_B, 0x400);
}