From adb54a9892fbbf079cac5b00aae3bee0d17a68cf Mon Sep 17 00:00:00 2001 From: Luke Street Date: Sat, 1 Oct 2022 02:19:09 -0400 Subject: [PATCH] Symbol fixes, headers & main progress Former-commit-id: 6944a14e890aff84111901c37e9a7b96a3e38517 --- asm/GuiSys/CGuiSys.s | 5 +- asm/Kyoto/CResFactory.s | 5 +- asm/Kyoto/CSimplePool.s | 5 +- asm/Kyoto/DolphinCMemoryCardSys.s | 5 +- asm/Kyoto/Particles/CElementGen.s | 5 +- asm/Kyoto/Text/CRasterFont.s | 5 +- asm/MetroidPrime/CCredits.s | 3 +- asm/MetroidPrime/CErrorOutputWindow.s | 5 +- asm/MetroidPrime/CIOWinManager.s | 64 ++++++------- asm/MetroidPrime/CPreFrontEnd.s | 3 +- asm/MetroidPrime/Factories/CAssetFactory.s | 3 +- .../Factories/CCharacterFactory.s | 3 +- asm/MetroidPrime/main.s | 90 +++++++++---------- include/GuiSys/CGuiSys.hpp | 11 +++ include/Kyoto/Alloc/CGameAllocator.hpp | 31 ++++--- include/Kyoto/Alloc/CMemory.hpp | 13 +-- include/Kyoto/Alloc/IAllocator.hpp | 5 +- include/Kyoto/Audio/CAudioSys.hpp | 1 + include/Kyoto/Audio/CDSPStreamManager.hpp | 1 + include/Kyoto/Audio/CSfxManager.hpp | 1 + include/Kyoto/Basics/COsContext.hpp | 2 + include/Kyoto/CResFactory.hpp | 9 +- include/Kyoto/CSimplePool.hpp | 1 + include/Kyoto/Graphics/CGraphics.hpp | 2 + include/Kyoto/TToken.hpp | 5 +- include/MetroidPrime/CArchitectureMessage.hpp | 38 ++++++++ include/MetroidPrime/CArchitectureQueue.hpp | 21 +++++ include/MetroidPrime/CAudioStateWin.hpp | 16 ++++ include/MetroidPrime/CConsoleOutputWindow.hpp | 17 ++++ include/MetroidPrime/CErrorOutputWindow.hpp | 18 ++++ .../MetroidPrime/CGameArchitectureSupport.hpp | 30 +++---- include/MetroidPrime/CGameGlobalObjects.hpp | 4 +- include/MetroidPrime/CIOWinManager.hpp | 12 ++- include/MetroidPrime/CInGameTweakManager.hpp | 52 ++++++++++- include/MetroidPrime/CInputGenerator.hpp | 14 ++- include/MetroidPrime/CMain.hpp | 1 + include/MetroidPrime/CMainFlow.hpp | 18 ++++ include/MetroidPrime/CMemoryCard.hpp | 2 + include/MetroidPrime/CSplashScreen.hpp | 6 +- .../MetroidPrime/Player/CSystemOptions.hpp | 2 +- include/dolphin/os/OSAlarm.h | 3 + include/dolphin/types.h | 2 +- include/rstl/list.hpp | 15 +++- include/rstl/rc_ptr.hpp | 31 +++++-- include/rstl/reserved_vector.hpp | 2 +- include/rstl/rmemory_allocator.hpp | 5 +- src/Kyoto/Alloc/CGameAllocator.cpp | 13 +-- src/MetroidPrime/main.cpp | 53 ++++++++--- 48 files changed, 458 insertions(+), 200 deletions(-) create mode 100644 include/MetroidPrime/CArchitectureMessage.hpp create mode 100644 include/MetroidPrime/CArchitectureQueue.hpp create mode 100644 include/MetroidPrime/CAudioStateWin.hpp create mode 100644 include/MetroidPrime/CConsoleOutputWindow.hpp create mode 100644 include/MetroidPrime/CErrorOutputWindow.hpp create mode 100644 include/MetroidPrime/CMainFlow.hpp diff --git a/asm/GuiSys/CGuiSys.s b/asm/GuiSys/CGuiSys.s index 5eff3cc2..a9485e46 100644 --- a/asm/GuiSys/CGuiSys.s +++ b/asm/GuiSys/CGuiSys.s @@ -27,8 +27,8 @@ CreateWidgetInGame__7CGuiSysFUiR12CInputStreamP9CGuiFrame: /* 802C6408 002C3368 38 21 00 10 */ addi r1, r1, 0x10 /* 802C640C 002C336C 4E 80 00 20 */ blr -.global sub_802c6410 -sub_802c6410: +.global __dt__7CGuiSysFv +__dt__7CGuiSysFv: /* 802C6410 002C3370 94 21 FF F0 */ stwu r1, -0x10(r1) /* 802C6414 002C3374 7C 08 02 A6 */ mflr r0 /* 802C6418 002C3378 90 01 00 14 */ stw r0, 0x14(r1) @@ -169,4 +169,3 @@ lbl_803D68C8: # ROM: 0x3D38C8 .asciz "??(??)" .balign 4 - diff --git a/asm/Kyoto/CResFactory.s b/asm/Kyoto/CResFactory.s index 996a72f5..4d60a72a 100644 --- a/asm/Kyoto/CResFactory.s +++ b/asm/Kyoto/CResFactory.s @@ -524,8 +524,8 @@ sub_80339b38: /* 80339BC8 00336B28 90 05 00 04 */ stw r0, 4(r5) /* 80339BCC 00336B2C 4E 80 00 20 */ blr -.global AsyncIdle__11CResFactoryFUl -AsyncIdle__11CResFactoryFUl: +.global AsyncIdle__11CResFactoryFUi +AsyncIdle__11CResFactoryFUi: /* 80339BD0 00336B30 94 21 FF D0 */ stwu r1, -0x30(r1) /* 80339BD4 00336B34 7C 08 02 A6 */ mflr r0 /* 80339BD8 00336B38 90 01 00 34 */ stw r0, 0x34(r1) @@ -1767,4 +1767,3 @@ lbl_803D7A28: .byte 0x31 .asciz ".1.3" .balign 4 - diff --git a/asm/Kyoto/CSimplePool.s b/asm/Kyoto/CSimplePool.s index b9bb81d5..699c4539 100644 --- a/asm/Kyoto/CSimplePool.s +++ b/asm/Kyoto/CSimplePool.s @@ -1045,8 +1045,8 @@ lbl_803406E4: /* 80340700 0033D660 38 21 00 20 */ addi r1, r1, 0x20 /* 80340704 0033D664 4E 80 00 20 */ blr -.global __dt__11CSimplePool -__dt__11CSimplePool: +.global __dt__11CSimplePoolFv +__dt__11CSimplePoolFv: /* 80340708 0033D668 94 21 FF F0 */ stwu r1, -0x10(r1) /* 8034070C 0033D66C 7C 08 02 A6 */ mflr r0 /* 80340710 0033D670 90 01 00 14 */ stw r0, 0x14(r1) @@ -1465,4 +1465,3 @@ lbl_803D7A98: # ROM: 0x3D4A98 .asciz "??(??)" .balign 4 - diff --git a/asm/Kyoto/DolphinCMemoryCardSys.s b/asm/Kyoto/DolphinCMemoryCardSys.s index 96fa87d0..ec3f794d 100644 --- a/asm/Kyoto/DolphinCMemoryCardSys.s +++ b/asm/Kyoto/DolphinCMemoryCardSys.s @@ -1212,8 +1212,8 @@ IsMemoryCardInserted__14CMemoryCardSysFQ214CMemoryCardSys15EMemoryCardPort: /* 8034E454 0034B3B4 38 21 00 20 */ addi r1, r1, 0x20 /* 8034E458 0034B3B8 4E 80 00 20 */ blr -.global sub_8034e45c -sub_8034e45c: +.global __dt__14CMemoryCardSysFv +__dt__14CMemoryCardSysFv: /* 8034E45C 0034B3BC 94 21 FF F0 */ stwu r1, -0x10(r1) /* 8034E460 0034B3C0 7C 08 02 A6 */ mflr r0 /* 8034E464 0034B3C4 90 01 00 14 */ stw r0, 0x14(r1) @@ -2085,4 +2085,3 @@ lbl_803D8220: # ROM: 0x3D5220 .asciz "??(??)" .balign 4 - diff --git a/asm/Kyoto/Particles/CElementGen.s b/asm/Kyoto/Particles/CElementGen.s index f82f9cb9..b306f82c 100644 --- a/asm/Kyoto/Particles/CElementGen.s +++ b/asm/Kyoto/Particles/CElementGen.s @@ -15601,7 +15601,7 @@ lbl_80324EB4: /* 80324EC4 00321E24 7C 64 1B 78 */ mr r4, r3 /* 80324EC8 00321E28 3B 01 00 70 */ addi r24, r1, 0x70 /* 80324ECC 00321E2C 38 61 00 10 */ addi r3, r1, 0x10 -/* 80324ED0 00321E30 4B CE 2B 5D */ bl "GetIObjObjectFor__17TToken<8CTexture>FP8CTexture" +/* 80324ED0 00321E30 4B CE 2B 5D */ bl "GetNewDerivedObject__35TObjOwnerDerivedFromIObj<8CTexture>FP8CTexture" /* 80324ED4 00321E34 38 00 00 00 */ li r0, 0 /* 80324ED8 00321E38 80 81 00 14 */ lwz r4, 0x14(r1) /* 80324EDC 00321E3C 98 01 00 10 */ stb r0, 0x10(r1) @@ -15732,7 +15732,7 @@ lbl_80325044: /* 803250B0 00322010 7C 64 1B 78 */ mr r4, r3 /* 803250B4 00322014 3B 01 00 60 */ addi r24, r1, 0x60 /* 803250B8 00322018 38 61 00 08 */ addi r3, r1, 8 -/* 803250BC 0032201C 4B CE 29 71 */ bl "GetIObjObjectFor__17TToken<8CTexture>FP8CTexture" +/* 803250BC 0032201C 4B CE 29 71 */ bl "GetNewDerivedObject__35TObjOwnerDerivedFromIObj<8CTexture>FP8CTexture" /* 803250C0 00322020 38 00 00 00 */ li r0, 0 /* 803250C4 00322024 80 81 00 0C */ lwz r4, 0xc(r1) /* 803250C8 00322028 98 01 00 08 */ stb r0, 8(r1) @@ -22031,4 +22031,3 @@ lbl_803D7918: # ROM: 0x3D4918 .asciz "??(??)" .balign 4 - diff --git a/asm/Kyoto/Text/CRasterFont.s b/asm/Kyoto/Text/CRasterFont.s index 1daeb07e..4475c310 100644 --- a/asm/Kyoto/Text/CRasterFont.s +++ b/asm/Kyoto/Text/CRasterFont.s @@ -2,8 +2,8 @@ .section .text, "ax" -.global sub_802ffed4 -sub_802ffed4: +.global "SetTexture__11CRasterFontF17TToken<8CTexture>" +"SetTexture__11CRasterFontF17TToken<8CTexture>": /* 802FFED4 002FCE34 94 21 FF F0 */ stwu r1, -0x10(r1) /* 802FFED8 002FCE38 7C 08 02 A6 */ mflr r0 /* 802FFEDC 002FCE3C 90 01 00 14 */ stw r0, 0x14(r1) @@ -1843,4 +1843,3 @@ lbl_803D6E80: # ROM: 0x3D3E80 .asciz "??(??)" .balign 4 - diff --git a/asm/MetroidPrime/CCredits.s b/asm/MetroidPrime/CCredits.s index f0d32ba5..c77e0f40 100644 --- a/asm/MetroidPrime/CCredits.s +++ b/asm/MetroidPrime/CCredits.s @@ -2967,7 +2967,7 @@ lbl_80027824: /* 80027824 00024784 3B 1F 00 50 */ addi r24, r31, 0x50 /* 80027828 00024788 38 61 00 08 */ addi r3, r1, 8 /* 8002782C 0002478C 38 80 00 00 */ li r4, 0 -/* 80027830 00024790 4B FE 05 A9 */ bl "GetIObjObjectFor__21TToken<11CRasterFont>FP11CRasterFont" +/* 80027830 00024790 4B FE 05 A9 */ bl "GetNewDerivedObject__39TObjOwnerDerivedFromIObj<11CRasterFont>FP11CRasterFont" /* 80027834 00024794 38 00 00 00 */ li r0, 0 /* 80027838 00024798 80 81 00 0C */ lwz r4, 0xc(r1) /* 8002783C 0002479C 98 01 00 08 */ stb r0, 8(r1) @@ -3807,4 +3807,3 @@ lbl_803CCC85: .byte 0x50 .asciz "layMovie" .balign 4 - diff --git a/asm/MetroidPrime/CErrorOutputWindow.s b/asm/MetroidPrime/CErrorOutputWindow.s index 027cfffd..a1c91126 100644 --- a/asm/MetroidPrime/CErrorOutputWindow.s +++ b/asm/MetroidPrime/CErrorOutputWindow.s @@ -803,8 +803,8 @@ GetIsContinueDraw__18CErrorOutputWindowCFv: /* 80269BB8 00266B18 54 03 0F FE */ srwi r3, r0, 0x1f /* 80269BBC 00266B1C 4E 80 00 20 */ blr -.global __ct__18CErrorOutputWindowFiff -__ct__18CErrorOutputWindowFiff: +.global __ct__18CErrorOutputWindowFb +__ct__18CErrorOutputWindowFb: /* 80269BC0 00266B20 94 21 FF E0 */ stwu r1, -0x20(r1) /* 80269BC4 00266B24 7C 08 02 A6 */ mflr r0 /* 80269BC8 00266B28 3C A0 80 3D */ lis r5, lbl_803D53E0@ha @@ -895,4 +895,3 @@ lbl_803D53E0: # ROM: 0x3D23E0 .asciz "Error output window" .4byte 0 - diff --git a/asm/MetroidPrime/CIOWinManager.s b/asm/MetroidPrime/CIOWinManager.s index e1d34490..2f647ea8 100644 --- a/asm/MetroidPrime/CIOWinManager.s +++ b/asm/MetroidPrime/CIOWinManager.s @@ -113,7 +113,7 @@ lbl_80051ECC: /* 80051EF4 0004EE54 80 85 00 04 */ lwz r4, 4(r5) /* 80051EF8 0004EE58 38 04 00 01 */ addi r0, r4, 1 /* 80051EFC 0004EE5C 90 05 00 04 */ stw r0, 4(r5) -/* 80051F00 0004EE60 4B FB 67 9D */ bl sub_8000869c +/* 80051F00 0004EE60 4B FB 67 9D */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" /* 80051F04 0004EE64 80 C1 00 24 */ lwz r6, 0x24(r1) /* 80051F08 0004EE68 80 06 00 00 */ lwz r0, 0(r6) /* 80051F0C 0004EE6C 28 00 00 00 */ cmplwi r0, 0 @@ -126,10 +126,10 @@ lbl_80051ECC: /* 80051F28 0004EE88 90 06 00 04 */ stw r0, 4(r6) /* 80051F2C 0004EE8C 48 00 08 E9 */ bl "RemoveIOWin__13CIOWinManagerFQ24rstl17ncrc_ptr<6CIOWin>" /* 80051F30 0004EE90 38 61 00 14 */ addi r3, r1, 0x14 -/* 80051F34 0004EE94 4B FB 67 69 */ bl sub_8000869c +/* 80051F34 0004EE94 4B FB 67 69 */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" lbl_80051F38: /* 80051F38 0004EE98 38 61 00 24 */ addi r3, r1, 0x24 -/* 80051F3C 0004EE9C 4B FB 67 61 */ bl sub_8000869c +/* 80051F3C 0004EE9C 4B FB 67 61 */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" /* 80051F40 0004EEA0 48 00 01 14 */ b lbl_80052054 lbl_80051F44: /* 80051F44 0004EEA4 7C 83 23 78 */ mr r3, r4 @@ -160,9 +160,9 @@ lbl_80051F84: /* 80051FA4 0004EF04 90 08 00 04 */ stw r0, 4(r8) /* 80051FA8 0004EF08 48 00 09 A9 */ bl "AddIOWin__13CIOWinManagerFQ24rstl17ncrc_ptr<6CIOWin>ii" /* 80051FAC 0004EF0C 38 61 00 10 */ addi r3, r1, 0x10 -/* 80051FB0 0004EF10 4B FB 66 ED */ bl sub_8000869c +/* 80051FB0 0004EF10 4B FB 66 ED */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" /* 80051FB4 0004EF14 38 61 00 20 */ addi r3, r1, 0x20 -/* 80051FB8 0004EF18 4B FB 66 E5 */ bl sub_8000869c +/* 80051FB8 0004EF18 4B FB 66 E5 */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" /* 80051FBC 0004EF1C 48 00 00 98 */ b lbl_80052054 lbl_80051FC0: /* 80051FC0 0004EF20 7C 83 23 78 */ mr r3, r4 @@ -180,7 +180,7 @@ lbl_80051FC0: /* 80051FF0 0004EF50 80 85 00 04 */ lwz r4, 4(r5) /* 80051FF4 0004EF54 38 04 00 01 */ addi r0, r4, 1 /* 80051FF8 0004EF58 90 05 00 04 */ stw r0, 4(r5) -/* 80051FFC 0004EF5C 4B FB 66 A1 */ bl sub_8000869c +/* 80051FFC 0004EF5C 4B FB 66 A1 */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" /* 80052000 0004EF60 81 01 00 1C */ lwz r8, 0x1c(r1) /* 80052004 0004EF64 80 08 00 00 */ lwz r0, 0(r8) /* 80052008 0004EF68 28 00 00 00 */ cmplwi r0, 0 @@ -195,10 +195,10 @@ lbl_80051FC0: /* 8005202C 0004EF8C 90 08 00 04 */ stw r0, 4(r8) /* 80052030 0004EF90 48 00 05 D9 */ bl sub_80052608 /* 80052034 0004EF94 38 61 00 08 */ addi r3, r1, 8 -/* 80052038 0004EF98 4B FB 66 65 */ bl sub_8000869c +/* 80052038 0004EF98 4B FB 66 65 */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" lbl_8005203C: /* 8005203C 0004EF9C 38 61 00 1C */ addi r3, r1, 0x1c -/* 80052040 0004EFA0 4B FB 66 5D */ bl sub_8000869c +/* 80052040 0004EFA0 4B FB 66 5D */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" /* 80052044 0004EFA4 48 00 00 10 */ b lbl_80052054 lbl_80052048: /* 80052048 0004EFA8 48 00 07 4D */ bl RemoveAllIOWins__13CIOWinManagerFv @@ -238,7 +238,7 @@ lbl_8005209C: /* 800520B8 0004F018 7D 89 03 A6 */ mtctr r12 /* 800520BC 0004F01C 4E 80 04 21 */ bctrl /* 800520C0 0004F020 38 61 00 14 */ addi r3, r1, 0x14 -/* 800520C4 0004F024 4B FB 65 D9 */ bl sub_8000869c +/* 800520C4 0004F024 4B FB 65 D9 */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" /* 800520C8 0004F028 7F C4 F3 78 */ mr r4, r30 /* 800520CC 0004F02C 38 61 00 10 */ addi r3, r1, 0x10 /* 800520D0 0004F030 4B FF FD 95 */ bl GetIOWin__Q213CIOWinManager11IOWinPQNodeCFv @@ -250,7 +250,7 @@ lbl_8005209C: /* 800520E8 0004F048 4E 80 04 21 */ bctrl /* 800520EC 0004F04C 7C 7F 1B 78 */ mr r31, r3 /* 800520F0 0004F050 38 61 00 10 */ addi r3, r1, 0x10 -/* 800520F4 0004F054 4B FB 65 A9 */ bl sub_8000869c +/* 800520F4 0004F054 4B FB 65 A9 */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" /* 800520F8 0004F058 57 E0 06 3F */ clrlwi. r0, r31, 0x18 /* 800520FC 0004F05C 41 82 00 10 */ beq lbl_8005210C /* 80052100 0004F060 83 DE 00 08 */ lwz r30, 8(r30) @@ -271,7 +271,7 @@ lbl_80052114: /* 80052130 0004F090 7D 89 03 A6 */ mtctr r12 /* 80052134 0004F094 4E 80 04 21 */ bctrl /* 80052138 0004F098 38 61 00 0C */ addi r3, r1, 0xc -/* 8005213C 0004F09C 4B FB 65 61 */ bl sub_8000869c +/* 8005213C 0004F09C 4B FB 65 61 */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" /* 80052140 0004F0A0 7F C4 F3 78 */ mr r4, r30 /* 80052144 0004F0A4 38 61 00 08 */ addi r3, r1, 8 /* 80052148 0004F0A8 4B FF FD 1D */ bl GetIOWin__Q213CIOWinManager11IOWinPQNodeCFv @@ -283,7 +283,7 @@ lbl_80052114: /* 80052160 0004F0C0 4E 80 04 21 */ bctrl /* 80052164 0004F0C4 7C 7F 1B 78 */ mr r31, r3 /* 80052168 0004F0C8 38 61 00 08 */ addi r3, r1, 8 -/* 8005216C 0004F0CC 4B FB 65 31 */ bl sub_8000869c +/* 8005216C 0004F0CC 4B FB 65 31 */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" /* 80052170 0004F0D0 57 E0 06 3F */ clrlwi. r0, r31, 0x18 /* 80052174 0004F0D4 41 82 00 10 */ beq lbl_80052184 /* 80052178 0004F0D8 83 DE 00 08 */ lwz r30, 8(r30) @@ -322,7 +322,7 @@ lbl_800521CC: /* 800521E4 0004F144 80 85 00 04 */ lwz r4, 4(r5) /* 800521E8 0004F148 38 04 00 01 */ addi r0, r4, 1 /* 800521EC 0004F14C 90 05 00 04 */ stw r0, 4(r5) -/* 800521F0 0004F150 4B FB 64 AD */ bl sub_8000869c +/* 800521F0 0004F150 4B FB 64 AD */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" /* 800521F4 0004F154 80 61 00 10 */ lwz r3, 0x10(r1) /* 800521F8 0004F158 7F 44 D3 78 */ mr r4, r26 /* 800521FC 0004F15C 38 B9 00 08 */ addi r5, r25, 8 @@ -385,7 +385,7 @@ lbl_800522B4: /* 800522C8 0004F228 4B FB 64 45 */ bl sub_8000870c lbl_800522CC: /* 800522CC 0004F22C 38 61 00 10 */ addi r3, r1, 0x10 -/* 800522D0 0004F230 4B FB 63 CD */ bl sub_8000869c +/* 800522D0 0004F230 4B FB 63 CD */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" /* 800522D4 0004F234 38 60 00 01 */ li r3, 1 /* 800522D8 0004F238 48 00 00 A0 */ b lbl_80052378 lbl_800522DC: @@ -416,7 +416,7 @@ lbl_80052314: /* 80052330 0004F290 90 06 00 04 */ stw r0, 4(r6) /* 80052334 0004F294 48 00 04 E1 */ bl "RemoveIOWin__13CIOWinManagerFQ24rstl17ncrc_ptr<6CIOWin>" /* 80052338 0004F298 38 61 00 08 */ addi r3, r1, 8 -/* 8005233C 0004F29C 4B FB 63 61 */ bl sub_8000869c +/* 8005233C 0004F29C 4B FB 63 61 */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" /* 80052340 0004F2A0 48 00 00 08 */ b lbl_80052348 lbl_80052344: /* 80052344 0004F2A4 83 9C 00 08 */ lwz r28, 8(r28) @@ -427,11 +427,11 @@ lbl_80052348: /* 80052354 0004F2B4 40 82 00 10 */ bne lbl_80052364 lbl_80052358: /* 80052358 0004F2B8 38 61 00 10 */ addi r3, r1, 0x10 -/* 8005235C 0004F2BC 4B FB 63 41 */ bl sub_8000869c +/* 8005235C 0004F2BC 4B FB 63 41 */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" /* 80052360 0004F2C0 48 00 00 14 */ b lbl_80052374 lbl_80052364: /* 80052364 0004F2C4 38 61 00 10 */ addi r3, r1, 0x10 -/* 80052368 0004F2C8 4B FB 63 35 */ bl sub_8000869c +/* 80052368 0004F2C8 4B FB 63 35 */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" lbl_8005236C: /* 8005236C 0004F2CC 28 1C 00 00 */ cmplwi r28, 0 /* 80052370 0004F2D0 40 82 FE 5C */ bne lbl_800521CC @@ -563,7 +563,7 @@ lbl_8005250C: /* 80052528 0004F488 48 00 00 B9 */ bl "find__Q24rstl418red_black_tree,Q24rstl17rmemory_allocator>,Q24rstl83pair,Q24rstl17rmemory_allocator>,s>,0,Q24rstl103select1st,Q24rstl17rmemory_allocator>,s>>,Q24rstl81less,Q24rstl17rmemory_allocator>>,Q24rstl17rmemory_allocator>CFRCQ24rstl66basic_string,Q24rstl17rmemory_allocat" /* 8005252C 0004F48C 7C 7F 1B 78 */ mr r31, r3 /* 80052530 0004F490 38 61 00 0C */ addi r3, r1, 0xc -/* 80052534 0004F494 4B FB 61 69 */ bl sub_8000869c +/* 80052534 0004F494 4B FB 61 69 */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" /* 80052538 0004F498 57 E0 06 3F */ clrlwi. r0, r31, 0x18 /* 8005253C 0004F49C 41 82 00 14 */ beq lbl_80052550 /* 80052540 0004F4A0 7F 63 DB 78 */ mr r3, r27 @@ -588,7 +588,7 @@ lbl_80052564: /* 80052580 0004F4E0 48 00 00 61 */ bl "find__Q24rstl418red_black_tree,Q24rstl17rmemory_allocator>,Q24rstl83pair,Q24rstl17rmemory_allocator>,s>,0,Q24rstl103select1st,Q24rstl17rmemory_allocator>,s>>,Q24rstl81less,Q24rstl17rmemory_allocator>>,Q24rstl17rmemory_allocator>CFRCQ24rstl66basic_string,Q24rstl17rmemory_allocat" /* 80052584 0004F4E4 7C 7F 1B 78 */ mr r31, r3 /* 80052588 0004F4E8 38 61 00 08 */ addi r3, r1, 8 -/* 8005258C 0004F4EC 4B FB 61 11 */ bl sub_8000869c +/* 8005258C 0004F4EC 4B FB 61 11 */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" /* 80052590 0004F4F0 57 E0 06 3F */ clrlwi. r0, r31, 0x18 /* 80052594 0004F4F4 41 82 00 14 */ beq lbl_800525A8 /* 80052598 0004F4F8 7F 63 DB 78 */ mr r3, r27 @@ -648,7 +648,7 @@ lbl_80052634: /* 80052648 0004F5A8 48 00 05 25 */ bl "__eq<6CIOWin>__4rstlFRCQ24rstl15rc_ptr<6CIOWin>RCQ24rstl15rc_ptr<6CIOWin>" /* 8005264C 0004F5AC 7C 7D 1B 78 */ mr r29, r3 /* 80052650 0004F5B0 38 61 00 0C */ addi r3, r1, 0xc -/* 80052654 0004F5B4 4B FB 60 49 */ bl sub_8000869c +/* 80052654 0004F5B4 4B FB 60 49 */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" /* 80052658 0004F5B8 57 A0 06 3F */ clrlwi. r0, r29, 0x18 /* 8005265C 0004F5BC 41 82 00 68 */ beq lbl_800526C4 /* 80052660 0004F5C0 28 1C 00 00 */ cmplwi r28, 0 @@ -701,7 +701,7 @@ lbl_800526E0: /* 800526F4 0004F654 48 00 04 79 */ bl "__eq<6CIOWin>__4rstlFRCQ24rstl15rc_ptr<6CIOWin>RCQ24rstl15rc_ptr<6CIOWin>" /* 800526F8 0004F658 7C 7D 1B 78 */ mr r29, r3 /* 800526FC 0004F65C 38 61 00 08 */ addi r3, r1, 8 -/* 80052700 0004F660 4B FB 5F 9D */ bl sub_8000869c +/* 80052700 0004F660 4B FB 5F 9D */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" /* 80052704 0004F664 57 A0 06 3F */ clrlwi. r0, r29, 0x18 /* 80052708 0004F668 41 82 00 68 */ beq lbl_80052770 /* 8005270C 0004F66C 28 1C 00 00 */ cmplwi r28, 0 @@ -763,7 +763,7 @@ lbl_800527AC: /* 800527B8 0004F718 38 81 00 0C */ addi r4, r1, 0xc /* 800527BC 0004F71C 48 00 00 59 */ bl "RemoveIOWin__13CIOWinManagerFQ24rstl17ncrc_ptr<6CIOWin>" /* 800527C0 0004F720 38 61 00 0C */ addi r3, r1, 0xc -/* 800527C4 0004F724 4B FB 5E D9 */ bl sub_8000869c +/* 800527C4 0004F724 4B FB 5E D9 */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" lbl_800527C8: /* 800527C8 0004F728 80 9F 00 00 */ lwz r4, 0(r31) /* 800527CC 0004F72C 28 04 00 00 */ cmplwi r4, 0 @@ -776,7 +776,7 @@ lbl_800527D8: /* 800527E4 0004F744 38 81 00 08 */ addi r4, r1, 8 /* 800527E8 0004F748 48 00 00 2D */ bl "RemoveIOWin__13CIOWinManagerFQ24rstl17ncrc_ptr<6CIOWin>" /* 800527EC 0004F74C 38 61 00 08 */ addi r3, r1, 8 -/* 800527F0 0004F750 4B FB 5E AD */ bl sub_8000869c +/* 800527F0 0004F750 4B FB 5E AD */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" lbl_800527F4: /* 800527F4 0004F754 80 9F 00 04 */ lwz r4, 4(r31) /* 800527F8 0004F758 28 04 00 00 */ cmplwi r4, 0 @@ -807,7 +807,7 @@ lbl_80052838: /* 8005284C 0004F7AC 48 00 03 21 */ bl "__eq<6CIOWin>__4rstlFRCQ24rstl15rc_ptr<6CIOWin>RCQ24rstl15rc_ptr<6CIOWin>" /* 80052850 0004F7B0 7C 7F 1B 78 */ mr r31, r3 /* 80052854 0004F7B4 38 61 00 0C */ addi r3, r1, 0xc -/* 80052858 0004F7B8 4B FB 5E 45 */ bl sub_8000869c +/* 80052858 0004F7B8 4B FB 5E 45 */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" /* 8005285C 0004F7BC 57 E0 06 3F */ clrlwi. r0, r31, 0x18 /* 80052860 0004F7C0 41 82 00 44 */ beq lbl_800528A4 /* 80052864 0004F7C4 28 1D 00 00 */ cmplwi r29, 0 @@ -824,7 +824,7 @@ lbl_80052880: /* 80052888 0004F7E8 41 82 00 10 */ beq lbl_80052898 /* 8005288C 0004F7EC 41 82 00 0C */ beq lbl_80052898 /* 80052890 0004F7F0 7F C3 F3 78 */ mr r3, r30 -/* 80052894 0004F7F4 4B FB 5E 09 */ bl sub_8000869c +/* 80052894 0004F7F4 4B FB 5E 09 */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" lbl_80052898: /* 80052898 0004F7F8 7F C3 F3 78 */ mr r3, r30 /* 8005289C 0004F7FC 48 2C 30 95 */ bl Free__7CMemoryFPCv @@ -848,7 +848,7 @@ lbl_800528C0: /* 800528D4 0004F834 48 00 02 99 */ bl "__eq<6CIOWin>__4rstlFRCQ24rstl15rc_ptr<6CIOWin>RCQ24rstl15rc_ptr<6CIOWin>" /* 800528D8 0004F838 7C 7F 1B 78 */ mr r31, r3 /* 800528DC 0004F83C 38 61 00 08 */ addi r3, r1, 8 -/* 800528E0 0004F840 4B FB 5D BD */ bl sub_8000869c +/* 800528E0 0004F840 4B FB 5D BD */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" /* 800528E4 0004F844 57 E0 06 3F */ clrlwi. r0, r31, 0x18 /* 800528E8 0004F848 41 82 00 44 */ beq lbl_8005292C /* 800528EC 0004F84C 28 1E 00 00 */ cmplwi r30, 0 @@ -865,7 +865,7 @@ lbl_80052908: /* 80052910 0004F870 41 82 00 10 */ beq lbl_80052920 /* 80052914 0004F874 41 82 00 0C */ beq lbl_80052920 /* 80052918 0004F878 7F A3 EB 78 */ mr r3, r29 -/* 8005291C 0004F87C 4B FB 5D 81 */ bl sub_8000869c +/* 8005291C 0004F87C 4B FB 5D 81 */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" lbl_80052920: /* 80052920 0004F880 7F A3 EB 78 */ mr r3, r29 /* 80052924 0004F884 48 2C 30 0D */ bl Free__7CMemoryFPCv @@ -930,7 +930,7 @@ lbl_800529E8: /* 800529E8 0004F948 7F 00 07 75 */ extsb. r0, r24 /* 800529EC 0004F94C 41 82 00 0C */ beq lbl_800529F8 /* 800529F0 0004F950 38 61 00 0C */ addi r3, r1, 0xc -/* 800529F4 0004F954 4B FB 5C A9 */ bl sub_8000869c +/* 800529F4 0004F954 4B FB 5C A9 */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" lbl_800529F8: /* 800529F8 0004F958 28 1B 00 00 */ cmplwi r27, 0 /* 800529FC 0004F95C 40 82 00 0C */ bne lbl_80052A08 @@ -976,7 +976,7 @@ lbl_80052A84: /* 80052A84 0004F9E4 7F 00 07 75 */ extsb. r0, r24 /* 80052A88 0004F9E8 41 82 00 0C */ beq lbl_80052A94 /* 80052A8C 0004F9EC 38 61 00 08 */ addi r3, r1, 8 -/* 80052A90 0004F9F0 4B FB 5C 0D */ bl sub_8000869c +/* 80052A90 0004F9F0 4B FB 5C 0D */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" lbl_80052A94: /* 80052A94 0004F9F4 28 1A 00 00 */ cmplwi r26, 0 /* 80052A98 0004F9F8 40 82 00 0C */ bne lbl_80052AA4 @@ -1003,8 +1003,8 @@ lbl_80052AA8: /* 80052AD8 0004FA38 90 C3 00 08 */ stw r6, 8(r3) /* 80052ADC 0004FA3C 4E 80 00 20 */ blr -.global sub_80052ae0 -sub_80052ae0: +.global __dt__13CIOWinManagerFv +__dt__13CIOWinManagerFv: /* 80052AE0 0004FA40 94 21 FF F0 */ stwu r1, -0x10(r1) /* 80052AE4 0004FA44 7C 08 02 A6 */ mflr r0 /* 80052AE8 0004FA48 90 01 00 14 */ stw r0, 0x14(r1) @@ -1018,7 +1018,7 @@ sub_80052ae0: /* 80052B08 0004FA68 41 82 00 10 */ beq lbl_80052B18 /* 80052B0C 0004FA6C 38 7E 00 08 */ addi r3, r30, 8 /* 80052B10 0004FA70 38 80 FF FF */ li r4, -1 -/* 80052B14 0004FA74 4B FB 65 95 */ bl sub_800090a8 +/* 80052B14 0004FA74 4B FB 65 95 */ bl __dt__18CArchitectureQueueFv lbl_80052B18: /* 80052B18 0004FA78 7F E0 07 35 */ extsh. r0, r31 /* 80052B1C 0004FA7C 40 81 00 0C */ ble lbl_80052B28 diff --git a/asm/MetroidPrime/CPreFrontEnd.s b/asm/MetroidPrime/CPreFrontEnd.s index c78355a8..99e9bd9e 100644 --- a/asm/MetroidPrime/CPreFrontEnd.s +++ b/asm/MetroidPrime/CPreFrontEnd.s @@ -86,7 +86,7 @@ lbl_8029E580: /* 8029E580 0029B4E0 3C 80 00 0F */ lis r4, 0x000F4240@ha /* 8029E584 0029B4E4 80 6D A0 60 */ lwz r3, gpResourceFactory@sda21(r13) /* 8029E588 0029B4E8 38 84 42 40 */ addi r4, r4, 0x000F4240@l -/* 8029E58C 0029B4EC 48 09 B6 45 */ bl AsyncIdle__11CResFactoryFUl +/* 8029E58C 0029B4EC 48 09 B6 45 */ bl AsyncIdle__11CResFactoryFUi /* 8029E590 0029B4F0 80 6D A0 78 */ lwz r3, gpMain@sda21(r13) /* 8029E594 0029B4F4 4B D6 80 A9 */ bl MemoryCardInitializePump__5CMainFv /* 8029E598 0029B4F8 80 0D A0 84 */ lwz r0, gpMemoryCard@sda21(r13) @@ -146,4 +146,3 @@ lbl_803D5E80: # ROM: 0x3D2E80 .asciz "Pre front-end window" .balign 4 - diff --git a/asm/MetroidPrime/Factories/CAssetFactory.s b/asm/MetroidPrime/Factories/CAssetFactory.s index 15bcce2b..808b69af 100644 --- a/asm/MetroidPrime/Factories/CAssetFactory.s +++ b/asm/MetroidPrime/Factories/CAssetFactory.s @@ -128,7 +128,7 @@ __dt__24CCharacterFactoryBuilderFv: /* 8003498C 000318EC 41 82 00 44 */ beq lbl_800349D0 /* 80034990 000318F0 38 7E 00 04 */ addi r3, r30, 4 /* 80034994 000318F4 38 80 FF FF */ li r4, -1 -/* 80034998 000318F8 48 30 BD 71 */ bl __dt__11CSimplePool +/* 80034998 000318F8 48 30 BD 71 */ bl __dt__11CSimplePoolFv /* 8003499C 000318FC 28 1E 00 00 */ cmplwi r30, 0 /* 800349A0 00031900 41 82 00 20 */ beq lbl_800349C0 /* 800349A4 00031904 3C 60 80 3E */ lis r3, lbl_803D9C88@ha @@ -455,4 +455,3 @@ lbl_803CCD80: # ROM: 0x3C9D80 .asciz "??(??)" .balign 4 - diff --git a/asm/MetroidPrime/Factories/CCharacterFactory.s b/asm/MetroidPrime/Factories/CCharacterFactory.s index 78b42d9d..1a4de6a2 100644 --- a/asm/MetroidPrime/Factories/CCharacterFactory.s +++ b/asm/MetroidPrime/Factories/CCharacterFactory.s @@ -2877,7 +2877,7 @@ __dt__17CCharacterFactoryFv: /* 80034074 00030FD4 38 04 9C 20 */ addi r0, r4, lbl_803D9C20@l /* 80034078 00030FD8 38 80 FF FF */ li r4, -1 /* 8003407C 00030FDC 90 1E 00 00 */ stw r0, 0(r30) -/* 80034080 00030FE0 48 30 C6 89 */ bl __dt__11CSimplePool +/* 80034080 00030FE0 48 30 C6 89 */ bl __dt__11CSimplePoolFv /* 80034084 00030FE4 34 1E 00 6C */ addic. r0, r30, 0x6c /* 80034088 00030FE8 41 82 00 24 */ beq lbl_800340AC /* 8003408C 00030FEC 3C 60 80 3E */ lis r3, lbl_803D9BA8@ha @@ -3475,4 +3475,3 @@ lbl_803CCD78: # ROM: 0x3C9D78 .asciz "??(??)" .balign 4 - diff --git a/asm/MetroidPrime/main.s b/asm/MetroidPrime/main.s index 3df1f283..6453a22b 100644 --- a/asm/MetroidPrime/main.s +++ b/asm/MetroidPrime/main.s @@ -2665,8 +2665,8 @@ lbl_80004CD0: /* 80004CE0 00001C40 90 03 00 08 */ stw r0, 8(r3) /* 80004CE4 00001C44 4E 80 00 20 */ blr -.global AsyncIdle__5CMainFUl -AsyncIdle__5CMainFUl: +.global AsyncIdle__5CMainFUi +AsyncIdle__5CMainFUi: /* 80004CE8 00001C48 94 21 FF F0 */ stwu r1, -0x10(r1) /* 80004CEC 00001C4C 7C 08 02 A6 */ mflr r0 /* 80004CF0 00001C50 90 01 00 14 */ stw r0, 0x14(r1) @@ -2706,7 +2706,7 @@ lbl_80004D6C: /* 80004D70 00001CD0 41 82 00 10 */ beq lbl_80004D80 /* 80004D74 00001CD4 80 6D A0 60 */ lwz r3, gpResourceFactory@sda21(r13) /* 80004D78 00001CD8 7F E4 FB 78 */ mr r4, r31 -/* 80004D7C 00001CDC 48 33 4E 55 */ bl AsyncIdle__11CResFactoryFUl +/* 80004D7C 00001CDC 48 33 4E 55 */ bl AsyncIdle__11CResFactoryFUi lbl_80004D80: /* 80004D80 00001CE0 80 1E 01 5C */ lwz r0, 0x15c(r30) /* 80004D84 00001CE4 54 00 10 3A */ slwi r0, r0, 2 @@ -3309,7 +3309,7 @@ lbl_800055EC: /* 80005638 00002598 7C 64 1B 78 */ mr r4, r3 lbl_8000563C: /* 8000563C 0000259C 7F A3 EB 78 */ mr r3, r29 -/* 80005640 000025A0 4B FF F6 A9 */ bl AsyncIdle__5CMainFUl +/* 80005640 000025A0 4B FF F6 A9 */ bl AsyncIdle__5CMainFUi /* 80005644 000025A4 80 6D A0 68 */ lwz r3, gpRender@sda21(r13) /* 80005648 000025A8 81 83 00 00 */ lwz r12, 0(r3) /* 8000564C 000025AC 81 8C 00 8C */ lwz r12, 0x8c(r12) @@ -3331,7 +3331,7 @@ lbl_80005688: /* 80005688 000025E8 3C 80 00 0F */ lis r4, 0x000F4240@ha /* 8000568C 000025EC 80 6D A0 60 */ lwz r3, gpResourceFactory@sda21(r13) /* 80005690 000025F0 38 84 42 40 */ addi r4, r4, 0x000F4240@l -/* 80005694 000025F4 48 33 45 3D */ bl AsyncIdle__11CResFactoryFUl +/* 80005694 000025F4 48 33 45 3D */ bl AsyncIdle__11CResFactoryFUi lbl_80005698: /* 80005698 000025F8 80 61 00 08 */ lwz r3, 8(r1) /* 8000569C 000025FC 48 00 15 F5 */ bl Update__24CGameArchitectureSupportFv @@ -3475,7 +3475,7 @@ __dt__18CGameGlobalObjectsFv: lbl_80005890: /* 80005890 000027F0 38 7E 01 50 */ addi r3, r30, 0x150 /* 80005894 000027F4 38 80 FF FF */ li r4, -1 -/* 80005898 000027F8 48 00 02 29 */ bl sub_80005ac0 +/* 80005898 000027F8 48 00 02 29 */ bl "__dt__Q24rstl33single_ptr<19CInGameTweakManager>Fv" /* 8000589C 000027FC 34 1E 01 4C */ addic. r0, r30, 0x14c /* 800058A0 00002800 41 82 00 24 */ beq lbl_800058C4 /* 800058A4 00002804 80 7E 01 4C */ lwz r3, 0x14c(r30) @@ -3510,25 +3510,25 @@ lbl_800058F8: lbl_8000590C: /* 8000590C 0000286C 38 7E 01 34 */ addi r3, r30, 0x134 /* 80005910 00002870 38 80 FF FF */ li r4, -1 -/* 80005914 00002874 48 00 01 55 */ bl sub_80005a68 +/* 80005914 00002874 48 00 01 55 */ bl "__dt__Q24rstl24single_ptr<10CGameState>Fv" /* 80005918 00002878 38 7E 01 30 */ addi r3, r30, 0x130 /* 8000591C 0000287C 38 80 FF FF */ li r4, -1 /* 80005920 00002880 48 30 3A D9 */ bl __dt__12CGraphicsSysFv /* 80005924 00002884 38 7E 01 10 */ addi r3, r30, 0x110 /* 80005928 00002888 38 80 FF FF */ li r4, -1 -/* 8000592C 0000288C 48 00 00 61 */ bl sub_8000598c +/* 8000592C 0000288C 48 00 00 61 */ bl __dt__10CAiFuncMapFv /* 80005930 00002890 38 7E 00 EC */ addi r3, r30, 0xec /* 80005934 00002894 38 80 FF FF */ li r4, -1 /* 80005938 00002898 48 02 F0 39 */ bl __dt__24CCharacterFactoryBuilderFv /* 8000593C 0000289C 38 7E 00 CC */ addi r3, r30, 0xcc /* 80005940 000028A0 38 80 FF FF */ li r4, -1 -/* 80005944 000028A4 48 33 AD C5 */ bl __dt__11CSimplePool +/* 80005944 000028A4 48 33 AD C5 */ bl __dt__11CSimplePoolFv /* 80005948 000028A8 38 7E 00 04 */ addi r3, r30, 4 /* 8000594C 000028AC 38 80 FF FF */ li r4, -1 /* 80005950 000028B0 48 33 4C CD */ bl __dt__11CResFactoryFv /* 80005954 000028B4 7F C3 F3 78 */ mr r3, r30 /* 80005958 000028B8 38 80 FF FF */ li r4, -1 -/* 8000595C 000028BC 48 34 8B 01 */ bl sub_8034e45c +/* 8000595C 000028BC 48 34 8B 01 */ bl __dt__14CMemoryCardSysFv /* 80005960 000028C0 7F E0 07 35 */ extsh. r0, r31 /* 80005964 000028C4 40 81 00 0C */ ble lbl_80005970 /* 80005968 000028C8 7F C3 F3 78 */ mr r3, r30 @@ -3542,8 +3542,8 @@ lbl_80005970: /* 80005984 000028E4 38 21 00 10 */ addi r1, r1, 0x10 /* 80005988 000028E8 4E 80 00 20 */ blr -.global sub_8000598c -sub_8000598c: +.global __dt__10CAiFuncMapFv +__dt__10CAiFuncMapFv: /* 8000598C 000028EC 94 21 FF D0 */ stwu r1, -0x30(r1) /* 80005990 000028F0 7C 08 02 A6 */ mflr r0 /* 80005994 000028F4 90 01 00 34 */ stw r0, 0x34(r1) @@ -3607,8 +3607,8 @@ lbl_80005A4C: /* 80005A60 000029C0 38 21 00 30 */ addi r1, r1, 0x30 /* 80005A64 000029C4 4E 80 00 20 */ blr -.global sub_80005a68 -sub_80005a68: +.global "__dt__Q24rstl24single_ptr<10CGameState>Fv" +"__dt__Q24rstl24single_ptr<10CGameState>Fv": /* 80005A68 000029C8 94 21 FF F0 */ stwu r1, -0x10(r1) /* 80005A6C 000029CC 7C 08 02 A6 */ mflr r0 /* 80005A70 000029D0 90 01 00 14 */ stw r0, 0x14(r1) @@ -3633,8 +3633,8 @@ lbl_80005AA4: /* 80005AB8 00002A18 38 21 00 10 */ addi r1, r1, 0x10 /* 80005ABC 00002A1C 4E 80 00 20 */ blr -.global sub_80005ac0 -sub_80005ac0: +.global "__dt__Q24rstl33single_ptr<19CInGameTweakManager>Fv" +"__dt__Q24rstl33single_ptr<19CInGameTweakManager>Fv": /* 80005AC0 00002A20 94 21 FF F0 */ stwu r1, -0x10(r1) /* 80005AC4 00002A24 7C 08 02 A6 */ mflr r0 /* 80005AC8 00002A28 90 01 00 14 */ stw r0, 0x14(r1) @@ -3645,7 +3645,7 @@ sub_80005ac0: /* 80005ADC 00002A3C 41 82 00 20 */ beq lbl_80005AFC /* 80005AE0 00002A40 80 7E 00 00 */ lwz r3, 0(r30) /* 80005AE4 00002A44 38 80 00 01 */ li r4, 1 -/* 80005AE8 00002A48 48 00 00 31 */ bl sub_80005b18 +/* 80005AE8 00002A48 48 00 00 31 */ bl __dt__19CInGameTweakManagerFv /* 80005AEC 00002A4C 7F E0 07 35 */ extsh. r0, r31 /* 80005AF0 00002A50 40 81 00 0C */ ble lbl_80005AFC /* 80005AF4 00002A54 7F C3 F3 78 */ mr r3, r30 @@ -3659,8 +3659,8 @@ lbl_80005AFC: /* 80005B10 00002A70 38 21 00 10 */ addi r1, r1, 0x10 /* 80005B14 00002A74 4E 80 00 20 */ blr -.global sub_80005b18 -sub_80005b18: +.global __dt__19CInGameTweakManagerFv +__dt__19CInGameTweakManagerFv: /* 80005B18 00002A78 94 21 FF F0 */ stwu r1, -0x10(r1) /* 80005B1C 00002A7C 7C 08 02 A6 */ mflr r0 /* 80005B20 00002A80 90 01 00 14 */ stw r0, 0x14(r1) @@ -4377,7 +4377,7 @@ AddPaksAndFactories__18CGameGlobalObjectsFv: /* 800061C0 00003120 48 33 7A 01 */ bl "internal_dereference__Q24rstl66basic_string,Q24rstl17rmemory_allocator>Fv" /* 800061C4 00003124 38 61 00 9C */ addi r3, r1, 0x9c /* 800061C8 00003128 38 80 00 01 */ li r4, 0x1 -/* 800061CC 0000312C 48 26 3A 71 */ bl __ct__18CErrorOutputWindowFiff +/* 800061CC 0000312C 48 26 3A 71 */ bl __ct__18CErrorOutputWindowFb /* 800061D0 00003130 38 60 00 01 */ li r3, 0x1 /* 800061D4 00003134 48 30 33 B5 */ bl SetIsBeginSceneClearFb__9CGraphicsFb /* 800061D8 00003138 3C 80 80 3F */ lis r4, mViewport__9CGraphics@ha @@ -4737,7 +4737,7 @@ AddPaksAndFactories__18CGameGlobalObjectsFv: /* 8000619C 000030FC 48 33 79 45 */ bl "internal_dereference__Q24rstl66basic_string,Q24rstl17rmemory_allocator>Fv" /* 800061A0 00003100 38 61 00 98 */ addi r3, r1, 0x98 /* 800061A4 00003104 38 80 00 01 */ li r4, 1 -/* 800061A8 00003108 48 26 3A 19 */ bl __ct__18CErrorOutputWindowFiff +/* 800061A8 00003108 48 26 3A 19 */ bl __ct__18CErrorOutputWindowFb /* 800061AC 0000310C 38 60 00 01 */ li r3, 1 /* 800061B0 00003110 48 30 32 F9 */ bl SetIsBeginSceneClearFb__9CGraphicsFb /* 800061B4 00003114 3C 80 80 3F */ lis r4, mViewport__9CGraphics@ha @@ -5795,10 +5795,10 @@ lbl_80007084: lbl_8000709C: /* 8000709C 00003FFC 38 7C 00 58 */ addi r3, r28, 0x58 /* 800070A0 00004000 38 80 FF FF */ li r4, -1 -/* 800070A4 00004004 48 04 BA 3D */ bl sub_80052ae0 +/* 800070A4 00004004 48 04 BA 3D */ bl __dt__13CIOWinManagerFv /* 800070A8 00004008 38 7C 00 44 */ addi r3, r28, 0x44 /* 800070AC 0000400C 38 80 FF FF */ li r4, -1 -/* 800070B0 00004010 48 2B F3 61 */ bl sub_802c6410 +/* 800070B0 00004010 48 2B F3 61 */ bl __dt__7CGuiSysFv /* 800070B4 00004014 34 1C 00 30 */ addic. r0, r28, 0x30 /* 800070B8 00004018 41 82 00 2C */ beq lbl_800070E4 /* 800070BC 0000401C 34 1C 00 34 */ addic. r0, r28, 0x34 @@ -5816,7 +5816,7 @@ lbl_800070E4: /* 800070E8 00004048 41 82 00 10 */ beq lbl_800070F8 /* 800070EC 0000404C 38 7C 00 04 */ addi r3, r28, 4 /* 800070F0 00004050 38 80 FF FF */ li r4, -1 -/* 800070F4 00004054 48 00 1F B5 */ bl sub_800090a8 +/* 800070F4 00004054 48 00 1F B5 */ bl __dt__18CArchitectureQueueFv lbl_800070F8: /* 800070F8 00004058 7F 83 E3 78 */ mr r3, r28 /* 800070FC 0000405C 38 80 FF FF */ li r4, -1 @@ -5947,7 +5947,7 @@ lbl_800072C8: /* 800072D8 00004238 38 C0 27 10 */ li r6, 0x2710 /* 800072DC 0000423C 48 04 B6 75 */ bl "AddIOWin__13CIOWinManagerFQ24rstl17ncrc_ptr<6CIOWin>ii" /* 800072E0 00004240 38 61 00 18 */ addi r3, r1, 0x18 -/* 800072E4 00004244 48 00 13 B9 */ bl sub_8000869c +/* 800072E4 00004244 48 00 13 B9 */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" lbl_800072E8: /* 800072E8 00004248 3C 80 80 3D */ lis r4, lbl_803CBE74@ha /* 800072EC 0000424C 38 60 00 18 */ li r3, 0x18 @@ -5979,7 +5979,7 @@ lbl_8000733C: /* 8000734C 000042AC 38 C0 00 00 */ li r6, 0 /* 80007350 000042B0 48 04 B6 01 */ bl "AddIOWin__13CIOWinManagerFQ24rstl17ncrc_ptr<6CIOWin>ii" /* 80007354 000042B4 38 61 00 14 */ addi r3, r1, 0x14 -/* 80007358 000042B8 48 00 13 45 */ bl sub_8000869c +/* 80007358 000042B8 48 00 13 45 */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" /* 8000735C 000042BC 3C 80 80 3D */ lis r4, lbl_803CBE74@ha /* 80007360 000042C0 38 60 00 4C */ li r3, 0x4c /* 80007364 000042C4 38 84 BE 74 */ addi r4, r4, lbl_803CBE74@l @@ -6013,7 +6013,7 @@ lbl_800073BC: /* 800073CC 0000432C 38 C0 00 00 */ li r6, 0 /* 800073D0 00004330 48 04 B5 81 */ bl "AddIOWin__13CIOWinManagerFQ24rstl17ncrc_ptr<6CIOWin>ii" /* 800073D4 00004334 38 61 00 10 */ addi r3, r1, 0x10 -/* 800073D8 00004338 48 00 12 C5 */ bl sub_8000869c +/* 800073D8 00004338 48 00 12 C5 */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" /* 800073DC 0000433C 3C 80 80 3D */ lis r4, lbl_803CBE74@ha /* 800073E0 00004340 38 60 00 14 */ li r3, 0x14 /* 800073E4 00004344 38 84 BE 74 */ addi r4, r4, lbl_803CBE74@l @@ -6044,7 +6044,7 @@ lbl_80007430: /* 80007440 000043A0 38 C0 FF FF */ li r6, -1 /* 80007444 000043A4 48 04 B5 0D */ bl "AddIOWin__13CIOWinManagerFQ24rstl17ncrc_ptr<6CIOWin>ii" /* 80007448 000043A8 38 61 00 0C */ addi r3, r1, 0xc -/* 8000744C 000043AC 48 00 12 51 */ bl sub_8000869c +/* 8000744C 000043AC 48 00 12 51 */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" /* 80007450 000043B0 3C 80 80 3D */ lis r4, lbl_803CBE74@ha /* 80007454 000043B4 38 60 00 20 */ li r3, 0x20 /* 80007458 000043B8 38 84 BE 74 */ addi r4, r4, lbl_803CBE74@l @@ -6054,7 +6054,7 @@ lbl_80007430: /* 80007468 000043C8 7C 7D 1B 79 */ or. r29, r3, r3 /* 8000746C 000043CC 41 82 00 10 */ beq lbl_8000747C /* 80007470 000043D0 38 80 00 00 */ li r4, 0 -/* 80007474 000043D4 48 26 27 4D */ bl __ct__18CErrorOutputWindowFiff +/* 80007474 000043D4 48 26 27 4D */ bl __ct__18CErrorOutputWindowFb /* 80007478 000043D8 7C 7D 1B 78 */ mr r29, r3 lbl_8000747C: /* 8000747C 000043DC 3C 80 80 3D */ lis r4, lbl_803CBE74@ha @@ -6077,7 +6077,7 @@ lbl_800074A8: /* 800074BC 0000441C 38 A0 27 10 */ li r5, 0x2710 /* 800074C0 00004420 48 04 B4 91 */ bl "AddIOWin__13CIOWinManagerFQ24rstl17ncrc_ptr<6CIOWin>ii" /* 800074C4 00004424 38 61 00 08 */ addi r3, r1, 8 -/* 800074C8 00004428 48 00 11 D5 */ bl sub_8000869c +/* 800074C8 00004428 48 00 11 D5 */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" /* 800074CC 0000442C 38 7E 00 44 */ addi r3, r30, 0x44 /* 800074D0 00004430 48 2B 97 25 */ bl InitializeApplicationUI__FR7CGuiSys /* 800074D4 00004434 38 1E 00 44 */ addi r0, r30, 0x44 @@ -6103,9 +6103,9 @@ lbl_800074A8: /* 80007524 00004484 7C 9D 23 78 */ mr r29, r4 /* 80007528 00004488 7C 7F 1B 78 */ mr r31, r3 /* 8000752C 0000448C 48 37 DE 7D */ bl OSGetTime -/* 80007530 00004490 3C A0 80 00 */ lis r5, sub_80007578@ha +/* 80007530 00004490 3C A0 80 00 */ lis r5, InfiniteLoopAlarm__FP7OSAlarmP9OSContext@ha /* 80007534 00004494 7F A8 EB 78 */ mr r8, r29 -/* 80007538 00004498 39 25 75 78 */ addi r9, r5, sub_80007578@l +/* 80007538 00004498 39 25 75 78 */ addi r9, r5, InfiniteLoopAlarm__FP7OSAlarmP9OSContext@l /* 8000753C 0000449C 7C 86 23 78 */ mr r6, r4 /* 80007540 000044A0 7C 65 1B 78 */ mr r5, r3 /* 80007544 000044A4 7F E7 FB 78 */ mr r7, r31 @@ -6122,8 +6122,8 @@ lbl_800074A8: /* 80007570 000044D0 38 21 00 40 */ addi r1, r1, 0x40 /* 80007574 000044D4 4E 80 00 20 */ blr -.global sub_80007578 -sub_80007578: +.global InfiniteLoopAlarm__FP7OSAlarmP9OSContext +InfiniteLoopAlarm__FP7OSAlarmP9OSContext: /* 80007578 000044D8 94 21 FF F0 */ stwu r1, -0x10(r1) /* 8000757C 000044DC 7C 08 02 A6 */ mflr r0 /* 80007580 000044E0 C0 02 80 58 */ lfs f0, lbl_805A9D78@sda21(r2) @@ -6373,7 +6373,7 @@ lbl_800078D0: lbl_80007904: /* 80007904 00004864 3B C1 00 20 */ addi r30, r1, 0x20 /* 80007908 00004868 38 61 00 08 */ addi r3, r1, 8 -/* 8000790C 0000486C 48 00 01 21 */ bl "GetIObjObjectFor__17TToken<8CTexture>FP8CTexture" +/* 8000790C 0000486C 48 00 01 21 */ bl "GetNewDerivedObject__35TObjOwnerDerivedFromIObj<8CTexture>FP8CTexture" /* 80007910 00004870 38 00 00 00 */ li r0, 0 /* 80007914 00004874 80 81 00 0C */ lwz r4, 0xc(r1) /* 80007918 00004878 98 01 00 08 */ stb r0, 8(r1) @@ -6393,7 +6393,7 @@ lbl_80007904: lbl_80007950: /* 80007950 000048B0 7F E3 FB 78 */ mr r3, r31 /* 80007954 000048B4 38 81 00 20 */ addi r4, r1, 0x20 -/* 80007958 000048B8 48 2F 85 7D */ bl sub_802ffed4 +/* 80007958 000048B8 48 2F 85 7D */ bl "SetTexture__11CRasterFontF17TToken<8CTexture>" /* 8000795C 000048BC 38 61 00 20 */ addi r3, r1, 0x20 /* 80007960 000048C0 38 80 00 00 */ li r4, 0 /* 80007964 000048C4 48 33 94 DD */ bl __dt__6CTokenFv @@ -6453,8 +6453,8 @@ lbl_80007A10: /* 80007A24 00004984 38 21 00 10 */ addi r1, r1, 0x10 /* 80007A28 00004988 4E 80 00 20 */ blr -.global "GetIObjObjectFor__17TToken<8CTexture>FP8CTexture" -"GetIObjObjectFor__17TToken<8CTexture>FP8CTexture": +.global "GetNewDerivedObject__35TObjOwnerDerivedFromIObj<8CTexture>FP8CTexture" +"GetNewDerivedObject__35TObjOwnerDerivedFromIObj<8CTexture>FP8CTexture": /* 80007A2C 0000498C 94 21 FF F0 */ stwu r1, -0x10(r1) /* 80007A30 00004990 7C 08 02 A6 */ mflr r0 /* 80007A34 00004994 3C A0 80 3D */ lis r5, lbl_803CBE74@ha @@ -6553,7 +6553,7 @@ lbl_80007B88: /* 80007B90 00004AF0 7C 64 1B 78 */ mr r4, r3 /* 80007B94 00004AF4 3B BF 01 54 */ addi r29, r31, 0x154 /* 80007B98 00004AF8 38 61 00 08 */ addi r3, r1, 8 -/* 80007B9C 00004AFC 48 00 02 3D */ bl "GetIObjObjectFor__21TToken<11CRasterFont>FP11CRasterFont" +/* 80007B9C 00004AFC 48 00 02 3D */ bl "GetNewDerivedObject__39TObjOwnerDerivedFromIObj<11CRasterFont>FP11CRasterFont" /* 80007BA0 00004B00 38 00 00 00 */ li r0, 0 /* 80007BA4 00004B04 80 81 00 0C */ lwz r4, 0xc(r1) /* 80007BA8 00004B08 98 01 00 08 */ stb r0, 8(r1) @@ -6717,8 +6717,8 @@ lbl_80007DBC: /* 80007DD0 00004D30 38 21 00 30 */ addi r1, r1, 0x30 /* 80007DD4 00004D34 4E 80 00 20 */ blr -.global "GetIObjObjectFor__21TToken<11CRasterFont>FP11CRasterFont" -"GetIObjObjectFor__21TToken<11CRasterFont>FP11CRasterFont": +.global "GetNewDerivedObject__39TObjOwnerDerivedFromIObj<11CRasterFont>FP11CRasterFont" +"GetNewDerivedObject__39TObjOwnerDerivedFromIObj<11CRasterFont>FP11CRasterFont": /* 80007DD8 00004D38 94 21 FF F0 */ stwu r1, -0x10(r1) /* 80007DDC 00004D3C 7C 08 02 A6 */ mflr r0 /* 80007DE0 00004D40 3C A0 80 3D */ lis r5, lbl_803CBE74@ha @@ -7356,8 +7356,8 @@ lbl_80008688: /* 80008694 000055F4 38 21 00 10 */ addi r1, r1, 0x10 /* 80008698 000055F8 4E 80 00 20 */ blr -.global sub_8000869c -sub_8000869c: +.global "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" +"__dt__Q24rstl15rc_ptr<6CIOWin>Fv": /* 8000869C 000055FC 94 21 FF F0 */ stwu r1, -0x10(r1) /* 800086A0 00005600 7C 08 02 A6 */ mflr r0 /* 800086A4 00005604 90 01 00 14 */ stw r0, 0x14(r1) @@ -8129,8 +8129,8 @@ lbl_8000908C: /* 800090A0 00006000 38 21 00 30 */ addi r1, r1, 0x30 /* 800090A4 00006004 4E 80 00 20 */ blr -.global sub_800090a8 -sub_800090a8: +.global __dt__18CArchitectureQueueFv +__dt__18CArchitectureQueueFv: /* 800090A8 00006008 94 21 FF E0 */ stwu r1, -0x20(r1) /* 800090AC 0000600C 7C 08 02 A6 */ mflr r0 /* 800090B0 00006010 90 01 00 24 */ stw r0, 0x24(r1) diff --git a/include/GuiSys/CGuiSys.hpp b/include/GuiSys/CGuiSys.hpp index 537e3549..7acecc86 100644 --- a/include/GuiSys/CGuiSys.hpp +++ b/include/GuiSys/CGuiSys.hpp @@ -6,6 +6,9 @@ class IFactory; class CSimplePool; +class CGuiSys; +extern CGuiSys* gGuiSystem; + class CGuiSys { public: enum EUsageMode { @@ -15,9 +18,17 @@ public: }; CGuiSys(IFactory*, CSimplePool*, EUsageMode); + ~CGuiSys(); + + static void SetGlobalGuiSys(CGuiSys* ptr) { + gGuiSystem = ptr; + spGuiSys = ptr; + } private: u8 pad[0x14]; + + static CGuiSys* spGuiSys; }; #endif diff --git a/include/Kyoto/Alloc/CGameAllocator.hpp b/include/Kyoto/Alloc/CGameAllocator.hpp index 0b3aea10..ff5f79bd 100644 --- a/include/Kyoto/Alloc/CGameAllocator.hpp +++ b/include/Kyoto/Alloc/CGameAllocator.hpp @@ -1,9 +1,9 @@ #ifndef __CGAMEALLOCATOR_HPP__ #define __CGAMEALLOCATOR_HPP__ -#include -#include #include +#include +#include class CSmallAllocPool; class CMediumAllocPool; @@ -12,8 +12,10 @@ class CGameAllocator : public IAllocator { public: class SGameMemInfo { friend class CGameAllocator; + public: - SGameMemInfo(SGameMemInfo* prev, SGameMemInfo* next, SGameMemInfo* nextFree, uint len, const char* fileAndLine, const char* type) + SGameMemInfo(SGameMemInfo* prev, SGameMemInfo* next, SGameMemInfo* nextFree, uint len, + const char* fileAndLine, const char* type) : x0_priorGuard(0xefefefef) , x4_len(len) , x8_fileAndLine(fileAndLine) @@ -25,15 +27,15 @@ public: SGameMemInfo* GetPrev() { return (SGameMemInfo*)((size_t)x10_prev & ~31); } void SetPrev(SGameMemInfo* prev) { - void* ptr = x10_prev; - x10_prev = prev; - x10_prev = (SGameMemInfo*)(((size_t)ptr & 31) | ((size_t)x10_prev & ~31)); + void* ptr = x10_prev; + x10_prev = prev; + x10_prev = (SGameMemInfo*)(((size_t)ptr & 31) | ((size_t)x10_prev & ~31)); } SGameMemInfo* GetNext() const { return (SGameMemInfo*)((size_t)x14_next & ~31); } void SetNext(SGameMemInfo* next) { - void* ptr = x14_next; - x14_next = next; - x14_next = (SGameMemInfo*)(((size_t)ptr & 31) | ((size_t)x14_next & ~31)); + void* ptr = x14_next; + x14_next = next; + x14_next = (SGameMemInfo*)(((size_t)ptr & 31) | ((size_t)x14_next & ~31)); } u32 GetPrevMaskedFlags(); u32 GetNextMaskedFlags(); @@ -41,9 +43,9 @@ public: size_t GetLength() const { return x4_len; } SGameMemInfo* GetNextFree() const { return (SGameMemInfo*)((size_t)x18_nextFree & ~31); } void SetNextFree(SGameMemInfo* info) { - void* ptr = x18_nextFree; - x18_nextFree = info; - x18_nextFree = (SGameMemInfo*)(((size_t)ptr & 31) | ((size_t)x18_nextFree & ~31)); + void* ptr = x18_nextFree; + x18_nextFree = info; + x18_nextFree = (SGameMemInfo*)(((size_t)ptr & 31) | ((size_t)x18_nextFree & ~31)); } bool IsAllocated() const { return ((size_t)x10_prev) & 1; } @@ -68,7 +70,7 @@ public: bool Initialize(COsContext& ctx); void Shutdown(); - void* Alloc(size_t, EHint, EScope, EType, const CCallStack&) override; + void* Alloc(size_t size, EHint hint, EScope scope, EType type, const CCallStack& cs) override; SGameMemInfo* FindFreeBlock(uint); SGameMemInfo* FindFreeBlockFromTopOfHeap(uint); uint FixupAllocPtrs(SGameMemInfo*, uint, uint, EHint, const CCallStack&); @@ -76,7 +78,8 @@ public: bool Free(const void* ptr) override; bool FreeNormalAllocation(const void* ptr); void ReleaseAll() override; - void* AllocSecondary(size_t, IAllocator::EHint, IAllocator::EScope, IAllocator::EType, const CCallStack&) override; + void* AllocSecondary(size_t size, EHint hint, EScope scope, EType type, + const CCallStack& cs) override; bool FreeSecondary(const void* ptr) override; void ReleaseAllSecondary() override; void SetOutOfMemoryCallback(FOutOfMemoryCb cb, const void* target) override; diff --git a/include/Kyoto/Alloc/CMemory.hpp b/include/Kyoto/Alloc/CMemory.hpp index 0a8481ca..de9a07d7 100644 --- a/include/Kyoto/Alloc/CMemory.hpp +++ b/include/Kyoto/Alloc/CMemory.hpp @@ -4,17 +4,18 @@ #include "types.h" namespace CMemory { -void* Alloc(unsigned long sz); +void* Alloc(size_t sz); void Free(const void* ptr); } // namespace CMemory -void* operator new(unsigned long sz, const char*, const char*); -void* operator new[](unsigned long sz, const char*, const char*); -inline void* operator new(unsigned long sz) { return operator new(sz, "??(??)", nullptr); } -inline void* operator new[](unsigned long sz) { return operator new[](sz, "??(??)", nullptr); } +void* operator new(size_t sz, const char*, const char*); +void* operator new[](size_t sz, const char*, const char*); +inline void* operator new(size_t sz) { return operator new(sz, "??(??)", nullptr); } +inline void* operator new[](size_t sz) { return operator new[](sz, "??(??)", nullptr); } // placement new -inline void* operator new(unsigned long n, void* ptr) { return ptr; }; +inline void* operator new(size_t n, void* ptr) { return ptr; }; inline void operator delete(void* ptr) { CMemory::Free(ptr); } +inline void operator delete[](void* ptr) { CMemory::Free(ptr); } #endif diff --git a/include/Kyoto/Alloc/IAllocator.hpp b/include/Kyoto/Alloc/IAllocator.hpp index 16fe2a28..fec7c14a 100644 --- a/include/Kyoto/Alloc/IAllocator.hpp +++ b/include/Kyoto/Alloc/IAllocator.hpp @@ -81,11 +81,10 @@ public: virtual bool Initialize(COsContext& ctx) = 0; virtual void Shutdown() = 0; - virtual void* Alloc(unsigned long size, EHint hint, EScope scope, EType type, - const CCallStack& cs) = 0; + virtual void* Alloc(size_t size, EHint hint, EScope scope, EType type, const CCallStack& cs) = 0; virtual bool Free(const void* ptr) = 0; virtual void ReleaseAll() = 0; - virtual void* AllocSecondary(unsigned long size, EHint hint, EScope scope, EType type, + virtual void* AllocSecondary(size_t size, EHint hint, EScope scope, EType type, const CCallStack& cs) = 0; virtual bool FreeSecondary(const void* ptr) = 0; virtual void ReleaseAllSecondary() = 0; diff --git a/include/Kyoto/Audio/CAudioSys.hpp b/include/Kyoto/Audio/CAudioSys.hpp index 1bbe9d46..7622029a 100644 --- a/include/Kyoto/Audio/CAudioSys.hpp +++ b/include/Kyoto/Audio/CAudioSys.hpp @@ -16,6 +16,7 @@ enum ETRKRepeatMode { class CAudioSys { public: CAudioSys(u8, u8, u8, u8, uint); + ~CAudioSys(); static void SysSetVolume(u8, uint, u8); static void SetDefaultVolumeScale(s16); diff --git a/include/Kyoto/Audio/CDSPStreamManager.hpp b/include/Kyoto/Audio/CDSPStreamManager.hpp index 6c4f1454..39f91631 100644 --- a/include/Kyoto/Audio/CDSPStreamManager.hpp +++ b/include/Kyoto/Audio/CDSPStreamManager.hpp @@ -6,6 +6,7 @@ class CDSPStreamManager { public: static void Initialize(); + static void Shutdown(); }; #endif diff --git a/include/Kyoto/Audio/CSfxManager.hpp b/include/Kyoto/Audio/CSfxManager.hpp index fa304e9c..2c66b839 100644 --- a/include/Kyoto/Audio/CSfxManager.hpp +++ b/include/Kyoto/Audio/CSfxManager.hpp @@ -9,6 +9,7 @@ class CSfxManager { public: static void Update(f32 dt); static void RemoveEmitter(CSfxHandle handle); + static void Shutdown(); }; #endif diff --git a/include/Kyoto/Basics/COsContext.hpp b/include/Kyoto/Basics/COsContext.hpp index 21132b32..1958b416 100644 --- a/include/Kyoto/Basics/COsContext.hpp +++ b/include/Kyoto/Basics/COsContext.hpp @@ -12,6 +12,8 @@ public: COsContext(bool, bool); ~COsContext(); + void OpenWindow(const char* title, int x, int y, int w, int h, bool fullscreen); + uint GetBaseFreeRam() const { size_t hiAddr = reinterpret_cast< size_t >(x1c_arenaHi); size_t loAddr = reinterpret_cast< size_t >(x20_arenaLo2); diff --git a/include/Kyoto/CResFactory.hpp b/include/Kyoto/CResFactory.hpp index 0cc187a5..4ce9890f 100644 --- a/include/Kyoto/CResFactory.hpp +++ b/include/Kyoto/CResFactory.hpp @@ -23,7 +23,14 @@ public: class CResFactory : public IFactory { public: CResFactory(); - virtual ~CResFactory() {} + + ~CResFactory() override {} + CFactoryFnReturn Build(const SObjectTag&, const CVParamTransfer&, CObjectReference*) override; + void BuildAsync(const SObjectTag&, const CVParamTransfer&, rstl::auto_ptr< IObj >*, + CObjectReference*) override; + void CancelBuild(const SObjectTag&) override; + bool CanBuild(const SObjectTag&) override; + const SObjectTag* GetResourceIdByName(const char* name) const override; void AsyncIdle(uint time); diff --git a/include/Kyoto/CSimplePool.hpp b/include/Kyoto/CSimplePool.hpp index 5212476a..ab961ce0 100644 --- a/include/Kyoto/CSimplePool.hpp +++ b/include/Kyoto/CSimplePool.hpp @@ -14,6 +14,7 @@ class IFactory; class CSimplePool : public IObjectStore { public: CSimplePool(IFactory& factory); + ~CSimplePool(); virtual CToken GetObj(const SObjectTag& tag, CVParamTransfer xfer); virtual CToken GetObj(const SObjectTag& tag); diff --git a/include/Kyoto/Graphics/CGraphics.hpp b/include/Kyoto/Graphics/CGraphics.hpp index 22331e12..6a239ddb 100644 --- a/include/Kyoto/Graphics/CGraphics.hpp +++ b/include/Kyoto/Graphics/CGraphics.hpp @@ -39,6 +39,8 @@ enum ERglPrimitive { kP_Points = 0xB8, }; +class CTimeProvider; + class CGraphics { public: static void SetIsBeginSceneClearFb(bool); diff --git a/include/Kyoto/TToken.hpp b/include/Kyoto/TToken.hpp index 2e6846f4..40f8b7cd 100644 --- a/include/Kyoto/TToken.hpp +++ b/include/Kyoto/TToken.hpp @@ -14,15 +14,12 @@ class TToken : public CToken { public: TToken() {} TToken(const CToken& token) : CToken(token) {} - TToken(T* obj) : CToken(GetIObjObjectFor(obj).release()) {} + TToken(T* obj) : CToken(TObjOwnerDerivedFromIObj< T >::GetNewDerivedObject(obj).release()) {} TToken(const rstl::auto_ptr< T >& obj) : CToken(GetIObjObjectFor(obj).release()) {} T* GetT() { return reinterpret_cast< T* >(CToken::GetObj()->GetContents()); } T* operator*() { return GetT(); } - static inline rstl::auto_ptr< TObjOwnerDerivedFromIObj< T > > GetIObjObjectFor(T* obj) { - return TObjOwnerDerivedFromIObj< T >::GetNewDerivedObject(obj); - } static inline rstl::auto_ptr< TObjOwnerDerivedFromIObj< T > > GetIObjObjectFor(const rstl::auto_ptr< T >& obj) { return TObjOwnerDerivedFromIObj< T >::GetNewDerivedObject(obj); diff --git a/include/MetroidPrime/CArchitectureMessage.hpp b/include/MetroidPrime/CArchitectureMessage.hpp new file mode 100644 index 00000000..f540ddf1 --- /dev/null +++ b/include/MetroidPrime/CArchitectureMessage.hpp @@ -0,0 +1,38 @@ +#ifndef _CARCHITECTUREMESSAGE_HPP +#define _CARCHITECTUREMESSAGE_HPP + +#include "types.h" + +#include "rstl/rc_ptr.hpp" + +enum EArchMsgTarget { + kAMT_IOWinManager, + kAMT_Game, +}; + +enum EArchMsgType { + kAM_RemoveIOWin = 0, + kAM_CreateIOWin = 1, + kAM_ChangeIOWinPriority = 2, + kAM_RemoveAllIOWins = 3, + kAM_TimerTick = 4, + kAM_UserInput = 5, + kAM_SetGameState = 6, + kAM_ControllerStatus = 7, + kAM_QuitGameplay = 8, + kAM_FrameBegin = 10, + kAM_FrameEnd = 11, +}; + +struct IArchitectureMessageParm { + virtual ~IArchitectureMessageParm() = 0; +}; + +class CArchitectureMessage { +private: + EArchMsgTarget x0_target; + EArchMsgType x4_type; + rstl::rc_ptr< IArchitectureMessageParm > x8_parm; +}; + +#endif diff --git a/include/MetroidPrime/CArchitectureQueue.hpp b/include/MetroidPrime/CArchitectureQueue.hpp new file mode 100644 index 00000000..ea15f11e --- /dev/null +++ b/include/MetroidPrime/CArchitectureQueue.hpp @@ -0,0 +1,21 @@ +#ifndef _CARCHITECTUREQUEUE_HPP +#define _CARCHITECTUREQUEUE_HPP + +#include "types.h" + +#include "MetroidPrime/CArchitectureMessage.hpp" + +#include "rstl/list.hpp" + +class CArchitectureQueue { +public: + void Push(const CArchitectureMessage&); // TODO + void Pop(); // TODO + void Clear(); // TODO + bool IsEmpty() const; // TODO + +private: + rstl::list< CArchitectureMessage > x0_queue; +}; + +#endif diff --git a/include/MetroidPrime/CAudioStateWin.hpp b/include/MetroidPrime/CAudioStateWin.hpp new file mode 100644 index 00000000..08d2ca23 --- /dev/null +++ b/include/MetroidPrime/CAudioStateWin.hpp @@ -0,0 +1,16 @@ +#ifndef _CAUDIOSTATEWIN_HPP +#define _CAUDIOSTATEWIN_HPP + +#include "types.h" + +#include "MetroidPrime/CIOWin.hpp" + +class CAudioStateWin : public CIOWin { +public: + CAudioStateWin(); + + ~CAudioStateWin() override; + EMessageReturn OnMessage(const CArchitectureMessage&, CArchitectureQueue&) override; +}; + +#endif diff --git a/include/MetroidPrime/CConsoleOutputWindow.hpp b/include/MetroidPrime/CConsoleOutputWindow.hpp new file mode 100644 index 00000000..16e0551a --- /dev/null +++ b/include/MetroidPrime/CConsoleOutputWindow.hpp @@ -0,0 +1,17 @@ +#ifndef _CCONSOLEOUTPUTWINDOW_HPP +#define _CCONSOLEOUTPUTWINDOW_HPP + +#include "types.h" + +#include "MetroidPrime/CIOWin.hpp" + +class CConsoleOutputWindow : public CIOWin { +public: + CConsoleOutputWindow(int, f32, f32); + + ~CConsoleOutputWindow() override; + EMessageReturn OnMessage(const CArchitectureMessage&, CArchitectureQueue&) override; + void Draw() override; +}; + +#endif diff --git a/include/MetroidPrime/CErrorOutputWindow.hpp b/include/MetroidPrime/CErrorOutputWindow.hpp new file mode 100644 index 00000000..9605f422 --- /dev/null +++ b/include/MetroidPrime/CErrorOutputWindow.hpp @@ -0,0 +1,18 @@ +#ifndef _CERROROUTPUTWINDOW_HPP +#define _CERROROUTPUTWINDOW_HPP + +#include "types.h" + +#include "MetroidPrime/CIOWin.hpp" + +class CErrorOutputWindow : public CIOWin { +public: + CErrorOutputWindow(bool); + + ~CErrorOutputWindow() override; + EMessageReturn OnMessage(const CArchitectureMessage&, CArchitectureQueue&) override; + bool GetIsContinueDraw() const override; + void Draw() override; +}; + +#endif diff --git a/include/MetroidPrime/CGameArchitectureSupport.hpp b/include/MetroidPrime/CGameArchitectureSupport.hpp index baf16a6a..0f80e029 100644 --- a/include/MetroidPrime/CGameArchitectureSupport.hpp +++ b/include/MetroidPrime/CGameArchitectureSupport.hpp @@ -4,19 +4,19 @@ #include "types.h" #include "GuiSys/CGuiSys.hpp" + #include "Kyoto/Audio/CAudioSys.hpp" #include "Kyoto/Basics/COsContext.hpp" #include "Kyoto/Basics/CStopwatch.hpp" #include "Kyoto/TOneStatic.hpp" + +#include "MetroidPrime/CArchitectureQueue.hpp" #include "MetroidPrime/CIOWinManager.hpp" #include "MetroidPrime/CInputGenerator.hpp" -class CSavableState; +#include "rstl/vector.hpp" -class Unknown { -private: - u8 pad[0x2c]; -}; +class CToken; class CGameArchitectureSupport : public TOneStatic< CGameArchitectureSupport > { public: @@ -26,33 +26,29 @@ public: void PreloadAudio(); bool UpdateTicks(); void Update(); + void UnloadAudio(); inline CStopwatch& GetStopwatch1() { return x20_stopwatch1; } inline CStopwatch& GetStopwatch2() { return x28_stopwatch2; } - // TODO - inline CIOWinManager& GetIOWinManager() { return *(CIOWinManager*)(((u8*)this) + 0x58); } - inline int& GetFramesDrawn() const { return *(int*)(((u8*)this) + 0x78); } + inline CIOWinManager& GetIOWinManager() { return x58_ioWinMgr; } + inline int& GetFramesDrawn() { return x78_gameFrameCount; } private: CAudioSys x0_audioSys; - rstl::list< CSavableState > x8_; - u32 pad; + CArchitectureQueue x4_archQueue; CStopwatch x20_stopwatch1; CStopwatch x28_stopwatch2; CInputGenerator x30_inputGenerator; CGuiSys x44_guiSys; CIOWinManager x58_ioWinMgr; - uint x78_gameFrameCount; + int x78_gameFrameCount; f32 x7c_; f32 x80_; f32 x84_; uint x88_; - uint x8c_; // unused? - uint x90_; - uint x94_; - uint x98_; - rstl::optional_object< Unknown > x9c_; - u8 pad2[0x4]; + rstl::vector< CToken > x90_; + OSAlarm xa0_infiniteLoopAlarm; + bool xc8_infiniteLoopAlarmSet; }; CHECK_SIZEOF(CGameArchitectureSupport, 0xd0) diff --git a/include/MetroidPrime/CGameGlobalObjects.hpp b/include/MetroidPrime/CGameGlobalObjects.hpp index cb8eb40b..344ee7f6 100644 --- a/include/MetroidPrime/CGameGlobalObjects.hpp +++ b/include/MetroidPrime/CGameGlobalObjects.hpp @@ -16,6 +16,7 @@ #include "Kyoto/TOneStatic.hpp" #include "Kyoto/Text/CRasterFont.hpp" #include "MetroidPrime/CInGameTweakManager.hpp" +#include "MetroidPrime/CMemoryCard.hpp" #include "MetroidPrime/Enemies/CAiFuncMap.hpp" #include "MetroidPrime/Factories/CCharacterFactoryBuilder.hpp" #include "MetroidPrime/Player/CGameState.hpp" @@ -43,7 +44,7 @@ private: CAiFuncMap x110_aiFuncMap; CGraphicsSys x130_graphicsSys; rstl::single_ptr< CGameState > x134_gameState; - uint x138_; + rstl::single_ptr< CMemoryCard > x138_; rstl::optional_object< TLockedToken< CStringTable > > x13c_stringTable; rstl::single_ptr< IRenderer > x14c_renderer; rstl::single_ptr< CInGameTweakManager > x150_inGameTweakManager; @@ -52,7 +53,6 @@ private: CHECK_SIZEOF(CGameGlobalObjects, 0x15c) // TODO move to related headers -extern unkptr gGuiSystem; extern unkptr gpController; extern unkptr gpDefaultFont; diff --git a/include/MetroidPrime/CIOWinManager.hpp b/include/MetroidPrime/CIOWinManager.hpp index e890a34a..0207459b 100644 --- a/include/MetroidPrime/CIOWinManager.hpp +++ b/include/MetroidPrime/CIOWinManager.hpp @@ -7,20 +7,24 @@ #include "rstl/rc_ptr.hpp" class CIOWin; +// TODO +class IOWinPQNode; class CIOWinManager { public: CIOWinManager(); + ~CIOWinManager(); void Draw() const; void AddIOWin(rstl::ncrc_ptr< CIOWin >, int, int); + void RemoveAllIOWins(); - inline bool IsEmpty() const { return x4_ == 0 && x0_ == 0; } + inline bool IsEmpty() const { return x4_pumpRoot == nullptr && x0_drawRoot == nullptr; } private: - uint x0_; - uint x4_; - rstl::list< unkptr > x8_; + IOWinPQNode* x0_drawRoot; + IOWinPQNode* x4_pumpRoot; + CArchitectureQueue x8_localGatherQueue; }; CHECK_SIZEOF(CIOWinManager, 0x20) diff --git a/include/MetroidPrime/CInGameTweakManager.hpp b/include/MetroidPrime/CInGameTweakManager.hpp index 40f9a92e..befa432d 100644 --- a/include/MetroidPrime/CInGameTweakManager.hpp +++ b/include/MetroidPrime/CInGameTweakManager.hpp @@ -4,6 +4,55 @@ #include "types.h" #include "rstl/string.hpp" +#include "rstl/vector.hpp" + +class CTweakValue { +public: + struct Audio { + public: + Audio(f32 fadeIn, f32 fadeOut, f32 vol, const rstl::string& fileName, u32 handle) + : x0_fadeIn(fadeIn) + , x4_fadeOut(fadeOut) + , x8_volume(vol) + , xc_fileName(fileName) + , x1c_res(handle) {} + + f32 GetFadeIn() const { return x0_fadeIn; } + f32 GetFadeOut() const { return x4_fadeOut; } + f32 GetVolume() const { return x8_volume; } + const rstl::string& GetFileName() const { return xc_fileName; } + CAssetId GetResId() const { return x1c_res; } + // static Audio None() { return Audio(0.f, 0.f, 0.f, "", 0); } + + private: + f32 x0_fadeIn; + f32 x4_fadeOut; + f32 x8_volume; + rstl::string xc_fileName; + CAssetId x1c_res; + }; + enum EType {}; + + CTweakValue(); + // CTweakValue(const rstl::string&, EType, const Audio&); + // CTweakValue(CTextInputStream&); + // void PutTo(CTextOutStream&); + const rstl::string& GetName() const { return x4_key; } + const rstl::string& GetValueAsString() const; + void SetValueFromString(const rstl::string&); + const Audio& GetAudio() const { return x24_audio; } + EType GetType() const { return x0_type; } + +private: + EType x0_type; + rstl::string x4_key; + rstl::string x14_str; + Audio x24_audio; + union { + u32 x44_int; + f32 x44_flt; + }; +}; class CInGameTweakManager { public: @@ -12,8 +61,9 @@ public: bool ReadFromMemoryCard(const rstl::string&); private: - u8 pad[0x10]; + rstl::vector< CTweakValue > x0_values; }; +CHECK_SIZEOF(CInGameTweakManager, 0x10) extern CInGameTweakManager* gpTweakManager; diff --git a/include/MetroidPrime/CInputGenerator.hpp b/include/MetroidPrime/CInputGenerator.hpp index b04e2aa0..372e8bd0 100644 --- a/include/MetroidPrime/CInputGenerator.hpp +++ b/include/MetroidPrime/CInputGenerator.hpp @@ -3,14 +3,26 @@ #include "types.h" +#include "rstl/single_ptr.hpp" + +#include "Kyoto/Input/IController.hpp" + class COsContext; +class IController; class CInputGenerator { public: CInputGenerator(COsContext*, f32, f32); + IController* GetController() const { return x4_controller.get(); } + private: - u8 pad[0x14]; + COsContext* x0_context; + rstl::single_ptr< IController > x4_controller; + bool x8_connectedControllers[4]; + f32 xc_leftDiv; + f32 x10_rightDiv; }; +CHECK_SIZEOF(CInputGenerator, 0x14) #endif diff --git a/include/MetroidPrime/CMain.hpp b/include/MetroidPrime/CMain.hpp index 1656088f..ec32f8bc 100644 --- a/include/MetroidPrime/CMain.hpp +++ b/include/MetroidPrime/CMain.hpp @@ -122,6 +122,7 @@ private: bool x161_24_gameFrameDrawn : 1; CGameArchitectureSupport* x164_; }; +CHECK_SIZEOF(CMain, 0x168) extern CMain* gpMain; diff --git a/include/MetroidPrime/CMainFlow.hpp b/include/MetroidPrime/CMainFlow.hpp new file mode 100644 index 00000000..80027545 --- /dev/null +++ b/include/MetroidPrime/CMainFlow.hpp @@ -0,0 +1,18 @@ +#ifndef _CMAINFLOW_HPP +#define _CMAINFLOW_HPP + +#include "types.h" + +#include "MetroidPrime/CIOWin.hpp" + +class CMainFlow : public CIOWin { +public: + CMainFlow(); + + ~CMainFlow() override; + EMessageReturn OnMessage(const CArchitectureMessage&, CArchitectureQueue&) override; + bool GetIsContinueDraw() const override; + void Draw() override; +}; + +#endif diff --git a/include/MetroidPrime/CMemoryCard.hpp b/include/MetroidPrime/CMemoryCard.hpp index 18a4f543..c6dd731d 100644 --- a/include/MetroidPrime/CMemoryCard.hpp +++ b/include/MetroidPrime/CMemoryCard.hpp @@ -4,6 +4,8 @@ #include "types.h" class CMemoryCard { +public: + ~CMemoryCard(); // TODO }; diff --git a/include/MetroidPrime/CSplashScreen.hpp b/include/MetroidPrime/CSplashScreen.hpp index 46a2c5d7..fdd061a8 100644 --- a/include/MetroidPrime/CSplashScreen.hpp +++ b/include/MetroidPrime/CSplashScreen.hpp @@ -14,10 +14,10 @@ public: }; CSplashScreen(ESplashScreen); - ~CSplashScreen() override; - virtual EMessageReturn OnMessage(const CArchitectureMessage&, CArchitectureQueue&); - virtual void Draw(); + ~CSplashScreen() override; + EMessageReturn OnMessage(const CArchitectureMessage&, CArchitectureQueue&) override; + void Draw() override; }; #endif diff --git a/include/MetroidPrime/Player/CSystemOptions.hpp b/include/MetroidPrime/Player/CSystemOptions.hpp index 01cc2fec..d13316d6 100644 --- a/include/MetroidPrime/Player/CSystemOptions.hpp +++ b/include/MetroidPrime/Player/CSystemOptions.hpp @@ -14,7 +14,7 @@ public: CSystemOptions(); void SetHasFusion(bool v); - bool GetHasFusion() const { return xd0_27_fusionBeat; } + bool GetHasFusion() const { return xd0_28_fusionSuitActive; } private: rstl::reserved_vector< u8, 98 > x0_nesState; diff --git a/include/dolphin/os/OSAlarm.h b/include/dolphin/os/OSAlarm.h index b2a4589d..3f709ff1 100644 --- a/include/dolphin/os/OSAlarm.h +++ b/include/dolphin/os/OSAlarm.h @@ -22,6 +22,9 @@ struct OSAlarm { }; void OSSetAlarm(OSAlarm* alarm, OSTime tick, OSAlarmHandler handler); +void OSSetPeriodicAlarm(OSAlarm* alarm, OSTime start, OSTime period, OSAlarmHandler handler); +void OSCancelAlarm(OSAlarm* alarm); + #ifdef __cplusplus } #endif diff --git a/include/dolphin/types.h b/include/dolphin/types.h index 526b4774..d5b40de7 100644 --- a/include/dolphin/types.h +++ b/include/dolphin/types.h @@ -64,7 +64,7 @@ typedef int BOOL; #define NULL 0 #endif #endif -#if !defined(__cplusplus) || defined(__MWERKS__) +#if !defined(__cplusplus) || __cplusplus < 201103L #ifndef nullptr #define nullptr NULL #endif diff --git a/include/rstl/list.hpp b/include/rstl/list.hpp index 5185dd05..f718955a 100644 --- a/include/rstl/list.hpp +++ b/include/rstl/list.hpp @@ -9,12 +9,13 @@ namespace rstl { template < typename T, typename Alloc = rmemory_allocator > class list { public: - list() : x4_start(&xc_empty), x8_end(&xc_empty), xc_empty(x8_end, nullptr) {} + list() : x4_start(&xc_empty), x8_end(&xc_empty), xc_empty(&xc_empty, &xc_empty) {} ~list() { node* cur = x4_start; - while (cur != nullptr) { - delete cur->x8_item; - cur = cur->x4_next; + while (cur != x8_end) { + cur->get_value()->~T(); + Alloc::deallocate(cur->get_value()); + cur = cur->get_next(); } } @@ -28,6 +29,12 @@ private: }; node(node* prev, node* next) : x0_prev(prev), x4_next(next), x8_count(0) {} + + node* get_prev() const { return x0_prev; } + node* get_next() const { return x4_next; } + T* get_value() { return x8_item; } + + // todo set_next / set_prev }; Alloc x0_allocator; diff --git a/include/rstl/rc_ptr.hpp b/include/rstl/rc_ptr.hpp index 66222e6d..87e91600 100644 --- a/include/rstl/rc_ptr.hpp +++ b/include/rstl/rc_ptr.hpp @@ -3,23 +3,36 @@ #include "types.h" +namespace rstl { class CRefData { public: - CRefData(void* ptr) : x0_ptr(ptr), x4_refCount(1) {} - CRefData(void* ptr, int refCount) : x0_ptr(ptr), x4_refCount(refCount) {} + CRefData(const void* ptr) : x0_ptr(ptr), x4_refCount(1) {} + CRefData(const void* ptr, int refCount) : x0_ptr(ptr), x4_refCount(refCount) {} - void* x0_ptr; - unsigned int x4_refCount; + void* GetPtr() const { return const_cast< void* >(x0_ptr); } + int GetRefCount() const { return x4_refCount; } + int AddRef() { return ++x4_refCount; } + int DelRef() { return --x4_refCount; } + + const void* x0_ptr; + int x4_refCount; + + static CRefData sNull; }; -namespace rstl { template < typename T > class rc_ptr { public: - rc_ptr(T* ptr) : x0_refData(new CRefData(ptr)) {} - ~rc_ptr(); - T* GetPtr() const { return reinterpret_cast< T* >(x0_refData->x0_ptr); } - // TODO ReleaseData__Q24rstl20rc_ptr + rc_ptr(const T* ptr) : x0_refData(new CRefData(ptr)) {} + rc_ptr(const rc_ptr& other) : x0_refData(other.x0_refData) { x0_refData->AddRef(); } + ~rc_ptr() { ReleaseData(); } + T* GetPtr() const { return static_cast< T* >(x0_refData->GetPtr()); } + void ReleaseData() { + if (x0_refData->DelRef() <= 0) { + delete GetPtr(); + delete x0_refData; + } + } T* operator->() const { return GetPtr(); } T& operator*() const { return *GetPtr(); } diff --git a/include/rstl/reserved_vector.hpp b/include/rstl/reserved_vector.hpp index 0bc03189..628f5110 100644 --- a/include/rstl/reserved_vector.hpp +++ b/include/rstl/reserved_vector.hpp @@ -38,7 +38,7 @@ public: } void clear() { for (int i = 0; i < x0_count; ++i) { - rstl::destroy(&reinterpret_cast< T* >(x4_data)[i]); + rstl::destroy(&data()[i]); } x0_count = 0; } diff --git a/include/rstl/rmemory_allocator.hpp b/include/rstl/rmemory_allocator.hpp index 63a9fbf4..a56c105b 100644 --- a/include/rstl/rmemory_allocator.hpp +++ b/include/rstl/rmemory_allocator.hpp @@ -13,8 +13,9 @@ struct rmemory_allocator { } template < typename T > static void deallocate(T* ptr) { - if (ptr != nullptr) - CMemory::Free(ptr); + if (ptr != nullptr) { + delete[] reinterpret_cast< u8* >(ptr); + } } }; } // namespace rstl diff --git a/src/Kyoto/Alloc/CGameAllocator.cpp b/src/Kyoto/Alloc/CGameAllocator.cpp index 87ff6a06..64b2d8a7 100644 --- a/src/Kyoto/Alloc/CGameAllocator.cpp +++ b/src/Kyoto/Alloc/CGameAllocator.cpp @@ -18,7 +18,7 @@ static inline U1 T_round_up(U2 val, int align) { } CGameAllocator::SGameMemInfo* CGameAllocator::GetMemInfoFromBlockPtr(const void* ptr) const { - return (SGameMemInfo*)(const_cast< u8* >(ptr) - sizeof(SGameMemInfo)); + return (SGameMemInfo*)((u8*)(ptr) - sizeof(SGameMemInfo)); } CGameAllocator::CGameAllocator() @@ -105,9 +105,7 @@ void* CGameAllocator::Alloc(size_t size, EHint hint, EScope scope, EType type, if (x74_mediumPool && size <= 0x400 && !(hint & kHI_TopOfHeap)) { void* buf = nullptr; if (!x74_mediumPool->HasPuddles()) { - void* ptr = x78_; - uint puddleSize = 0x1000; - x74_mediumPool->AddPuddle(puddleSize, ptr, 0); + x74_mediumPool->AddPuddle(0x1000, x78_, 0); x78_ = nullptr; } @@ -149,10 +147,9 @@ void* CGameAllocator::Alloc(size_t size, EHint hint, EScope scope, EType type, } static bool bTriedCallback = false; - if (!bTriedCallback) { bTriedCallback = true; - mediumBuf = (SGameMemInfo*)Alloc(size, hint, scope, type, callstack); + mediumBuf = Alloc(size, hint, scope, type, callstack); bTriedCallback = false; } else { return nullptr; @@ -162,7 +159,6 @@ void* CGameAllocator::Alloc(size_t size, EHint hint, EScope scope, EType type, callstack.GetFileAndLineText(); callstack.GetTypeText(); DumpAllocations(); - mediumBuf = nullptr; return nullptr; } return mediumBuf; @@ -175,8 +171,7 @@ void* CGameAllocator::Alloc(size_t size, EHint hint, EScope scope, EType type, UpdateAllocDebugStats(size, roundedSize, tmp); gAllocatorTime += OSGetTick() - startTick; - ((u8*)info) += sizeof(SGameMemInfo); - return info; + return ++info; } CGameAllocator::SGameMemInfo* CGameAllocator::FindFreeBlock(uint) {} diff --git a/src/MetroidPrime/main.cpp b/src/MetroidPrime/main.cpp index 62a0972a..d7865dd2 100644 --- a/src/MetroidPrime/main.cpp +++ b/src/MetroidPrime/main.cpp @@ -35,10 +35,14 @@ #include "Kyoto/Text/CStringTable.hpp" #include "MetaRender/CCubeRenderer.hpp" #include "MetroidPrime/CAnimData.hpp" +#include "MetroidPrime/CAudioStateWin.hpp" +#include "MetroidPrime/CConsoleOutputWindow.hpp" #include "MetroidPrime/CDecalManager.hpp" #include "MetroidPrime/CEnvFxManager.hpp" +#include "MetroidPrime/CErrorOutputWindow.hpp" #include "MetroidPrime/CGameGlobalObjects.hpp" #include "MetroidPrime/CInGameTweakManager.hpp" +#include "MetroidPrime/CMainFlow.hpp" #include "MetroidPrime/CMemoryCard.hpp" #include "MetroidPrime/CSplashScreen.hpp" #include "MetroidPrime/Factories/CCharacterFactoryBuilder.hpp" @@ -60,7 +64,7 @@ CResFactory* gpResourceFactory; CSimplePool* gpSimplePool; CCubeRenderer* gpRender; CCharacterFactoryBuilder* gpCharacterFactoryBuilder; -unkptr gGuiSystem; +CGuiSys* gGuiSystem; CStringTable* gpStringTable; CMain* gpMain; unkptr gpController; @@ -72,6 +76,7 @@ unkptr lbl_805A8C50; unkptr lbl_805A8C54; bool lbl_805A8C58; u32 sARAMMemArray[2]; +f32 sInfiniteLoopTime; #define GRAPHICS_FIFO_SIZE 0x60000 static u8 sGraphicsFifo[GRAPHICS_FIFO_SIZE]; @@ -113,8 +118,7 @@ bool lbl_805A6BC0; int main(int argc, char** argv) { DVDSetAutoFatalMessaging(TRUE); SetErrorHandlers(); - CMain* main = reinterpret_cast< CMain* >(&sMainSpace); - new (&sMainSpace) CMain(); + CMain* main = new (&sMainSpace) CMain(); gpMain->RsMain(argc, argv); main->~CMain(); return 0; @@ -123,7 +127,7 @@ int main(int argc, char** argv) { CMain::CMain() : x0_osContext(true, true) , x6c_unk(this) -, x6d_memorySys(InitOsContext(), CMemorySys::GetGameAllocator()) +, x6d_memorySys(x0_osContext, CMemorySys::GetGameAllocator()) , xe8_(0.0) , x118_(0.f) , x11c_(0.f) @@ -203,8 +207,6 @@ CGameGlobalObjects::CGameGlobalObjects(COsContext& osContext, CMemorySys& memory : xcc_simplePool(x4_resFactory) , x130_graphicsSys(osContext, memorySys, GRAPHICS_FIFO_SIZE, sGraphicsFifo) , x134_gameState(new CGameState()) -, x138_(0) -, x14c_renderer(0) , x150_inGameTweakManager(new CInGameTweakManager()) , x154_defaultFont(LoadDefaultFont()) { gpResourceFactory = &x4_resFactory; @@ -415,8 +417,18 @@ void CGameGlobalObjects::LoadStringTable() { gpStringTable = **x13c_stringTable; } +// TODO CAuiMain +void InitializeApplicationUI(CGuiSys&); + +void InfiniteLoopAlarm(OSAlarm* alarm, OSContext* context) { + if (sInfiniteLoopTime >= 10.f) { + rs_debugger_printf("INFINITE LOOP"); + } + sInfiniteLoopTime += alarm->period / OS_TIMER_CLOCK; +} + CGameArchitectureSupport::CGameArchitectureSupport(COsContext& osContext) -: x0_audioSys(0, 0, 0, 0, 0x5fc000) +: x0_audioSys(0x30, 0x30, 0x30, 0x30, 0x5fc000) , x30_inputGenerator(&osContext, gpTweakPlayer->GetLeftAnalogMax(), gpTweakPlayer->GetRightAnalogMax()) , x44_guiSys(gpResourceFactory, gpSimplePool, CGuiSys::kUM_Zero) @@ -425,9 +437,7 @@ CGameArchitectureSupport::CGameArchitectureSupport(COsContext& osContext) , x80_(0.f) , x84_(0.f) , x88_(2) -, x90_(0) -, x94_(0) -, x98_(0) { +, xc8_infiniteLoopAlarmSet(false) { CAudioSys::SysSetVolume(0x7F, 0, 0xFF); CAudioSys::SetDefaultVolumeScale(0x75); CAudioSys::SetVolumeScale(CAudioSys::GetDefaultVolumeScale()); @@ -439,7 +449,28 @@ CGameArchitectureSupport::CGameArchitectureSupport(COsContext& osContext) if (!gpTweakGame->GetSplashScreensDisabled()) { x58_ioWinMgr.AddIOWin(new CSplashScreen(CSplashScreen::Nintendo), 1000, 10000); } - // TODO + x58_ioWinMgr.AddIOWin(new CMainFlow(), 0, 0); + x58_ioWinMgr.AddIOWin(new CConsoleOutputWindow(8, 5.f, 0.75f), 100, 0); + x58_ioWinMgr.AddIOWin(new CAudioStateWin(), 100, -1); + x58_ioWinMgr.AddIOWin(new CErrorOutputWindow(false), 10000, 100000); + InitializeApplicationUI(x44_guiSys); + CGuiSys::SetGlobalGuiSys(&x44_guiSys); + gpController = x30_inputGenerator.GetController(); + gpGameState->GameOptions().EnsureOptions(); + sInfiniteLoopTime = 0.f; + OSSetPeriodicAlarm(&xa0_infiniteLoopAlarm, OSGetTime(), (f32)OS_TIMER_CLOCK, InfiniteLoopAlarm); + xc8_infiniteLoopAlarmSet = true; +} + +CGameArchitectureSupport::~CGameArchitectureSupport() { + if (xc8_infiniteLoopAlarmSet) { + OSCancelAlarm(&xa0_infiniteLoopAlarm); + xc8_infiniteLoopAlarmSet = false; + } + x58_ioWinMgr.RemoveAllIOWins(); + UnloadAudio(); + CSfxManager::Shutdown(); + CDSPStreamManager::Shutdown(); } // 80003658