From ac0720a8ce43fde10c2f1c2901711a576d799dd1 Mon Sep 17 00:00:00 2001 From: Yanis002 <35189056+Yanis002@users.noreply.github.com> Date: Mon, 7 Jul 2025 14:11:51 +0200 Subject: [PATCH] `data_027e0618` -> `gGame` --- config/eur/arm9/dtcm/symbols.txt | 2 +- config/usa/arm9/dtcm/symbols.txt | 2 +- include/DTCM/UnkStruct_027e0618.hpp | 9 --------- src/00_Core/Item/ItemManager.cpp | 4 ++-- src/05/Player/LinkStateMove.cpp | 4 ++-- src/Main/Message/MessageManager.cpp | 18 +++++++++--------- src/Main/Unknown/UnkStruct_02038aa0.cpp | 5 ++--- src/Main/Unknown/UnkStruct_020397f8.cpp | 20 ++++++++++---------- src/Main/Unknown/UnkStruct_02063220.cpp | 4 ++-- 9 files changed, 29 insertions(+), 39 deletions(-) delete mode 100644 include/DTCM/UnkStruct_027e0618.hpp diff --git a/config/eur/arm9/dtcm/symbols.txt b/config/eur/arm9/dtcm/symbols.txt index 995c23fc..0036a26b 100644 --- a/config/eur/arm9/dtcm/symbols.txt +++ b/config/eur/arm9/dtcm/symbols.txt @@ -66,7 +66,7 @@ data_027e05f4 kind:bss addr:0x027e05f4 data_027e05f8 kind:bss addr:0x027e05f8 data_027e0600 kind:bss addr:0x027e0600 data_027e060c kind:bss addr:0x027e060c -data_027e0618 kind:bss addr:0x027e0618 +gGame kind:bss addr:0x027e0618 data_027e0698 kind:bss addr:0x027e0698 data_027e06d8 kind:bss addr:0x027e06d8 data_027e06e4 kind:bss addr:0x027e06e4 diff --git a/config/usa/arm9/dtcm/symbols.txt b/config/usa/arm9/dtcm/symbols.txt index f2c6013e..018efdc8 100644 --- a/config/usa/arm9/dtcm/symbols.txt +++ b/config/usa/arm9/dtcm/symbols.txt @@ -66,7 +66,7 @@ data_027e05f4 kind:bss addr:0x027e05f4 data_027e05f8 kind:bss addr:0x027e05f8 data_027e0600 kind:bss addr:0x027e0600 data_027e060c kind:bss addr:0x027e060c -data_027e0618 kind:bss addr:0x027e0618 +gGame kind:bss addr:0x027e0618 data_027e0698 kind:bss addr:0x027e0698 data_027e06d8 kind:bss addr:0x027e06d8 data_027e06e4 kind:bss addr:0x027e06e4 diff --git a/include/DTCM/UnkStruct_027e0618.hpp b/include/DTCM/UnkStruct_027e0618.hpp deleted file mode 100644 index 7489cee5..00000000 --- a/include/DTCM/UnkStruct_027e0618.hpp +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -#include "types.h" - -struct UnkStruct_027e0618 { - void func_0202cf34(void); -}; - -extern UnkStruct_027e0618 data_027e0618; diff --git a/src/00_Core/Item/ItemManager.cpp b/src/00_Core/Item/ItemManager.cpp index 3c77b0ab..e95326ab 100644 --- a/src/00_Core/Item/ItemManager.cpp +++ b/src/00_Core/Item/ItemManager.cpp @@ -2,6 +2,7 @@ #include "DTCM/UnkStruct_027e0d38.hpp" #include "DTCM/UnkStruct_027e0f78.hpp" #include "DTCM/UnkStruct_027e103c.hpp" +#include "Game/Game.hpp" #include "Item/ItemModelLoader.hpp" #include "Map/MapManager.hpp" #include "Player/PlayerLinkBase.hpp" @@ -188,9 +189,8 @@ ARM void ItemManager::Shield_vfunc_38(unk32 param1) { (*mEquipItems)[ItemFlag_WoodenShield]->vfunc_38(param1); } -extern unk32 data_027e0618; ARM void ItemManager::EquipItem_vfunc_38(unk32 param1) { - if (data_027e0618 != 6) { + if (gGame.mModeId != GameModeId_Battle) { this->Sword_vfunc_38(param1); this->Shield_vfunc_38(param1); } diff --git a/src/05/Player/LinkStateMove.cpp b/src/05/Player/LinkStateMove.cpp index 0ca48089..ab5c4f88 100644 --- a/src/05/Player/LinkStateMove.cpp +++ b/src/05/Player/LinkStateMove.cpp @@ -1,5 +1,6 @@ #include "Player/LinkStateMove.hpp" #include "DTCM/UnkStruct_027e0d38.hpp" +#include "Game/Game.hpp" #include "Player/LinkStateDamage.hpp" #include "Player/LinkStateFollow.hpp" #include "Player/LinkStateInteract.hpp" @@ -50,7 +51,6 @@ static Vec3p data_ov005_02112bf0 = { static const volatile q20 data_ov005_021123b8 = FLOAT_TO_Q20(15.0); extern LinkStateFollow *GetLinkStateFollow(); -extern unk32 data_027e0618; 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); @@ -101,7 +101,7 @@ ARM void LinkStateMove::vfunc_1c() { this->EquipItem_vfunc_28(); } } - if (data_027e0618 != 6) { + if (gGame.mModeId != GameModeId_Battle) { s32 temp_r7_2 = gPlayerControl->func_ov00_020b0418(); if ((this->func_ov00_020a8f2c() == 0) && (temp_r7_2 > 0)) { mUnk_0c = temp_r7_2; diff --git a/src/Main/Message/MessageManager.cpp b/src/Main/Message/MessageManager.cpp index 3b667a61..84807755 100644 --- a/src/Main/Message/MessageManager.cpp +++ b/src/Main/Message/MessageManager.cpp @@ -1,5 +1,6 @@ #include "Message/MessageManager.hpp" #include "Actor/ActorManager.hpp" +#include "Game/Game.hpp" #include "Player/TouchControl.hpp" #include "System/SysNew.hpp" @@ -18,8 +19,6 @@ struct UnkStruct_027e0ffc { }; extern UnkStruct_027e0ffc *data_027e0ffc; -extern u32 data_027e0618[]; - // non-matching ARM void MessageManager::func_0203643c(u32 *param_1, MessageManager *param_2, u32 param_3) { BMGGroups *pBVar2 = param_2->pGroups; @@ -35,20 +34,20 @@ THUMB void MessageManager::func_02036490() { this->pGroups->func_020372f0(BMG_FILE_INDEX_SYSTEM, 2); - switch (*data_027e0618) { - case 3: + switch (gGame.mModeId) { + case GameModeId_FileSelect: this->pGroups->func_020372f0(BMG_FILE_INDEX_MAINSELECT, 2); this->pGroups->func_020372f0(BMG_FILE_INDEX_BATTLE, 2); break; - case 5: + case GameModeId_DownloadPlay: this->pGroups->func_020372f0(BMG_FILE_INDEX_BATTLE, 2); this->pGroups->func_020372f0(BMG_FILE_INDEX_BATTLECOMMON, 2); break; - case 6: + case GameModeId_Battle: this->pGroups->func_020372f0(BMG_FILE_INDEX_BATTLE, 2); this->pGroups->func_020372f0(BMG_FILE_INDEX_BATTLECOMMON, 2); break; - case 7: this->pGroups->func_020372f0(BMG_FILE_INDEX_MAINSELECT, 2); break; + case GameModeId_Contact: this->pGroups->func_020372f0(BMG_FILE_INDEX_MAINSELECT, 2); break; default: break; } @@ -67,11 +66,12 @@ THUMB void MessageManager::func_02036490() { this->mUnk_18[0]->mUnk_39 = 0; this->mUnk_18[1]->mUnk_39 = 1; - if (*data_027e0618 == 2 || *data_027e0618 == 3 || *data_027e0618 == 6) { + if (gGame.mModeId == GameModeId_Adventure || gGame.mModeId == GameModeId_FileSelect || gGame.mModeId == GameModeId_Battle) + { for (s32 i = 0; i < ARRAY_LEN(this->mUnk_28); i++) { switch (data_02056924[i + 1]) { case 0: - if (*data_027e0618 != 2) { + if (gGame.mModeId != GameModeId_Adventure) { this->mUnk_28[i] = new(data_027e0ce0[1], 4) UnkStruct_020397f8(); this->mUnk_28[i]->func_0203dc74(0xE0, 0x40); this->mUnk_28[i]->mUnk_2c = &data_02068e6c; diff --git a/src/Main/Unknown/UnkStruct_02038aa0.cpp b/src/Main/Unknown/UnkStruct_02038aa0.cpp index 038d25b6..75e512bf 100644 --- a/src/Main/Unknown/UnkStruct_02038aa0.cpp +++ b/src/Main/Unknown/UnkStruct_02038aa0.cpp @@ -1,9 +1,8 @@ #include "Unknown/UnkStruct_02038aa0.hpp" #include "DTCM/UnkStruct_027e103c.hpp" +#include "Game/Game.hpp" #include "Message/MessageManager.hpp" -extern u32 data_027e0618[]; - ARM UnkStruct_0203881c::UnkStruct_0203881c() { this->mUnk_14 = 0x1000; this->mUnk_18 = 0; @@ -155,7 +154,7 @@ ARM void UnkStruct_02038aa0::vfunc_50(EntryINF1 *param1, u32 param2, s16 *param3 // this->vfunc_60(0, 0, (unk32)param3); // this->vfunc_64(param3); - if (*(unk32 *) data_027e0618 == 2) { + if (gGame.mModeId == GameModeId_Adventure) { if (this->func_02032fa4() == 0) { data_027e103c->func_ov000_020cfc9c(1, 0); } else { diff --git a/src/Main/Unknown/UnkStruct_020397f8.cpp b/src/Main/Unknown/UnkStruct_020397f8.cpp index ede7e671..c446d859 100644 --- a/src/Main/Unknown/UnkStruct_020397f8.cpp +++ b/src/Main/Unknown/UnkStruct_020397f8.cpp @@ -1,5 +1,6 @@ #include "Unknown/UnkStruct_020397f8.hpp" #include "DTCM/UnkStruct_027e103c.hpp" +#include "Game/Game.hpp" #include "Message/MessageManager.hpp" #include "Message/MsgProc.hpp" #include "Player/TouchControl.hpp" @@ -12,7 +13,6 @@ extern "C" void func_ov018_02169634(UnkStruct_020397f8 *); extern unk16 data_02056a0e[]; extern u8 data_02056a08[]; -extern u32 data_027e0618[]; THUMB UnkStruct_020397f8::UnkStruct_020397f8() : UnkStruct_02038aa0(0, 0), @@ -90,7 +90,7 @@ THUMB void UnkStruct_020397f8::vfunc_4c() { // non-matching ARM void UnkStruct_020397f8::vfunc_2c() { - if (data_027e0618[0x101] != 0) { + if (gGame.mUnk_101 != 0) { if (((data_02056be4[data_027e077c.mUnk_0] & 1) != 0) != this->mUnk_50) { return; } @@ -177,7 +177,7 @@ ARM void UnkStruct_020397f8::vfunc_3c(unk32 param1) { return; } - if (data_027e0618[0x101] != 0) { + if (gGame.mUnk_101 != 0) { if (((data_02056be4[data_027e077c.mUnk_0] & 1) != 0) != this->mUnk_50) { return; } @@ -233,13 +233,13 @@ ARM void UnkStruct_020397f8::vfunc_40(s32 param1, s32 param2) { } if (this->mUnk_585 != 0 && ((data_02056be4[data_027e077c.mUnk_0] & 1) == 0)) { - switch (data_027e0618[0]) { - case 2: + switch (gGame.mModeId) { + case GameModeId_Adventure: if (data_027e0cbc.func_0203d7e0(3) != 0) { this->mUnk_388.func_02034b0c(0xBE, 0, 0, 0, 0); } break; - case 6: + case GameModeId_Battle: if (data_027e0cbc.func_0203d7e0(0x58) != 0) { this->mUnk_388.func_02034b0c(0x013B, 0, 0, 0, 0); } @@ -409,7 +409,7 @@ ARM void UnkStruct_020397f8::vfunc_44(s32 touchLastX, s32 touchLastY) { if ((gTouchControl.mFlags & 1) != 0) { if (this->mUnk_50 == 0 && data_027e0d38 != 0) { if (func_ov000_02079e04() == 0 && data_027e0e28->func_ov000_0207bc48() == 0) { - if (data_027e0618[0x101] == 0 && data_027e103c->mUnk_24 == 0) { + if (gGame.mUnk_101 == 0 && data_027e103c->mUnk_24 == 0) { return; } } @@ -521,7 +521,7 @@ ARM void UnkStruct_020397f8::vfunc_50(EntryINF1 *param1, unk32 param2, s32 *para } } - if (*((s32 *) data_027e0618) == 2 && data_027e0d38->func_ov000_02078b40() == 2 && + if (gGame.mModeId == GameModeId_Adventure && data_027e0d38->func_ov000_02078b40() == 2 && func_ov003_020f3f94(data_ov009_0211f5b4) == 0) { UnkStruct_020397f8 *pVar4 = (UnkStruct_020397f8 *) gMessageManager.mUnk_28[4]; @@ -603,7 +603,7 @@ ARM void UnkStruct_020397f8::vfunc_58() { } } - // if (data_027e0618[0] == 2 && func_ov000_02079e04() && (data_027e1054.mUnk_04 + 0x99) != 0 && + // if (gGame.mModeId == GameModeId_Adventure && func_ov000_02079e04() && (data_027e1054.mUnk_04 + 0x99) != 0 && // (data_027e077c.mUnk_0 != 0x39 || data_027e103c->func_ov000_020cf0bc())) { // data_027e1054.func_ov003_020f4874(); // data_027e103c->func_ov005_02103f8c(data_02057ed4); @@ -920,7 +920,7 @@ ARM bool UnkStruct_020397f8::func_0203c084() { bVar1 = false; } - if (!bVar1 && data_027e0618[0x101] == 0) { + if (!bVar1 && gGame.mUnk_101 == 0) { if ((data_027e0d38 != NULL && data_027e0d38->mUnk_14 == 1) == 0) { bVar2 = false; } diff --git a/src/Main/Unknown/UnkStruct_02063220.cpp b/src/Main/Unknown/UnkStruct_02063220.cpp index fe026560..a7ccc315 100644 --- a/src/Main/Unknown/UnkStruct_02063220.cpp +++ b/src/Main/Unknown/UnkStruct_02063220.cpp @@ -1,8 +1,8 @@ #include "Unknown/UnkStruct_02063220.hpp" #include "DTCM/UnkStruct_027e02a0.hpp" #include "DTCM/UnkStruct_027e05f8.hpp" -#include "DTCM/UnkStruct_027e0618.hpp" #include "DTCM/UnkStruct_027e08f8.hpp" +#include "Game/Game.hpp" #include "System/OverlayManager.hpp" #include "Unknown/UnkStruct_0206322c.hpp" #include "Unknown/UnkStruct_020ee734.hpp" @@ -268,7 +268,7 @@ THUMB void UnkStruct_02063220::func_0202f754(unk32 param1) { data_0206322c.func_02030464(1, 1); } - data_027e0618.func_0202cf34(); + gGame.func_0202cf34(); if (gOverlayManager.mLoadedOverlays[OverlayIndex_Core] != -1) { data_ov000_020ee734.func_ov000_020d6620();