* Game 74%

* Game 99%

* Fix symbol name
This commit is contained in:
Aetias
2025-07-22 15:54:46 +02:00
committed by GitHub
parent aee9c362bb
commit 383ca6aaa2
31 changed files with 299 additions and 141 deletions
+2 -3
View File
@@ -9,6 +9,7 @@
#include "Player/PlayerManager.hpp"
#include "Save/AdventureFlags.hpp"
#include "System/OverlayManager.hpp"
#include "Unknown/UnkStruct_020eec68.hpp"
static const char *sShipPartTypes[] = {"anc", "bow", "hul", "can", "dco", "pdl", "fnl", "brg"};
@@ -1056,8 +1057,6 @@ THUMB void ItemManager::LoadDungeonItemModels() {
}
}
extern unk32 data_ov000_020eec68;
extern "C" void PlaySoundEffect(void *param1, SfxId sfx);
THUMB void ItemManager::PlayItemFanfareSfx(ItemId item) {
if (gItemManager->mMuteNextFanfare == true) {
gItemManager->mMuteNextFanfare = false;
@@ -1105,7 +1104,7 @@ THUMB void ItemManager::PlayItemFanfareSfx(ItemId item) {
gItemManager->mFanfareSfx = SfxId_None;
}
PlaySoundEffect(&data_ov000_020eec68, sfx);
data_ov000_020eec68.PlaySoundEffect(sfx);
}
THUMB bool ItemManager::HasShipPartPriceShown(ShipPart part, ShipType type) const {
+8 -16
View File
@@ -6,12 +6,14 @@
#include "Actor/Actor.hpp"
#include "Actor/ActorManager.hpp"
#include "Actor/ActorSpawner.hpp"
#include "DTCM/UnkStruct_027e077c.hpp"
#include "DTCM/UnkStruct_027e0d38.hpp"
#include "DTCM/UnkStruct_027e0fd4.hpp"
#include "DTCM/UnkStruct_027e103c.hpp"
#include "Player/PlayerBase.hpp"
#include "Save/AdventureFlags.hpp"
#include "Unknown/UnkStruct_02037750.hpp"
#include "Unknown/UnkStruct_020eec68.hpp"
#include "stdio.h"
extern bool func_01ffbe78(Vec3p *param1, Vec3p *param2, Vec3p *param3, Vec4p *param4);
@@ -48,7 +50,6 @@ extern s32 func_ov000_0209d71c(s32 *param_1, s32 param_2);
extern void func_ov000_020c3348(ActorSpawnOptions *param_1);
extern void func_ov000_020d70a4(unk32 *param_1, unk32 param_2, unk32 param_3, unk32 param_4);
extern void func_ov000_020d72b8(unk32 *param_1);
extern unk32 func_ov000_020d7424(unk32 *param_1);
extern void func_ov004_021024c4(MapManager *param_1, s32 param_2, bool param_3, s32 param_4);
extern void func_ov004_02102770(s32 *param_1);
@@ -84,13 +85,6 @@ struct astruct_16 {
/* 2c */
}; // What is this struct?
struct UnkStruct_027e077c {
/* 00 */ unk32 mUnk_00;
/* 04 */ unk32 mUnk_04;
/* 08 */ unk16 mUnk_08;
/* 0a */ unk8 mUnk_0a;
};
class Case_0 : public MapBase {
public:
char pad[0x790 - 0x1B0];
@@ -112,7 +106,6 @@ public:
virtual ~Case_Default() override;
};
extern UnkStruct_027e077c *data_027e077c;
extern unk32 *data_027e0c68;
extern u32 *data_027e0ce0[];
extern UnkStruct_0202e894 *data_027e0ce4;
@@ -128,7 +121,6 @@ extern UnkStruct_027e103c *data_027e103c;
extern unk32 *data_ov000_020e24a4;
extern MapManager_Unk2 data_ov000_020e24c8[];
extern MapManager_Unk2 data_ov000_020e24e8[];
extern unk32 data_ov000_020eec68;
extern unk32 data_ov015_02190458;
MapManager::MapManager() {
@@ -446,19 +438,19 @@ ARM void MapManager::func_ov00_02082808(bool param_2) {
if (iVar2 == 0) {
func_ov015_021849a4(&data_ov015_02190458);
}
func_ov000_020d70a4(&data_ov000_020eec68, iVar1, 0, 0x7f);
data_ov000_020eec68.func_ov000_020d70a4(iVar1, 0, 0x7f);
} else {
iVar2 = func_ov000_020d7424(&data_ov000_020eec68);
iVar2 = data_ov000_020eec68.func_ov000_020d7424();
if (iVar1 == iVar2) {
return;
}
func_ov000_020d70a4(&data_ov000_020eec68, iVar1, 0, 0x7f);
data_ov000_020eec68.func_ov000_020d70a4(iVar1, 0, 0x7f);
}
iVar1 = data_027e0d38->mUnk_0c.func_ov000_020a5e9c();
if (iVar1 == 0) {
return;
}
func_ov000_020d72b8(&data_ov000_020eec68);
data_ov000_020eec68.func_ov000_020d72b8();
}
ARM s32 MapManager::MapData_vfunc_7c(s32 param_1, unk32 *param_2, s32 param_3, short param_4[4]) {
@@ -2390,8 +2382,8 @@ void MapManager::func_ov00_0208583c(MapManager *param_1, Vec3p *param_2, unk32 p
if (piVar1 == NULL) {
return;
}
if (data_027e077c->mUnk_00 == 1) {
if (data_027e077c->mUnk_04 == 1) {
if (data_027e077c.mUnk_0 == 1) {
if (data_027e077c.mUnk_4 == 1) {
//(**(code **) (*piVar1 + 0x30))(piVar1, param_3);
return;
}
+2 -2
View File
@@ -1,4 +1,5 @@
#include "DTCM/UnkStruct_027e0d38.hpp"
#include "DTCM/UnkStruct_027e0ffc.hpp"
#include "Game/Game.hpp"
#include "Player/LinkStateDamage.hpp"
#include "Player/LinkStateFollow.hpp"
@@ -52,7 +53,6 @@ static const volatile q20 data_ov005_021123b8 = FLOAT_TO_Q20(15.0);
extern LinkStateFollow *GetLinkStateFollow();
extern "C" bool Lerp(s32 *pValue, s32 dest, s32 factor, unk32 param4, u32 step);
extern unk32 data_027e0ffc;
extern "C" void func_ov000_020ceacc(unk32 *param1, unk32 param2, Vec3p *param3, unk32 param4);
ARM void LinkStateMove::vfunc_1c() {
Actor *grabActor = this->GetGrabActor();
@@ -169,7 +169,7 @@ ARM void LinkStateMove::vfunc_1c() {
} else if (mUnk_10 > 0) {
*(unk16 *) ((u32) this->func_ov00_020a8d40() + 0xa8) = 0x4CD;
if (mUnk_10 == 0x19) {
func_ov000_020ceacc(&data_027e0ffc, 0x23D, this->GetPlayerPos(), 0);
data_027e0ffc.func_ov000_020ceacc(0x23D, this->GetPlayerPos(), 0);
}
mUnk_10 -= 1;
} else {
+143 -35
View File
@@ -7,6 +7,7 @@
#include "DTCM/UnkStruct_027e05f8.hpp"
#include "DTCM/UnkStruct_027e077c.hpp"
#include "DTCM/UnkStruct_027e080c.hpp"
#include "DTCM/UnkStruct_027e08e4.hpp"
#include "DTCM/UnkStruct_027e08f8.hpp"
#include "DTCM/UnkStruct_027e08fc.hpp"
#include "DTCM/UnkStruct_027e0c38.hpp"
@@ -24,25 +25,23 @@
#include "System/Random.hpp"
#include "Unknown/UnkStruct_0203dae0.hpp"
#include "Unknown/UnkStruct_02063220.hpp"
#include "Unknown/UnkStruct_02068894.hpp"
#include "Unknown/UnkStruct_02075dac.hpp"
#include "Unknown/UnkStruct_020ec7dc.hpp"
#include "Unknown/UnkStruct_020ee734.hpp"
#include "Unknown/UnkStruct_020eec68.hpp"
#include "Unknown/UnkStruct_027e0d54.hpp"
#include "Unknown/UnkStruct_027e0dbc.hpp"
#define FRAME_COUNTER (*(u32 *) 0x027ffc3c)
#define FRAME_COUNTER (*(vu32 *) 0x027ffc3c)
#define REG_POWER_CNT (*(u16 *) 0x04000304)
#define REG_DISPCNT_SUB (*(volatile u32 *) 0x04001000)
#define GAME_MODE_DATA(id) ((GameModeData *) (((u8 *) &gGameModes) + ((id) * sizeof(GameModeData))))
extern unk32 data_02068ed0;
extern unk32 data_02068e64;
extern unk32 data_02062d4c;
extern unk32 data_020683f4;
extern unk32 data_02063e4c;
extern unk32 data_02068780;
extern unk32 data_027e08e4;
extern bool data_027e0f8c;
extern unk32 data_ov009_0211e0c0;
extern unk32 data_ov010_0211e960;
@@ -154,6 +153,18 @@ const GameModeData gGameModes[] = {
},
};
extern "C" void func_02005a30(u16, u16, u16, u16, u16);
THUMB void Game::func_0202c678() {
mUnk_0fc = mUnk_0fe;
func_02005a30(mUnk_0fc, 31, 0x7fff, 0, 0);
}
THUMB void Game::func_0202c69c() {
bool bVar1 = (mModeId == GameModeId_Adventure) || (mModeId == GameModeId_Battle);
mUnk_0fe = bVar1 ? 0x7f72 : 0;
this->func_0202c678();
}
extern "C" void func_ov000_020d6488(unk32 *param0);
extern "C" void func_0203d14c(unk32 *param0);
extern "C" void func_020355e4(unk32 *param0, unk32 param1);
@@ -173,9 +184,23 @@ THUMB void Game::EndGameMode() {
return;
}
struct SchedulerTask {
/* 0 */ void (*mFunc)();
/* 4 */ void *mObject;
/* 8 */ SchedulerTask *mNext;
/* c */
};
SchedulerTask data_02062d40;
unk8 data_02062d4c[0xd4];
inline const GameModeData *GetGameMode(GameModeId id) {
return &gGameModes[id];
}
extern "C" void func_0202c0cc();
extern "C" void func_0202c128(unk32 param1, u16 param2);
extern "C" void func_02017cb0(unk32 *param0, unk32 param1);
extern "C" void func_02017cb0(unk8 *param0, unk32 param1);
extern "C" void func_02031024(unk32 *param0);
extern "C" void Fill16(int value, unsigned short *dst, int size);
extern "C" void func_ov000_0207c0f0(unk32 *param0, unk32 param1);
@@ -187,6 +212,7 @@ extern "C" void FlushGfxQueue();
extern "C" void func_0200eec8();
extern "C" void func_02005778();
extern "C" void func_02003a54();
extern "C" void _ZN18UnkStruct_027e05f8C1Ev(UnkStruct_027e05f8 *);
THUMB bool Game::StartGameMode() {
func_0202c0cc();
@@ -196,18 +222,19 @@ THUMB bool Game::StartGameMode() {
mUnk_0fe = uVar3;
mUnk_0fc = mUnk_0fe;
func_0202c128(1, mUnk_0fc);
func_02017cb0(&data_02062d4c, 0xc);
func_02017cb0(data_02062d4c, 0xc);
mUnk_0f0 = 0;
mUnk_0f4 = 0;
mUnk_101 = 0;
mUnk_103 = GAME_MODE_DATA(mModeId)->mUnk_03;
mUnk_0f2 = GAME_MODE_DATA(mModeId)->mUnk_00;
mUnk_103 = GetGameMode(mModeId)->mUnk_03;
mUnk_0f2 = GetGameMode(mModeId)->mUnk_00;
func_02031024(&data_020683f4);
data_027e077c.Init(0);
Fill16(0, (u16 *) &data_027e0d04, 6);
data_027e0c38.func_02033d40();
data_027e05f8 = UnkStruct_027e05f8();
// HACK to rerun the constructor
_ZN18UnkStruct_027e05f8C1Ev(&data_027e05f8);
if (gOverlayManager.mLoadedOverlays[0] != OverlayId_None) {
data_ov000_020ec7dc.func_ov000_0207c0f0(mModeId);
gTouchControl.Init();
@@ -230,7 +257,7 @@ THUMB bool Game::StartGameMode() {
data_027e0dbc.func_ov000_0207b988(mModeId);
}
mMode = GAME_MODE_DATA(mModeId)->mModeCreateFunc(mModeId);
mMode = GetGameMode(mModeId)->mModeCreateFunc(mModeId);
mUnk_102 = 0;
data_027e0cbc.func_0203d6d0();
@@ -245,8 +272,7 @@ THUMB bool Game::StartGameMode() {
}
func_02003a54();
u8 unk1 = GAME_MODE_DATA(mModeId)->mUnk_03;
if (unk1 != 0) {
if (GetGameMode(mModeId)->mUnk_03 != 0) {
REG_DISPCNT_SUB |= 0x10000;
} else {
REG_DISPCNT_SUB &= ~0x10000;
@@ -256,18 +282,22 @@ THUMB bool Game::StartGameMode() {
return mFadeControl.func_0202abdc(0x20, 0);
}
THUMB void Game::func_0202c974() {
this->func_0202cf34();
THUMB void Game::func_0202c974(Game *game) {
game->func_0202cf34();
}
THUMB void Game::func_0202c97c() {}
extern "C" void func_0200b934(SchedulerTask *param0);
THUMB void Game::func_0202c97c() {
data_02062d40.mFunc = (void (*)()) &Game::func_0202c974;
data_02062d40.mObject = (void *) &gGame;
func_0200b934(&data_02062d40);
}
extern "C" void func_0200a440();
extern "C" void func_020310fc(unk32 *param0);
extern "C" void func_02025c7c(unk32 *param0);
extern "C" void func_020363c8(u16 *param0, UnkStruct_027e0c54 *param1);
extern "C" void func_02025d2c();
extern "C" void func_0202f2ac(unk32 *param0);
extern "C" bool func_0202f328(unk32 *param0);
ARM void Game::Run() {
bool bVar2;
@@ -293,7 +323,7 @@ ARM void Game::Run() {
}
data_027e05f8.func_0202adf4(this->mUnk_0f2, bVar2);
data_027e08f8.func_0202f9a0(0);
bVar6 = data_027e080c.mUnk_04 == 3 || data_027e080c.mUnk_10[0].mUnk_00 == 3;
bVar6 = data_027e080c.mUnk_04 == 3 || data_027e080c.mUnk_08 == 3;
data_027e080c.func_0202eebc(this->mUnk_0f2);
data_027e0d04.func_0203fe00();
data_027e0c38.func_02033d70(bVar2);
@@ -320,7 +350,7 @@ ARM void Game::Run() {
data_ov000_020ee734.func_ov000_020d64ac();
}
}
if (bVar6) {
if (!bVar6) {
gFadeController.ProcessFade((u32) this->mUnk_0f2);
if ((this->mUnk_101 == 0) && (ov00Loaded)) {
data_027e0e2c.func_ov000_0207be84(bVar2);
@@ -352,26 +382,42 @@ ARM void Game::Run() {
data_027e103c->func_ov005_02103e58(&this->mUnk_0f0);
}
func_02025d2c();
bool unk = (this->mUnk_0f2 >= 1);
bVar2 = (s32) (this->mUnk_0f2 - (FRAME_COUNTER - this->mUnk_0f8) - 1) > 0;
if (unk && bVar2) {
u16 uVar5 = this->mUnk_0f2;
bool bVar6 = false;
if (uVar5 > 1) {
u32 frameCounter = FRAME_COUNTER;
u32 unk_0f8 = this->mUnk_0f8;
s32 iVar7 = frameCounter - unk_0f8;
uVar5 = ((s32) (mUnk_0f2 - iVar7 - 1) > 0);
if (uVar5 != 0) {
bVar6 = true;
}
}
if (bVar6) {
do {
if ((s32) REG_VCOUNT < 0xb0) {
break;
}
} while ((s32) REG_VCOUNT <= 0xc5);
bVar2 = (u32) this->mUnk_0f2 - (FRAME_COUNTER - this->mUnk_0f8);
while ((0 < bVar2 + -1) ? 1 : 0) {
func_0202f2ac(&data_027e08e4);
bVar2 = (u32) this->mUnk_0f2 - (FRAME_COUNTER - this->mUnk_0f8);
u32 frameCounter = FRAME_COUNTER;
u32 unk_0f8 = this->mUnk_0f8;
s32 iVar7 = frameCounter - unk_0f8;
bool bVar3 = (s32) (this->mUnk_0f2 - iVar7 - 1) > 0;
while (bVar3 > 0) {
data_027e08e4.func_0202f2ac();
frameCounter = FRAME_COUNTER;
unk_0f8 = this->mUnk_0f8;
iVar7 = frameCounter - unk_0f8;
bVar3 = (s32) (this->mUnk_0f2 - iVar7 - 1) > 0;
}
}
uVar4 = OS_DisableInterrupts_Irq();
this->mUnk_100 = 1;
this->mUnk_100 = true;
GFX_FIFO_SWAP_BUFFERS = 3;
OS_RestoreInterrupts(uVar4);
func_0202f2ac(&data_027e08e4);
this->mUnk_100 = 0;
data_027e08e4.func_0202f2ac();
this->mUnk_100 = false;
this->mUnk_0f8 = FRAME_COUNTER;
if (gOverlayManager.mLoadedOverlays[0] != -1) {
switch (data_027e0d54.mUnk_0f) {
@@ -384,8 +430,8 @@ ARM void Game::Run() {
}
}
} while (nextGameMode == 0);
while (func_0202f328(&data_027e08e4)) {
func_0202f2ac(&data_027e08e4);
while (data_027e08e4.func_0202f328()) {
data_027e08e4.func_0202f2ac();
}
FlushGfxQueue();
this->EndGameMode();
@@ -395,7 +441,69 @@ ARM void Game::Run() {
} while (true);
}
THUMB void Game::func_0202cec8(s32 param1, unk32 param2) {}
THUMB void Game::func_0202cf34() {}
ARM void Game::func_0202cf44() {}
ARM Game::~Game() {}
THUMB bool Game::func_0202cec8(s32 param1, bool param2) {
bool result = false;
if (mFadeControl.func_0202abf4(32, 0)) {
mUnk_102 = param2;
if (param1 != 0) {
mFadeControl.mUnk_20 = false;
} else {
mFadeControl.mUnk_20 = true;
}
gFadeController.func_0202d77c(&mFadeControl);
if (gOverlayManager.mLoadedOverlays[0] != OverlayId_None) {
data_ov000_020eec68.func_ov000_020d716c(32);
data_027e0ffc.mUnk_14 = -1;
}
result = true;
}
return result;
}
THUMB void Game::func_0202cf34() {
if (mMode) {
mMode->vfunc_18();
}
}
extern "C" void func_02017cd0();
ARM void Game::func_0202cf44() {
while (true) {
if (mUnk_100) {
mUnk_0f4 += 1;
while (REG_GFX_RAM_COUNT_2 != 0) {
}
func_02005778();
func_02017cd0();
if (mUnk_0fc != mUnk_0fe) {
this->func_0202c678();
}
if (data_027e080c.func_0202eef8()) {
data_027e08f8.mUnk_1 = true;
} else {
data_027e0c54.func_02036240(&mUnk_0f0);
data_027e0c38.func_02033d84(&mUnk_0f0);
mMode->vfunc_0c(&mUnk_0f0);
gMessageManager.func_02036c50(&mUnk_0f0);
if ((s32) (data_027e080c.mUnk_04 == 3 || data_027e080c.mUnk_08 == 3) == 0) {
gFadeController.SetScreenBrightness(mUnk_103);
}
data_027e0cbc.func_0203d67c(&mUnk_0f0);
if (gOverlayManager.mLoadedOverlays[0] != OverlayId_None) {
data_027e0db0.func_ov000_0207b43c();
}
if (mModeId == 2) {
data_027e077c.func_ov009_0211653c();
}
data_02068894.func_0203235c();
data_02075dac.func_0203f974();
}
mUnk_100 = false;
}
data_027e08e4.func_0202f2ac();
}
}
ARM Game::~Game() {
mFadeControl.Unregister();
}
+3 -7
View File
@@ -1,6 +1,7 @@
#include "Message/MessageManager.hpp"
#include "Actor/ActorManager.hpp"
#include "DTCM/UnkStruct_027e0c54.hpp"
#include "DTCM/UnkStruct_027e0ffc.hpp"
#include "Game/Game.hpp"
#include "Player/TouchControl.hpp"
#include "System/SysNew.hpp"
@@ -15,11 +16,6 @@ extern UnkStruct_MsgProc_Base_unk_2C *data_02068e8c;
extern u16 data_02056918[];
extern ActorTypeId data_0205691c[];
struct UnkStruct_027e0ffc {
void func_ov000_020cec60(u16, Vec3p *, Actor *, unk32);
};
extern UnkStruct_027e0ffc *data_027e0ffc;
// non-matching
ARM void MessageManager::func_0203643c(u32 *param_1, MessageManager *param_2, u32 param_3) {
BMGGroups *pBVar2 = param_2->pGroups;
@@ -327,7 +323,7 @@ ARM void MessageManager::func_0203690c(unk32 param_2) {
pActor = gActorManager->GetActor(&actorRef);
if (pActor != NULL) {
data_027e0ffc->func_ov000_020cec60(data_02056918[this->mUnk_10], &pActor->mPos, pActor, 0);
data_027e0ffc.func_ov000_020cec60(data_02056918[this->mUnk_10], &pActor->mPos, pActor, 0);
}
}
}
@@ -354,7 +350,7 @@ ARM void MessageManager::func_02036bbc(void) {
}
}
ARM void MessageManager::func_02036c50(unk32 param_2) {
ARM void MessageManager::func_02036c50(u16 *param_2) {
s32 i;
for (i = 0; i < ARRAY_LEN(this->mUnk_28); i++) {
+1 -1
View File
@@ -53,7 +53,7 @@ THUMB void MsgProc_Type2::func_0203c39c(unk32 param_2, unk32 param_3) {
}
}
ARM void MsgProc_Type2::vfunc_3C(unk32 param_2) {
ARM void MsgProc_Type2::vfunc_3C(u16 *param_2) {
if (this->mUnk_15c > 0 && this->mUnk_122 != 1) {
if (this->func_0203de14(param_2) != 0) {
this->vfunc_40(0, 0);
+3 -2
View File
@@ -7,6 +7,7 @@
#include "Message/MsgProc.hpp"
#include "Player/TouchControl.hpp"
#include "Save/AdventureFlags.hpp"
#include "Unknown/UnkStruct_02068894.hpp"
extern "C" void func_ov000_020d0460(void *);
extern "C" void func_0203efd8(void *, void *);
@@ -174,7 +175,7 @@ ARM void UnkStruct_020397f8::func_02039ca8() {
}
}
ARM void UnkStruct_020397f8::vfunc_3c(unk32 param1) {
ARM void UnkStruct_020397f8::vfunc_3c(u16 *param1) {
if (this->mUnk_15c > 0 && this->func_0203de14(param1) != 0) {
if (this->mUnk_124->mUnk_29 != 3) {
if ((this->mUnk_50 == 0) && func_ov000_02079e04() != 0) {
@@ -814,7 +815,7 @@ ARM void UnkStruct_020397f8::vfunc_60(func_0203b410_param1 *param1, unk32 param2
if (this->mUnk_15e == 7) {
uVar5 = func_0202d5b4(data_02057f08, data_02057eec, data_020691a0, 0xCC00, 1);
func_02032304(data_02068894, data_02057ed8, data_02056af0, 1, param3);
data_02068894.func_02032304(data_02057ed8, data_02056af0, 1, param3);
iVar3 = func_02016fcc(uVar5);
} else {
if (this->func_02032fa4() != 0) {