From 66515ad30f260cc6c03461a726f4740ec064a857 Mon Sep 17 00:00:00 2001 From: Henrique Gemignani Passos Lima Date: Fri, 6 Jan 2023 22:29:49 +0200 Subject: [PATCH] Naming and reordering in main.cpp Former-commit-id: 7fb8be3eea359ef515d015ab7e1905bdc16fc792 --- asm/MetroidPrime/CCredits.s | 4 +- asm/MetroidPrime/CLogBookScreen.s | 2 +- asm/MetroidPrime/CStateManager.s | 4 +- asm/MetroidPrime/CWorldTransManager.s | 4 +- asm/MetroidPrime/Player/CGameState.s | 6 +-- asm/MetroidPrime/Player/CPlayerDynamics.s | 2 +- asm/MetroidPrime/main.s | 24 ++++++------ include/MetroidPrime/Player/CGameOptions.hpp | 1 + include/MetroidPrime/Player/CWorldState.hpp | 1 + src/MetroidPrime/main.cpp | 40 ++++++++++---------- 10 files changed, 45 insertions(+), 43 deletions(-) diff --git a/asm/MetroidPrime/CCredits.s b/asm/MetroidPrime/CCredits.s index 745035f0..38e7884d 100644 --- a/asm/MetroidPrime/CCredits.s +++ b/asm/MetroidPrime/CCredits.s @@ -2147,9 +2147,9 @@ lbl_80026C0C: /* 80026C68 00023BC8 1C 03 00 64 */ mulli r0, r3, 0x64 /* 80026C6C 00023BCC 38 61 00 34 */ addi r3, r1, 0x34 /* 80026C70 00023BD0 7F 00 D3 D6 */ divw r24, r0, r26 -/* 80026C74 00023BD4 4B FE 22 99 */ bl sub_80008f0c +/* 80026C74 00023BD4 4B FE 22 99 */ bl "ReleaseData__Q24rstl22rc_ptr<12CPlayerState>Fv" /* 80026C78 00023BD8 38 61 00 38 */ addi r3, r1, 0x38 -/* 80026C7C 00023BDC 4B FE 22 91 */ bl sub_80008f0c +/* 80026C7C 00023BDC 4B FE 22 91 */ bl "ReleaseData__Q24rstl22rc_ptr<12CPlayerState>Fv" /* 80026C80 00023BE0 38 7F 00 48 */ addi r3, r31, 0x48 /* 80026C84 00023BE4 48 31 A1 89 */ bl GetObj__6CTokenFv /* 80026C88 00023BE8 80 63 00 04 */ lwz r3, 4(r3) diff --git a/asm/MetroidPrime/CLogBookScreen.s b/asm/MetroidPrime/CLogBookScreen.s index 7c04f28c..df7d5326 100644 --- a/asm/MetroidPrime/CLogBookScreen.s +++ b/asm/MetroidPrime/CLogBookScreen.s @@ -441,7 +441,7 @@ lbl_80245EFC: /* 80245F28 00242E88 80 81 00 0C */ lwz r4, 0xc(r1) /* 80245F2C 00242E8C 38 61 00 0C */ addi r3, r1, 0xc /* 80245F30 00242E90 83 A4 00 00 */ lwz r29, 0(r4) -/* 80245F34 00242E94 4B DC 2F D9 */ bl sub_80008f0c +/* 80245F34 00242E94 4B DC 2F D9 */ bl "ReleaseData__Q24rstl22rc_ptr<12CPlayerState>Fv" /* 80245F38 00242E98 7F A3 EB 78 */ mr r3, r29 /* 80245F3C 00242E9C 38 9E 00 1D */ addi r4, r30, 0x1d /* 80245F40 00242EA0 4B E4 BB 81 */ bl HasPowerUp__12CPlayerStateCFQ212CPlayerState9EItemType diff --git a/asm/MetroidPrime/CStateManager.s b/asm/MetroidPrime/CStateManager.s index 612f15b3..ce8cf298 100644 --- a/asm/MetroidPrime/CStateManager.s +++ b/asm/MetroidPrime/CStateManager.s @@ -11239,7 +11239,7 @@ lbl_8004D4D0: /* 8004D4D8 0004A438 34 1D 08 C4 */ addic. r0, r29, 0x8c4 /* 8004D4DC 0004A43C 41 82 00 0C */ beq lbl_8004D4E8 /* 8004D4E0 0004A440 38 7D 08 C4 */ addi r3, r29, 0x8c4 -/* 8004D4E4 0004A444 4B FB B1 01 */ bl sub_800085e4 +/* 8004D4E4 0004A444 4B FB B1 01 */ bl "ReleaseData__Q24rstl28rc_ptr<18CWorldTransManager>Fv" lbl_8004D4E8: /* 8004D4E8 0004A448 34 1D 08 C0 */ addic. r0, r29, 0x8c0 /* 8004D4EC 0004A44C 41 82 00 14 */ beq lbl_8004D500 @@ -11260,7 +11260,7 @@ lbl_8004D518: /* 8004D520 0004A480 34 1D 08 B8 */ addic. r0, r29, 0x8b8 /* 8004D524 0004A484 41 82 00 0C */ beq lbl_8004D530 /* 8004D528 0004A488 38 7D 08 B8 */ addi r3, r29, 0x8b8 -/* 8004D52C 0004A48C 4B FB B9 E1 */ bl sub_80008f0c +/* 8004D52C 0004A48C 4B FB B9 E1 */ bl "ReleaseData__Q24rstl22rc_ptr<12CPlayerState>Fv" lbl_8004D530: /* 8004D530 0004A490 34 1D 08 A4 */ addic. r0, r29, 0x8a4 /* 8004D534 0004A494 41 82 00 34 */ beq lbl_8004D568 diff --git a/asm/MetroidPrime/CWorldTransManager.s b/asm/MetroidPrime/CWorldTransManager.s index e4e28921..25dd01a7 100644 --- a/asm/MetroidPrime/CWorldTransManager.s +++ b/asm/MetroidPrime/CWorldTransManager.s @@ -2217,7 +2217,7 @@ lbl_8020AC20: /* 8020ACDC 00207C3C 4B FA 15 35 */ bl GetCinematicBeamResId__15CTweakPlayerResCFQ212CPlayerState7EBeamId /* 8020ACE0 00207C40 7C 79 1B 78 */ mr r25, r3 /* 8020ACE4 00207C44 38 61 00 08 */ addi r3, r1, 8 -/* 8020ACE8 00207C48 4B DF E2 25 */ bl sub_80008f0c +/* 8020ACE8 00207C48 4B DF E2 25 */ bl "ReleaseData__Q24rstl22rc_ptr<12CPlayerState>Fv" /* 8020ACEC 00207C4C 3C 60 43 4D */ lis r3, 0x434D444C@ha /* 8020ACF0 00207C50 93 21 00 40 */ stw r25, 0x40(r1) /* 8020ACF4 00207C54 38 03 44 4C */ addi r0, r3, 0x434D444C@l @@ -2721,7 +2721,7 @@ sub_8020b3e4: /* 8020B404 00208364 80 81 00 08 */ lwz r4, 8(r1) /* 8020B408 00208368 38 61 00 08 */ addi r3, r1, 8 /* 8020B40C 0020836C 83 E4 00 00 */ lwz r31, 0(r4) -/* 8020B410 00208370 4B DF DA FD */ bl sub_80008f0c +/* 8020B410 00208370 4B DF DA FD */ bl "ReleaseData__Q24rstl22rc_ptr<12CPlayerState>Fv" /* 8020B414 00208374 83 DF 00 20 */ lwz r30, 0x20(r31) /* 8020B418 00208378 7F E3 FB 78 */ mr r3, r31 /* 8020B41C 0020837C 4B E8 60 A9 */ bl GetIsFusionEnabled__12CPlayerStateCFv diff --git a/asm/MetroidPrime/Player/CGameState.s b/asm/MetroidPrime/Player/CGameState.s index 8cfc3526..fa6009e9 100644 --- a/asm/MetroidPrime/Player/CGameState.s +++ b/asm/MetroidPrime/Player/CGameState.s @@ -1202,7 +1202,7 @@ lbl_801D4730: /* 801D480C 001D176C 7C 7C 1B 78 */ mr r28, r3 lbl_801D4810: /* 801D4810 001D1770 38 7D 00 98 */ addi r3, r29, 0x98 -/* 801D4814 001D1774 4B E3 46 F9 */ bl sub_80008f0c +/* 801D4814 001D1774 4B E3 46 F9 */ bl "ReleaseData__Q24rstl22rc_ptr<12CPlayerState>Fv" /* 801D4818 001D1778 3C 80 80 3D */ lis r4, lbl_803D1B88@ha /* 801D481C 001D177C 38 60 00 08 */ li r3, 8 /* 801D4820 001D1780 38 84 1B 88 */ addi r4, r4, lbl_803D1B88@l @@ -2100,7 +2100,7 @@ lbl_801D53B0: /* 801D53C0 001D2320 41 82 00 68 */ beq lbl_801D5428 /* 801D53C4 001D2324 38 7E 00 AC */ addi r3, r30, 0xac /* 801D53C8 001D2328 38 88 00 01 */ addi r4, r8, 1 -/* 801D53CC 001D232C 4B E3 37 79 */ bl sub_80008b44 +/* 801D53CC 001D232C 4B E3 37 79 */ bl "reserve__Q24rstl63vector,Q24rstl17rmemory_allocator>Fi" /* 801D53D0 001D2330 80 1E 00 B0 */ lwz r0, 0xb0(r30) /* 801D53D4 001D2334 80 BE 00 B4 */ lwz r5, 0xb4(r30) /* 801D53D8 001D2338 7C 00 28 00 */ cmpw r0, r5 @@ -2111,7 +2111,7 @@ lbl_801D53B0: /* 801D53EC 001D234C 41 82 00 08 */ beq lbl_801D53F4 /* 801D53F0 001D2350 54 A4 08 3C */ slwi r4, r5, 1 lbl_801D53F4: -/* 801D53F4 001D2354 4B E3 37 51 */ bl sub_80008b44 +/* 801D53F4 001D2354 4B E3 37 51 */ bl "reserve__Q24rstl63vector,Q24rstl17rmemory_allocator>Fi" lbl_801D53F8: /* 801D53F8 001D2358 80 1E 00 B0 */ lwz r0, 0xb0(r30) /* 801D53FC 001D235C 80 7E 00 B8 */ lwz r3, 0xb8(r30) diff --git a/asm/MetroidPrime/Player/CPlayerDynamics.s b/asm/MetroidPrime/Player/CPlayerDynamics.s index 086402f5..b36157c4 100644 --- a/asm/MetroidPrime/Player/CPlayerDynamics.s +++ b/asm/MetroidPrime/Player/CPlayerDynamics.s @@ -7297,7 +7297,7 @@ GetGravity__7CPlayerCFv: /* 8028838C 002852EC 4B E0 97 35 */ bl HasPowerUp__12CPlayerStateCFQ212CPlayerState9EItemType /* 80288390 002852F0 7C 7F 1B 78 */ mr r31, r3 /* 80288394 002852F4 38 61 00 08 */ addi r3, r1, 8 -/* 80288398 002852F8 4B D8 0B 75 */ bl sub_80008f0c +/* 80288398 002852F8 4B D8 0B 75 */ bl "ReleaseData__Q24rstl22rc_ptr<12CPlayerState>Fv" /* 8028839C 002852FC 57 E0 06 3F */ clrlwi. r0, r31, 0x18 /* 802883A0 00285300 40 82 00 20 */ bne lbl_802883C0 /* 802883A4 00285304 7F C3 F3 78 */ mr r3, r30 diff --git a/asm/MetroidPrime/main.s b/asm/MetroidPrime/main.s index 661c91bb..2f035973 100644 --- a/asm/MetroidPrime/main.s +++ b/asm/MetroidPrime/main.s @@ -1354,7 +1354,7 @@ lbl_80003B2C: lbl_80003B34: /* 80003B34 00000A94 38 7E 00 AC */ addi r3, r30, 0xac /* 80003B38 00000A98 38 9F 00 AC */ addi r4, r31, 0xac -/* 80003B3C 00000A9C 48 00 00 51 */ bl sub_80003b8c +/* 80003B3C 00000A9C 48 00 00 51 */ bl "__as__Q24rstl63vector,Q24rstl17rmemory_allocator>FRCQ24rstl63vector,Q24rstl17rmemory_allocator>" /* 80003B40 00000AA0 80 1F 00 BC */ lwz r0, 0xbc(r31) /* 80003B44 00000AA4 7F C3 F3 78 */ mr r3, r30 /* 80003B48 00000AA8 90 1E 00 BC */ stw r0, 0xbc(r30) @@ -1375,8 +1375,8 @@ lbl_80003B34: /* 80003B84 00000AE4 38 21 00 10 */ addi r1, r1, 0x10 /* 80003B88 00000AE8 4E 80 00 20 */ blr -.global sub_80003b8c # __dt__? -sub_80003b8c: +.global "__as__Q24rstl63vector,Q24rstl17rmemory_allocator>FRCQ24rstl63vector,Q24rstl17rmemory_allocator>" # __dt__? +"__as__Q24rstl63vector,Q24rstl17rmemory_allocator>FRCQ24rstl63vector,Q24rstl17rmemory_allocator>": /* 80003B8C 00000AEC 94 21 FF E0 */ stwu r1, -0x20(r1) /* 80003B90 00000AF0 7C 08 02 A6 */ mflr r0 /* 80003B94 00000AF4 90 01 00 24 */ stw r0, 0x24(r1) @@ -1419,7 +1419,7 @@ lbl_80003C08: /* 80003C18 00000B78 48 00 00 54 */ b lbl_80003C6C lbl_80003C1C: /* 80003C1C 00000B7C 7F E3 FB 78 */ mr r3, r31 -/* 80003C20 00000B80 48 00 4F 25 */ bl sub_80008b44 +/* 80003C20 00000B80 48 00 4F 25 */ bl "reserve__Q24rstl63vector,Q24rstl17rmemory_allocator>Fi" /* 80003C24 00000B84 80 1E 00 04 */ lwz r0, 4(r30) /* 80003C28 00000B88 80 BE 00 0C */ lwz r5, 0xc(r30) /* 80003C2C 00000B8C 54 00 18 38 */ slwi r0, r0, 3 @@ -1536,14 +1536,14 @@ lbl_80003D84: /* 80003DA4 00000D04 34 1E 00 9C */ addic. r0, r30, 0x9c /* 80003DA8 00000D08 41 82 00 0C */ beq lbl_80003DB4 /* 80003DAC 00000D0C 38 7E 00 9C */ addi r3, r30, 0x9c -/* 80003DB0 00000D10 48 00 48 35 */ bl sub_800085e4 +/* 80003DB0 00000D10 48 00 48 35 */ bl "ReleaseData__Q24rstl28rc_ptr<18CWorldTransManager>Fv" lbl_80003DB4: /* 80003DB4 00000D14 34 1E 00 98 */ addic. r0, r30, 0x98 /* 80003DB8 00000D18 41 82 00 14 */ beq lbl_80003DCC /* 80003DBC 00000D1C 34 1E 00 98 */ addic. r0, r30, 0x98 /* 80003DC0 00000D20 41 82 00 0C */ beq lbl_80003DCC /* 80003DC4 00000D24 38 7E 00 98 */ addi r3, r30, 0x98 -/* 80003DC8 00000D28 48 00 51 45 */ bl sub_80008f0c +/* 80003DC8 00000D28 48 00 51 45 */ bl "ReleaseData__Q24rstl22rc_ptr<12CPlayerState>Fv" lbl_80003DCC: /* 80003DCC 00000D2C 38 7E 00 88 */ addi r3, r30, 0x88 /* 80003DD0 00000D30 38 80 FF FF */ li r4, -1 @@ -7302,8 +7302,8 @@ sub_80008584: /* 800085DC 0000553C 38 21 00 20 */ addi r1, r1, 0x20 /* 800085E0 00005540 4E 80 00 20 */ blr -.global sub_800085e4 -sub_800085e4: +.global "ReleaseData__Q24rstl28rc_ptr<18CWorldTransManager>Fv" +"ReleaseData__Q24rstl28rc_ptr<18CWorldTransManager>Fv": /* 800085E4 00005544 94 21 FF F0 */ stwu r1, -0x10(r1) /* 800085E8 00005548 7C 08 02 A6 */ mflr r0 /* 800085EC 0000554C 90 01 00 14 */ stw r0, 0x14(r1) @@ -7722,8 +7722,8 @@ lbl_80008B28: /* 80008B40 00005AA0 4E 80 00 20 */ blr # CPlayer? -.global sub_80008b44 -sub_80008b44: +.global "reserve__Q24rstl63vector,Q24rstl17rmemory_allocator>Fi" +"reserve__Q24rstl63vector,Q24rstl17rmemory_allocator>Fi": /* 80008B44 00005AA4 94 21 FF D0 */ stwu r1, -0x30(r1) /* 80008B48 00005AA8 7C 08 02 A6 */ mflr r0 /* 80008B4C 00005AAC 90 01 00 34 */ stw r0, 0x34(r1) @@ -8007,8 +8007,8 @@ lbl_80008EF0: /* 80008F04 00005E64 38 21 00 30 */ addi r1, r1, 0x30 /* 80008F08 00005E68 4E 80 00 20 */ blr -.global sub_80008f0c -sub_80008f0c: +.global "ReleaseData__Q24rstl22rc_ptr<12CPlayerState>Fv" +"ReleaseData__Q24rstl22rc_ptr<12CPlayerState>Fv": /* 80008F0C 00005E6C 94 21 FF F0 */ stwu r1, -0x10(r1) /* 80008F10 00005E70 7C 08 02 A6 */ mflr r0 /* 80008F14 00005E74 90 01 00 14 */ stw r0, 0x14(r1) diff --git a/include/MetroidPrime/Player/CGameOptions.hpp b/include/MetroidPrime/Player/CGameOptions.hpp index b07778ad..063e74c9 100644 --- a/include/MetroidPrime/Player/CGameOptions.hpp +++ b/include/MetroidPrime/Player/CGameOptions.hpp @@ -18,6 +18,7 @@ class CGameOptions { public: CGameOptions(); CGameOptions(CInputStream& in); + ~CGameOptions(); void PutTo(CMemoryStreamOut&); diff --git a/include/MetroidPrime/Player/CWorldState.hpp b/include/MetroidPrime/Player/CWorldState.hpp index 210b168f..0158c1c7 100644 --- a/include/MetroidPrime/Player/CWorldState.hpp +++ b/include/MetroidPrime/Player/CWorldState.hpp @@ -5,6 +5,7 @@ class CWorldState { public: + ~CWorldState(); void SetDesiredAreaAssetId(CAssetId id); private: diff --git a/src/MetroidPrime/main.cpp b/src/MetroidPrime/main.cpp index e42ea571..eb189a75 100644 --- a/src/MetroidPrime/main.cpp +++ b/src/MetroidPrime/main.cpp @@ -476,26 +476,6 @@ CGameArchitectureSupport::~CGameArchitectureSupport() { CDSPStreamManager::Shutdown(); } -// 80003658 -void CMain::UpdateStreamedAudio() { CStreamAudioManager::Update(1.f / 60.f); } - -// 8000367C -void CMain::RegisterResourceTweaks() { x70_tweaks.RegisterResourceTweaks(); } - -// 800036A0 -void CMain::ResetGameState() { - CSystemOptions persistentOptions = gpGameState->SystemOptions(); - CGameOptions gameOptions = gpGameState->GameOptions(); - x128_gameGlobalObjects->GameState() = nullptr; - gpGameState = nullptr; - x128_gameGlobalObjects->GameState() = new CGameState(); - gpGameState = x128_gameGlobalObjects->GameState().get(); - gpGameState->SystemOptions() = persistentOptions; - gpGameState->GameOptions() = gameOptions; - gpGameState->GameOptions().EnsureOptions(); - gpGameState->PlayerState()->SetIsFusionEnabled(gpGameState->SystemOptions().GetHasFusion()); -} - // 800044A4 void CMain::StreamNewGameState(CInputStream& in, int saveIdx) { bool hasFusion = gpGameState->SystemOptions().GetHasFusion(); @@ -737,3 +717,23 @@ void CMain::EnsureWorldPakReady(CAssetId id) { } } } + +// 800036A0 +void CMain::ResetGameState() { + CSystemOptions persistentOptions = gpGameState->SystemOptions(); + CGameOptions gameOptions = gpGameState->GameOptions(); + x128_gameGlobalObjects->GameState() = nullptr; + gpGameState = nullptr; + x128_gameGlobalObjects->GameState() = new CGameState(); + gpGameState = x128_gameGlobalObjects->GameState().get(); + gpGameState->SystemOptions() = persistentOptions; + gpGameState->GameOptions() = gameOptions; + gpGameState->GameOptions().EnsureOptions(); + gpGameState->PlayerState()->SetIsFusionEnabled(gpGameState->SystemOptions().GetHasFusion()); +} + +// 8000367C +void CMain::RegisterResourceTweaks() { x70_tweaks.RegisterResourceTweaks(); } + +// 80003658 +void CMain::UpdateStreamedAudio() { CStreamAudioManager::Update(1.f / 60.f); }