From c3213e0c67cb60974569b4f20e84d85816b9ba8b Mon Sep 17 00:00:00 2001 From: Niklas Bauer Date: Tue, 30 Dec 2025 13:22:38 +0100 Subject: [PATCH] f_op work (#3008) * f_op debug 1 * f_op debug 2 * f_op debug 3 * f_op debug 4 * f_op debug 5 * f_op_debug fix build * f_op linking * remove goto in fopac_create * fix regressions * fix regressions * pr comments * f_op debug 6 * f_op debug 7 * f_op debug 8 * f_op debug 9 * f_op debug 10 * f_op work, linking, symbols, heap * regressions 1 * regressions 2 * pr comments --- config/RZDE01_00/symbols.txt | 8 +- config/RZDE01_02/symbols.txt | 8 +- config/RZDJ01/symbols.txt | 8 +- config/RZDP01/symbols.txt | 10 +- config/Shield/symbols.txt | 6 +- config/ShieldD/symbols.txt | 18 +- configure.py | 38 +- include/JSystem/J2DGraph/J2DPane.h | 4 +- include/JSystem/JKernel/JKRExpHeap.h | 1 + include/JSystem/JUtility/JUTAssert.h | 5 +- include/d/d_debug_viewer.h | 1 + include/d/d_error_msg.h | 6 + include/d/d_msg_object.h | 4 +- include/d/d_path.h | 4 + include/d/d_procname.h | 2 +- include/d/d_stage.h | 3 +- include/f_op/f_op_actor_mng.h | 31 +- include/m_Do/m_Do_ext.h | 2 +- include/m_Do/m_Do_hostIO.h | 4 +- include/m_Do/m_Do_mtx.h | 2 +- src/d/d_path.cpp | 4 + src/f_op/f_op_actor.cpp | 11 +- src/f_op/f_op_actor_map.cpp | 13 + src/f_op/f_op_actor_mng.cpp | 641 ++++++++++++++++++++------- src/f_op/f_op_draw_iter.cpp | 2 + src/f_op/f_op_msg_mng.cpp | 154 ++++--- src/f_op/f_op_overlap.cpp | 4 + src/f_op/f_op_scene.cpp | 5 +- src/f_op/f_op_scene_iter.cpp | 1 + src/f_op/f_op_scene_req.cpp | 13 +- src/m_Do/m_Do_ext.cpp | 14 +- src/m_Do/m_Do_hostIO.cpp | 4 - 32 files changed, 729 insertions(+), 302 deletions(-) create mode 100644 src/f_op/f_op_actor_map.cpp diff --git a/config/RZDE01_00/symbols.txt b/config/RZDE01_00/symbols.txt index 8b8871d95e..7c16a90383 100644 --- a/config/RZDE01_00/symbols.txt +++ b/config/RZDE01_00/symbols.txt @@ -28144,10 +28144,10 @@ cDyl_Initialized = .sbss:0x8053A8FC; // type:object size:0x4 scope:global align: cDyl_DVD = .sbss:0x8053A900; // type:object size:0x4 scope:global align:4 data:4byte g_fopAc_type = .sbss:0x8053A908; // type:object size:0x4 scope:global align:4 data:4byte stopStatus__10fopAc_ac_c = .sbss:0x8053A90C; // type:object size:0x4 scope:global align:4 data:4byte -lbl_8053A910 = .sbss:0x8053A910; // type:object size:0x1 data:byte -lbl_8053A911 = .sbss:0x8053A911; // type:object size:0x1 data:byte -lbl_8053A912 = .sbss:0x8053A912; // type:object size:0x1 -lbl_8053A913 = .sbss:0x8053A913; // type:object size:0x1 +HeapAdjustEntry__6fopAcM = .sbss:0x8053A910; // type:object size:0x1 data:byte +HeapAdjustUnk__6fopAcM = .sbss:0x8053A911; // type:object size:0x1 data:byte +l_hio = .sbss:0x8053A912; // type:object size:0x1 +l_actorLC = .sbss:0x8053A913; // type:object size:0x1 mGroundY__11fopAcM_gc_c = .sbss:0x8053A914; // type:object size:0x4 scope:global align:4 data:float mRoofY__11fopAcM_rc_c = .sbss:0x8053A918; // type:object size:0x4 scope:global align:4 data:float mWaterY__11fopAcM_wt_c = .sbss:0x8053A91C; // type:object size:0x4 scope:global align:4 data:float diff --git a/config/RZDE01_02/symbols.txt b/config/RZDE01_02/symbols.txt index 3572680587..1ccb0c7749 100644 --- a/config/RZDE01_02/symbols.txt +++ b/config/RZDE01_02/symbols.txt @@ -27694,10 +27694,10 @@ cDyl_Initialized = .sbss:0x80520904; // type:object size:0x4 scope:global align: cDyl_DVD = .sbss:0x80520908; // type:object size:0x4 scope:global align:4 data:4byte g_fopAc_type = .sbss:0x80520910; // type:object size:0x4 scope:global align:4 data:4byte stopStatus__10fopAc_ac_c = .sbss:0x80520914; // type:object size:0x4 scope:global align:4 data:4byte -lbl_80520918 = .sbss:0x80520918; // type:object size:0x1 data:byte -lbl_80520919 = .sbss:0x80520919; // type:object size:0x1 data:byte -lbl_8052091A = .sbss:0x8052091A; // type:object size:0x1 -lbl_8052091B = .sbss:0x8052091B; // type:object size:0x1 +HeapAdjustEntry__6fopAcM = .sbss:0x80520918; // type:object size:0x1 data:byte +HeapAdjustUnk__6fopAcM = .sbss:0x80520919; // type:object size:0x1 data:byte +l_hio = .sbss:0x8052091A; // type:object size:0x1 +l_actorLC = .sbss:0x8052091B; // type:object size:0x1 mGroundY__11fopAcM_gc_c = .sbss:0x8052091C; // type:object size:0x4 scope:global align:4 data:float mRoofY__11fopAcM_rc_c = .sbss:0x80520920; // type:object size:0x4 scope:global align:4 data:float mWaterY__11fopAcM_wt_c = .sbss:0x80520924; // type:object size:0x4 scope:global align:4 data:float diff --git a/config/RZDJ01/symbols.txt b/config/RZDJ01/symbols.txt index 7e63623202..1190a34e82 100644 --- a/config/RZDJ01/symbols.txt +++ b/config/RZDJ01/symbols.txt @@ -27700,10 +27700,10 @@ cDyl_Initialized = .sbss:0x8051E784; // type:object size:0x4 scope:global align: cDyl_DVD = .sbss:0x8051E788; // type:object size:0x4 scope:global align:4 data:4byte g_fopAc_type = .sbss:0x8051E790; // type:object size:0x4 scope:global align:4 data:4byte stopStatus__10fopAc_ac_c = .sbss:0x8051E794; // type:object size:0x4 scope:global align:4 data:4byte -lbl_8051E798 = .sbss:0x8051E798; // type:object size:0x1 data:byte -lbl_8051E799 = .sbss:0x8051E799; // type:object size:0x1 data:byte -lbl_8051E79A = .sbss:0x8051E79A; // type:object size:0x1 -lbl_8051E79B = .sbss:0x8051E79B; // type:object size:0x1 +HeapAdjustEntry__6fopAcM = .sbss:0x8051E798; // type:object size:0x1 data:byte +HeapAdjustUnk__6fopAcM = .sbss:0x8051E799; // type:object size:0x1 data:byte +l_hio = .sbss:0x8051E79A; // type:object size:0x1 +l_actorLC = .sbss:0x8051E79B; // type:object size:0x1 mGroundY__11fopAcM_gc_c = .sbss:0x8051E79C; // type:object size:0x4 scope:global align:4 data:float mRoofY__11fopAcM_rc_c = .sbss:0x8051E7A0; // type:object size:0x4 scope:global align:4 data:float mWaterY__11fopAcM_wt_c = .sbss:0x8051E7A4; // type:object size:0x4 scope:global align:4 data:float diff --git a/config/RZDP01/symbols.txt b/config/RZDP01/symbols.txt index 752db8a4f2..73851a557e 100644 --- a/config/RZDP01/symbols.txt +++ b/config/RZDP01/symbols.txt @@ -27585,10 +27585,10 @@ cDyl_Initialized = .sbss:0x805210C4; // type:object size:0x4 scope:global align: cDyl_DVD = .sbss:0x805210C8; // type:object size:0x4 scope:global align:4 data:4byte g_fopAc_type = .sbss:0x805210D0; // type:object size:0x4 scope:global align:4 data:4byte stopStatus__10fopAc_ac_c = .sbss:0x805210D4; // type:object size:0x4 scope:global align:4 data:4byte -lbl_805210D8 = .sbss:0x805210D8; // type:object size:0x1 data:byte -lbl_805210D9 = .sbss:0x805210D9; // type:object size:0x1 data:byte -lbl_805210DA = .sbss:0x805210DA; // type:object size:0x1 -lbl_805210DB = .sbss:0x805210DB; // type:object size:0x1 +HeapAdjustEntry__6fopAcM = .sbss:0x805210D8; // type:object size:0x1 data:byte +HeapAdjustUnk__6fopAcM = .sbss:0x805210D9; // type:object size:0x1 data:byte +l_hio = .sbss:0x805210DA; // type:object size:0x1 +l_actorLC = .sbss:0x805210DB; // type:object size:0x1 mGroundY__11fopAcM_gc_c = .sbss:0x805210DC; // type:object size:0x4 scope:global align:4 data:float mRoofY__11fopAcM_rc_c = .sbss:0x805210E0; // type:object size:0x4 scope:global align:4 data:float mWaterY__11fopAcM_wt_c = .sbss:0x805210E4; // type:object size:0x4 scope:global align:4 data:float @@ -27608,7 +27608,7 @@ request_id$46742 = .sbss:0x80521140; // type:object size:0x4 scope:local align:4 g_fpcPf_ProfileList_p = .sbss:0x80521148; // type:object size:0x4 scope:global align:4 data:4byte lbl_80521150 = .sbss:0x80521150; // type:object size:0x8 mProcID__20dStage_roomControl_c = .sbss:0x80521158; // type:object size:0x4 scope:global align:4 data:4byte -lbl_8052115C = .sbss:0x8052115C; // type:object size:0x1 data:byte +mStayNo__20dStage_roomControl_c = .sbss:0x8052115C; // type:object size:0x1 data:byte lbl_8052115D = .sbss:0x8052115D; // type:object size:0x1 data:byte lbl_8052115E = .sbss:0x8052115E; // type:object size:0x1 data:byte lbl_8052115F = .sbss:0x8052115F; // type:object size:0x1 data:byte diff --git a/config/Shield/symbols.txt b/config/Shield/symbols.txt index 814a870c54..d0f7467e56 100644 --- a/config/Shield/symbols.txt +++ b/config/Shield/symbols.txt @@ -25252,8 +25252,8 @@ cDyl_Initialized = .sbss:0x80508ACC; // type:object size:0x4 scope:global data:4 cDyl_DVD = .sbss:0x80508AD0; // type:object size:0x4 scope:global data:4byte hash:0x12A4A3DE g_fopAc_type = .sbss:0x80508AD8; // type:object size:0x4 scope:global data:4byte hash:0x79729021 stopStatus__10fopAc_ac_c = .sbss:0x80508ADC; // type:object size:0x4 scope:global data:4byte hash:0xD4489812 dhash:0xA7560FD3 -lbl_80508AE0 = .sbss:0x80508AE0; // type:object size:0x1 data:byte hash:0x112A0F50 dhash:0xD993AE06 -lbl_80508AE1 = .sbss:0x80508AE1; // type:object size:0x1 data:byte hash:0x16A8A2FA dhash:0x6C7BE12C +HeapAdjustEntry__6fopAcM = .sbss:0x80508AE0; // type:object size:0x1 data:byte hash:0x112A0F50 dhash:0xD993AE06 +HeapAdjustUnk__6fopAcM = .sbss:0x80508AE1; // type:object size:0x1 data:byte hash:0x16A8A2FA dhash:0x6C7BE12C l_hio = .sbss:0x80508AE4; // type:object size:0x1 scope:global hash:0x0A6CFFF8 mGroundY__11fopAcM_gc_c = .sbss:0x80508AE8; // type:object size:0x4 scope:global align:4 data:float hash:0x43B2A105 dhash:0x6F39B9E5 mRoofY__11fopAcM_rc_c = .sbss:0x80508AEC; // type:object size:0x4 scope:global align:4 data:float hash:0x062D9541 dhash:0xBEBFC081 @@ -25274,7 +25274,7 @@ g_fpcNd_type = .sbss:0x80508B48; // type:object size:0x4 scope:global data:4byte g_fpcPf_ProfileList_p = .sbss:0x80508B58; // type:object size:0x4 scope:global data:4byte hash:0x2CADF2C7 @LOCAL@dStage_getName__FsSc@tmp_name = .sbss:0x80508B60; // type:object size:0x8 scope:local hash:0xDC907C52 dhash:0x0B811DD9 mProcID__20dStage_roomControl_c = .sbss:0x80508B68; // type:object size:0x4 scope:global data:4byte hash:0x24C2F7B2 dhash:0xBF1DEEF0 -lbl_80508B6C = .sbss:0x80508B6C; // type:object size:0x1 data:byte hash:0x87058A4F dhash:0xB3B700CD +mStayNo__20dStage_roomControl_c = .sbss:0x80508B6C; // type:object size:0x1 data:byte hash:0x87058A4F dhash:0xB3B700CD lbl_80508B6D = .sbss:0x80508B6D; // type:object size:0x1 data:byte hash:0x5AF37248 dhash:0x1A945A6A lbl_80508B6E = .sbss:0x80508B6E; // type:object size:0x1 data:byte hash:0xE957ED68 dhash:0x66C51F6A lbl_80508B6F = .sbss:0x80508B6F; // type:object size:0x1 data:byte hash:0x88D929D5 dhash:0xB0689D17 diff --git a/config/ShieldD/symbols.txt b/config/ShieldD/symbols.txt index 232039cea8..f72be9f389 100644 --- a/config/ShieldD/symbols.txt +++ b/config/ShieldD/symbols.txt @@ -25711,7 +25711,7 @@ getSDevice__12JUTAssertionFv = .text:0x80522C80; // type:function size:0x8 scope setConfirmMessage__12JUTAssertionFUlPcibPCc = .text:0x80522C90; // type:function size:0xF4 scope:global align:16 hash:0x81E1CAAB dhash:0x4A96C3A5 showAssert_f_va = .text:0x80522D90; // type:function size:0x23C scope:global align:16 hash:0xF0EFDC15 showAssert_f__12JUTAssertionFUlPCciPCce = .text:0x80522FD0; // type:function size:0xAC scope:global align:16 hash:0x281C1DAC dhash:0x542AA36D -setWarningMessage_f_va = .text:0x80523080; // type:function size:0x110 scope:global align:16 hash:0xD1C7AD17 +setWarningMessage_f_va__FUlPCciPCcP16__va_list_struct = .text:0x80523080; // type:function size:0x110 scope:global align:16 hash:0xD1C7AD17 setWarningMessage_f__12JUTAssertionFUlPciPCce = .text:0x80523190; // type:function size:0xAC scope:global align:16 hash:0xB2CDC6ED dhash:0xC8D660CA setLogMessage_f_va = .text:0x80523240; // type:function size:0x10C scope:global align:16 hash:0x72144599 setLogMessage_f__12JUTAssertionFUlPciPCce = .text:0x80523350; // type:function size:0xAC scope:global align:16 hash:0x2FDEA7A3 dhash:0xDE10A904 @@ -64188,8 +64188,8 @@ lbl_8074C3AB = .sbss:0x8074C3AB; // type:object size:0x1 data:byte hash:0x15E8B5 @LOCAL@exceptionNNGCReadPad__FPUlPUl@l_oldButton@0 = .sbss:0x8074C3AC; // type:object size:0x4 scope:local data:4byte hash:0x50F85B88 dhash:0x8D7B3DDD mDoMtx_stack = .sbss:0x8074C3B0; // type:object size:0x1 scope:global hash:0x2AB168B3 lbl_8074C3B8 = .sbss:0x8074C3B8; // type:object size:0x1 data:byte hash:0x60980213 dhash:0x3EBAE505 -lbl_8074C3B9 = .sbss:0x8074C3B9; // type:object size:0x1 data:byte hash:0xDD10CA27 dhash:0x25FFD851 -lbl_8074C3BA = .sbss:0x8074C3BA; // type:object size:0x2 hash:0x364A3DE1 dhash:0xAED09ED7 +HeapAdjustVerbose__6mDoExt = .sbss:0x8074C3B9; // type:object size:0x1 data:byte hash:0xDD10CA27 dhash:0x25FFD851 +HeapAdjustQuiet__6mDoExt = .sbss:0x8074C3BA; // type:object size:0x2 hash:0x364A3DE1 dhash:0xAED09ED7 AssertHeap = .sbss:0x8074C3BC; // type:object size:0x4 scope:global data:4byte hash:0x0726E63B DbPrintHeap = .sbss:0x8074C3C0; // type:object size:0x4 scope:global data:4byte hash:0x114A8B4E gameHeap = .sbss:0x8074C3C4; // type:object size:0x4 scope:global data:4byte hash:0x31D7CBD7 @@ -64266,12 +64266,12 @@ stopStatus__10fopAc_ac_c = .sbss:0x8074C4B4; // type:object size:0x4 scope:globa @LOCAL@fopAc_Draw__FPv@l_name@0 = .sbss:0x8074C4C0; // type:object size:0x8 scope:local hash:0xD2949688 dhash:0x486AE47F @LOCAL@fopAc_Execute__FPv@l_name = .sbss:0x8074C4C8; // type:object size:0x8 scope:local hash:0xB39E0987 dhash:0x018DD2A0 @LOCAL@fopAc_Execute__FPv@l_name@0 = .sbss:0x8074C4D0; // type:object size:0x8 scope:local hash:0x13467F37 dhash:0x018DD2A0 -lbl_8074C4D8 = .sbss:0x8074C4D8; // type:object size:0x1 data:byte hash:0x112A0F50 dhash:0xD993AE06 -lbl_8074C4D9 = .sbss:0x8074C4D9; // type:object size:0x1 data:byte hash:0x16A8A2FA dhash:0x6C7BE12C -lbl_8074C4DA = .sbss:0x8074C4DA; // type:object size:0x1 data:byte hash:0xFD0599DE dhash:0x91983648 -lbl_8074C4DB = .sbss:0x8074C4DB; // type:object size:0x1 data:byte hash:0x3B1C7C18 dhash:0xD83275CE -lbl_8074C4DC = .sbss:0x8074C4DC; // type:object size:0x1 data:byte hash:0xCE781BD5 dhash:0x9D3A7FA3 -lbl_8074C4DD = .sbss:0x8074C4DD; // type:object size:0x1 data:byte hash:0x26832D44 dhash:0xBFAD0F52 +HeapAdjustEntry__6fopAcM = .sbss:0x8074C4D8; // type:object size:0x1 data:byte hash:0x112A0F50 dhash:0xD993AE06 +HeapSkipMargin__6fopAcM = .sbss:0x8074C4D9; // type:object size:0x1 data:byte hash:0x16A8A2FA dhash:0x6C7BE12C +HeapAdjustVerbose__6fopAcM = .sbss:0x8074C4DA; // type:object size:0x1 data:byte hash:0xFD0599DE dhash:0x91983648 +HeapAdjustQuiet__6fopAcM = .sbss:0x8074C4DB; // type:object size:0x1 data:byte hash:0x3B1C7C18 dhash:0xD83275CE +HeapDummyCreate__6fopAcM = .sbss:0x8074C4DC; // type:object size:0x1 data:byte hash:0xCE781BD5 dhash:0x9D3A7FA3 +HeapDummyCheck__6fopAcM = .sbss:0x8074C4DD; // type:object size:0x1 data:byte hash:0x26832D44 dhash:0xBFAD0F52 l_hio = .sbss:0x8074C4E0; // type:object size:0x8 scope:global hash:0x0A6CFFF8 l_actorLC = .sbss:0x8074C4E8; // type:object size:0x1 scope:global hash:0xCFE549D2 mGroundY__11fopAcM_gc_c = .sbss:0x8074C4EC; // type:object size:0x4 scope:global align:4 data:float hash:0x43B2A105 dhash:0x6F39B9E5 diff --git a/configure.py b/configure.py index 09ddce3ef7..8fb5950bba 100755 --- a/configure.py +++ b/configure.py @@ -604,29 +604,29 @@ config.libs = [ Object(MatchingFor(ALL_GCN), "f_ap/f_ap_game.cpp"), # f_op - Object(MatchingFor(ALL_GCN), "f_op/f_op_actor.cpp"), - Object(MatchingFor(ALL_GCN, ALL_SHIELD), "f_op/f_op_actor_iter.cpp"), - Object(MatchingFor(ALL_GCN, ALL_SHIELD), "f_op/f_op_actor_tag.cpp"), - Object(MatchingFor(ALL_GCN, "ShieldD"), "f_op/f_op_camera.cpp"), - Object(NonMatching, "f_op/f_op_actor_map.cpp"), + Object(MatchingFor(ALL_GCN, "Shield"), "f_op/f_op_actor.cpp"), + Object(MatchingFor(ALL), "f_op/f_op_actor_iter.cpp"), + Object(MatchingFor(ALL), "f_op/f_op_actor_tag.cpp"), + Object(MatchingFor(ALL), "f_op/f_op_camera.cpp"), + Object(MatchingFor(ALL), "f_op/f_op_actor_map.cpp"), Object(MatchingFor(ALL_GCN), "f_op/f_op_actor_mng.cpp"), - Object(MatchingFor(ALL_GCN), "f_op/f_op_camera_mng.cpp"), - Object(MatchingFor(ALL_GCN, "ShieldD"), "f_op/f_op_overlap.cpp"), - Object(MatchingFor(ALL_GCN, "Shield"), "f_op/f_op_overlap_mng.cpp"), - Object(MatchingFor(ALL_GCN, "ShieldD"), "f_op/f_op_overlap_req.cpp"), - Object(MatchingFor(ALL_GCN, "Shield"), "f_op/f_op_scene.cpp"), + Object(MatchingFor(ALL_GCN, ALL_WII, "Shield"), "f_op/f_op_camera_mng.cpp"), + Object(MatchingFor(ALL), "f_op/f_op_overlap.cpp"), + Object(MatchingFor(ALL_GCN, ALL_WII, "Shield"), "f_op/f_op_overlap_mng.cpp"), + Object(MatchingFor(ALL_GCN, ALL_WII, "ShieldD"), "f_op/f_op_overlap_req.cpp"), + Object(MatchingFor(ALL_GCN, ALL_WII, "Shield"), "f_op/f_op_scene.cpp"), Object(MatchingFor(ALL_GCN, "ShieldD"), "f_op/f_op_scene_iter.cpp"), - Object(MatchingFor(ALL_GCN, "ShieldD"), "f_op/f_op_scene_mng.cpp"), - Object(MatchingFor(ALL_GCN, "Shield"), "f_op/f_op_scene_req.cpp"), - Object(MatchingFor(ALL_GCN, ALL_SHIELD), "f_op/f_op_scene_tag.cpp"), - Object(MatchingFor(ALL_GCN, ALL_SHIELD), "f_op/f_op_view.cpp"), - Object(MatchingFor(ALL_GCN, "ShieldD"), "f_op/f_op_kankyo.cpp"), + Object(MatchingFor(ALL), "f_op/f_op_scene_mng.cpp"), + Object(MatchingFor(ALL), "f_op/f_op_scene_req.cpp"), + Object(MatchingFor(ALL), "f_op/f_op_scene_tag.cpp"), + Object(MatchingFor(ALL), "f_op/f_op_view.cpp"), + Object(MatchingFor(ALL), "f_op/f_op_kankyo.cpp"), Object(MatchingFor(ALL), "f_op/f_op_msg.cpp"), - Object(MatchingFor(ALL_GCN), "f_op/f_op_kankyo_mng.cpp"), + Object(MatchingFor(ALL_GCN, ALL_WII, "Shield"), "f_op/f_op_kankyo_mng.cpp"), Object(MatchingFor(ALL_GCN), "f_op/f_op_msg_mng.cpp"), - Object(MatchingFor(ALL_GCN), "f_op/f_op_draw_iter.cpp"), - Object(MatchingFor(ALL_GCN, ALL_SHIELD), "f_op/f_op_draw_tag.cpp"), - Object(MatchingFor(ALL_GCN, ALL_SHIELD), "f_op/f_op_scene_pause.cpp"), + Object(MatchingFor(ALL), "f_op/f_op_draw_iter.cpp"), + Object(MatchingFor(ALL), "f_op/f_op_draw_tag.cpp"), + Object(MatchingFor(ALL), "f_op/f_op_scene_pause.cpp"), # f_pc Object(MatchingFor(ALL_GCN), "f_pc/f_pc_base.cpp"), diff --git a/include/JSystem/J2DGraph/J2DPane.h b/include/JSystem/J2DGraph/J2DPane.h index dccc76e448..c66e10d668 100644 --- a/include/JSystem/J2DGraph/J2DPane.h +++ b/include/JSystem/J2DGraph/J2DPane.h @@ -86,7 +86,9 @@ public: /* vt 0x18 */ virtual void resize(f32 x, f32 y); /* vt 0x1C */ virtual void setCullBack(bool cull); /* vt 0x20 */ virtual void setCullBack(_GXCullMode cmode); - /* vt 0x24 */ virtual void setAlpha(u8); + /* vt 0x24 */ virtual void setAlpha(u8 alpha) { + mAlpha = alpha; + }; /* vt 0x28 */ virtual bool setConnectParent(bool connected); /* vt 0x2C */ virtual void calcMtx() { if (mPaneTree.getParent() != NULL) { diff --git a/include/JSystem/JKernel/JKRExpHeap.h b/include/JSystem/JKernel/JKRExpHeap.h index f9f126aa23..224d4cbe1e 100644 --- a/include/JSystem/JKernel/JKRExpHeap.h +++ b/include/JSystem/JKernel/JKRExpHeap.h @@ -63,6 +63,7 @@ protected: void joinTwoBlocks(CMemBlock* block); public: + s32 isEmpty(); s32 getUsedSize(u8 groupId) const; s32 getTotalUsedSize(void) const; diff --git a/include/JSystem/JUtility/JUTAssert.h b/include/JSystem/JUtility/JUTAssert.h index 3c8cf14908..66af11774b 100644 --- a/include/JSystem/JUtility/JUTAssert.h +++ b/include/JSystem/JUtility/JUTAssert.h @@ -63,10 +63,12 @@ namespace JUTAssertion { u32 getSDevice(); void showAssert_f(u32 device, const char* file, int line, const char* msg, ...); + void showAssert_f_va(u32 device, const char* file, int line, const char* msg, __va_list args); void setWarningMessage_f(u32 device, char * file, int line, const char * fmt, ...); + void setWarningMessage_f_va(u32 device, const char* file, int line, const char* msg, va_list args); void setLogMessage_f(u32 device, char* file, int line, const char* fmt, ...); void setConfirmMessage(u32 param_1, char* file, int line, bool param_4, const char* msg); - + inline void showAssert(u32 device, const char* file, int line, const char* msg) { showAssert_f(device, file, line, "%s", msg); } @@ -76,6 +78,7 @@ namespace JUTAssertion { } }; + extern bool sAssertVisible; #endif /* JUTASSERT_H */ diff --git a/include/d/d_debug_viewer.h b/include/d/d_debug_viewer.h index cd2fe2d93c..f535207a3a 100644 --- a/include/d/d_debug_viewer.h +++ b/include/d/d_debug_viewer.h @@ -22,6 +22,7 @@ void dDbVw_drawCircle(int i_bufferType, cXyz& i_pos, f32 i_radius, const GXColor void dDbVw_drawSphere(int i_bufferType, cXyz& i_pos, f32 i_size, const GXColor& i_color, u8 i_clipZ); void dDbVw_drawCylinder(int i_bufferType, cXyz& i_pos, f32 i_radius, f32 i_height, const GXColor& i_color, u8 i_clipZ); void dDbVw_drawCylinderM(int i_bufferType, Mtx i_mtx, const GXColor& i_color, u8 i_clipZ); +void dDbVw_drawCube8pXlu(cXyz* i_points, const GXColor& i_color); inline void dDbVw_drawCube8pOpa(cXyz* i_points, const GXColor& i_color) { dDbVw_drawCube8p(0, i_points, i_color); diff --git a/include/d/d_error_msg.h b/include/d/d_error_msg.h index 8016378b22..ebd87ec633 100644 --- a/include/d/d_error_msg.h +++ b/include/d/d_error_msg.h @@ -12,4 +12,10 @@ struct dDvdErrorMsg_c { static u8 execute(); }; +#if !PLATFORM_GCN +struct dConnectErrorMsg_c { + static void disable(); +}; +#endif + #endif /* D_D_ERROR_MSG_H */ diff --git a/include/d/d_msg_object.h b/include/d/d_msg_object.h index c646e957f7..8d91d20b29 100644 --- a/include/d/d_msg_object.h +++ b/include/d/d_msg_object.h @@ -417,7 +417,7 @@ inline void dMsgObject_changeFlowGroup(s32 flow) { inline void dMsgObject_setTalkActor(fopAc_ac_c* actor) { if (dMsgObject_getMsgObjectClass() != NULL) { - dMsgObject_c::setTalkActor(actor); + dMsgObject_getMsgObjectClass()->setTalkActor(actor); } } @@ -445,7 +445,7 @@ inline void dMsgObject_setKillMessageFlag() { } inline void dMsgObject_endFlowGroup() { - dMsgObject_c::endFlowGroup(); + dMsgObject_getMsgObjectClass()->endFlowGroup(); } inline void dMsgObject_setSmellType(u8 type) { diff --git a/include/d/d_path.h b/include/d/d_path.h index 37a876a8f8..3d1b296988 100644 --- a/include/d/d_path.h +++ b/include/d/d_path.h @@ -30,6 +30,10 @@ inline BOOL dPath_ChkClose(const dPath* i_path) { return i_path->m_closed & 1; } dPath* dPath_GetRoomPath(int path_index, int room_no); dPath* dPath_GetNextRoomPath(dPath const* i_path, int room_no); dPnt* dPath_GetPnt(dPath const* i_path, int pnt_index); +#if !PLATFORM_GCN // Fakematch due to differing return type on non-GCN platforms +int dPath_GetPolyRoomPathVec(cBgS_PolyInfo const& poly, cXyz* p_pathVec, int* param_2); +#else u8 dPath_GetPolyRoomPathVec(cBgS_PolyInfo const& poly, cXyz* p_pathVec, int* param_2); +#endif #endif /* D_D_PATH_H */ diff --git a/include/d/d_procname.h b/include/d/d_procname.h index cfdeaf6730..bc0ed5efc1 100644 --- a/include/d/d_procname.h +++ b/include/d/d_procname.h @@ -19,7 +19,7 @@ enum { /* 0x00C */ PROC_OPENING_SCENE, /* 0x00D */ PROC_NAME_SCENE, /* 0x00E */ PROC_NAMEEX_SCENE, -#if VERSION != VERSION_WII_USA_R0 +#if VERSION != VERSION_WII_USA_R0 && VERSION != VERSION_WII_PAL /* 0x00F */ PROC_WARNING_SCENE, /* 0x010 */ PROC_WARNING2_SCENE, #endif diff --git a/include/d/d_stage.h b/include/d/d_stage.h index d3a2f9c114..2fdc6a9cf3 100644 --- a/include/d/d_stage.h +++ b/include/d/d_stage.h @@ -1140,7 +1140,8 @@ public: static void setRegionNo(int i_roomNo, u8 i_regionNo) { mStatus[i_roomNo].mRegionNo = i_regionNo; } u8 checkStatusFlag(int i_roomNo, u8 flag) const { - return cLib_checkBit(mStatus[i_roomNo].mFlag, flag); + JUT_ASSERT(2699, 0 <= i_roomNo && i_roomNo < 64); + return cLib_checkBit((u8) mStatus[i_roomNo].mFlag, flag); } void onStatusFlag(int i_roomNo, u8 flag) { diff --git a/include/f_op/f_op_actor_mng.h b/include/f_op/f_op_actor_mng.h index f1d161342e..b81a7735cf 100644 --- a/include/f_op/f_op_actor_mng.h +++ b/include/f_op/f_op_actor_mng.h @@ -39,6 +39,17 @@ class cM3dGPla; s8 dComIfGp_getReverb(int roomNo); +namespace fopAcM { +extern u8 HeapAdjustEntry; +extern u8 HeapAdjustUnk; +extern u8 HeapAdjustVerbose; +extern u8 HeapAdjustQuiet; +extern u8 HeapDummyCreate; +extern u8 HeapDummyCheck; +extern u8 HeapSkipMargin; +extern int HeapAdjustMargin; +} // namespace fopAcM + struct fopAcM_prmBase_class { /* 0x00 */ u32 parameters; /* 0x04 */ cXyz position; @@ -816,22 +827,8 @@ inline void fopAcM_effSmokeSet2(u32* param_0, u32* param_1, cXyz const* param_2, fopAcM_effSmokeSet1(param_0, param_1, param_2, param_3, param_4, param_5, 0); } -inline void fopAcM_setWarningMessage_f(const fopAc_ac_c* i_actor, const char* i_filename, - int i_line, const char* i_msg, ...) { -#if DEBUG - /* va_list args; - va_start(args, i_msg); - - char buf[64]; - snprintf(buf, sizeof(buf), "<%s> %s", dStage_getName(fopAcM_GetProfName(i_actor), - i_actor->argument), i_msg); setWarningMessage_f_va(JUTAssertion::getSDevice(), i_filename, - i_line, buf, args); - - va_end(args); */ -#endif -} - -void fopAcM_showAssert_f(const fopAc_ac_c*, const char*, int, const char*, ...); +void fopAcM_showAssert_f(const fopAc_ac_c* i_actor, const char* i_filename, int i_line, + const char* i_msg, ...) ; #define fopAcM_assert(line, actor, COND, msg) \ (COND) ? (void)0 : (fopAcM_showAssert_f(actor, __FILE__, line, msg)); @@ -839,6 +836,8 @@ void fopAcM_showAssert_f(const fopAc_ac_c*, const char*, int, const char*, ...); #if DEBUG #define fopAcM_setWarningMessage(i_actor, i_filename, i_line, i_msg) \ fopAcM_setWarningMessage_f(i_actor, i_filename, i_line, i_msg) +void fopAcM_setWarningMessage_f(const fopAc_ac_c* i_actor, const char* i_filename, int i_line, + const char* i_msg, ...); #else #define fopAcM_setWarningMessage(...) #endif diff --git a/include/m_Do/m_Do_ext.h b/include/m_Do/m_Do_ext.h index e2aa21e811..00a8144bc3 100644 --- a/include/m_Do/m_Do_ext.h +++ b/include/m_Do/m_Do_ext.h @@ -751,7 +751,7 @@ inline void mDoExt_bckAnmRemove(J3DModelData* i_modelData) { i_modelData->getJointNodePointer(0)->setMtxCalc(NULL); } -static JKRSolidHeap* mDoExt_createSolidHeap(u32 i_size, JKRHeap* i_parent, u32 i_alignment); +JKRSolidHeap* mDoExt_createSolidHeap(u32 i_size, JKRHeap* i_parent, u32 i_alignment); JKRSolidHeap* mDoExt_createSolidHeapFromGame(u32 i_size, u32 i_alignment); void mDoExt_destroySolidHeap(JKRSolidHeap* i_heap); u32 mDoExt_adjustSolidHeap(JKRSolidHeap* i_heap); diff --git a/include/m_Do/m_Do_hostIO.h b/include/m_Do/m_Do_hostIO.h index e432c736ad..643143cd45 100644 --- a/include/m_Do/m_Do_hostIO.h +++ b/include/m_Do/m_Do_hostIO.h @@ -71,7 +71,9 @@ public: extern mDoHIO_root_c mDoHIO_root; void mDoHIO_updateChild(s8 i_no); -void mDoHIO_update(); +inline void mDoHIO_update() { + mDoHIO_root.update(); +}; void mDoHIO_deleteChild(s8 i_no); inline s8 mDoHIO_createChild(const char* i_name, JORReflexible* i_node) { return mDoHIO_root.createChild(i_name, i_node); diff --git a/include/m_Do/m_Do_mtx.h b/include/m_Do/m_Do_mtx.h index cbc3fd8616..a85f7e9b4f 100644 --- a/include/m_Do/m_Do_mtx.h +++ b/include/m_Do/m_Do_mtx.h @@ -45,7 +45,7 @@ inline void mDoMtx_multVec(CMtxP m, const Vec* src, Vec* dst) { } inline void mDoMtx_multVecArray(const Mtx m, const Vec* src, Vec* dst, u32 count) { - MTXMultVecArray(m, src, dst, count); + PSMTXMultVecArray(m, src, dst, count); } inline void mDoMtx_copy(const Mtx src, Mtx dst) { diff --git a/src/d/d_path.cpp b/src/d/d_path.cpp index bbf549364f..fb15758e06 100644 --- a/src/d/d_path.cpp +++ b/src/d/d_path.cpp @@ -63,7 +63,11 @@ dPath* dPath_GetNextRoomPath(dPath const* p_path, int room_no) { return &path->m_path[next_id]; } +#if !PLATFORM_GCN // Fakematch due to differing return type on non-GCN platforms +int dPath_GetPolyRoomPathVec(cBgS_PolyInfo const& poly, cXyz* p_pathVec, int* param_2) { +#else u8 dPath_GetPolyRoomPathVec(cBgS_PolyInfo const& poly, cXyz* p_pathVec, int* param_2) { +#endif int roomId = dComIfG_Bgsp().GetRoomId(poly); int roomPathId = dComIfG_Bgsp().GetRoomPathId(poly); diff --git a/src/f_op/f_op_actor.cpp b/src/f_op/f_op_actor.cpp index 2a0d52a768..a04944759e 100644 --- a/src/f_op/f_op_actor.cpp +++ b/src/f_op/f_op_actor.cpp @@ -155,7 +155,7 @@ print_error_check_c::param_s print_error_check_c::sDRAW = { class fopac_HIO_c : public JORReflexible { public: fopac_HIO_c(); - ~fopac_HIO_c(); + virtual ~fopac_HIO_c(); void genMessage(JORMContext*); @@ -168,7 +168,6 @@ public: /* 0x0C */ u8 mBBtnInfoDisp; }; -fopac_HIO_c::~fopac_HIO_c() {} fopac_HIO_c::fopac_HIO_c() { mId = -1; @@ -178,6 +177,8 @@ fopac_HIO_c::fopac_HIO_c() { mBBtnInfoDisp = false; } +fopac_HIO_c::~fopac_HIO_c() {} + static fopac_HIO_c l_HIO; void fopac_HIO_c::genMessage(JORMContext* mctx) { @@ -433,6 +434,7 @@ static int fopAc_Delete(void* i_this) { return ret; } +// Wii: NONMATCHING, minor temp regalloc static int fopAc_Create(void* i_this) { fopAc_ac_c* actor = (fopAc_ac_c*)i_this; int ret; @@ -628,6 +630,11 @@ void fopEn_enemy_c::drawBallModel(dKy_tevstr_c* i_tevstr) { } } +#if PLATFORM_WII || VERSION == VERSION_SHIELD +u8 fopAcM::HeapAdjustEntry; +u8 fopAcM::HeapAdjustUnk; +#endif + actor_method_class g_fopAc_Method = { (process_method_func)fopAc_Create, (process_method_func)fopAc_Delete, (process_method_func)fopAc_Execute, (process_method_func)fopAc_IsDelete, diff --git a/src/f_op/f_op_actor_map.cpp b/src/f_op/f_op_actor_map.cpp new file mode 100644 index 0000000000..ede583eb3d --- /dev/null +++ b/src/f_op/f_op_actor_map.cpp @@ -0,0 +1,13 @@ +/** + * f_op_actor_map.cpp + * Actor Map (Debug only) + */ + +#include "d/dolzel.h" // IWYU pragma: keep + +#include "f_op/f_op_actor_mng.h" + + +void dummy(s16 i_procName, createFunc i_createFunc, void* params) { + fopAcM_Create(i_procName, i_createFunc, params); +} diff --git a/src/f_op/f_op_actor_mng.cpp b/src/f_op/f_op_actor_mng.cpp index e3e33f7ba0..c56d92c086 100644 --- a/src/f_op/f_op_actor_mng.cpp +++ b/src/f_op/f_op_actor_mng.cpp @@ -17,6 +17,7 @@ #include "d/d_item.h" #include "d/d_path.h" #include "d/d_s_play.h" +#include "d/d_debug_viewer.h" #include "f_op/f_op_actor_mng.h" #include "f_op/f_op_camera_mng.h" #include "f_op/f_op_scene_mng.h" @@ -24,15 +25,7 @@ #include #define MAKE_ITEM_PARAMS(itemNo, itemBitNo, param_2, param_3) \ - ((itemNo & 0xFF) << 0 | (itemBitNo & 0xFF) << 0x8 | param_2 << 0x10 | (param_3 & 0xF) << 0x18) - -namespace fopAcM { -extern u8 HeapAdjustEntry; -extern u8 HeapAdjustUnk; -extern u8 HeapAdjustVerbose; -extern u8 HeapAdjustQuiet; -extern u8 HeapDummyCreate; -} // namespace fopAcM + ((itemNo & 0xFF) << 0x0 | (itemBitNo & 0xFF) << 0x8 | (param_2 & 0xFF) << 0x10 | (param_3 & 0xF) << 0x18) class l_HIO : public JORReflexible { public: @@ -87,6 +80,7 @@ void l_HIO::genMessage(JORMContext* mctx) { } void l_HIO::listenPropertyEvent(const JORPropertyEvent* property) { + (void)property; JORMContext* mctx = attachJORMContext(8); JORReflexible::listenPropertyEvent(property); @@ -100,6 +94,37 @@ void l_HIO::listenPropertyEvent(const JORPropertyEvent* property) { releaseJORMContext(mctx); } + +void fopAcM_setWarningMessage_f(const fopAc_ac_c* i_actor, const char* i_filename, int i_line, + const char* i_msg, ...) { + (void)i_msg; + va_list args; + va_start(args, i_msg); + + char buf[64]; + const char* name = dStage_getName(fopAcM_GetProfName(i_actor), i_actor->argument); + snprintf(buf, sizeof(buf), "<%s> %s", name, i_msg); + JUTAssertion::setWarningMessage_f_va(JUTAssertion::getSDevice(), i_filename, i_line, buf, + args); // Namespace issue + + va_end(args); +} + +void fopAcM_showAssert_f(const fopAc_ac_c* i_actor, const char* i_filename, int i_line, + const char* i_msg, ...) { + (void)i_msg; + va_list args; + va_start(args, i_msg); + + char buf[64]; + const char* name = dStage_getName(fopAcM_GetProfName(i_actor), i_actor->argument); + snprintf(buf, sizeof(buf), "<%s> %s", name, i_msg); + JUTAssertion::showAssert_f_va(JUTAssertion::getSDevice(), i_filename, i_line, buf, + args); // Namespace/Inlining issue + OS_PANIC(267, "Halt"); + + va_end(args); +} #endif fopAc_ac_c* fopAcM_FastCreate(s16 i_procName, FastCreateReqFunc i_createFunc, void* i_createData, @@ -203,7 +228,10 @@ fopAcM_prm_class* createAppend(u16 i_setId, u32 i_parameters, const cXyz* i_pos, return append; } -void fopAcM_Log(fopAc_ac_c const* i_actor, char const* i_message) {} +void fopAcM_Log(fopAc_ac_c const* i_actor, char const* i_message) { + UNUSED(i_actor); + UNUSED(i_message); +} s32 fopAcM_delete(fopAc_ac_c* i_actor) { // "Deleting Actor" @@ -355,33 +383,66 @@ u8 fopAcM::HeapAdjustUnk; u8 fopAcM::HeapAdjustVerbose; u8 fopAcM::HeapAdjustQuiet; u8 fopAcM::HeapDummyCreate; - -static bool lbl_8074C4DC; -static bool lbl_8074C4DD; +u8 fopAcM::HeapSkipMargin; +u8 fopAcM::HeapDummyCheck; +int fopAcM::HeapAdjustMargin = +#if VERSION == VERSION_SHIELD_DEBUG + 0x1000; +#else + 0x10000; +#endif struct DummyCheckHeap { - static JKRHeap* getHeap(); + JKRHeap* getHeap(); + void setHeap(JKRHeap* heap); /* 0x0 */ JKRHeap* dummyHeap; }; -static DummyCheckHeap* dch; +static DummyCheckHeap* dch = NULL; bool fopAcM_entrySolidHeap_(fopAc_ac_c* i_actor, heapCallbackFunc i_heapCallback, u32 i_size) { - const char* procNameString = fopAcM_getProcNameString(i_actor); - JKRSolidHeap* heap00 = NULL; - #if DEBUG - if (lbl_8074C4DC != 0 && lbl_8074C4DD != 0 && dch != NULL) { + s16 procProfName = fopAcM_GetProfName(i_actor); + + char procNameString[16]; + fopAcM_getNameString(i_actor, procNameString); +#else + const char* procNameString = fopAcM_getProcNameString(i_actor); +#endif + JKRSolidHeap* heap = NULL; + + u32 adjustedHeap; + bool result; + + if (DEBUG && fopAcM::HeapDummyCreate && !fopAcM::HeapDummyCheck && dch != NULL) { JKRHeap* dummy_heap = dch->getHeap(); if (dummy_heap != NULL) { - JKRSolidHeap* heap = mDoExt_createSolidHeap(-1, dummy_heap, 0x20); + heap = mDoExt_createSolidHeap(-1, dummy_heap, 0x20); JUT_ASSERT(1211, heap); + + if (fopAcM::HeapAdjustVerbose) { + // Attempting registration with max dummy heap. + OS_REPORT("ダミーヒープ最大で登録してみます。%08x\n", heap); + } + result = fopAcM_callCallback(i_actor, i_heapCallback, heap); + if (!result) { + // Registration failed with max dummy heap. + OS_REPORT_ERROR("ダミーヒープ最大で登録失敗。%08x[%s]\n", heap->getFreeSize(), + procNameString); + } else if (fopAcM::HeapAdjustVerbose) { + // Registration successful with max dummy heap. + OS_REPORT("ダミーヒープ最大で登録成功。\n"); + } + + mDoExt_destroySolidHeap(heap); + heap = NULL; + dch->setHeap(dummy_heap); } } -#endif if (fopAcM::HeapAdjustVerbose) { + // fopAcM_entrySolidHeap Start [%s] Estimated Size=%08x OS_REPORT("\x1b[36mfopAcM_entrySolidHeap 開始 [%s] 見積もりサイズ=%08x\n\x1b[m", procNameString, i_size); } @@ -393,102 +454,260 @@ bool fopAcM_entrySolidHeap_(fopAc_ac_c* i_actor, heapCallbackFunc i_heapCallback while (true) { if (i_size != 0) { if (fopAcM::HeapAdjustVerbose) { + // Attempting to allocate with estimated heap size (%08x). [%s] OS_REPORT("見積もりヒープサイズで(%08x)確保してみます。 [%s]\n", i_size, procNameString); } - heap00 = mDoExt_createSolidHeapFromGame(i_size, 0x20); - if (heap00 != NULL) { + heap = mDoExt_createSolidHeapFromGame(i_size, 0x20); + if (heap != NULL) { if (fopAcM::HeapAdjustVerbose) { - OS_REPORT("見積もりヒープサイズで登録してみます。%08x [%s]\n", heap00, + // Attempting registration with estimated heap size. %08x [%s] + OS_REPORT("見積もりヒープサイズで登録してみます。%08x [%s]\n", heap, procNameString); } - bool status = fopAcM_callCallback(i_actor, i_heapCallback, heap00) != 0; - if (!status) { - // "Entry for estimated heap size(%08x) failed. %08x[%s]\n" - OSReport_Error("見積もりヒープサイズ(%08x)で登録失敗しました。%08x[%s]\n", - i_size, heap00->getFreeSize(), procNameString); - mDoExt_destroySolidHeap(heap00); - heap00 = NULL; - } - } else { - // "Could not allocate estimated heap. %08x [%s]\n" - OSReport_Error("見積もりヒープが確保できませんでした。 %08x [%s]\n", i_size, - procNameString); - } - } - - if (heap00 == NULL) { - heap00 = mDoExt_createSolidHeapFromGame(0xFFFFFFFF, 0x20); - if (heap00 == NULL) { - // "Failed to allocate maximum heap size. [%s]\n" - OSReport_Error("最大空きヒープサイズで確保失敗。[%s]\n", procNameString); - return false; - } - - bool status = fopAcM_callCallback(i_actor, i_heapCallback, heap00) != 0; - if (!status) { - // "Entry failed for maximum heap size. %08x[%s]\n" - OSReport_Error("最大空きヒープサイズで登録失敗。%08x[%s]\n", heap00->getFreeSize(), - procNameString); - mDoExt_destroySolidHeap(heap00); - return false; - } - } - - if (heap00 == NULL) { - break; - } - - if (fopAcM::HeapAdjustEntry == 0) { - mDoExt_adjustSolidHeap(heap00); - i_actor->heap = heap00; - return true; - } else { - JKRSolidHeap* heap = NULL; - u32 heap00Size = heap00->getSize(); - u32 alignedSize = ALIGN_NEXT(heap00Size - heap00->getFreeSize(), 0x20); - if (alignedSize + 0x90 < mDoExt_getGameHeap()->getFreeSize()) { - heap = mDoExt_createSolidHeapFromGame(alignedSize, 0x20); - } - - if (heap != NULL) { - if (heap < heap00) { - mDoExt_destroySolidHeap(heap00); - heap00 = NULL; - bool status = fopAcM_callCallback(i_actor, i_heapCallback, heap) != 0; - if (!status) { - // "Entry fails at exact size? (Bug)\n" - OSReport_Error("ぴったりサイズで、登録失敗?(バグ)\n"); - mDoExt_destroySolidHeap(heap); - heap = NULL; + result = fopAcM_callCallback(i_actor, i_heapCallback, heap); + if (!result) { + if (!DEBUG || !fopAcM::HeapAdjustQuiet) { + // Registration failed with estimated heap size (%08x). %08x[%s] + OSReport_Error("見積もりヒープサイズ(%08x)で登録失敗しました。%08x[%s]\n", + i_size, heap->getFreeSize(), procNameString); } - } else { mDoExt_destroySolidHeap(heap); heap = NULL; } +#if !PLATFORM_GCN && VERSION != VERSION_WII_JPN + else { + int margin = fopAcM::HeapAdjustMargin; + adjustedHeap = ALIGN_NEXT(heap->getHeapSize() - heap->getFreeSize(), 0x20); +#if PLATFORM_SHIELD + if (i_size < adjustedHeap + margin || fopAcM::HeapSkipMargin) { +#elif VERSION == VERSION_WII_USA_R2 || VERSION == VERSION_WII_PAL + if (i_size < adjustedHeap + margin || fopAcM::HeapAdjustUnk) { +#else + if (i_size < adjustedHeap + margin) { +#endif + if (!fopAcM::HeapAdjustEntry) { + u32 res = mDoExt_adjustSolidHeap(heap); + if (fopAcM::HeapAdjustVerbose) { + // Registration successful with estimated heap size. %08x %08x %08x + OS_REPORT( + "見積もりヒープサイズで登録成功しました。 %08x %08x %08x\n", + adjustedHeap, res, i_size); + } + i_actor->heap = heap; + return true; + } + } else { + if (!DEBUG || !fopAcM::HeapAdjustQuiet) { + // Too much free space remaining with estimated heap size. %08x %08x + // [%s] + OSReport_Warning( + "見積もりヒープサイズでは空きが多すぎます。 %08x %08x [%s]\n", + adjustedHeap, i_size, procNameString); + } +#if DEBUG + // Destroying heap temporarily to obtain exact size + OS_WARNING("正確なサイズを得るために一旦 heap を破棄します\n"); + mDoExt_destroySolidHeap(heap); + heap = NULL; +#endif + } + } +#endif + } else { + // Could not allocate estimated heap. %08x [%s] + OSReport_Error("見積もりヒープが確保できませんでした。 %08x [%s]\n", i_size, + procNameString); + } + } + + if (heap == NULL) { + heap = mDoExt_createSolidHeapFromGame(-1, 0x20); + if (heap == NULL) { + // Allocation failed with max free heap size. [%s] + OSReport_Error("最大空きヒープサイズで確保失敗。[%s]\n", procNameString); + return false; + } +#if DEBUG + if (!fopAcM::HeapAdjustQuiet) { + // Attempting registration with max heap size. %08x + OS_REPORT("最大ヒープサイズで登録してみます。%08x\n", heap); + } + heap->alloc(16, 16); + + bool result2 = fopAcM_callCallback(i_actor, i_heapCallback, heap); + + if (!result2) { + // Registration failed with max free heap size -16 (1st attempt). + OS_REPORT_ERROR("最大空きヒープサイズ-16(1回目)で登録失敗。%08x[%s]\n", + heap->getFreeSize(), procNameString); + mDoExt_destroySolidHeap(heap); + heap = NULL; + return false; + } + u32 prevAlignedHeapSize = + ALIGN_PREV(heap->getHeapSize() - heap->getFreeSize() - 1, 0x10); + heap->freeAll(); + + bool result3 = fopAcM_callCallback(i_actor, i_heapCallback, heap); + if (!result3) { + // Registration failed with max free heap size (2nd attempt). + OS_REPORT_ERROR("最大空きヒープサイズ(2回目)で登録失敗。%08x[%s]\n", + heap->getFreeSize(), procNameString); + mDoExt_destroySolidHeap(heap); + heap = NULL; + return false; + } + + u32 alignedHeapSize = ALIGN_NEXT(heap->getHeapSize() - heap->getFreeSize(), 0x10); + + if (prevAlignedHeapSize > alignedHeapSize + 0x20 || + prevAlignedHeapSize + 0x20 < alignedHeapSize) + { + // Sizes differ between 1st and 2nd attempts. Registration failed. [%s] 0x%08x + // 0x%08x + OS_REPORT_ERROR("1回目と2回目でサイズが違います。登録失敗。[%s] 0x%08x 0x%08x\n", + procNameString, prevAlignedHeapSize, alignedHeapSize); + mDoExt_destroySolidHeap(heap); + heap = NULL; + return false; + } + + if (!fopAcM::HeapAdjustQuiet) { + u32 maxSize = + (prevAlignedHeapSize > alignedHeapSize) ? prevAlignedHeapSize : alignedHeapSize; + + if (!fopAcM::HeapAdjustQuiet) { + // Registration successful with max free heap size. [%s(%d)] 0x%08x 0x%08x + OS_WARNING("最大空きヒープサイズで登録成功。[%s(%d)] 0x%08x 0x%08x\n", + procNameString, procProfName, prevAlignedHeapSize, alignedHeapSize); + } + + if (i_size == 0) { + if (!fopAcM::HeapAdjustQuiet) { + // Please set the estimated size value. (0x%08x) + OS_WARNING("見積もりサイズの値を設定してください。(0x%08x)\n", maxSize); + } + } else if (i_size != maxSize) { + // Please change the estimated size value. (0x%08x -> 0x%08x) [%s] + OS_REPORT_ERROR("見積もりサイズの値を変更してください。(0x%08x→0x%08x) [%s]\n", + i_size, maxSize, procNameString); + } else if (fopAcM::HeapAdjustVerbose) { + // Matches the estimated size. (0x%08x) + OS_REPORT("見積もりサイズと一致しています。(0x%08x)\n", maxSize); + } + } +#else + bool result2 = fopAcM_callCallback(i_actor, i_heapCallback, heap); + if (!result2) { + // "Entry failed for maximum heap size. %08x[%s]\n" + OSReport_Error("最大空きヒープサイズで登録失敗。%08x[%s]\n", heap->getFreeSize(), + procNameString); + mDoExt_destroySolidHeap(heap); + return false; + } +#endif + } + + if (heap == NULL) { + break; + } + + if (!fopAcM::HeapAdjustEntry) { + adjustedHeap = mDoExt_adjustSolidHeap(heap); + if (fopAcM::HeapAdjustVerbose) { + // Skipping exact size check for speed optimization. %08x + OS_REPORT("高速化のためぴったりサイズは調べません。%08x\n", adjustedHeap); + } + i_actor->heap = heap; + return true; + } else { + JKRSolidHeap* newHeap = NULL; + u32 alignedSize = ALIGN_NEXT(heap->getHeapSize() - heap->getFreeSize(), 0x20); + u32 adjOffset = 0x80; + u32 freeSize = mDoExt_getGameHeap()->getFreeSize(); + + if (alignedSize + adjOffset + 0x10 < freeSize) { + newHeap = mDoExt_createSolidHeapFromGame(alignedSize, 0x20); + } + + if (fopAcM::HeapAdjustVerbose) { + // Attempting registration with exact size. %08x %08x + OS_REPORT("ぴったりサイズで登録してみます。%08x %08x\n", newHeap, alignedSize); + } + + if (newHeap != NULL) { + if (newHeap < heap) { + if (fopAcM::HeapAdjustVerbose) { + // Exact size heap was allocated at the front. + OS_REPORT("ぴったりサイズヒープは前のほうに確保されました。\n"); + } + if (fopAcM::HeapAdjustVerbose) { + // Destroying the previous heap first. %08x + OS_REPORT("先にさっきのヒープは破壊しておきます。%08x\n", heap); + } + + mDoExt_destroySolidHeap(heap); + heap = NULL; + + result = fopAcM_callCallback(i_actor, i_heapCallback, newHeap); + JUT_ASSERT(1421, result != NULL); + + if (!result) { + // Registration failed with exact size? (Bug) + OSReport_Error("ぴったりサイズで、登録失敗?(バグ)\n"); + mDoExt_destroySolidHeap(newHeap); + newHeap = NULL; + } else if (fopAcM::HeapAdjustVerbose) { + // Registration successful with exact size. + OS_REPORT("ぴったりサイズで登録成功しました。\n"); + } + } else { + mDoExt_destroySolidHeap(newHeap); + newHeap = NULL; + + if (fopAcM::HeapAdjustVerbose) { + // Exact size heap was allocated at the back, so it will not be used. + OS_REPORT( + "ぴったりサイズヒープは後ろのほうに確保されたので採用しません。\n"); + } + } + } else if (fopAcM::HeapAdjustVerbose) { + // Could not allocate new exact size heap. + OS_REPORT("ぴったりサイズヒープを新たに確保できませんでした。\n"); + } + + if (newHeap != NULL) { + adjustedHeap = mDoExt_adjustSolidHeap(newHeap); + if (fopAcM::HeapAdjustVerbose) { + // Using the exact size heap. %08x + OS_REPORT("ぴったりサイズヒープを採用します。%08x\n", adjustedHeap); + } + i_actor->heap = newHeap; + return true; } if (heap != NULL) { - mDoExt_adjustSolidHeap(heap); + adjustedHeap = mDoExt_adjustSolidHeap(heap); + if (fopAcM::HeapAdjustVerbose) { + // Using the previous heap. This is normal. %08x + OS_REPORT("さっきのヒープを採用します。これは正常です。%08x\n", adjustedHeap); + } i_actor->heap = heap; return true; } - if (heap00 != NULL) { - mDoExt_adjustSolidHeap(heap00); - i_actor->heap = heap00; - return true; - } - - OSReport_Error("ばぐばぐです\n"); // "There's a big bug\n" - JUT_ASSERT(0, FALSE); - OSReport_Error("緊急回避措置\n"); // "Emergency action\n" + OSReport_Error("ばぐばぐです\n"); // It is extremely buggy. + JUT_ASSERT(1454, FALSE); +#if VERSION != VERSION_WII_USA_R0 + OSReport_Error("緊急回避措置\n"); // Emergency evasion measure. fopAcM::HeapAdjustEntry = false; +#endif } } - // "fopAcM_entrySolidHeap didn't work [%s]\n" + // fopAcM_entrySolidHeap failed. [%s] OSReport_Error("fopAcM_entrySolidHeap だめでした [%s]\n", procNameString); return false; } @@ -498,15 +717,27 @@ bool fopAcM_entrySolidHeap(fopAc_ac_c* i_actor, heapCallbackFunc i_heapCallback, if (i_size & 0x80000000) { fopAcM::HeapAdjustUnk = true; } - - u8 var_r30 = fopAcM::HeapAdjustEntry; +#if DEBUG + u8 var_r29 = fopAcM::HeapDummyCheck; + if (i_size & 0x40000000) { + fopAcM::HeapDummyCheck = true; + }; +#endif +u8 var_r30 = fopAcM::HeapAdjustEntry; if (i_size & 0x20000000) { fopAcM::HeapAdjustEntry = false; - } else if (i_size & 0x10000000) { + } +#if VERSION != VERSION_WII_USA_R0 + else if (i_size & 0x10000000) { fopAcM::HeapAdjustEntry = true; } +#endif - bool result = fopAcM_entrySolidHeap_(i_actor, i_heapCallback, i_size & 0xFFFFFF); + u32 size = i_size & 0xFFFFFF; + bool result = fopAcM_entrySolidHeap_(i_actor, i_heapCallback, size); +#if DEBUG + fopAcM::HeapDummyCheck = var_r29; +#endif fopAcM::HeapAdjustUnk = var_r31; fopAcM::HeapAdjustEntry = var_r30; return result; @@ -912,11 +1143,11 @@ s32 fopAcM_orderDoorEvent(fopAc_ac_c* i_actorA, fopAc_ac_c* i_actorB, u16 i_prio s16 evid = i_actorB->eventInfo.getEventId(); u8 toolid = i_actorB->eventInfo.getMapToolId(); - if (fopAcM_GetProfName(i_actorB) == 0x55) { + if (fopAcM_GetProfName(i_actorB) == PROC_Obj_Kshutter) { if (toolid != 0xFF) { evid = dComIfGp_getEventManager().getEventIdx(i_actorA, NULL, toolid); } - } else if (fopAcM_GetProfName(i_actorB) == 0xAB) { + } else if (fopAcM_GetProfName(i_actorB) == PROC_Obj_SmgDoor) { } OS_REPORT("toolid<%d>evid<%d>\n", toolid, evid); @@ -1074,9 +1305,8 @@ s32 fopAcM_orderMapToolEvent(fopAc_ac_c* i_actor, u8 param_1, s16 i_eventID, u16 s32 fopAcM_orderMapToolAutoNextEvent(fopAc_ac_c* i_actor, u8 param_1, s16 i_eventID, u16 param_3, u16 i_flag, u16 param_5) { - u16 flag = i_flag; - flag = flag | 0x100; - return fopAcM_orderMapToolEvent(i_actor, param_1, i_eventID, param_3, flag, param_5); + i_flag |= (u16)0x100; + return fopAcM_orderMapToolEvent(i_actor, param_1, i_eventID, param_3, i_flag, param_5); } s32 fopAcM_orderPotentialEvent(fopAc_ac_c* i_actor, u16 i_flag, u16 param_2, u16 i_priority) { @@ -1276,38 +1506,39 @@ fpc_ProcID fopAcM_createItemFromTable(cXyz const* i_pos, int i_itemNo, int i_ite cXyz const* i_scale, f32* i_speedF, f32* i_speedY, bool i_createDirect) { // clang-format off - JUT_ASSERT(0, 0 <= i_itemNo && i_itemNo <= 255 && (-1 <= i_itemBitNo && i_itemBitNo < (dSv_info_c::DAN_ITEM + dSv_info_c::MEMORY_ITEM + dSv_info_c::ZONE_ITEM )) || i_itemBitNo == 255); + JUT_ASSERT(3655, 0 <= i_itemNo && i_itemNo <= 255 && (-1 <= i_itemBitNo && i_itemBitNo < (dSv_info_c::DAN_ITEM + dSv_info_c::MEMORY_ITEM + dSv_info_c::ZONE_ITEM )) || i_itemBitNo == 255); // clang-format on - ItemTableList* tableList = (ItemTableList*)dComIfGp_getItemTable(); - + u8 tableNum; + ItemTableList* tableList; + tableList = (ItemTableList*)dComIfGp_getItemTable(); if (i_itemNo == 0xFF) { return fpcM_ERROR_PROCESS_ID_e; } #if DEBUG - if (tableList->mTableNum - 1 < i_itemNo) { - // "Table Num<%d>, Specified Table<%d>, over table num!\n" + tableNum = tableList->mTableNum; + if (tableNum - 1 < i_itemNo) { OSReport_Error("テーブル数<%d>、指定テーブル番号<%d>で、テーブル数オーバーしています!\n", - tableList->mTableNum, i_itemNo); + tableNum, i_itemNo); i_itemNo = 0; } #endif - int itemNo = fopAcM_getItemNoFromTableNo(i_itemNo); - if (itemNo == fpcNm_ITEM_NONE) { + i_itemNo = fopAcM_getItemNoFromTableNo(i_itemNo); + if (i_itemNo == fpcNm_ITEM_NONE) { return fpcM_ERROR_PROCESS_ID_e; } void* create_actor; if (i_createDirect) { create_actor = - fopAcM_createItemForDirectGet(i_pos, itemNo, i_roomNo, NULL, NULL, 0.0f, 0.0f); + fopAcM_createItemForDirectGet(i_pos, i_itemNo, i_roomNo, NULL, NULL, 0.0f, 0.0f); } else if (i_speedF == NULL && i_speedY == NULL) { - create_actor = - fopAcM_fastCreateItem2(i_pos, itemNo, i_itemBitNo, i_roomNo, param_5, i_angle, i_scale); + create_actor = fopAcM_fastCreateItem2(i_pos, i_itemNo, i_itemBitNo, i_roomNo, param_5, + i_angle, i_scale); } else { - create_actor = fopAcM_fastCreateItem(i_pos, itemNo, i_roomNo, i_angle, i_scale, i_speedF, + create_actor = fopAcM_fastCreateItem(i_pos, i_itemNo, i_roomNo, i_angle, i_scale, i_speedF, i_speedY, i_itemBitNo, param_5, NULL); } @@ -1318,24 +1549,25 @@ fpc_ProcID fopAcM_createDemoItem(const cXyz* i_pos, int i_itemNo, int i_itemBitN const csXyz* i_angle, int i_roomNo, const cXyz* scale, u8 param_7) { // clang-format off - JUT_ASSERT(0, 0 <= i_itemNo && i_itemNo < 256 && (-1 <= i_itemBitNo && i_itemBitNo < (dSv_info_c::DAN_ITEM + dSv_info_c::MEMORY_ITEM + dSv_info_c::ZONE_ITEM )) || i_itemBitNo == 255); + JUT_ASSERT(3824, 0 <= i_itemNo && i_itemNo < 256 && (-1 <= i_itemBitNo && i_itemBitNo < (dSv_info_c::DAN_ITEM + dSv_info_c::MEMORY_ITEM + dSv_info_c::ZONE_ITEM )) || i_itemBitNo == 255); // clang-format on if (i_itemNo == fpcNm_ITEM_NONE) { return fpcM_ERROR_PROCESS_ID_e; } - return fopAcM_create(PROC_Demo_Item, - (i_itemNo & 0xFF) | (i_itemBitNo & 0x7F) << 0x8 | (param_7 << 0x10), i_pos, - i_roomNo, i_angle, scale, -1); + u32 params = (i_itemNo & 0xFF) << 0x0 | (i_itemBitNo & 0x7F) << 0x8 | (param_7 & 0xFF) << 0x10; + return fopAcM_create(PROC_Demo_Item, params, i_pos, i_roomNo, i_angle, scale, -1); } fpc_ProcID fopAcM_createItemForBoss(const cXyz* i_pos, int i_itemNo, int i_roomNo, const csXyz* i_angle, const cXyz* i_scale, f32 i_speedF, f32 i_speedY, int param_8) { - fopAc_ac_c* actor = - fopAcM_fastCreate(PROC_Obj_LifeContainer, 0xFFFF0000 | param_8 << 0x8 | (i_itemNo & 0xFF), - i_pos, i_roomNo, i_angle, i_scale, -1, NULL, NULL); + int _ = -1; + u32 params = 0xFFFF0000 | param_8 << 8 | (i_itemNo & 0xFF); + + fopAc_ac_c* actor = fopAcM_fastCreate(PROC_Obj_LifeContainer, params, i_pos, i_roomNo, i_angle, + i_scale, -1, NULL, NULL); if (actor != NULL) { actor->speedF = i_speedF; actor->speed.y = i_speedY; @@ -1347,28 +1579,36 @@ fpc_ProcID fopAcM_createItemForBoss(const cXyz* i_pos, int i_itemNo, int i_roomN fpc_ProcID fopAcM_createItemForMidBoss(const cXyz* i_pos, int i_itemNo, int i_roomNo, const csXyz* i_angle, const cXyz* i_scale, int param_6, int param_7) { + UNUSED(i_angle); + UNUSED(param_6); + fpc_ProcID ret = -1; csXyz angle(csXyz::Zero); - return fopAcM_createItem(i_pos, i_itemNo, param_7, i_roomNo, &angle, i_scale, 0x6); + ret = fopAcM_createItem(i_pos, i_itemNo, param_7, i_roomNo, &angle, i_scale, 0x6); + return ret; } fopAc_ac_c* fopAcM_createItemForDirectGet(const cXyz* i_pos, int i_itemNo, int i_roomNo, const csXyz* i_angle, const cXyz* i_scale, f32 i_speedF, f32 i_speedY) { - return fopAcM_fastCreateItem(i_pos, i_itemNo, i_roomNo, i_angle, i_scale, &i_speedF, &i_speedY, -1, + fopAc_ac_c* item = fopAcM_fastCreateItem(i_pos, i_itemNo, i_roomNo, i_angle, i_scale, &i_speedF, &i_speedY, -1, 0x7, NULL); + fopAc_ac_c* ret = item; + return ret; } fopAc_ac_c* fopAcM_createItemForSimpleDemo(const cXyz* i_pos, int i_itemNo, int i_roomNo, const csXyz* i_angle, const cXyz* i_scale, f32 i_speedF, f32 i_speedY) { - return fopAcM_fastCreateItem(i_pos, i_itemNo, i_roomNo, i_angle, i_scale, &i_speedF, &i_speedY, -1, + fopAc_ac_c* item = fopAcM_fastCreateItem(i_pos, i_itemNo, i_roomNo, i_angle, i_scale, &i_speedF, &i_speedY, -1, 0x4, NULL); + fopAc_ac_c* ret = item; + return ret; } fpc_ProcID fopAcM_createItem(const cXyz* i_pos, int i_itemNo, int i_itemBitNo, int i_roomNo, const csXyz* i_angle, const cXyz* i_scale, int param_7) { // clang-format off - JUT_ASSERT(0, 0 <= i_itemNo && i_itemNo < 256 && (-1 <= i_itemBitNo && i_itemBitNo < (dSv_info_c::DAN_ITEM + dSv_info_c::MEMORY_ITEM + dSv_info_c::ZONE_ITEM )) || i_itemBitNo == 255); + JUT_ASSERT(4067, 0 <= i_itemNo && i_itemNo < 256 && (-1 <= i_itemBitNo && i_itemBitNo < (dSv_info_c::DAN_ITEM + dSv_info_c::MEMORY_ITEM + dSv_info_c::ZONE_ITEM )) || i_itemBitNo == 255); // clang-format on if (i_itemNo == fpcNm_ITEM_NONE) { @@ -1384,39 +1624,49 @@ fpc_ProcID fopAcM_createItem(const cXyz* i_pos, int i_itemNo, int i_itemBitNo, i item_angle.z = 0xFF; u8 item_no = check_itemno(i_itemNo); - u32 params = MAKE_ITEM_PARAMS(item_no, i_itemBitNo, 0xFF, param_7); + int unk = -1; + fpc_ProcID ret; + int i; + + u32 params = MAKE_ITEM_PARAMS(item_no, i_itemBitNo, unk, param_7); switch (i_itemNo) { case fpcNm_ITEM_RECOVERY_FAILY: - return fopAcM_create(PROC_Obj_Yousei, 0xFFFFFFFF, i_pos, i_roomNo, i_angle, i_scale, -1); + ret = fopAcM_create(PROC_Obj_Yousei, 0xFFFFFFFF, i_pos, i_roomNo, i_angle, i_scale, -1); + break; #if DEBUG +// Return pointer fopAc_ac_c* is uninitialized for these branches case fpcNm_ITEM_SMALL_KEY: // "Small Key: Can't support map display, so program generation is prohibited!\n" OS_REPORT_ERROR("小さい鍵:マップ表示対応出来ないので、プログラム生成禁止!\n"); - JUT_ASSERT(0, FALSE); + JUT_ASSERT(4145, FALSE); break; case fpcNm_ITEM_KANTERA: // "Lantern: Program generation is prohibited!\n" OS_REPORT_ERROR("カンテラ:プログラム生成禁止!\n"); - JUT_ASSERT(0, FALSE); + JUT_ASSERT(4149, FALSE); break; case fpcNm_ITEM_LIGHT_DROP: // "Light Drop: Program generation is prohibited!\n" OS_REPORT_ERROR("光の雫:プログラム生成禁止!\n"); - JUT_ASSERT(0, FALSE); + JUT_ASSERT(4153, FALSE); break; #endif case fpcNm_ITEM_KAKERA_HEART: case fpcNm_ITEM_UTAWA_HEART: - return fopAcM_create(PROC_Obj_LifeContainer, params, i_pos, i_roomNo, i_angle, i_scale, -1); + ret = fopAcM_create(PROC_Obj_LifeContainer, params, i_pos, i_roomNo, i_angle, i_scale, -1); + break; case fpcNm_ITEM_TRIPLE_HEART: - for (int i = 0; i < 2; i++) { + for (i = 0; i < 2; i++) { fopAcM_create(PROC_ITEM, params, i_pos, i_roomNo, &item_angle, i_scale, -1); item_angle.y = cM_rndFX(0x7FFF); } default: - return fopAcM_create(PROC_ITEM, params, i_pos, i_roomNo, &item_angle, i_scale, -1); + ret = fopAcM_create(PROC_ITEM, params, i_pos, i_roomNo, &item_angle, i_scale, -1); + break; } + + return ret; } fopAc_ac_c* fopAcM_fastCreateItem2(const cXyz* i_pos, int i_itemNo, int i_itemBitNo, int i_roomNo, @@ -1439,15 +1689,19 @@ fopAc_ac_c* fopAcM_fastCreateItem2(const cXyz* i_pos, int i_itemNo, int i_itemBi item_angle.z = 0xFF; u8 item_no = check_itemno(i_itemNo); - u32 params = MAKE_ITEM_PARAMS(item_no, i_itemBitNo, 0xFF, param_5); + int unk = -1; + int i; fopAc_ac_c* ret; + u32 params = MAKE_ITEM_PARAMS(item_no, i_itemBitNo, unk, param_5); + switch (i_itemNo) { case fpcNm_ITEM_RECOVERY_FAILY: ret = fopAcM_fastCreate(PROC_Obj_Yousei, 0xFFFFFFFF, i_pos, i_roomNo, i_angle, i_scale, -1, - NULL, NULL); + NULL, NULL); break; #if DEBUG +// Return pointer fopAc_ac_c* is uninitialized for these branches case fpcNm_ITEM_SMALL_KEY: // "Small Key: Can't support map display, so program generation is prohibited!\n" OS_REPORT_ERROR("小さい鍵:マップ表示対応出来ないので、プログラム生成禁止!\n"); @@ -1467,17 +1721,17 @@ fopAc_ac_c* fopAcM_fastCreateItem2(const cXyz* i_pos, int i_itemNo, int i_itemBi case fpcNm_ITEM_KAKERA_HEART: case fpcNm_ITEM_UTAWA_HEART: ret = fopAcM_fastCreate(PROC_Obj_LifeContainer, params, i_pos, i_roomNo, i_angle, i_scale, - -1, NULL, NULL); + -1, NULL, NULL); break; case fpcNm_ITEM_TRIPLE_HEART: - for (int i = 0; i < 2; i++) { - ret = fopAcM_fastCreate(PROC_ITEM, params, i_pos, i_roomNo, &item_angle, i_scale, -1, NULL, - NULL); + for (i = 0; i < 2; i++) { + ret = fopAcM_fastCreate(PROC_ITEM, params, i_pos, i_roomNo, &item_angle, i_scale, -1, + NULL, NULL); item_angle.y = cM_rndFX(0x7FFF); } default: ret = fopAcM_fastCreate(PROC_ITEM, params, i_pos, i_roomNo, &item_angle, i_scale, -1, NULL, - NULL); + NULL); } return ret; } @@ -1487,30 +1741,32 @@ fopAc_ac_c* fopAcM_fastCreateItem(const cXyz* i_pos, int i_itemNo, int i_roomNo, f32* i_speedY, int i_itemBitNo, int param_9, createFunc i_createFunc) { JUT_ASSERT(4324, 0 <= i_itemNo && i_itemNo < 256); - + csXyz angle; if (i_itemNo == fpcNm_ITEM_NONE) { return NULL; } - int i; - u8 item_no = check_itemno(i_itemNo); - u8 item_bit_no = i_itemBitNo; - u32 params = MAKE_ITEM_PARAMS(item_no, item_bit_no, 0xFF, param_9); - + u8 item_bit_no = (u8) i_itemBitNo; + u8 last_param = (u8) param_9; + + int unk = -1; + int i; + fopAc_ac_c* ret; + u32 params = MAKE_ITEM_PARAMS(item_no, item_bit_no, unk, last_param); + if (i_speedF != NULL && isHeart(i_itemNo)) { *i_speedF = 2.0f * *i_speedF; } - - fopAc_ac_c* ret; - + switch (i_itemNo) { case fpcNm_ITEM_RECOVERY_FAILY: ret = fopAcM_fastCreate(PROC_Obj_Yousei, 0xFFFFFFFF, i_pos, i_roomNo, i_angle, i_scale, -1, NULL, NULL); break; #if DEBUG +// Return pointer fopAc_ac_c* is uninitialized for these branches case fpcNm_ITEM_SMALL_KEY: // "Small Key: Can't support map display, so program generation is prohibited!\n" OS_REPORT_ERROR("小さい鍵:マップ表示対応出来ないので、プログラム生成禁止!\n"); @@ -1542,16 +1798,16 @@ fopAc_ac_c* fopAcM_fastCreateItem(const cXyz* i_pos, int i_itemNo, int i_roomNo, angle.z = 0xFF; angle.y += (s16)cM_rndFX(0x2000); - fopAc_ac_c* actor = (fopAc_ac_c*)fopAcM_fastCreate( + ret = (fopAc_ac_c*)fopAcM_fastCreate( PROC_ITEM, params, i_pos, i_roomNo, &angle, i_scale, -1, i_createFunc, NULL); - if (actor != NULL) { + if (ret != NULL) { if (i_speedF != NULL) { - actor->speedF = *i_speedF * (1.0f + cM_rndFX(0.3f)); + ret->speedF = *i_speedF * (1.0f + cM_rndFX(0.3f)); } if (i_speedY != NULL) { - actor->speed.y = *i_speedY * (1.0f + cM_rndFX(0.2f)); + ret->speed.y = *i_speedY * (1.0f + cM_rndFX(0.2f)); } } } @@ -1580,6 +1836,10 @@ fopAc_ac_c* fopAcM_fastCreateItem(const cXyz* i_pos, int i_itemNo, int i_roomNo, return ret; } +void dummySetAll() { + cXyz().setall(0.0f); +} + fpc_ProcID fopAcM_createBokkuri(u16 i_setId, const cXyz* i_pos, int i_itemNo, int i_itemBit, int i_roomNo, const cXyz* param_6, int i_itemType, int param_8) { u32 params = 0; @@ -1611,6 +1871,7 @@ void* enemySearchJugge(void* i_actor, void* i_data) { } else { return NULL; } + UNUSED(i_data); } fopAc_ac_c* fopAcM_myRoomSearchEnemy(s8 roomNo) { @@ -1631,6 +1892,68 @@ fopAc_ac_c* fopAcM_myRoomSearchEnemy(s8 roomNo) { return (fopAc_ac_c*)fpcM_JudgeInLayer(fpcM_LayerID(roomProc), enemySearchJugge, NULL); } +void dummyStatusCheck(int i_roomNo, u8 i_flag) { + dComIfGp_roomControl_checkStatusFlag(i_roomNo, i_flag); +} + +void fopAcM_DrawCullingBox(const fopAc_ac_c* i_actor, const GXColor& i_color) { + if (fopAcM_CULLSIZE_IS_BOX(fopAcM_GetCullSize(i_actor))) { + cXyz vertices[8]; + + cXyz* min; + cXyz* max; + + if (fopAcM_GetCullSize(i_actor) == fopAc_CULLBOX_CUSTOM_e) { + min = (cXyz*)&i_actor->cull.box.min; + max = (cXyz*)&i_actor->cull.box.max; + } else { + cull_box* box = &l_cullSizeBox[fopAcM_CULLSIZE_IDX(fopAcM_GetCullSize(i_actor))]; + min = (cXyz*)&box->min; + max = (cXyz*)&box->max; + } + + vertices[0].set(min->x, max->y, min->z); + vertices[1].set(max->x, max->y, min->z); + vertices[2].set(min->x, max->y, max->z); + vertices[3].set(max->x, max->y, max->z); + vertices[4].set(min->x, min->y, min->z); + vertices[5].set(max->x, min->y, min->z); + vertices[6].set(min->x, min->y, max->z); + vertices[7].set(max->x, min->y, max->z); + + if (fopAcM_GetMtx(i_actor) != NULL) { + cMtx_multVecArray(fopAcM_GetMtx(i_actor), vertices, vertices, 8); + } + + dDbVw_drawCube8pXlu(vertices, i_color); + } else { + cXyz center; + f32 radius; + + if (fopAcM_GetCullSize(i_actor) == fopAc_CULLSPHERE_CUSTOM_e) { + radius = fopAcM_getCullSizeSphereR(i_actor); + if (fopAcM_GetMtx(i_actor) != NULL) { + cMtx_multVec(fopAcM_GetMtx(i_actor), &i_actor->cull.sphere.center, ¢er); + } else { + center = fopAcM_getCullSizeSphereCenter(i_actor); + } + } else { + radius = l_cullSizeSphere[fopAcM_CULLSIZE_Q_IDX(fopAcM_GetCullSize(i_actor))].radius; + if (fopAcM_GetMtx(i_actor) != NULL) { + cMtx_multVec( + fopAcM_GetMtx(i_actor), + &l_cullSizeSphere[fopAcM_CULLSIZE_Q_IDX(fopAcM_GetCullSize(i_actor))].center, + ¢er); + } else { + center = + l_cullSizeSphere[fopAcM_CULLSIZE_Q_IDX(fopAcM_GetCullSize(i_actor))].center; + } + } + + dDbVw_drawSphereXlu(center, radius, i_color, 1); + } +} + fpc_ProcID fopAcM_createDisappear(const fopAc_ac_c* i_actor, const cXyz* i_pos, u8 i_size, u8 i_type, u8 i_enemyID) { u32 param = (i_enemyID << 0x10) | (i_size << 0x8) | i_type; @@ -1848,6 +2171,7 @@ static void get_vectle_calc(const cXyz* pXyzA, const cXyz* pXyzB, cXyz* pOut) { vectle_calc(&dPos, pOut); } +// Wii: NONMATCHING, regalloc r30/r31 void fopAcM_setEffectMtx(const fopAc_ac_c* i_actor, const J3DModelData* modelData) { const cXyz* pEyePos = &i_actor->eyePos; camera_class* camera = dCam_getCamera(); @@ -2019,7 +2343,7 @@ s32 fopAcM_getWaterStream(cXyz const* pos, cBgS_PolyInfo const& polyinfo, cXyz* } if (dComIfG_Bgsp().ChkPolySafe(polyinfo)) { - if (dPath_GetPolyRoomPathVec(polyinfo, speed, power)) { + if (dPath_GetPolyRoomPathVec(polyinfo, speed, power) != 0) { speed->normalizeZP(); return 1; } @@ -2054,8 +2378,7 @@ s16 fopAcM_getPolygonAngle(cM3dGPla const* p_plane, s16 param_1) { } f32 cos = cM_scos(p_plane->mNormal.atan2sX_Z() - param_1); - f32 xz = JMAFastSqrt(p_plane->mNormal.x * p_plane->mNormal.x + - p_plane->mNormal.z * p_plane->mNormal.z); + f32 xz = JMAFastSqrt(SQUARE(p_plane->mNormal.x) + SQUARE(p_plane->mNormal.z)); xz *= cos; return cM_atan2s(xz, p_plane->mNormal.y); } @@ -2101,7 +2424,7 @@ BOOL fopAcM_getNameString(const fopAc_ac_c* i_actor, char* o_name) { void fopAcM_initManager() { #if DEBUG DummyCheckHeap_init(); - if (lbl_8074C4DC != 0) { + if (fopAcM::HeapDummyCreate != 0) { DummyCheckHeap_create(); } l_hio.entry(); diff --git a/src/f_op/f_op_draw_iter.cpp b/src/f_op/f_op_draw_iter.cpp index de1805762a..7b4c9e4173 100644 --- a/src/f_op/f_op_draw_iter.cpp +++ b/src/f_op/f_op_draw_iter.cpp @@ -34,7 +34,9 @@ create_tag_class* fopDwIt_Begin() { } create_tag_class* fopDwIt_Next(create_tag_class* i_createTag) { + (void)&i_createTag; create_tag_class* tag = (create_tag_class*)i_createTag->mpNode.mpNextNode; + if (tag == NULL) { return fopDwIt_GetTag(); } diff --git a/src/f_op/f_op_msg_mng.cpp b/src/f_op/f_op_msg_mng.cpp index 6bcb675acd..9442a807a6 100644 --- a/src/f_op/f_op_msg_mng.cpp +++ b/src/f_op/f_op_msg_mng.cpp @@ -1,4 +1,4 @@ -#include "d/dolzel.h" // IWYU pragma: keep +#include "d/dolzel.h" // IWYU pragma: keep #include "JSystem/JKernel/JKRExpHeap.h" #include "SSystem/SComponent/c_malloc.h" @@ -9,15 +9,17 @@ #include "f_op/f_op_msg_mng.h" #include "f_op/f_op_scene_mng.h" -s32 fopMsgM_setStageLayer(void* i_process) { - scene_class* scn = fopScnM_SearchByID(dStage_roomControl_c::getProcID()); +static fpc_ProcID i_msgID = fpcM_ERROR_PROCESS_ID_e; - int id = fopScnM_LayerID(scn); - return fpcM_ChangeLayerID(i_process, id); +s32 fopMsgM_setStageLayer(void* i_process) { + scene_class* stageProc = fopScnM_SearchByID(dStage_roomControl_c::getProcID()); + JUT_ASSERT(93, stageProc != 0); + + return fpcM_ChangeLayerID(i_process, fopScnM_LayerID(stageProc)); } msg_class* fopMsgM_SearchByID(fpc_ProcID i_id) { - return (msg_class*)fpcEx_SearchByID(i_id); + return (msg_class*)fpcM_SearchByID(i_id); } fopMsg_prm_class* fopMsgM_GetAppend(void* i_msg) { @@ -28,8 +30,8 @@ void fopMsgM_Delete(void* i_this) { fpcM_Delete(i_this); } -static fopMsg_prm_class* createAppend(fopAc_ac_c* i_talkActor, cXyz* i_pos, u32* i_msgIdx, u32* param_3, - fpc_ProcID param_4) { +static fopMsg_prm_class* createAppend(fopAc_ac_c* i_talkActor, cXyz* i_pos, u32* i_msgIdx, + u32* param_3, fpc_ProcID param_4) { fopMsg_prm_class* append = (fopMsg_prm_class*)cMl::memalignB(-4, sizeof(fopMsg_prm_class)); if (append == NULL) { return NULL; @@ -40,10 +42,14 @@ static fopMsg_prm_class* createAppend(fopAc_ac_c* i_talkActor, cXyz* i_pos, u32* if (i_msgIdx != NULL) { append->msg_idx = *i_msgIdx; + } else { + i_msgIdx = NULL; } if (param_3 != NULL) { append->field_0x14 = *param_3; + } else { + param_3 = NULL; } if (i_pos != NULL) { @@ -81,29 +87,33 @@ static fopMsg_prm_timer* createTimerAppend(int i_mode, u32 i_limitMs, u8 i_type, return appen; } -fpc_ProcID fopMsgM_create(s16 i_procName, fopAc_ac_c* i_talkActor, cXyz* i_pos, u32* i_msgIdx, u32* param_4, - fopMsgCreateFunc createFunc) { - fopMsg_prm_class* append = createAppend(i_talkActor, i_pos, i_msgIdx, param_4, fpcM_ERROR_PROCESS_ID_e); +fpc_ProcID fopMsgM_create(s16 i_procName, fopAc_ac_c* i_talkActor, cXyz* i_pos, u32* i_msgIdx, + u32* param_4, FastCreateReqFunc i_createFunc) { + fopMsg_prm_class* append = + createAppend(i_talkActor, i_pos, i_msgIdx, param_4, fpcM_ERROR_PROCESS_ID_e); if (append == NULL) { return fpcM_ERROR_PROCESS_ID_e; } - return fpcSCtRq_Request(fpcLy_CurrentLayer(), i_procName, (stdCreateFunc)createFunc, NULL, append); + return fpcM_Create(i_procName, i_createFunc, append); } -fpc_ProcID fop_Timer_create(s16 i_procName, u8 i_mode, u32 i_limitMs, u8 i_type, u8 param_4, f32 param_5, - f32 param_6, f32 param_7, f32 param_8, fopMsgCreateFunc i_createFunc) { - fopMsg_prm_timer* append = createTimerAppend(i_mode, i_limitMs, i_type, param_4, param_5, - param_6, param_7, param_8, fpcM_ERROR_PROCESS_ID_e); +fpc_ProcID fop_Timer_create(s16 i_procName, u8 i_mode, u32 i_limitMs, u8 i_type, u8 param_4, + f32 param_5, f32 param_6, f32 param_7, f32 param_8, + FastCreateReqFunc i_createFunc) { + fopMsg_prm_timer* append = + createTimerAppend(i_mode, i_limitMs, i_type, param_4, param_5, param_6, param_7, param_8, + fpcM_ERROR_PROCESS_ID_e); if (append == NULL) { return fpcM_ERROR_PROCESS_ID_e; } - return fpcSCtRq_Request(fpcLy_CurrentLayer(), i_procName, (stdCreateFunc)i_createFunc, NULL, - append); + return fpcM_Create(i_procName, i_createFunc, append); } -static fpc_ProcID i_msgID = fpcM_ERROR_PROCESS_ID_e; +void dummySet() { + csXyz().set(0, 0, 0); +} fpc_ProcID fopMsgM_messageSet(u32 i_msgIdx, fopAc_ac_c* i_talkActor, u32 param_2) { if (dComIfGp_isHeapLockFlag() == 8) { @@ -115,7 +125,6 @@ fpc_ProcID fopMsgM_messageSet(u32 i_msgIdx, fopAc_ac_c* i_talkActor, u32 param_2 dComIfGp_isHeapLockFlag() != 1) { return fpcM_ERROR_PROCESS_ID_e; - } dComIfGp_clearMesgAnimeTagInfo(); @@ -156,9 +165,9 @@ fpc_ProcID fopMsgM_messageSet(u32 i_msgIdx, u32 param_1) { dComIfGp_isHeapLockFlag() != 1) { return fpcM_ERROR_PROCESS_ID_e; - } + fopAc_ac_c* actor = NULL; cXyz pos; pos.x = pos.y = pos.z = 0.0f; @@ -169,7 +178,7 @@ fpc_ProcID fopMsgM_messageSet(u32 i_msgIdx, u32 param_1) { msg->pos.set(pos); msg->msg_idx = i_msgIdx; msg->field_0xf0 = param_1; - msg->talk_actor = NULL; + msg->talk_actor = actor; msg->setTalkPartner(NULL); msg->setMessageIndex(i_msgIdx, param_1, false); return i_msgID; @@ -177,7 +186,7 @@ fpc_ProcID fopMsgM_messageSet(u32 i_msgIdx, u32 param_1) { msg->pos.set(pos); msg->msg_idx = i_msgIdx; msg->field_0xf0 = param_1; - msg->talk_actor = NULL; + msg->talk_actor = actor; return i_msgID; } } @@ -196,9 +205,10 @@ fpc_ProcID fopMsgM_messageSetDemo(u32 i_msgidx) { dComIfGp_isHeapLockFlag() != 1) { return fpcM_ERROR_PROCESS_ID_e; - } + fopAc_ac_c* NULL_ = NULL; + cXyz pos; pos.x = pos.y = pos.z = 0.0f; @@ -208,7 +218,7 @@ fpc_ProcID fopMsgM_messageSetDemo(u32 i_msgidx) { msg->pos.set(pos); msg->msg_idx = i_msgidx; msg->field_0xf0 = 1000; - msg->talk_actor = NULL; + msg->talk_actor = NULL_; msg->setMessageIndexDemo(i_msgidx, false); return i_msgID; } @@ -238,56 +248,67 @@ u8 fopMsgM_itemNumIdx(u8 i_no) { return itemicon[i_no] & 0xFF; } -void J2DPane::setAlpha(u8 alpha) { - mAlpha = alpha; -} - f32 dummy() { + J2DPane* dummyPlane = NULL; + dummyPlane->getAlpha(); + dummyPlane->getHeight(); + dummyPlane->getWidth(); + dummyPlane->setAlpha(0); + +#if !PLATFORM_GCN + J2DPicture* dummyPicture = NULL; + const char* str = NULL; + dummyPicture->append(str, 0.0f); + dummyPicture->setBlendRatio(0.0f, 0.0f); +#endif + return 0.5f; } -f32 fopMsgM_valueIncrease(int param_0, int param_1, u8 i_type) { - if (param_0 <= 0) { +// Wii: NONMATCHING, float regalloc in case 3 +f32 fopMsgM_valueIncrease(int i_max, int i_value, u8 i_mode) { + if (i_max <= 0) { return 1.0f; } - if (param_1 < 0) { - param_1 = 0; - } else if (param_1 > param_0) { - param_1 = param_0; + if (i_value < 0) { + i_value = 0; + } else if (i_value > i_max) { + i_value = i_max; } - f32 var_f31 = (f32)param_1 / param_0; - f32 var_f30; + f32 v = (f32)i_value / i_max; + f32 ret; - switch (i_type) { + switch (i_mode) { case 0: - var_f30 = var_f31 * var_f31; + ret = v * v; break; case 1: - var_f30 = JMAFastSqrt(var_f31); + ret = JMAFastSqrt(v); break; case 2: default: - var_f30 = var_f31; + ret = v; break; case 3: - var_f30 = (2.0f * ((2.0f * var_f31) - 1.0f)) - 1.0f; + v = (2.0f * v) - 1.0f; + ret = (2.0f * v) - 1.0f; break; case 4: - var_f31 = cM_ssin(0.5f * ((f32)0x8000 * var_f31)); - var_f30 = var_f31 * var_f31; + v = cM_ssin((int)(0.5f * ((f32)0x8000 * v))); + ret = v * v; break; case 5: - var_f31 = cM_ssin(0.5f * ((f32)0xFFFF * var_f31)); - var_f30 = var_f31 * var_f31; + v = cM_ssin((int)(0.5f * ((f32)0xFFFF * v))); + ret = v * v; break; case 6: - var_f30 = cM_ssin((f32)0x8000 * var_f31); + ret = cM_ssin((int)((f32)0x8000 * v)); break; } - return var_f30; + return ret; } // Here to generate J2DPicture virtual inlines @@ -297,13 +318,46 @@ static void dummyVirtual(J2DPicture* picture, f32 param_1, f32 param_2, const ch } JKRExpHeap* fopMsgM_createExpHeap(u32 i_heapSize, JKRHeap* i_heap) { + JKRHeap* heap; if (i_heap == NULL) { - i_heap = mDoExt_getGameHeap(); + heap = mDoExt_getGameHeap(); + } else { + heap = i_heap; } + + JKRExpHeap* exp_heap = JKRCreateExpHeap(i_heapSize, heap, false); + +#if DEBUG + static int displayed = false; + if (exp_heap == NULL && !displayed) { + displayed = true; + int _; - return JKRExpHeap::create(i_heapSize, i_heap, false); + // Failed to allocate %f KB of ExpHeap Continuous free space = %f KB + // Remaining free space = %f + OS_REPORT("\x1b[43;30mfopMsgM_createMaxExpHeap : Expヒープ%fKの確保に失敗 連続空き容量=%fK " + "残り空き容量=%f\n\x1b[m", + i_heapSize / 1024.0f, heap->getFreeSize() / 1024.0f, + heap->getTotalFreeSize() / 1024.0f); + } +#endif + + return exp_heap; } void fopMsgM_destroyExpHeap(JKRExpHeap* i_heap) { +#if DEBUG + if (!i_heap->check()) { + // EXPHeap is corrupted %08x + OS_REPORT_ERROR("EXPヒープ破壊されている %08x\n", i_heap); + } else if (i_heap->isEmpty() == false) { + // EXPHeap has not been completely freed %08x %08x + OS_REPORT_ERROR("EXPヒープ全開放されていない %08x %08x\n", i_heap, + i_heap->getTotalUsedSize()); + i_heap->dump(); + i_heap->freeAll(); + } +#endif + i_heap->destroy(); } diff --git a/src/f_op/f_op_overlap.cpp b/src/f_op/f_op_overlap.cpp index 557e9bda08..5cdaea666b 100644 --- a/src/f_op/f_op_overlap.cpp +++ b/src/f_op/f_op_overlap.cpp @@ -5,6 +5,7 @@ #include "f_op/f_op_overlap.h" #include "JSystem/JKernel/JKRExpHeap.h" +#include "d/d_error_msg.h" #include "f_pc/f_pc_manager.h" #include "m_Do/m_Do_ext.h" @@ -15,6 +16,9 @@ static s32 fopOvlp_Draw(void* i_this) { static s32 fopOvlp_Execute(void* i_this) { s32 ret = fpcMtd_Execute(&((overlap_task_class*)i_this)->submethod->base, i_this); +#if VERSION == VERSION_SHIELD || PLATFORM_WII + dConnectErrorMsg_c::disable(); +#endif return ret; } diff --git a/src/f_op/f_op_scene.cpp b/src/f_op/f_op_scene.cpp index 97a0124b09..304a734577 100644 --- a/src/f_op/f_op_scene.cpp +++ b/src/f_op/f_op_scene.cpp @@ -19,7 +19,8 @@ static int fopScn_Execute(scene_class* i_this) { } static int fopScn_IsDelete(void* i_this) { - return fpcMtd_IsDelete((process_method_class*)static_cast(i_this)->submethod, i_this); + int ret = fpcMtd_IsDelete((process_method_class*)((scene_class*) i_this)->submethod, i_this); + return ret; } static int fopScn_Delete(void* i_this) { @@ -53,7 +54,7 @@ static int fopScn_Create(void* i_this) { } - ret = fpcMtd_Create((process_method_class*)scene->submethod, i_this); + ret = fpcMtd_Create((process_method_class*)scene->submethod, scene); return ret; } diff --git a/src/f_op/f_op_scene_iter.cpp b/src/f_op/f_op_scene_iter.cpp index 69b2d61616..a21919a74e 100644 --- a/src/f_op/f_op_scene_iter.cpp +++ b/src/f_op/f_op_scene_iter.cpp @@ -8,6 +8,7 @@ #include "SSystem/SComponent/c_tag_iter.h" #include "f_op/f_op_scene_tag.h" +// Wii: NONMATCHING, regalloc, scheduling void* fopScnIt_Judge(fop_ScnItFunc i_judgeFunc, void* i_data) { struct { fop_ScnItFunc func; diff --git a/src/f_op/f_op_scene_req.cpp b/src/f_op/f_op_scene_req.cpp index d3136962ae..94aed7f3e8 100644 --- a/src/f_op/f_op_scene_req.cpp +++ b/src/f_op/f_op_scene_req.cpp @@ -18,6 +18,7 @@ static cPhs__Step fopScnRq_phase_ClearOverlap(scene_request_class* i_sceneReq) { rv = cPhs_INIT_e; } return rv; + UNUSED(i_sceneReq); } static cPhs__Step fopScnRq_phase_Execute(scene_request_class* i_sceneReq) { @@ -32,6 +33,7 @@ static cPhs__Step fopScnRq_phase_IsDoingOverlap(scene_request_class* i_sceneReq) rv = cPhs_INIT_e; } return rv; + UNUSED(i_sceneReq); } static cPhs__Step fopScnRq_phase_IsDoneOverlap(scene_request_class* i_sceneReq) { @@ -42,13 +44,16 @@ static cPhs__Step fopScnRq_phase_IsDoneOverlap(scene_request_class* i_sceneReq) rv = cPhs_INIT_e; } return rv; + UNUSED(i_sceneReq); } static BOOL l_fopScnRq_IsUsingOfOverlap; static cPhs__Step fopScnRq_phase_Done(scene_request_class* i_sceneReq) { + if (i_sceneReq->create_request.parameters != 1) { scene_class* scene = (scene_class*)fpcM_SearchByID(i_sceneReq->create_request.creating_id); + (void)scene; fopScnPause_Disable(scene); } @@ -56,16 +61,18 @@ static cPhs__Step fopScnRq_phase_Done(scene_request_class* i_sceneReq) { return cPhs_NEXT_e; } -static void fopScnRq_Execute(scene_request_class* i_sceneReq) { - int phase_state = cPhs_Do(&i_sceneReq->phase_request, i_sceneReq); +static cPhs__Step fopScnRq_Execute(scene_request_class* i_sceneReq) { + cPhs__Step phase_state = (cPhs__Step)cPhs_Do(&i_sceneReq->phase_request, i_sceneReq); switch (phase_state) { case cPhs_NEXT_e: - fopScnRq_Execute(i_sceneReq); + return fopScnRq_Execute(i_sceneReq); break; default: break; } + + return phase_state; } static int fopScnRq_PostMethod(void* i_scene, scene_request_class* i_sceneReq) { diff --git a/src/m_Do/m_Do_ext.cpp b/src/m_Do/m_Do_ext.cpp index 228bc9f29f..2a0794cc35 100644 --- a/src/m_Do/m_Do_ext.cpp +++ b/src/m_Do/m_Do_ext.cpp @@ -717,11 +717,7 @@ JKRExpHeap* mDoExt_getHostIOHeap() { return HostIOHeap; } -#if DEBUG -extern u8 lbl_8074C3B9[1]; -#endif - -static JKRSolidHeap* mDoExt_createSolidHeap(u32 i_size, JKRHeap* i_heap, u32 i_alignment) { +JKRSolidHeap* mDoExt_createSolidHeap(u32 i_size, JKRHeap* i_heap, u32 i_alignment) { if (i_heap == NULL) { i_heap = JKRGetCurrentHeap(); } @@ -729,7 +725,7 @@ static JKRSolidHeap* mDoExt_createSolidHeap(u32 i_size, JKRHeap* i_heap, u32 i_a JKRSolidHeap* createdHeap; if (i_size == 0 || i_size == -1) { #if DEBUG - if (lbl_8074C3B9[0] != 0) { + if (mDoExt::HeapAdjustVerbose != 0) { OS_REPORT("\x1b[44mmDoExt_createSolidHeap サイズ未設定\n\x1b[m"); OS_REPORT("最大空き容量確保します %08x\n\x1b[m", i_heap->getFreeSize()); } @@ -749,7 +745,7 @@ static JKRSolidHeap* mDoExt_createSolidHeap(u32 i_size, JKRHeap* i_heap, u32 i_a if (createdHeap != NULL) { JKRSetErrorFlag(createdHeap, true); #if DEBUG - if (lbl_8074C3B9[0] != 0) { + if (mDoExt::HeapAdjustVerbose != 0) { u32 heapSize = createdHeap->getHeapSize(); OS_REPORT( "JKRCreateSolidHeap %08x i_size=%08x solidHeapSize=%08x\n", @@ -841,7 +837,7 @@ u32 mDoExt_adjustSolidHeap(JKRSolidHeap* i_heap) { u32 actualSize = i_heap->getHeapSize(); #if DEBUG - if (lbl_8074C3B9[0]) { + if (mDoExt::HeapAdjustVerbose) { // "\x1B[33mSolid heap estimate: %08x actual: %08x\n\x1B[m" OS_REPORT("\x1B[33mソリッドヒープの見積もり %08x 実際 %08x\n\x1B[m", estimatedSize, actualSize); @@ -857,7 +853,7 @@ u32 mDoExt_adjustSolidHeap(JKRSolidHeap* i_heap) { } } - if (lbl_8074C3B9[0]) { + if (mDoExt::HeapAdjustVerbose) { OS_REPORT("JKRSolidHeap::adjustSize %08x (%08x bytes)\n", (u32)i_heap, result); } #endif diff --git a/src/m_Do/m_Do_hostIO.cpp b/src/m_Do/m_Do_hostIO.cpp index 7ee6a3653b..286a942110 100644 --- a/src/m_Do/m_Do_hostIO.cpp +++ b/src/m_Do/m_Do_hostIO.cpp @@ -128,10 +128,6 @@ void mDoHIO_updateChild(s8 i_no) { mDoHIO_root.updateChild(i_no); } -void mDoHIO_update() { - mDoHIO_root.update(); -} - void mDoHIO_root_c::updateChild(s8 i_no) { mSub.updateChild(i_no); }