From 9d4efb09ae9a6d7c95d702267625742cdc92c7a8 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Fri, 14 Oct 2022 00:45:18 -0700 Subject: [PATCH] Nearly match Decode.cpp --- asm/MetroidPrime/CCredits.s | 2 +- asm/MetroidPrime/CFrontEndUI.s | 2 +- asm/MetroidPrime/CIOWinManager.s | 25 ++++++-- asm/MetroidPrime/CInputGenerator.s | 16 ++--- asm/MetroidPrime/CMFGame.s | 6 +- asm/MetroidPrime/CMainFlow.s | 10 +-- asm/MetroidPrime/CPauseScreenFrame.s | 2 +- asm/MetroidPrime/CSplashScreen.s | 2 +- asm/MetroidPrime/Decode.s | 25 +++----- asm/MetroidPrime/main.s | 12 ++-- configure.py | 2 +- include/MetroidPrime/CArchitectureMessage.hpp | 9 ++- include/MetroidPrime/Decode.hpp | 31 +++++++--- src/MetroidPrime/Decode.cpp | 61 +++++++++++++++++++ 14 files changed, 145 insertions(+), 60 deletions(-) create mode 100644 src/MetroidPrime/Decode.cpp diff --git a/asm/MetroidPrime/CCredits.s b/asm/MetroidPrime/CCredits.s index 2a70ec02..35823b44 100644 --- a/asm/MetroidPrime/CCredits.s +++ b/asm/MetroidPrime/CCredits.s @@ -3382,7 +3382,7 @@ sub_80027db4: /* 80027DEC 00024D4C 4B FD EF 15 */ bl InsertMsg__18CArchitectureQueueFRC20CArchitectureMessage /* 80027DF0 00024D50 34 61 00 14 */ addic. r3, r1, 0x14 /* 80027DF4 00024D54 41 82 00 08 */ beq lbl_80027DFC -/* 80027DF8 00024D58 4B FE 09 15 */ bl sub_8000870c +/* 80027DF8 00024D58 4B FE 09 15 */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" lbl_80027DFC: /* 80027DFC 00024D5C 80 01 00 24 */ lwz r0, 0x24(r1) /* 80027E00 00024D60 83 E1 00 1C */ lwz r31, 0x1c(r1) diff --git a/asm/MetroidPrime/CFrontEndUI.s b/asm/MetroidPrime/CFrontEndUI.s index 13214b6b..e21d88d6 100644 --- a/asm/MetroidPrime/CFrontEndUI.s +++ b/asm/MetroidPrime/CFrontEndUI.s @@ -602,7 +602,7 @@ lbl_8001BB30: /* 8001BB54 00018AB4 4B FE B1 AD */ bl InsertMsg__18CArchitectureQueueFRC20CArchitectureMessage /* 8001BB58 00018AB8 34 61 00 14 */ addic. r3, r1, 0x14 /* 8001BB5C 00018ABC 41 82 00 08 */ beq lbl_8001BB64 -/* 8001BB60 00018AC0 4B FE CB AD */ bl sub_8000870c +/* 8001BB60 00018AC0 4B FE CB AD */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" lbl_8001BB64: /* 8001BB64 00018AC4 80 01 00 24 */ lwz r0, 0x24(r1) /* 8001BB68 00018AC8 83 E1 00 1C */ lwz r31, 0x1c(r1) diff --git a/asm/MetroidPrime/CIOWinManager.s b/asm/MetroidPrime/CIOWinManager.s index 2f647ea8..1cd16fe9 100644 --- a/asm/MetroidPrime/CIOWinManager.s +++ b/asm/MetroidPrime/CIOWinManager.s @@ -1,5 +1,18 @@ .include "macros.inc" +.section .rodata +.balign 8 + +.global lbl_803CCF28 +lbl_803CCF28: + # ROM: 0x3C9F28 + .asciz "Msg[%3d] %s" + .asciz "-------------------------" + .asciz "Draw[%3d] %s" + .asciz "??(??)" + .balign 4 + .4byte 0 + .section .text, "ax" .global sub_80051d7c @@ -349,7 +362,7 @@ lbl_8005221C: /* 8005224C 0004F1AC 90 04 00 04 */ stw r0, 4(r4) /* 80052250 0004F1B0 41 82 00 0C */ beq lbl_8005225C /* 80052254 0004F1B4 7F C3 F3 78 */ mr r3, r30 -/* 80052258 0004F1B8 4B FB 64 B5 */ bl sub_8000870c +/* 80052258 0004F1B8 4B FB 64 B5 */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" lbl_8005225C: /* 8005225C 0004F1BC 80 01 00 20 */ lwz r0, 0x20(r1) /* 80052260 0004F1C0 2C 00 00 00 */ cmpwi r0, 0 @@ -382,7 +395,7 @@ lbl_800522B4: /* 800522BC 0004F21C 28 1D 00 00 */ cmplwi r29, 0 /* 800522C0 0004F220 41 82 00 0C */ beq lbl_800522CC /* 800522C4 0004F224 7F A3 EB 78 */ mr r3, r29 -/* 800522C8 0004F228 4B FB 64 45 */ bl sub_8000870c +/* 800522C8 0004F228 4B FB 64 45 */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" lbl_800522CC: /* 800522CC 0004F22C 38 61 00 10 */ addi r3, r1, 0x10 /* 800522D0 0004F230 4B FB 63 CD */ bl "__dt__Q24rstl15rc_ptr<6CIOWin>Fv" @@ -396,7 +409,7 @@ lbl_800522E8: /* 800522E8 0004F248 28 1D 00 00 */ cmplwi r29, 0 /* 800522EC 0004F24C 41 82 00 0C */ beq lbl_800522F8 /* 800522F0 0004F250 7F A3 EB 78 */ mr r3, r29 -/* 800522F4 0004F254 4B FB 64 19 */ bl sub_8000870c +/* 800522F4 0004F254 4B FB 64 19 */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" lbl_800522F8: /* 800522F8 0004F258 80 19 00 1C */ lwz r0, 0x1c(r25) /* 800522FC 0004F25C 2C 00 00 00 */ cmpwi r0, 0 @@ -479,7 +492,7 @@ sub_8005238c: /* 80052404 0004F364 90 04 00 04 */ stw r0, 4(r4) /* 80052408 0004F368 41 82 00 0C */ beq lbl_80052414 /* 8005240C 0004F36C 7F E3 FB 78 */ mr r3, r31 -/* 80052410 0004F370 4B FB 62 FD */ bl sub_8000870c +/* 80052410 0004F370 4B FB 62 FD */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" lbl_80052414: /* 80052414 0004F374 80 01 00 24 */ lwz r0, 0x24(r1) /* 80052418 0004F378 83 E1 00 1C */ lwz r31, 0x1c(r1) @@ -518,7 +531,7 @@ lbl_8005245C: /* 8005248C 0004F3EC 90 04 00 04 */ stw r0, 4(r4) /* 80052490 0004F3F0 41 82 00 0C */ beq lbl_8005249C /* 80052494 0004F3F4 7F E3 FB 78 */ mr r3, r31 -/* 80052498 0004F3F8 4B FB 62 75 */ bl sub_8000870c +/* 80052498 0004F3F8 4B FB 62 75 */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" lbl_8005249C: /* 8005249C 0004F3FC 7F 83 E3 78 */ mr r3, r28 /* 800524A0 0004F400 7F A5 EB 78 */ mr r5, r29 @@ -527,7 +540,7 @@ lbl_8005249C: /* 800524AC 0004F40C 28 1E 00 00 */ cmplwi r30, 0 /* 800524B0 0004F410 41 82 00 0C */ beq lbl_800524BC /* 800524B4 0004F414 7F C3 F3 78 */ mr r3, r30 -/* 800524B8 0004F418 4B FB 62 55 */ bl sub_8000870c +/* 800524B8 0004F418 4B FB 62 55 */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" lbl_800524BC: /* 800524BC 0004F41C 80 1D 00 14 */ lwz r0, 0x14(r29) /* 800524C0 0004F420 2C 00 00 00 */ cmpwi r0, 0 diff --git a/asm/MetroidPrime/CInputGenerator.s b/asm/MetroidPrime/CInputGenerator.s index e0536bdf..d9e7ae8e 100644 --- a/asm/MetroidPrime/CInputGenerator.s +++ b/asm/MetroidPrime/CInputGenerator.s @@ -88,7 +88,7 @@ lbl_8002309C: /* 800230EC 0002004C 90 04 00 04 */ stw r0, 4(r4) /* 800230F0 00020050 41 82 00 0C */ beq lbl_800230FC /* 800230F4 00020054 7F 63 DB 78 */ mr r3, r27 -/* 800230F8 00020058 4B FE 56 15 */ bl sub_8000870c +/* 800230F8 00020058 4B FE 56 15 */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" lbl_800230FC: /* 800230FC 0002005C 83 9F 00 08 */ lwz r28, 8(r31) /* 80023100 00020060 3C 60 80 3D */ lis r3, lbl_803CCAA0@ha @@ -130,7 +130,7 @@ lbl_80023168: /* 80023184 000200E4 90 1F 00 14 */ stw r0, 0x14(r31) /* 80023188 000200E8 41 82 00 0C */ beq lbl_80023194 /* 8002318C 000200EC 7F 43 D3 78 */ mr r3, r26 -/* 80023190 000200F0 4B FE 55 7D */ bl sub_8000870c +/* 80023190 000200F0 4B FE 55 7D */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" lbl_80023194: /* 80023194 000200F4 3A D6 00 01 */ addi r22, r22, 1 lbl_80023198: @@ -158,7 +158,7 @@ lbl_80023198: /* 800231EC 0002014C 90 04 00 04 */ stw r0, 4(r4) /* 800231F0 00020150 41 82 00 0C */ beq lbl_800231FC /* 800231F4 00020154 7F 23 CB 78 */ mr r3, r25 -/* 800231F8 00020158 4B FE 55 15 */ bl sub_8000870c +/* 800231F8 00020158 4B FE 55 15 */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" lbl_800231FC: /* 800231FC 0002015C 83 9F 00 08 */ lwz r28, 8(r31) /* 80023200 00020160 3C 60 80 3D */ lis r3, lbl_803CCAA0@ha @@ -202,7 +202,7 @@ lbl_80023268: /* 8002328C 000201EC 7C 1E B9 AE */ stbx r0, r30, r23 /* 80023290 000201F0 41 82 00 0C */ beq lbl_8002329C /* 80023294 000201F4 7F 03 C3 78 */ mr r3, r24 -/* 80023298 000201F8 4B FE 54 75 */ bl sub_8000870c +/* 80023298 000201F8 4B FE 54 75 */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" lbl_8002329C: /* 8002329C 000201FC 3A 94 00 01 */ addi r20, r20, 1 lbl_800232A0: @@ -232,7 +232,7 @@ lbl_800232A8: /* 800232F8 00020258 38 04 00 01 */ addi r0, r4, 1 /* 800232FC 0002025C 90 05 00 04 */ stw r0, 4(r5) /* 80023300 00020260 41 82 00 08 */ beq lbl_80023308 -/* 80023304 00020264 4B FE 54 09 */ bl sub_8000870c +/* 80023304 00020264 4B FE 54 09 */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" lbl_80023308: /* 80023308 00020268 82 7F 00 08 */ lwz r19, 8(r31) /* 8002330C 0002026C 3C 60 80 3D */ lis r3, lbl_803CCAA0@ha @@ -274,7 +274,7 @@ lbl_80023374: /* 80023390 000202F0 90 1F 00 14 */ stw r0, 0x14(r31) /* 80023394 000202F4 41 82 01 00 */ beq lbl_80023494 /* 80023398 000202F8 7E E3 BB 78 */ mr r3, r23 -/* 8002339C 000202FC 4B FE 53 71 */ bl sub_8000870c +/* 8002339C 000202FC 4B FE 53 71 */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" /* 800233A0 00020300 48 00 00 F4 */ b lbl_80023494 lbl_800233A4: /* 800233A4 00020304 FC 20 F8 90 */ fmr f1, f31 @@ -298,7 +298,7 @@ lbl_800233A4: /* 800233EC 0002034C 38 04 00 01 */ addi r0, r4, 1 /* 800233F0 00020350 90 05 00 04 */ stw r0, 4(r5) /* 800233F4 00020354 41 82 00 08 */ beq lbl_800233FC -/* 800233F8 00020358 4B FE 53 15 */ bl sub_8000870c +/* 800233F8 00020358 4B FE 53 15 */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" lbl_800233FC: /* 800233FC 0002035C 82 7F 00 08 */ lwz r19, 8(r31) /* 80023400 00020360 3C 60 80 3D */ lis r3, lbl_803CCAA0@ha @@ -340,7 +340,7 @@ lbl_80023468: /* 80023484 000203E4 90 1F 00 14 */ stw r0, 0x14(r31) /* 80023488 000203E8 41 82 00 0C */ beq lbl_80023494 /* 8002348C 000203EC 7E E3 BB 78 */ mr r3, r23 -/* 80023490 000203F0 4B FE 52 7D */ bl sub_8000870c +/* 80023490 000203F0 4B FE 52 7D */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" lbl_80023494: /* 80023494 000203F4 38 60 00 01 */ li r3, 1 lbl_80023498: diff --git a/asm/MetroidPrime/CMFGame.s b/asm/MetroidPrime/CMFGame.s index cd156012..6d9616d8 100644 --- a/asm/MetroidPrime/CMFGame.s +++ b/asm/MetroidPrime/CMFGame.s @@ -448,7 +448,7 @@ lbl_80023E88: /* 80023EA8 00020E08 4B FE 2E 59 */ bl InsertMsg__18CArchitectureQueueFRC20CArchitectureMessage /* 80023EAC 00020E0C 34 61 00 38 */ addic. r3, r1, 0x38 /* 80023EB0 00020E10 41 82 00 08 */ beq lbl_80023EB8 -/* 80023EB4 00020E14 4B FE 48 59 */ bl sub_8000870c +/* 80023EB4 00020E14 4B FE 48 59 */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" lbl_80023EB8: /* 80023EB8 00020E18 48 33 14 BD */ bl EnableTextureTimeout__6CModelFv /* 80023EBC 00020E1C 38 60 00 02 */ li r3, 2 @@ -1256,7 +1256,7 @@ lbl_800249A4: /* 800249DC 0002193C 4B FE 23 25 */ bl InsertMsg__18CArchitectureQueueFRC20CArchitectureMessage /* 800249E0 00021940 34 61 00 2C */ addic. r3, r1, 0x2c /* 800249E4 00021944 41 82 00 3C */ beq lbl_80024A20 -/* 800249E8 00021948 4B FE 3D 25 */ bl sub_8000870c +/* 800249E8 00021948 4B FE 3D 25 */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" /* 800249EC 0002194C 48 00 00 34 */ b lbl_80024A20 lbl_800249F0: /* 800249F0 00021950 80 7D 00 14 */ lwz r3, 0x14(r29) @@ -1478,7 +1478,7 @@ lbl_80024CF4: /* 80024D28 00021C88 4B FE 1F D9 */ bl InsertMsg__18CArchitectureQueueFRC20CArchitectureMessage /* 80024D2C 00021C8C 34 61 00 20 */ addic. r3, r1, 0x20 /* 80024D30 00021C90 41 82 00 18 */ beq lbl_80024D48 -/* 80024D34 00021C94 4B FE 39 D9 */ bl sub_8000870c +/* 80024D34 00021C94 4B FE 39 D9 */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" /* 80024D38 00021C98 48 00 00 10 */ b lbl_80024D48 .global lbl_80024D3C lbl_80024D3C: diff --git a/asm/MetroidPrime/CMainFlow.s b/asm/MetroidPrime/CMainFlow.s index 9b0c6aad..f16a56de 100644 --- a/asm/MetroidPrime/CMainFlow.s +++ b/asm/MetroidPrime/CMainFlow.s @@ -186,7 +186,7 @@ lbl_8002362C: /* 80023650 000205B0 4B FE 36 B1 */ bl InsertMsg__18CArchitectureQueueFRC20CArchitectureMessage /* 80023654 000205B4 34 61 00 54 */ addic. r3, r1, 0x54 /* 80023658 000205B8 41 82 01 E8 */ beq lbl_80023840 -/* 8002365C 000205BC 4B FE 50 B1 */ bl sub_8000870c +/* 8002365C 000205BC 4B FE 50 B1 */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" /* 80023660 000205C0 48 00 01 E0 */ b lbl_80023840 lbl_80023664: /* 80023664 000205C4 3C 80 80 3D */ lis r4, lbl_803CCAA8@ha @@ -212,7 +212,7 @@ lbl_8002368C: /* 800236B0 00020610 4B FE 36 51 */ bl InsertMsg__18CArchitectureQueueFRC20CArchitectureMessage /* 800236B4 00020614 34 61 00 48 */ addic. r3, r1, 0x48 /* 800236B8 00020618 41 82 01 88 */ beq lbl_80023840 -/* 800236BC 0002061C 4B FE 50 51 */ bl sub_8000870c +/* 800236BC 0002061C 4B FE 50 51 */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" /* 800236C0 00020620 48 00 01 80 */ b lbl_80023840 lbl_800236C4: /* 800236C4 00020624 80 6D A0 78 */ lwz r3, gpMain@sda21(r13) @@ -241,7 +241,7 @@ lbl_800236F8: /* 8002371C 0002067C 4B FE 35 E5 */ bl InsertMsg__18CArchitectureQueueFRC20CArchitectureMessage /* 80023720 00020680 34 61 00 3C */ addic. r3, r1, 0x3c /* 80023724 00020684 41 82 01 1C */ beq lbl_80023840 -/* 80023728 00020688 4B FE 4F E5 */ bl sub_8000870c +/* 80023728 00020688 4B FE 4F E5 */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" /* 8002372C 0002068C 48 00 01 14 */ b lbl_80023840 lbl_80023730: /* 80023730 00020690 80 6D A0 78 */ lwz r3, gpMain@sda21(r13) @@ -286,7 +286,7 @@ lbl_8002379C: /* 800237BC 0002071C 4B FE 35 45 */ bl InsertMsg__18CArchitectureQueueFRC20CArchitectureMessage /* 800237C0 00020720 34 61 00 30 */ addic. r3, r1, 0x30 /* 800237C4 00020724 41 82 00 7C */ beq lbl_80023840 -/* 800237C8 00020728 4B FE 4F 45 */ bl sub_8000870c +/* 800237C8 00020728 4B FE 4F 45 */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" /* 800237CC 0002072C 48 00 00 74 */ b lbl_80023840 lbl_800237D0: /* 800237D0 00020730 80 6D A0 80 */ lwz r3, gpGameState@sda21(r13) @@ -317,7 +317,7 @@ lbl_80023800: /* 80023830 00020790 4B FE 34 D1 */ bl InsertMsg__18CArchitectureQueueFRC20CArchitectureMessage /* 80023834 00020794 34 61 00 24 */ addic. r3, r1, 0x24 /* 80023838 00020798 41 82 00 08 */ beq lbl_80023840 -/* 8002383C 0002079C 4B FE 4E D1 */ bl sub_8000870c +/* 8002383C 0002079C 4B FE 4E D1 */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" lbl_80023840: /* 80023840 000207A0 80 01 00 64 */ lwz r0, 0x64(r1) /* 80023844 000207A4 83 E1 00 5C */ lwz r31, 0x5c(r1) diff --git a/asm/MetroidPrime/CPauseScreenFrame.s b/asm/MetroidPrime/CPauseScreenFrame.s index e5a47d80..549a8d8f 100644 --- a/asm/MetroidPrime/CPauseScreenFrame.s +++ b/asm/MetroidPrime/CPauseScreenFrame.s @@ -2536,7 +2536,7 @@ lbl_80243CD4: /* 80243D64 00240CC4 4B DC 2F 9D */ bl InsertMsg__18CArchitectureQueueFRC20CArchitectureMessage /* 80243D68 00240CC8 34 61 00 30 */ addic. r3, r1, 0x30 /* 80243D6C 00240CCC 41 82 00 08 */ beq lbl_80243D74 -/* 80243D70 00240CD0 4B DC 49 9D */ bl sub_8000870c +/* 80243D70 00240CD0 4B DC 49 9D */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" lbl_80243D74: /* 80243D74 00240CD4 38 60 00 00 */ li r3, 0 /* 80243D78 00240CD8 48 0A 5B 3D */ bl SetChannel__11CSfxManagerFQ211CSfxManager12ESfxChannels diff --git a/asm/MetroidPrime/CSplashScreen.s b/asm/MetroidPrime/CSplashScreen.s index 99f289a8..9bd6b350 100644 --- a/asm/MetroidPrime/CSplashScreen.s +++ b/asm/MetroidPrime/CSplashScreen.s @@ -1190,7 +1190,7 @@ lbl_800290C0: /* 800290E4 00026044 4B FD DC 1D */ bl InsertMsg__18CArchitectureQueueFRC20CArchitectureMessage /* 800290E8 00026048 34 61 00 14 */ addic. r3, r1, 0x14 /* 800290EC 0002604C 41 82 00 08 */ beq lbl_800290F4 -/* 800290F0 00026050 4B FD F6 1D */ bl sub_8000870c +/* 800290F0 00026050 4B FD F6 1D */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" lbl_800290F4: /* 800290F4 00026054 38 60 00 02 */ li r3, 2 /* 800290F8 00026058 48 00 00 F0 */ b lbl_800291E8 diff --git a/asm/MetroidPrime/Decode.s b/asm/MetroidPrime/Decode.s index e68c7467..7d17064b 100644 --- a/asm/MetroidPrime/Decode.s +++ b/asm/MetroidPrime/Decode.s @@ -48,7 +48,7 @@ lbl_80051838: /* 80051858 0004E7B8 80 85 00 04 */ lwz r4, 4(r5) /* 8005185C 0004E7BC 38 04 00 01 */ addi r0, r4, 1 /* 80051860 0004E7C0 90 05 00 04 */ stw r0, 4(r5) -/* 80051864 0004E7C4 4B FB 6E A9 */ bl sub_8000870c +/* 80051864 0004E7C4 4B FB 6E A9 */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" /* 80051868 0004E7C8 80 01 00 24 */ lwz r0, 0x24(r1) /* 8005186C 0004E7CC 83 E1 00 1C */ lwz r31, 0x1c(r1) /* 80051870 0004E7D0 83 C1 00 18 */ lwz r30, 0x18(r1) @@ -110,7 +110,7 @@ lbl_80051910: /* 80051930 0004E890 80 85 00 04 */ lwz r4, 4(r5) /* 80051934 0004E894 38 04 00 01 */ addi r0, r4, 1 /* 80051938 0004E898 90 05 00 04 */ stw r0, 4(r5) -/* 8005193C 0004E89C 4B FB 6D D1 */ bl sub_8000870c +/* 8005193C 0004E89C 4B FB 6D D1 */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" /* 80051940 0004E8A0 80 01 00 24 */ lwz r0, 0x24(r1) /* 80051944 0004E8A4 83 E1 00 1C */ lwz r31, 0x1c(r1) /* 80051948 0004E8A8 83 C1 00 18 */ lwz r30, 0x18(r1) @@ -163,7 +163,7 @@ lbl_800519D0: /* 800519F0 0004E950 80 85 00 04 */ lwz r4, 4(r5) /* 800519F4 0004E954 38 04 00 01 */ addi r0, r4, 1 /* 800519F8 0004E958 90 05 00 04 */ stw r0, 4(r5) -/* 800519FC 0004E95C 4B FB 6D 11 */ bl sub_8000870c +/* 800519FC 0004E95C 4B FB 6D 11 */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" /* 80051A00 0004E960 80 01 00 24 */ lwz r0, 0x24(r1) /* 80051A04 0004E964 83 E1 00 1C */ lwz r31, 0x1c(r1) /* 80051A08 0004E968 83 C1 00 18 */ lwz r30, 0x18(r1) @@ -217,7 +217,7 @@ lbl_80051A94: /* 80051AB4 0004EA14 80 85 00 04 */ lwz r4, 4(r5) /* 80051AB8 0004EA18 38 04 00 01 */ addi r0, r4, 1 /* 80051ABC 0004EA1C 90 05 00 04 */ stw r0, 4(r5) -/* 80051AC0 0004EA20 4B FB 6C 4D */ bl sub_8000870c +/* 80051AC0 0004EA20 4B FB 6C 4D */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" /* 80051AC4 0004EA24 BB 61 00 1C */ lmw r27, 0x1c(r1) /* 80051AC8 0004EA28 80 01 00 34 */ lwz r0, 0x34(r1) /* 80051ACC 0004EA2C 7C 08 03 A6 */ mtlr r0 @@ -282,7 +282,7 @@ lbl_80051B6C: /* 80051B8C 0004EAEC 80 85 00 04 */ lwz r4, 4(r5) /* 80051B90 0004EAF0 38 04 00 01 */ addi r0, r4, 1 /* 80051B94 0004EAF4 90 05 00 04 */ stw r0, 4(r5) -/* 80051B98 0004EAF8 4B FB 6B 75 */ bl sub_8000870c +/* 80051B98 0004EAF8 4B FB 6B 75 */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" /* 80051B9C 0004EAFC 80 01 00 24 */ lwz r0, 0x24(r1) /* 80051BA0 0004EB00 83 E1 00 1C */ lwz r31, 0x1c(r1) /* 80051BA4 0004EB04 83 C1 00 18 */ lwz r30, 0x18(r1) @@ -344,7 +344,7 @@ lbl_80051C44: /* 80051C64 0004EBC4 80 85 00 04 */ lwz r4, 4(r5) /* 80051C68 0004EBC8 38 04 00 01 */ addi r0, r4, 1 /* 80051C6C 0004EBCC 90 05 00 04 */ stw r0, 4(r5) -/* 80051C70 0004EBD0 4B FB 6A 9D */ bl sub_8000870c +/* 80051C70 0004EBD0 4B FB 6A 9D */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" /* 80051C74 0004EBD4 80 01 00 24 */ lwz r0, 0x24(r1) /* 80051C78 0004EBD8 83 E1 00 1C */ lwz r31, 0x1c(r1) /* 80051C7C 0004EBDC 83 C1 00 18 */ lwz r30, 0x18(r1) @@ -413,7 +413,7 @@ lbl_80051D2C: /* 80051D4C 0004ECAC 80 85 00 04 */ lwz r4, 4(r5) /* 80051D50 0004ECB0 38 04 00 01 */ addi r0, r4, 1 /* 80051D54 0004ECB4 90 05 00 04 */ stw r0, 4(r5) -/* 80051D58 0004ECB8 4B FB 69 B5 */ bl sub_8000870c +/* 80051D58 0004ECB8 4B FB 69 B5 */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" /* 80051D5C 0004ECBC BB 41 00 18 */ lmw r26, 0x18(r1) /* 80051D60 0004ECC0 80 01 00 34 */ lwz r0, 0x34(r1) /* 80051D64 0004ECC4 7C 08 03 A6 */ mtlr r0 @@ -433,14 +433,3 @@ lbl_803CCF20: # ROM: 0x3C9F20 .asciz "??(??)" .balign 4 - -.global lbl_803CCF28 -lbl_803CCF28: - # ROM: 0x3C9F28 - .asciz "Msg[%3d] %s" - .asciz "-------------------------" - .asciz "Draw[%3d] %s" - .asciz "??(??)" - .balign 4 - .4byte 0 - diff --git a/asm/MetroidPrime/main.s b/asm/MetroidPrime/main.s index 7f26fb28..79300908 100644 --- a/asm/MetroidPrime/main.s +++ b/asm/MetroidPrime/main.s @@ -5524,7 +5524,7 @@ Update__24CGameArchitectureSupportFv: /* 80006CD0 00003C30 48 00 00 31 */ bl InsertMsg__18CArchitectureQueueFRC20CArchitectureMessage /* 80006CD4 00003C34 34 61 00 10 */ addic. r3, r1, 0x10 /* 80006CD8 00003C38 41 82 00 08 */ beq lbl_80006CE0 -/* 80006CDC 00003C3C 48 00 1A 31 */ bl sub_8000870c +/* 80006CDC 00003C3C 48 00 1A 31 */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" lbl_80006CE0: /* 80006CE0 00003C40 38 7F 00 58 */ addi r3, r31, 0x58 /* 80006CE4 00003C44 38 9F 00 04 */ addi r4, r31, 4 @@ -5668,7 +5668,7 @@ lbl_80006EB4: /* 80006ED0 00003E30 4B FF FE 31 */ bl InsertMsg__18CArchitectureQueueFRC20CArchitectureMessage /* 80006ED4 00003E34 34 61 00 1C */ addic. r3, r1, 0x1c /* 80006ED8 00003E38 41 82 00 08 */ beq lbl_80006EE0 -/* 80006EDC 00003E3C 48 00 18 31 */ bl sub_8000870c +/* 80006EDC 00003E3C 48 00 18 31 */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" lbl_80006EE0: /* 80006EE0 00003E40 C3 E2 80 00 */ lfs f31, lbl_805A9D20@sda21(r2) /* 80006EE4 00003E44 3B A1 00 10 */ addi r29, r1, 0x10 @@ -5693,7 +5693,7 @@ lbl_80006F0C: /* 80006F28 00003E88 28 1D 00 00 */ cmplwi r29, 0 /* 80006F2C 00003E8C 41 82 00 0C */ beq lbl_80006F38 /* 80006F30 00003E90 7F A3 EB 78 */ mr r3, r29 -/* 80006F34 00003E94 48 00 17 D9 */ bl sub_8000870c +/* 80006F34 00003E94 48 00 17 D9 */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" lbl_80006F38: /* 80006F38 00003E98 C0 1E 00 7C */ lfs f0, 0x7c(r30) /* 80006F3C 00003E9C 38 7E 00 58 */ addi r3, r30, 0x58 @@ -7389,8 +7389,8 @@ lbl_800086F8: /* 80008704 00005664 38 21 00 10 */ addi r1, r1, 0x10 /* 80008708 00005668 4E 80 00 20 */ blr -.global sub_8000870c -sub_8000870c: +.global "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" +"__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv": /* 8000870C 0000566C 94 21 FF F0 */ stwu r1, -0x10(r1) /* 80008710 00005670 7C 08 02 A6 */ mflr r0 /* 80008714 00005674 90 01 00 14 */ stw r0, 0x14(r1) @@ -8151,7 +8151,7 @@ lbl_800090D8: /* 800090E8 00006048 34 03 00 08 */ addic. r0, r3, 8 /* 800090EC 0000604C 41 82 00 0C */ beq lbl_800090F8 /* 800090F0 00006050 38 63 00 08 */ addi r3, r3, 8 -/* 800090F4 00006054 4B FF F6 19 */ bl sub_8000870c +/* 800090F4 00006054 4B FF F6 19 */ bl "__dt__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" lbl_800090F8: /* 800090F8 00006058 28 1E 00 00 */ cmplwi r30, 0 /* 800090FC 0000605C 41 82 00 0C */ beq lbl_80009108 diff --git a/configure.py b/configure.py index be45f554..466fc662 100755 --- a/configure.py +++ b/configure.py @@ -66,7 +66,7 @@ LIBS = [ ["MetroidPrime/CArchMsgParmInt32Int32VoidPtr", True], ["MetroidPrime/CArchMsgParmNull", True], ["MetroidPrime/CArchMsgParmReal32", True], - "MetroidPrime/Decode", + ["MetroidPrime/Decode", False], "MetroidPrime/CIOWinManager", ["MetroidPrime/CIOWin", True], "MetroidPrime/CActor", diff --git a/include/MetroidPrime/CArchitectureMessage.hpp b/include/MetroidPrime/CArchitectureMessage.hpp index e6b52382..5fc07833 100644 --- a/include/MetroidPrime/CArchitectureMessage.hpp +++ b/include/MetroidPrime/CArchitectureMessage.hpp @@ -33,8 +33,15 @@ IArchitectureMessageParm::~IArchitectureMessageParm() {} class CArchitectureMessage { public: + CArchitectureMessage(EArchMsgTarget target, int type, const rstl::rc_ptr& parm) + : x0_target(target) + , x4_type(static_cast(type)) + , x8_parm(parm) {} + EArchMsgType GetType() const { return x4_type; } - + const IArchitectureMessageParm* GetParm() const { + return x8_parm.GetPtr(); + } private: EArchMsgTarget x0_target; EArchMsgType x4_type; diff --git a/include/MetroidPrime/Decode.hpp b/include/MetroidPrime/Decode.hpp index e01429a2..2f731736 100644 --- a/include/MetroidPrime/Decode.hpp +++ b/include/MetroidPrime/Decode.hpp @@ -1,20 +1,35 @@ #ifndef _DECODE #define _DECODE -#include "MetroidPrime/CArchitectureMessage.hpp" +#include "MetroidPrime/CArchMsgParmControllerStatus.hpp" #include "MetroidPrime/CArchMsgParmInt32.hpp" #include "MetroidPrime/CArchMsgParmInt32Int32VoidPtr.hpp" #include "MetroidPrime/CArchMsgParmNull.hpp" #include "MetroidPrime/CArchMsgParmReal32.hpp" #include "MetroidPrime/CArchMsgParmUserInput.hpp" -#include "MetroidPrime/CArchMsgParmControllerStatus.hpp" +#include "MetroidPrime/CArchitectureMessage.hpp" +class CIOWin; namespace MakeMsg { - CArchitectureMessage CreateControllerStatus(EArchMsgTarget target, ushort chan, bool connected); - - CArchitectureMessage CreateUserInput(EArchMsgTarget target, const CFinalInput& input); - - const CArchMsgParmReal32& GetParmTimerTick(const CArchitectureMessage& msg); -} +const CArchMsgParmNull& GetParmDeleteIOWin(const CArchitectureMessage& msg); +CArchitectureMessage CreateCreateIOWin(EArchMsgTarget target, const int& pmin, const int& pmax, + CIOWin* const &); +const CArchMsgParmInt32Int32VoidPtr& GetParmCreateIOWin(const CArchitectureMessage& msg); +const CArchMsgParmInt32Int32VoidPtr& GetParmChangeIOWinPriority(const CArchitectureMessage& msg); + +CArchitectureMessage CreateTimerTick(EArchMsgTarget target, const float& val); +const CArchMsgParmReal32& GetParmTimerTick(const CArchitectureMessage& msg); + +CArchitectureMessage CreateUserInput(EArchMsgTarget target, const CFinalInput& input); +const CArchMsgParmUserInput& GetParmUserInput(const CArchitectureMessage& msg); + +const CArchMsgParmInt32& GetParmNewGameflowState(const CArchitectureMessage& msg); + +CArchitectureMessage CreateControllerStatus(EArchMsgTarget target, const short& chan, + const bool& connected); +CArchitectureMessage CreateQuitGameplay(EArchMsgTarget target); +CArchitectureMessage CreateFrameBegin(EArchMsgTarget target, const int& a); +CArchitectureMessage CreateFrameEnd(EArchMsgTarget target, const int& a); +} // namespace MakeMsg #endif // _DECODE diff --git a/src/MetroidPrime/Decode.cpp b/src/MetroidPrime/Decode.cpp new file mode 100644 index 00000000..ed693b03 --- /dev/null +++ b/src/MetroidPrime/Decode.cpp @@ -0,0 +1,61 @@ +#include "MetroidPrime/Decode.hpp" +#include "Kyoto/Alloc/CMemory.hpp" + +const CArchMsgParmNull& MakeMsg::GetParmDeleteIOWin(const CArchitectureMessage& msg) { + return *static_cast< const CArchMsgParmNull* >(msg.GetParm()); +} + +CArchitectureMessage MakeMsg::CreateCreateIOWin(EArchMsgTarget target, const int& pmin, const int& pmax, + CIOWin* const& iowin) { + return CArchitectureMessage( + target, kAM_CreateIOWin, + rstl::rc_ptr< IArchitectureMessageParm >( + new CArchMsgParmInt32Int32VoidPtr(pmin, pmax, reinterpret_cast< const void* >(iowin)))); +} + +const CArchMsgParmInt32Int32VoidPtr& MakeMsg::GetParmCreateIOWin(const CArchitectureMessage& msg) { + return *static_cast< const CArchMsgParmInt32Int32VoidPtr* >(msg.GetParm()); +} + +const CArchMsgParmInt32Int32VoidPtr& MakeMsg::GetParmChangeIOWinPriority(const CArchitectureMessage& msg) { + return *static_cast< const CArchMsgParmInt32Int32VoidPtr* >(msg.GetParm()); +} + +CArchitectureMessage MakeMsg::CreateTimerTick(EArchMsgTarget target, const float& val) { + return CArchitectureMessage( + target, kAM_TimerTick, rstl::rc_ptr< IArchitectureMessageParm >(new CArchMsgParmReal32(val))); +} +const CArchMsgParmReal32& MakeMsg::GetParmTimerTick(const CArchitectureMessage& msg) { + return *static_cast< const CArchMsgParmReal32* >(msg.GetParm()); +} + +CArchitectureMessage MakeMsg::CreateUserInput(EArchMsgTarget target, const CFinalInput& input) { + return CArchitectureMessage( + target, kAM_UserInput, + rstl::rc_ptr< IArchitectureMessageParm >(new CArchMsgParmUserInput(input))); +} +const CArchMsgParmUserInput& MakeMsg::GetParmUserInput(const CArchitectureMessage& msg) { + return *static_cast< const CArchMsgParmUserInput* >(msg.GetParm()); +} + +const CArchMsgParmInt32& MakeMsg::GetParmNewGameflowState(const CArchitectureMessage& msg) { + return *static_cast< const CArchMsgParmInt32* >(msg.GetParm()); +} + +CArchitectureMessage MakeMsg::CreateControllerStatus(EArchMsgTarget target, const short& chan, + const bool& connected) { + return CArchitectureMessage( + target, kAM_ControllerStatus, + rstl::rc_ptr< IArchitectureMessageParm >(new CArchMsgParmControllerStatus(chan, connected))); +} + +CArchitectureMessage MakeMsg::CreateQuitGameplay(EArchMsgTarget target) { + return CArchitectureMessage(target, kAM_QuitGameplay, rstl::rc_ptr(new CArchMsgParmNull())); +} + +CArchitectureMessage MakeMsg::CreateFrameBegin(EArchMsgTarget target, const int& a) { + return CArchitectureMessage(target, kAM_FrameBegin, rstl::rc_ptr(new CArchMsgParmInt32(a))); +} +CArchitectureMessage MakeMsg::CreateFrameEnd(EArchMsgTarget target, const int& a) { + return CArchitectureMessage(target, kAM_FrameEnd, rstl::rc_ptr(new CArchMsgParmInt32(a))); +}