diff --git a/asm/MetroidPrime/CCredits.s b/asm/MetroidPrime/CCredits.s index b2eaa4bb..745035f0 100644 --- a/asm/MetroidPrime/CCredits.s +++ b/asm/MetroidPrime/CCredits.s @@ -3379,7 +3379,7 @@ sub_80027db4: /* 80027DE0 00024D40 48 02 9E CD */ bl CreateCreateIOWin__7MakeMsgF14EArchMsgTargetRCiRCiRCP6CIOWin /* 80027DE4 00024D44 7F E3 FB 78 */ mr r3, r31 /* 80027DE8 00024D48 38 81 00 0C */ addi r4, r1, 0xc -/* 80027DEC 00024D4C 4B FD EF 15 */ bl InsertMsg__18CArchitectureQueueFRC20CArchitectureMessage +/* 80027DEC 00024D4C 4B FD EF 15 */ bl Push__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 "ReleaseData__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" diff --git a/asm/MetroidPrime/CFrontEndUI.s b/asm/MetroidPrime/CFrontEndUI.s index 83c584ab..e820c491 100644 --- a/asm/MetroidPrime/CFrontEndUI.s +++ b/asm/MetroidPrime/CFrontEndUI.s @@ -599,7 +599,7 @@ lbl_8001BB30: /* 8001BB48 00018AA8 48 03 61 65 */ bl CreateCreateIOWin__7MakeMsgF14EArchMsgTargetRCiRCiRCP6CIOWin /* 8001BB4C 00018AAC 7F E3 FB 78 */ mr r3, r31 /* 8001BB50 00018AB0 38 81 00 0C */ addi r4, r1, 0xc -/* 8001BB54 00018AB4 4B FE B1 AD */ bl InsertMsg__18CArchitectureQueueFRC20CArchitectureMessage +/* 8001BB54 00018AB4 4B FE B1 AD */ bl Push__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 "ReleaseData__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" diff --git a/asm/MetroidPrime/CIOWinManager.s b/asm/MetroidPrime/CIOWinManager.s index 2755be80..8995c655 100644 --- a/asm/MetroidPrime/CIOWinManager.s +++ b/asm/MetroidPrime/CIOWinManager.s @@ -404,7 +404,7 @@ lbl_800522CC: lbl_800522DC: /* 800522DC 0004F23C 7F 63 DB 78 */ mr r3, r27 /* 800522E0 0004F240 38 81 00 20 */ addi r4, r1, 0x20 -/* 800522E4 0004F244 4B FB 4A 1D */ bl InsertMsg__18CArchitectureQueueFRC20CArchitectureMessage +/* 800522E4 0004F244 4B FB 4A 1D */ bl Push__18CArchitectureQueueFRC20CArchitectureMessage lbl_800522E8: /* 800522E8 0004F248 28 1D 00 00 */ cmplwi r29, 0 /* 800522EC 0004F24C 41 82 00 0C */ beq lbl_800522F8 diff --git a/asm/MetroidPrime/CMFGame.s b/asm/MetroidPrime/CMFGame.s index fd9cbec0..f55cb4ad 100644 --- a/asm/MetroidPrime/CMFGame.s +++ b/asm/MetroidPrime/CMFGame.s @@ -445,7 +445,7 @@ lbl_80023E88: /* 80023E9C 00020DFC 48 02 DE 11 */ bl CreateCreateIOWin__7MakeMsgF14EArchMsgTargetRCiRCiRCP6CIOWin /* 80023EA0 00020E00 7F C3 F3 78 */ mr r3, r30 /* 80023EA4 00020E04 38 81 00 30 */ addi r4, r1, 0x30 -/* 80023EA8 00020E08 4B FE 2E 59 */ bl InsertMsg__18CArchitectureQueueFRC20CArchitectureMessage +/* 80023EA8 00020E08 4B FE 2E 59 */ bl Push__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 "ReleaseData__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" @@ -1253,7 +1253,7 @@ lbl_800249A4: /* 800249D0 00021930 48 02 CF 91 */ bl CreateQuitGameplay__7MakeMsgF14EArchMsgTarget /* 800249D4 00021934 7F C3 F3 78 */ mr r3, r30 /* 800249D8 00021938 38 81 00 24 */ addi r4, r1, 0x24 -/* 800249DC 0002193C 4B FE 23 25 */ bl InsertMsg__18CArchitectureQueueFRC20CArchitectureMessage +/* 800249DC 0002193C 4B FE 23 25 */ bl Push__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 "ReleaseData__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" @@ -1475,7 +1475,7 @@ lbl_80024CF4: /* 80024D1C 00021C7C 48 02 CC 45 */ bl CreateQuitGameplay__7MakeMsgF14EArchMsgTarget /* 80024D20 00021C80 7F C3 F3 78 */ mr r3, r30 /* 80024D24 00021C84 38 81 00 18 */ addi r4, r1, 0x18 -/* 80024D28 00021C88 4B FE 1F D9 */ bl InsertMsg__18CArchitectureQueueFRC20CArchitectureMessage +/* 80024D28 00021C88 4B FE 1F D9 */ bl Push__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 "ReleaseData__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" diff --git a/asm/MetroidPrime/CMainFlow.s b/asm/MetroidPrime/CMainFlow.s index 44bbf1f0..38bcc7c3 100644 --- a/asm/MetroidPrime/CMainFlow.s +++ b/asm/MetroidPrime/CMainFlow.s @@ -2,8 +2,8 @@ .section .data .balign 8 -.global lbl_803D9928 -lbl_803D9928: +.global __vt__9CMainFlow +__vt__9CMainFlow: # ROM: 0x3D6928 .4byte 0 .4byte 0 @@ -108,9 +108,9 @@ __dt__9CMainFlowFv: /* 80023538 00020498 93 C1 00 08 */ stw r30, 8(r1) /* 8002353C 0002049C 7C 7E 1B 79 */ or. r30, r3, r3 /* 80023540 000204A0 41 82 00 28 */ beq lbl_80023568 -/* 80023544 000204A4 3C A0 80 3E */ lis r5, lbl_803D9928@ha +/* 80023544 000204A4 3C A0 80 3E */ lis r5, __vt__9CMainFlow@ha /* 80023548 000204A8 38 80 00 00 */ li r4, 0 -/* 8002354C 000204AC 38 05 99 28 */ addi r0, r5, lbl_803D9928@l +/* 8002354C 000204AC 38 05 99 28 */ addi r0, r5, __vt__9CMainFlow@l /* 80023550 000204B0 90 1E 00 00 */ stw r0, 0(r30) /* 80023554 000204B4 48 02 F6 51 */ bl __dt__6CIOWinFv /* 80023558 000204B8 7F E0 07 35 */ extsh. r0, r31 @@ -183,7 +183,7 @@ lbl_8002362C: /* 80023644 000205A4 48 02 E6 69 */ bl CreateCreateIOWin__7MakeMsgF14EArchMsgTargetRCiRCiRCP6CIOWin /* 80023648 000205A8 7F E3 FB 78 */ mr r3, r31 /* 8002364C 000205AC 38 81 00 4C */ addi r4, r1, 0x4c -/* 80023650 000205B0 4B FE 36 B1 */ bl InsertMsg__18CArchitectureQueueFRC20CArchitectureMessage +/* 80023650 000205B0 4B FE 36 B1 */ bl Push__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 "ReleaseData__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" @@ -209,7 +209,7 @@ lbl_8002368C: /* 800236A4 00020604 48 02 E6 09 */ bl CreateCreateIOWin__7MakeMsgF14EArchMsgTargetRCiRCiRCP6CIOWin /* 800236A8 00020608 7F E3 FB 78 */ mr r3, r31 /* 800236AC 0002060C 38 81 00 40 */ addi r4, r1, 0x40 -/* 800236B0 00020610 4B FE 36 51 */ bl InsertMsg__18CArchitectureQueueFRC20CArchitectureMessage +/* 800236B0 00020610 4B FE 36 51 */ bl Push__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 "ReleaseData__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" @@ -238,7 +238,7 @@ lbl_800236F8: /* 80023710 00020670 48 02 E5 9D */ bl CreateCreateIOWin__7MakeMsgF14EArchMsgTargetRCiRCiRCP6CIOWin /* 80023714 00020674 7F E3 FB 78 */ mr r3, r31 /* 80023718 00020678 38 81 00 34 */ addi r4, r1, 0x34 -/* 8002371C 0002067C 4B FE 35 E5 */ bl InsertMsg__18CArchitectureQueueFRC20CArchitectureMessage +/* 8002371C 0002067C 4B FE 35 E5 */ bl Push__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 "ReleaseData__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" @@ -283,7 +283,7 @@ lbl_8002379C: /* 800237B0 00020710 48 02 E4 FD */ bl CreateCreateIOWin__7MakeMsgF14EArchMsgTargetRCiRCiRCP6CIOWin /* 800237B4 00020714 7F E3 FB 78 */ mr r3, r31 /* 800237B8 00020718 38 81 00 28 */ addi r4, r1, 0x28 -/* 800237BC 0002071C 4B FE 35 45 */ bl InsertMsg__18CArchitectureQueueFRC20CArchitectureMessage +/* 800237BC 0002071C 4B FE 35 45 */ bl Push__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 "ReleaseData__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" @@ -314,7 +314,7 @@ lbl_80023800: /* 80023824 00020784 48 02 E4 89 */ bl CreateCreateIOWin__7MakeMsgF14EArchMsgTargetRCiRCiRCP6CIOWin /* 80023828 00020788 7F E3 FB 78 */ mr r3, r31 /* 8002382C 0002078C 38 81 00 1C */ addi r4, r1, 0x1c -/* 80023830 00020790 4B FE 34 D1 */ bl InsertMsg__18CArchitectureQueueFRC20CArchitectureMessage +/* 80023830 00020790 4B FE 34 D1 */ bl Push__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 "ReleaseData__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" @@ -340,25 +340,21 @@ AdvanceGameState__9CMainFlowFR18CArchitectureQueue: /* 8002387C 000207DC 7C 05 00 2E */ lwzx r0, r5, r0 /* 80023880 000207E0 7C 09 03 A6 */ mtctr r0 /* 80023884 000207E4 4E 80 04 20 */ bctr -.global lbl_80023888 lbl_80023888: /* 80023888 000207E8 7C 85 23 78 */ mr r5, r4 /* 8002388C 000207EC 38 80 00 0F */ li r4, 0xf /* 80023890 000207F0 4B FF FC F5 */ bl SetGameState__9CMainFlowF17EClientFlowStatesR18CArchitectureQueue /* 80023894 000207F4 48 00 00 58 */ b lbl_800238EC -.global lbl_80023898 lbl_80023898: /* 80023898 000207F8 7C 85 23 78 */ mr r5, r4 /* 8002389C 000207FC 38 80 00 08 */ li r4, 8 /* 800238A0 00020800 4B FF FC E5 */ bl SetGameState__9CMainFlowF17EClientFlowStatesR18CArchitectureQueue /* 800238A4 00020804 48 00 00 48 */ b lbl_800238EC -.global lbl_800238A8 lbl_800238A8: /* 800238A8 00020808 7C 85 23 78 */ mr r5, r4 /* 800238AC 0002080C 38 80 00 0E */ li r4, 0xe /* 800238B0 00020810 4B FF FC D5 */ bl SetGameState__9CMainFlowF17EClientFlowStatesR18CArchitectureQueue /* 800238B4 00020814 48 00 00 38 */ b lbl_800238EC -.global lbl_800238B8 lbl_800238B8: /* 800238B8 00020818 80 CD A0 78 */ lwz r6, gpMain@sda21(r13) /* 800238BC 0002081C 80 06 01 2C */ lwz r0, 0x12c(r6) @@ -370,12 +366,10 @@ lbl_800238B8: /* 800238D4 00020834 38 A0 00 01 */ li r5, 1 /* 800238D8 00020838 50 A0 0F BC */ rlwimi r0, r5, 1, 0x1e, 0x1e /* 800238DC 0002083C 98 06 01 60 */ stb r0, 0x160(r6) -.global lbl_800238E0 lbl_800238E0: /* 800238E0 00020840 7C 85 23 78 */ mr r5, r4 /* 800238E4 00020844 38 80 00 07 */ li r4, 7 /* 800238E8 00020848 4B FF FC 9D */ bl SetGameState__9CMainFlowF17EClientFlowStatesR18CArchitectureQueue -.global lbl_800238EC lbl_800238EC: /* 800238EC 0002084C 80 01 00 14 */ lwz r0, 0x14(r1) /* 800238F0 00020850 7C 08 03 A6 */ mtlr r0 @@ -461,9 +455,9 @@ __ct__9CMainFlowFv: /* 800239EC 0002094C 48 02 F2 21 */ bl "__ct__6CIOWinFRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>" /* 800239F0 00020950 38 61 00 08 */ addi r3, r1, 8 /* 800239F4 00020954 48 31 A0 ED */ bl "internal_dereference__Q24rstl66basic_string,Q24rstl17rmemory_allocator>Fv" -/* 800239F8 00020958 3C 60 80 3E */ lis r3, lbl_803D9928@ha +/* 800239F8 00020958 3C 60 80 3E */ lis r3, __vt__9CMainFlow@ha /* 800239FC 0002095C 38 00 FF FF */ li r0, -1 -/* 80023A00 00020960 38 83 99 28 */ addi r4, r3, lbl_803D9928@l +/* 80023A00 00020960 38 83 99 28 */ addi r4, r3, __vt__9CMainFlow@l /* 80023A04 00020964 7F E3 FB 78 */ mr r3, r31 /* 80023A08 00020968 90 9F 00 00 */ stw r4, 0(r31) /* 80023A0C 0002096C 90 1F 00 14 */ stw r0, 0x14(r31) diff --git a/asm/MetroidPrime/CPauseScreenFrame.s b/asm/MetroidPrime/CPauseScreenFrame.s index d0e769ba..581e5410 100644 --- a/asm/MetroidPrime/CPauseScreenFrame.s +++ b/asm/MetroidPrime/CPauseScreenFrame.s @@ -2533,7 +2533,7 @@ lbl_80243CD4: /* 80243D58 00240CB8 4B E0 DC 09 */ bl CreateQuitGameplay__7MakeMsgF14EArchMsgTarget /* 80243D5C 00240CBC 7F E3 FB 78 */ mr r3, r31 /* 80243D60 00240CC0 38 81 00 28 */ addi r4, r1, 0x28 -/* 80243D64 00240CC4 4B DC 2F 9D */ bl InsertMsg__18CArchitectureQueueFRC20CArchitectureMessage +/* 80243D64 00240CC4 4B DC 2F 9D */ bl Push__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 "ReleaseData__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" diff --git a/asm/MetroidPrime/CSplashScreen.s b/asm/MetroidPrime/CSplashScreen.s index 65ae8765..394574b2 100644 --- a/asm/MetroidPrime/CSplashScreen.s +++ b/asm/MetroidPrime/CSplashScreen.s @@ -1187,7 +1187,7 @@ lbl_800290C0: /* 800290D8 00026038 48 02 8B D5 */ bl CreateCreateIOWin__7MakeMsgF14EArchMsgTargetRCiRCiRCP6CIOWin /* 800290DC 0002603C 7F E3 FB 78 */ mr r3, r31 /* 800290E0 00026040 38 81 00 0C */ addi r4, r1, 0xc -/* 800290E4 00026044 4B FD DC 1D */ bl InsertMsg__18CArchitectureQueueFRC20CArchitectureMessage +/* 800290E4 00026044 4B FD DC 1D */ bl Push__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 "ReleaseData__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" diff --git a/asm/MetroidPrime/main.s b/asm/MetroidPrime/main.s index 6a536065..d5fb4b6b 100644 --- a/asm/MetroidPrime/main.s +++ b/asm/MetroidPrime/main.s @@ -5521,7 +5521,7 @@ Update__24CGameArchitectureSupportFv: /* 80006CC4 00003C24 48 04 AA F9 */ bl CreateFrameEnd__7MakeMsgF14EArchMsgTargetRCi /* 80006CC8 00003C28 38 7F 00 04 */ addi r3, r31, 4 /* 80006CCC 00003C2C 38 81 00 08 */ addi r4, r1, 8 -/* 80006CD0 00003C30 48 00 00 31 */ bl InsertMsg__18CArchitectureQueueFRC20CArchitectureMessage +/* 80006CD0 00003C30 48 00 00 31 */ bl Push__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 "ReleaseData__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" @@ -5535,8 +5535,8 @@ lbl_80006CE0: /* 80006CF8 00003C58 38 21 00 20 */ addi r1, r1, 0x20 /* 80006CFC 00003C5C 4E 80 00 20 */ blr -.global InsertMsg__18CArchitectureQueueFRC20CArchitectureMessage -InsertMsg__18CArchitectureQueueFRC20CArchitectureMessage: +.global Push__18CArchitectureQueueFRC20CArchitectureMessage +Push__18CArchitectureQueueFRC20CArchitectureMessage: /* 80006D00 00003C60 94 21 FF F0 */ stwu r1, -0x10(r1) /* 80006D04 00003C64 7C 08 02 A6 */ mflr r0 /* 80006D08 00003C68 90 01 00 14 */ stw r0, 0x14(r1) @@ -5665,7 +5665,7 @@ lbl_80006EB4: /* 80006EC4 00003E24 48 04 A9 D1 */ bl CreateFrameBegin__7MakeMsgF14EArchMsgTargetRCi /* 80006EC8 00003E28 38 7E 00 04 */ addi r3, r30, 4 /* 80006ECC 00003E2C 38 81 00 14 */ addi r4, r1, 0x14 -/* 80006ED0 00003E30 4B FF FE 31 */ bl InsertMsg__18CArchitectureQueueFRC20CArchitectureMessage +/* 80006ED0 00003E30 4B FF FE 31 */ bl Push__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 "ReleaseData__Q24rstl34rc_ptr<24IArchitectureMessageParm>Fv" @@ -5689,7 +5689,7 @@ lbl_80006F0C: /* 80006F18 00003E78 48 04 AC B1 */ bl CreateTimerTick__7MakeMsgF14EArchMsgTargetRCf /* 80006F1C 00003E7C 38 7E 00 04 */ addi r3, r30, 4 /* 80006F20 00003E80 38 81 00 08 */ addi r4, r1, 8 -/* 80006F24 00003E84 4B FF FD DD */ bl InsertMsg__18CArchitectureQueueFRC20CArchitectureMessage +/* 80006F24 00003E84 4B FF FD DD */ bl Push__18CArchitectureQueueFRC20CArchitectureMessage /* 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 diff --git a/configure.py b/configure.py index 445b4dc0..80fb2248 100755 --- a/configure.py +++ b/configure.py @@ -49,7 +49,7 @@ LIBS = [ ["MetroidPrime/CArchMsgParmUserInput", True], "MetroidPrime/CFrontEndUI", ["MetroidPrime/CInputGenerator", False], - "MetroidPrime/CMainFlow", + ["MetroidPrime/CMainFlow", False], "MetroidPrime/CMFGame", "MetroidPrime/CCredits", "MetroidPrime/CSplashScreen", diff --git a/include/MetroidPrime/CArchMsgParmInt32.hpp b/include/MetroidPrime/CArchMsgParmInt32.hpp index bbd02b5b..32180d65 100644 --- a/include/MetroidPrime/CArchMsgParmInt32.hpp +++ b/include/MetroidPrime/CArchMsgParmInt32.hpp @@ -6,11 +6,14 @@ #include "MetroidPrime/CArchitectureMessage.hpp" class CArchMsgParmInt32 : public IArchitectureMessageParm { - int mVal; - public: CArchMsgParmInt32(int); ~CArchMsgParmInt32(); + + int GetInt32() const { return mVal; } + +private: + int mVal; }; #endif // _CARCHMSGPARMINT32 diff --git a/include/MetroidPrime/CArchitectureQueue.hpp b/include/MetroidPrime/CArchitectureQueue.hpp index b25af3b8..ed22cd23 100644 --- a/include/MetroidPrime/CArchitectureQueue.hpp +++ b/include/MetroidPrime/CArchitectureQueue.hpp @@ -9,10 +9,7 @@ class CArchitectureQueue { public: - bool Push(const CArchitectureMessage& msg) { - x0_queue.push_back(msg); - return false; // TODO - } + bool Push(const CArchitectureMessage& msg); void Pop(); // TODO void Clear(); // TODO bool IsEmpty() const; // TODO diff --git a/include/MetroidPrime/CCredits.hpp b/include/MetroidPrime/CCredits.hpp new file mode 100644 index 00000000..289199b1 --- /dev/null +++ b/include/MetroidPrime/CCredits.hpp @@ -0,0 +1,15 @@ +#ifndef _CCREDITS +#define _CCREDITS + +#include "MetroidPrime/CIOWin.hpp" + +class CCredits : public CIOWin { +public: + CCredits(); + EMessageReturn OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue); + +private: + char data[0x4c]; +}; + +#endif // _CCREDITS diff --git a/include/MetroidPrime/CFrontEndUI.hpp b/include/MetroidPrime/CFrontEndUI.hpp new file mode 100644 index 00000000..ccbdce5d --- /dev/null +++ b/include/MetroidPrime/CFrontEndUI.hpp @@ -0,0 +1,14 @@ +#ifndef _CFRONTENDUI +#define _CFRONTENDUI + +#include "MetroidPrime/CIOWin.hpp" + +class CFrontEndUI : public CIOWin { +public: + CFrontEndUI(); + + EMessageReturn OnMessage(const CArchitectureMessage& message, CArchitectureQueue& queue); +private: +}; + +#endif // _CFRONTENDUI diff --git a/include/MetroidPrime/CMFGameLoader.hpp b/include/MetroidPrime/CMFGameLoader.hpp new file mode 100644 index 00000000..23e9d89f --- /dev/null +++ b/include/MetroidPrime/CMFGameLoader.hpp @@ -0,0 +1,15 @@ +#ifndef _CMFGAMELOADER +#define _CMFGAMELOADER + +#include "MetroidPrime/CIOWin.hpp" + +class CMFGameLoader : public CIOWin { + +public: + CMFGameLoader(); + EMessageReturn OnMessage(const CArchitectureMessage& message, CArchitectureQueue& queue); +private: + char data[0x1c]; +}; + +#endif // _CMFGAMELOADER diff --git a/include/MetroidPrime/CMain.hpp b/include/MetroidPrime/CMain.hpp index 63f183d0..fcc853b8 100644 --- a/include/MetroidPrime/CMain.hpp +++ b/include/MetroidPrime/CMain.hpp @@ -87,6 +87,10 @@ public: x160_26_screenFading = v; } + void SetX30(bool v) { + x160_30_ = v; + } + static void EnsureWorldPaksReady(); static void EnsureWorldPakReady(CAssetId id); diff --git a/include/MetroidPrime/CMainFlow.hpp b/include/MetroidPrime/CMainFlow.hpp index ef0579d5..8d98bd9f 100644 --- a/include/MetroidPrime/CMainFlow.hpp +++ b/include/MetroidPrime/CMainFlow.hpp @@ -5,6 +5,21 @@ #include "MetroidPrime/CIOWin.hpp" +enum EClientFlowStates { + kCFS_Unspecified = -1, + kCFS_None = 0, + kCFS_WinBad = 1, + kCFS_WinGood = 2, + kCFS_WinBest = 3, + kCFS_LoseGame = 4, + kCFS_Default = 5, + kCFS_StateSetter = 6, + kCFS_PreFrontEnd = 7, + kCFS_FrontEnd = 8, + kCFS_Game = 14, + kCFS_GameExit = 15 +}; + class CMainFlow : public CIOWin { public: CMainFlow(); @@ -12,7 +27,12 @@ public: ~CMainFlow() override; EMessageReturn OnMessage(const CArchitectureMessage&, CArchitectureQueue&) override; bool GetIsContinueDraw() const override; - void Draw() override; + void Draw() const override; + + void AdvanceGameState(CArchitectureQueue& queue); + void SetGameState(EClientFlowStates state, CArchitectureQueue& queue); +private: + EClientFlowStates x14_gameState; }; #endif // _CMAINFLOW diff --git a/include/MetroidPrime/CPlayMovie.hpp b/include/MetroidPrime/CPlayMovie.hpp new file mode 100644 index 00000000..b73f737d --- /dev/null +++ b/include/MetroidPrime/CPlayMovie.hpp @@ -0,0 +1,25 @@ +#ifndef _CPLAYMOVIE +#define _CPLAYMOVIE + +#include "MetroidPrime/CIOWin.hpp" + +class CPlayMovie : public CIOWin { +public: + enum EWhichMovie { + kWM_WinGameBad, + kWM_WinGameGood, + kWM_WinGameBest, + kWM_LoseGame, + kWM_TalonText, + kWM_AfterCredits, + kWM_SpecialEnding, + kWM_CreditBG + }; + CPlayMovie(EWhichMovie movie); + + EMessageReturn OnMessage(const CArchitectureMessage& message, CArchitectureQueue& queue); +private: + char data[0x68]; +}; + +#endif // _CPLAYMOVIE diff --git a/include/MetroidPrime/CStateFlowSetter.hpp b/include/MetroidPrime/CStateFlowSetter.hpp new file mode 100644 index 00000000..cf0a4ad2 --- /dev/null +++ b/include/MetroidPrime/CStateFlowSetter.hpp @@ -0,0 +1,12 @@ +#ifndef _CSTATEFLOWSETTER +#define _CSTATEFLOWSETTER + +#include "MetroidPrime/CIOWin.hpp" + +class CStateFlowSetter : public CIOWin { +public: + CStateFlowSetter(); + EMessageReturn OnMessage(const CArchitectureMessage& message, CArchitectureQueue& queue); +}; + +#endif // _CSTATEFLOWSETTER diff --git a/src/MetroidPrime/CMainFlow.cpp b/src/MetroidPrime/CMainFlow.cpp new file mode 100644 index 00000000..c96f01b7 --- /dev/null +++ b/src/MetroidPrime/CMainFlow.cpp @@ -0,0 +1,117 @@ +#include "MetroidPrime/CMainFlow.hpp" + +#include "MetroidPrime/CArchMsgParmInt32.hpp" +#include "MetroidPrime/CArchitectureMessage.hpp" +#include "MetroidPrime/CArchitectureQueue.hpp" +#include "MetroidPrime/CCredits.hpp" +#include "MetroidPrime/CFrontEndUI.hpp" +#include "MetroidPrime/CMFGameLoader.hpp" +#include "MetroidPrime/CPlayMovie.hpp" +#include "MetroidPrime/CPreFrontEnd.hpp" +#include "MetroidPrime/CStateFlowSetter.hpp" +#include "MetroidPrime/Decode.hpp" + +#include "MetroidPrime/CMain.hpp" + +CMainFlow::CMainFlow() : CIOWin(rstl::string_l("MainFlow")), x14_gameState(kCFS_Unspecified) {} + +CIOWin::EMessageReturn CMainFlow::OnMessage(const CArchitectureMessage& msg, + CArchitectureQueue& queue) { + switch (msg.GetType()) { + case kAM_TimerTick: + AdvanceGameState(queue); + break; + case kAM_SetGameState: + CArchMsgParmInt32 state = MakeMsg::GetParmNewGameflowState(msg); + SetGameState((EClientFlowStates)state.GetInt32(), queue); + return CIOWin::kMR_Exit; + } + + return CIOWin::kMR_Normal; +} + +bool CMainFlow::GetIsContinueDraw() const { return false; } + +void CMainFlow::Draw() const {} + +void CMainFlow::AdvanceGameState(CArchitectureQueue& queue) { + switch (x14_gameState) { + case kCFS_Game: + SetGameState(kCFS_GameExit, queue); + break; + case kCFS_PreFrontEnd: + SetGameState(kCFS_FrontEnd, queue); + break; + case kCFS_FrontEnd: + SetGameState(kCFS_Game, queue); + break; + case kCFS_GameExit: { + if (gpMain->GetRestartMode() != CMain::kRM_None && + gpMain->GetRestartMode() != CMain::kRM_StateSetter) { + gpMain->SetX30(true); + } + // [[fallthrough]]; + } + case kCFS_Unspecified: + SetGameState(kCFS_PreFrontEnd, queue); + break; + default: + break; + } +} + +void CMainFlow::SetGameState(EClientFlowStates state, CArchitectureQueue& queue) { + x14_gameState = state; + + switch (state) { + case kCFS_GameExit: { + switch (gpMain->GetRestartMode()) { + case CMain::kRM_WinBad: + case CMain::kRM_WinGood: + case CMain::kRM_WinBest: + queue.Push(MakeMsg::CreateCreateIOWin(kAMT_IOWinManager, 12, 11, new CCredits())); + break; + case CMain::kRM_LoseGame: + queue.Push(MakeMsg::CreateCreateIOWin(kAMT_IOWinManager, 12, 11, + new CPlayMovie(CPlayMovie::kWM_LoseGame))); + break; + default: + break; + } + } + case kCFS_PreFrontEnd: { + if (gpMain->GetRestartMode() == CMain::kRM_None) { + break; + } + + queue.Push(MakeMsg::CreateCreateIOWin(kAMT_IOWinManager, 12, 11, new CPreFrontEnd())); + break; + } + case kCFS_FrontEnd: + CIOWin* ioWin = nullptr; + switch (gpMain->GetRestartMode()) { + case CMain::kRM_StateSetter: + ioWin = new CStateFlowSetter(); + break; + case CMain::kRM_WinBad: + case CMain::kRM_WinGood: + case CMain::kRM_WinBest: + case CMain::kRM_LoseGame: + case CMain::kRM_Default: + ioWin = new CFrontEndUI(); + default: + break; + } + + queue.Push(MakeMsg::CreateCreateIOWin(kAMT_IOWinManager, 12, 11, ioWin)); + break; + case kCFS_Game: + gpGameState->GameOptions().EnsureOptions(); + CMFGameLoader* gameFlow = new CMFGameLoader(); + gpMain->SetRestartMode(CMain::kRM_Default); + queue.Push(MakeMsg::CreateCreateIOWin(kAMT_IOWinManager, 10, 1000, gameFlow)); + break; + } +} + +CMainFlow::~CMainFlow() {}