From c277082c408cb1bcbeccb1ca97eff2abfa16d76c Mon Sep 17 00:00:00 2001 From: ItsNiklas Date: Thu, 18 Dec 2025 17:59:49 +0100 Subject: [PATCH] f_op debug 1 --- config/ShieldD/symbols.txt | 12 ++--- configure.py | 10 ++-- include/d/d_s_play.h | 2 +- include/f_op/f_op_actor.h | 1 + include/f_op/f_op_actor_tag.h | 2 +- include/f_pc/f_pc_manager.h | 11 +++- src/f_op/f_op_actor.cpp | 99 ++++++++++++++++++----------------- src/f_op/f_op_actor_tag.cpp | 5 +- src/f_op/f_op_camera.cpp | 27 ++++++++-- src/f_op/f_op_camera_mng.cpp | 2 - src/f_op/f_op_draw_iter.cpp | 8 +-- src/f_op/f_op_msg.cpp | 57 +++++++++++++------- src/f_op/f_op_overlap.cpp | 32 +++++++---- src/f_op/f_op_scene_pause.cpp | 2 +- src/f_pc/f_pc_manager.cpp | 1 + 15 files changed, 167 insertions(+), 104 deletions(-) diff --git a/config/ShieldD/symbols.txt b/config/ShieldD/symbols.txt index 508a7bf04ed..92c851fbae5 100644 --- a/config/ShieldD/symbols.txt +++ b/config/ShieldD/symbols.txt @@ -64102,7 +64102,7 @@ mDoMain_HIO = .sbss:0x8074C280; // type:object size:0x8 scope:global hash:0x5C34 @LOCAL@Debug_console__FUl@console_scroll@1 = .sbss:0x8074C288; // type:object size:0x4 scope:local align:4 data:float hash:0xBF7B851A dhash:0x7086F27F @LOCAL@main01__Fv@frame = .sbss:0x8074C28C; // type:object size:0x4 scope:local data:4byte hash:0xA8D047CF dhash:0x4B63C2BB instance__29JHIComPortManager<9JHICmnMem> = .sbss:0x8074C290; // type:object size:0x4 scope:global data:4byte hash:0x3E85C712 dhash:0x073E21A0 -lbl_8074C298 = .sbss:0x8074C298; // type:object size:0x1 data:byte hash:0xAA4B677C +print_initialized = .sbss:0x8074C298; // type:object size:0x1 data:byte hash:0xAA4B677C lbl_8074C299 = .sbss:0x8074C299; // type:object size:0x1 data:byte hash:0x732354FB lbl_8074C29A = .sbss:0x8074C29A; // type:object size:0x1 data:byte hash:0x192C6F69 lbl_8074C29B = .sbss:0x8074C29B; // type:object size:0x1 data:byte hash:0xD31C3E46 @@ -64255,9 +64255,9 @@ mCaptureScreenLineNum__11fapGm_HIO_c = .sbss:0x8074C490; // type:object size:0x2 lbl_8074C492 = .sbss:0x8074C492; // type:object size:0x1 data:byte hash:0x56EDE2EE dhash:0x36F65A0E lbl_8074C493 = .sbss:0x8074C493; // type:object size:0x1 data:byte hash:0xDA2ADA30 dhash:0x36F65A10 lbl_8074C494 = .sbss:0x8074C494; // type:object size:0x1 data:byte hash:0xA9B59EC0 dhash:0xA12DE4E0 -lbl_8074C498 = .sbss:0x8074C498; // type:object size:0x1 data:byte hash:0xE0AE7E09 dhash:0x4F24BEA1 -lbl_8074C499 = .sbss:0x8074C499; // type:object size:0x1 data:byte hash:0xC93122F6 dhash:0x62D5041E -lbl_8074C49A = .sbss:0x8074C49A; // type:object size:0x1 data:byte hash:0xB66ED925 dhash:0x722717CD +mPriorityMaximum__19print_error_check_c = .sbss:0x8074C498; // type:object size:0x1 data:byte hash:0xE0AE7E09 dhash:0x4F24BEA1 +mPrintDisable__19print_error_check_c = .sbss:0x8074C499; // type:object size:0x1 data:byte hash:0xC93122F6 dhash:0x62D5041E +mThresholdEnable__19print_error_check_c = .sbss:0x8074C49A; // type:object size:0x1 data:byte hash:0xB66ED925 dhash:0x722717CD @LOCAL@check__19print_error_check_cFv@l_name = .sbss:0x8074C4A0; // type:object size:0x8 scope:local hash:0x67D55231 dhash:0x02F8A364 @LOCAL@check__19print_error_check_cFv@l_name@0 = .sbss:0x8074C4A8; // type:object size:0x8 scope:local hash:0xB2729A01 dhash:0x02F8A364 g_fopAc_type = .sbss:0x8074C4B0; // type:object size:0x4 scope:global data:4byte hash:0x79729021 @@ -64625,9 +64625,9 @@ dylPreLoadTime1 = .sbss:0x8074CAB8; // type:object size:0x8 scope:global data:4b resPreLoadTime0 = .sbss:0x8074CAC0; // type:object size:0x8 scope:global data:4byte hash:0xA1124705 resPreLoadTime1 = .sbss:0x8074CAC8; // type:object size:0x8 scope:global data:4byte hash:0xA1124704 g_preLoadHIO = .sbss:0x8074CAD0; // type:object size:0x8 scope:global hash:0x2AE34DF2 -lbl_8074CAD8 = .sbss:0x8074CAD8; // type:object size:0x1 data:byte hash:0x2421530A dhash:0x54C04193 +pauseTimer__9dScnPly_c = .sbss:0x8074CAD8; // type:object size:0x1 data:byte hash:0x2421530A dhash:0x54C04193 lbl_8074CAD9 = .sbss:0x8074CAD9; // type:object size:0x1 data:byte hash:0x16684D2D dhash:0x100CD5B4 -lbl_8074CADA = .sbss:0x8074CADA; // type:object size:0x1 data:byte hash:0xA127BB3C dhash:0x6A3A8CA5 +nextPauseTimer__9dScnPly_c = .sbss:0x8074CADA; // type:object size:0x1 data:byte hash:0xA127BB3C dhash:0x6A3A8CA5 lbl_8074CADB = .sbss:0x8074CADB; // type:object size:0x1 data:byte hash:0x2EF7A134 l_pause = .sbss:0x8074CADC; // type:object size:0x4 scope:global data:4byte hash:0x57FF2104 l_pauseFrame = .sbss:0x8074CAE0; // type:object size:0x4 scope:global align:4 data:float hash:0x378D15B9 diff --git a/configure.py b/configure.py index d775928b809..509faa4255d 100755 --- a/configure.py +++ b/configure.py @@ -631,11 +631,11 @@ config.libs = [ # f_op Object(MatchingFor(ALL_GCN), "f_op/f_op_actor.cpp"), Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "f_op/f_op_actor_iter.cpp"), - Object(MatchingFor(ALL_GCN), "f_op/f_op_actor_tag.cpp"), - Object(MatchingFor(ALL_GCN), "f_op/f_op_camera.cpp"), + Object(MatchingFor(ALL_GCN, "ShieldD"), "f_op/f_op_actor_tag.cpp"), + Object(MatchingFor(ALL_GCN, "ShieldD"), "f_op/f_op_camera.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), "f_op/f_op_overlap.cpp"), + Object(MatchingFor(ALL_GCN, "ShieldD"), "f_op/f_op_overlap.cpp"), Object(MatchingFor(ALL_GCN), "f_op/f_op_overlap_mng.cpp"), Object(MatchingFor(ALL_GCN), "f_op/f_op_overlap_req.cpp"), Object(MatchingFor(ALL_GCN), "f_op/f_op_scene.cpp"), @@ -645,12 +645,12 @@ config.libs = [ Object(MatchingFor(ALL_GCN, "ShieldD"), "f_op/f_op_scene_tag.cpp"), Object(MatchingFor(ALL_GCN), "f_op/f_op_view.cpp"), Object(MatchingFor(ALL_GCN), "f_op/f_op_kankyo.cpp"), - Object(MatchingFor(ALL_GCN), "f_op/f_op_msg.cpp"), + Object(MatchingFor(ALL_GCN), "f_op/f_op_msg.cpp"), # ShieldD fopMsg::MemCheck Object(MatchingFor(ALL_GCN), "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, "Shield", "ShieldD"), "f_op/f_op_draw_tag.cpp"), - Object(MatchingFor(ALL_GCN, "Shield"), "f_op/f_op_scene_pause.cpp"), + Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "f_op/f_op_scene_pause.cpp"), # f_pc Object(MatchingFor(ALL_GCN), "f_pc/f_pc_base.cpp"), diff --git a/include/d/d_s_play.h b/include/d/d_s_play.h index 8c2c03c615e..a29f9807093 100644 --- a/include/d/d_s_play.h +++ b/include/d/d_s_play.h @@ -68,7 +68,7 @@ public: bool resetGame(); void offReset(); - static bool isPause() { return pauseTimer == 0; } + static s8 isPause() { return pauseTimer | nextPauseTimer; } static void setPauseTimer(s8 time) { nextPauseTimer = time; } static s8 pauseTimer; diff --git a/include/f_op/f_op_actor.h b/include/f_op/f_op_actor.h index 648196b8703..88d877fc5c2 100644 --- a/include/f_op/f_op_actor.h +++ b/include/f_op/f_op_actor.h @@ -275,6 +275,7 @@ public: fopAc_ac_c(); ~fopAc_ac_c(); + static u32 getStopStatus() { return stopStatus; } static void setStopStatus(u32 status) { stopStatus = status; } static u32 stopStatus; diff --git a/include/f_op/f_op_actor_tag.h b/include/f_op/f_op_actor_tag.h index dbda5276a0d..a354178a8be 100644 --- a/include/f_op/f_op_actor_tag.h +++ b/include/f_op/f_op_actor_tag.h @@ -3,7 +3,7 @@ #include "SSystem/SComponent/c_tag.h" -int fopAcTg_ActorQTo(create_tag_class* i_createTag); +void fopAcTg_ActorQTo(create_tag_class* i_createTag); int fopAcTg_Init(create_tag_class* i_createTag, void* i_data); int fopAcTg_ToActorQ(create_tag_class* i_createTag); diff --git a/include/f_pc/f_pc_manager.h b/include/f_pc/f_pc_manager.h index 21505588275..f2399a39b63 100644 --- a/include/f_pc/f_pc_manager.h +++ b/include/f_pc/f_pc_manager.h @@ -1,6 +1,7 @@ #ifndef F_PC_MANAGER_H_ #define F_PC_MANAGER_H_ +#include "f_op/f_op_scene.h" #include "f_pc/f_pc_create_iter.h" #include "f_pc/f_pc_executor.h" #include "f_pc/f_pc_leaf.h" @@ -41,7 +42,7 @@ inline fpc_ProcID fpcM_Create(s16 i_procName, FastCreateReqFunc i_createFunc, vo i_append); } -inline s16 fpcM_DrawPriority(const void* i_process) { +inline s32 fpcM_DrawPriority(const void* i_process) { return (s16)fpcLf_GetPriority((const leafdraw_class*)i_process); } @@ -49,6 +50,10 @@ inline s32 fpcM_ChangeLayerID(void* i_process, int i_layerID) { return fpcPi_Change(&((base_process_class*)i_process)->priority, i_layerID, 0xFFFD, 0xFFFD); } +inline s32 fpcM_MakeOfType(int* i_type) { + return fpcBs_MakeOfType(i_type); +} + inline BOOL fpcM_IsJustType(int i_typeA, int i_typeB) { return fpcBs_Is_JustOfType(i_typeA, i_typeB); } @@ -85,6 +90,10 @@ inline base_process_class* fpcM_SearchByID(fpc_ProcID i_id) { return fpcEx_SearchByID(i_id); } +inline process_node_class* fpcM_Layer(void* i_process) { + return ((base_process_class*)i_process)->layer_tag.layer->process_node; +} + void fpcM_Draw(void* i_process); s32 fpcM_DrawIterater(fpcM_DrawIteraterFunc i_drawIterFunc); s32 fpcM_Execute(void* i_process); diff --git a/src/f_op/f_op_actor.cpp b/src/f_op/f_op_actor.cpp index 7fa86e9728c..84162c8622b 100644 --- a/src/f_op/f_op_actor.cpp +++ b/src/f_op/f_op_actor.cpp @@ -6,8 +6,8 @@ #include "d/dolzel.h" // IWYU pragma: keep #include "d/actor/d_a_alink.h" +#include "d/actor/d_a_suspend.h" #include "d/d_com_inf_actor.h" -#include "d/d_com_static.h" #include "d/d_demo.h" #include "d/d_s_play.h" #include "f_ap/f_ap_game.h" @@ -242,7 +242,7 @@ static int fopAc_Draw(void* i_this) { if (!dComIfGp_isPauseFlag()) { int var_r28 = dComIfGp_event_moveApproval(actor); - if ((var_r28 == 2 || (!fopAcM_CheckStatus(actor, fopAc_ac_c::stopStatus) && + if ((var_r28 == 2 || (!fopAcM_CheckStatus(actor, fopAc_ac_c::getStopStatus()) && (!fopAcM_CheckStatus(actor, fopAcStts_CULL_e) || !fopAcM_cullingCheck(actor)))) && !fopAcM_CheckStatus(actor, 0x21000000)) { @@ -315,54 +315,52 @@ static int fopAc_Execute(void* i_this) { JUT_ASSERT(685, -1.0e32f < actor->current.pos.x && actor->current.pos.x < 1.0e32f && -1.0e32f < actor->current.pos.y && actor->current.pos.y < 1.0e32f && -1.0e32f < actor->current.pos.z && actor->current.pos.z < 1.0e32f); #endif - if (!dComIfGp_isPauseFlag() && dScnPly_c::isPause()) { - if (!dComIfA_PauseCheck()) { - daSus_c::check(actor); - actor->eventInfo.beforeProc(); - s32 move = dComIfGp_event_moveApproval(i_this); - fopAcM_OffStatus(actor, 0x40000000); + if (!dComIfGp_isPauseFlag() && !dScnPly_c::isPause() && !dComIfA_PauseCheck()) { + daSus_c::check(actor); + actor->eventInfo.beforeProc(); + s32 move = dComIfGp_event_moveApproval(actor); + fopAcM_OffStatus(actor, 0x40000000); - if (!fopAcM_CheckStatus(actor, 0x20000000) && - (move == 2 || - (move != 0 && !fopAcM_CheckStatus(actor, fopAc_ac_c::stopStatus) && - (!fopAcM_CheckStatus(actor, fopAcStts_NOEXEC_e) || !fopAcM_CheckCondition(actor, fopAcCnd_NODRAW_e))))) + if (!fopAcM_CheckStatus(actor, 0x20000000) && + (move == 2 || + (move != 0 && !fopAcM_CheckStatus(actor, fopAc_ac_c::getStopStatus()) && + (!fopAcM_CheckStatus(actor, fopAcStts_NOEXEC_e) || !fopAcM_CheckCondition(actor, fopAcCnd_NODRAW_e))))) + { + fopAcM_OffCondition(actor, fopAcCnd_NOEXEC_e); + actor->old = actor->current; + + #if DEBUG { - fopAcM_OffCondition(actor, fopAcCnd_NOEXEC_e); - actor->old = actor->current; + print_error_check_c error_check(actor, print_error_check_c::sEXECUTE); + #endif - #if DEBUG - { - print_error_check_c error_check(actor, print_error_check_c::sEXECUTE); - #endif + ret = fpcMtd_Execute((process_method_class*)actor->sub_method, actor); - ret = fpcMtd_Execute((process_method_class*)actor->sub_method, actor); - - #if DEBUG - } - #endif - } else { - actor->eventInfo.suspendProc(actor); - fopAcM_OnCondition(actor, fopAcCnd_NOEXEC_e); + #if DEBUG } - - if (fopAcM_CheckStatus(actor, 0x20) && - actor->home.pos.y - actor->current.pos.y > 5000.0f) - { - fopAcM_delete(actor); - } - - JUT_ASSERT(750, !isnan(actor->current.pos.x)); - JUT_ASSERT(751, !isnan(actor->current.pos.y)); - JUT_ASSERT(752, !isnan(actor->current.pos.z)); - - if (actor->current.pos.y < -1e31f) { - actor->current.pos.y = -1e31f; - } - - JUT_ASSERT(762, -1.0e32f < actor->current.pos.x && actor->current.pos.x < 1.0e32f && -1.0e32f < actor->current.pos.y && actor->current.pos.y < 1.0e32f && -1.0e32f < actor->current.pos.z && actor->current.pos.z < 1.0e32f); - - dKy_depth_dist_set(actor); + #endif + } else { + actor->eventInfo.suspendProc(actor); + fopAcM_OnCondition(actor, fopAcCnd_NOEXEC_e); } + + if (fopAcM_CheckStatus(actor, 0x20) && + actor->home.pos.y - actor->current.pos.y > 5000.0f) + { + fopAcM_delete(actor); + } + + JUT_ASSERT(750, !isnan(actor->current.pos.x)); + JUT_ASSERT(751, !isnan(actor->current.pos.y)); + JUT_ASSERT(752, !isnan(actor->current.pos.z)); + + if (actor->current.pos.y < -1e31f) { + actor->current.pos.y = -1e31f; + } + + JUT_ASSERT(762, -1.0e32f < actor->current.pos.x && actor->current.pos.x < 1.0e32f && -1.0e32f < actor->current.pos.y && actor->current.pos.y < 1.0e32f && -1.0e32f < actor->current.pos.z && actor->current.pos.z < 1.0e32f); + + dKy_depth_dist_set(actor); } #if DEBUG @@ -400,7 +398,7 @@ static int fopAc_IsDelete(void* i_this) { static int fopAc_Delete(void* i_this) { fopAc_ac_c* actor = (fopAc_ac_c*)i_this; - int ret; + int ret = FALSE; #if DEBUG { @@ -416,7 +414,7 @@ static int fopAc_Delete(void* i_this) { if (ret == TRUE) { fopAcTg_ActorQTo(&actor->actor_tag); fopDwTg_DrawQTo(&actor->draw_tag); - fopAcM_DeleteHeap(actor); + fopAcM_DeleteHeap((fopAc_ac_c*) i_this); dDemo_actor_c* demoAc = dDemo_c::getActor(actor->demoActorID); if (demoAc != NULL) { @@ -442,7 +440,7 @@ static int fopAc_Create(void* i_this) { if (fpcM_IsFirstCreating(i_this)) { actor_process_profile_definition* profile = (actor_process_profile_definition*)fpcM_GetProfile(i_this); - actor->actor_type = fpcBs_MakeOfType(&g_fopAc_type); + actor->actor_type = fpcM_MakeOfType(&g_fopAc_type); actor->sub_method = (profile_method_class*)profile->sub_method; fopAcTg_Init(&actor->actor_tag, actor); @@ -506,16 +504,18 @@ static int fopAc_Create(void* i_this) { } if (filelist != NULL) { + u8 sw; if (!dStage_FileList_dt_GetEnemyAppear1Flag(filelist)) { - u8 sw = dStage_FileList_dt_GetBitSw(filelist); + sw = dStage_FileList_dt_GetBitSw(filelist); if (sw != 0xFF && dComIfGs_isSwitch(sw, actor->home.roomNo) && profile->group == fopAc_ENEMY_e) { OS_WARNING("f_op_actor.cpp マップツール設定により敵グループは削除されました!\n"); return cPhs_ERROR_e; } + goto end_check; // Need immediate jump } else { - u8 sw = dStage_FileList_dt_GetBitSw(filelist); + sw = dStage_FileList_dt_GetBitSw(filelist); if (sw != 0xFF && !dComIfGs_isSwitch(sw, actor->home.roomNo) && profile->group == fopAc_ENEMY_e) { @@ -526,6 +526,7 @@ static int fopAc_Create(void* i_this) { } } +end_check: #if DEBUG { print_error_check_c error_check(actor, print_error_check_c::sCREATE); diff --git a/src/f_op/f_op_actor_tag.cpp b/src/f_op/f_op_actor_tag.cpp index b4a95012e5a..5e2e31e5623 100644 --- a/src/f_op/f_op_actor_tag.cpp +++ b/src/f_op/f_op_actor_tag.cpp @@ -12,8 +12,9 @@ int fopAcTg_ToActorQ(create_tag_class* i_createTag) { return cTg_Addition(&g_fopAcTg_Queue, i_createTag); } -int fopAcTg_ActorQTo(create_tag_class* i_createTag) { - return cTg_SingleCutFromTree(i_createTag); +void fopAcTg_ActorQTo(create_tag_class* i_createTag) { + int _ = cTg_SingleCutFromTree(i_createTag); + return; } int fopAcTg_Init(create_tag_class* i_createTag, void* i_data) { diff --git a/src/f_op/f_op_camera.cpp b/src/f_op/f_op_camera.cpp index 3d17f6d4fac..37f7bfd784c 100644 --- a/src/f_op/f_op_camera.cpp +++ b/src/f_op/f_op_camera.cpp @@ -5,26 +5,42 @@ #include "f_op/f_op_camera.h" #include "f_op/f_op_camera_mng.h" +#include "f_ap/f_ap_game.h" #include "d/d_com_inf_game.h" #include "d/d_s_play.h" #include "f_op/f_op_draw_tag.h" static s32 fopCam_Draw(camera_class* i_this) { s32 ret = 1; + #if DEBUG + fapGm_HIO_c::startCpuTimer(); + #endif + if (!dComIfGp_isPauseFlag()) { ret = fpcLf_DrawMethod(i_this->submethod, i_this); } + #if DEBUG + fapGm_HIO_c::stopCpuTimer("カメラ(描画処理)"); // Camera (rendering process) + #endif + return ret; } static int fopCam_Execute(camera_class* i_this) { int ret; + #if DEBUG + fapGm_HIO_c::startCpuTimer(); + #endif - if (!dComIfGp_isPauseFlag() && dScnPly_c::isPause()) { + if (!dComIfGp_isPauseFlag() && !dScnPly_c::isPause()) { ret = fpcMtd_Execute((process_method_class*)i_this->submethod, i_this); } + #if DEBUG + fapGm_HIO_c::stopCpuTimer("カメラ(計算処理)"); // Camera (computational processing) + #endif + return ret; } @@ -38,7 +54,8 @@ int fopCam_IsDelete(camera_class* i_this) { } int fopCam_Delete(camera_class* i_this) { - int ret = fpcMtd_Delete((process_method_class*)i_this->submethod, i_this); + int ret = 0; + ret = fpcMtd_Delete((process_method_class*)i_this->submethod, i_this); if (ret == 1) { fopDwTg_DrawQTo(&i_this->create_tag); } @@ -47,6 +64,7 @@ int fopCam_Delete(camera_class* i_this) { } static int fopCam_Create(void* i_this) { + int ret; camera_class* a_this = (camera_class*)i_this; if (fpcM_IsFirstCreating(i_this)) { @@ -61,10 +79,9 @@ static int fopCam_Create(void* i_this) { } } - int ret = fpcMtd_Create(&a_this->submethod->base, a_this); + ret = fpcMtd_Create(&a_this->submethod->base, a_this); if (ret == cPhs_COMPLEATE_e) { - s32 priority = fpcM_DrawPriority(a_this); - fopDwTg_ToDrawQ(&a_this->create_tag, priority); + fopDwTg_ToDrawQ(&a_this->create_tag, fpcM_DrawPriority(a_this)); } return ret; diff --git a/src/f_op/f_op_camera_mng.cpp b/src/f_op/f_op_camera_mng.cpp index ea40325226c..8d8ffc03e70 100644 --- a/src/f_op/f_op_camera_mng.cpp +++ b/src/f_op/f_op_camera_mng.cpp @@ -4,8 +4,6 @@ */ #include "f_op/f_op_camera_mng.h" -#include "f_pc/f_pc_layer.h" -#include "f_pc/f_pc_stdcreate_req.h" static fpc_ProcID l_fopCamM_id[4]; diff --git a/src/f_op/f_op_draw_iter.cpp b/src/f_op/f_op_draw_iter.cpp index 8f9150acfa9..de1805762a6 100644 --- a/src/f_op/f_op_draw_iter.cpp +++ b/src/f_op/f_op_draw_iter.cpp @@ -12,8 +12,8 @@ static int l_fopDwTg_id; create_tag_class* fopDwIt_GetTag() { while (l_fopDwTg_id + 1 < g_fopDwTg_Queue.mNumLists) { - l_fopDwTg_id++; - node_class* node = g_fopDwTg_Queue.mpLists[l_fopDwTg_id].mpHead; + node_list_class* list = &g_fopDwTg_Queue.mpLists[++l_fopDwTg_id]; + node_class* node = list->mpHead; if (node != NULL) { return (create_tag_class*)node; @@ -30,13 +30,13 @@ create_tag_class* fopDwIt_Begin() { if (tag != NULL) { return tag; } - return tag = fopDwIt_GetTag(); + return fopDwIt_GetTag(); } create_tag_class* fopDwIt_Next(create_tag_class* i_createTag) { create_tag_class* tag = (create_tag_class*)i_createTag->mpNode.mpNextNode; if (tag == NULL) { - tag = fopDwIt_GetTag(); + return fopDwIt_GetTag(); } return tag; } diff --git a/src/f_op/f_op_msg.cpp b/src/f_op/f_op_msg.cpp index 4b9ad8afe6f..8bd113b43c0 100644 --- a/src/f_op/f_op_msg.cpp +++ b/src/f_op/f_op_msg.cpp @@ -5,32 +5,52 @@ #include "f_op/f_op_msg.h" #include "d/d_s_play.h" +#include "f_ap/f_ap_game.h" #include "f_op/f_op_draw_tag.h" #include "f_op/f_op_msg_mng.h" #include "f_pc/f_pc_manager.h" +#include "m_Do/m_Do_machine.h" static int fopMsg_Draw(void* i_this) { - msg_class* a_this = (msg_class*)i_this; - return fpcLf_DrawMethod(a_this->sub_method, i_this); +#if DEBUG + fapGm_HIO_c::startCpuTimer(); +#endif + s32 ret = fpcLf_DrawMethod(((msg_class*)i_this)->sub_method, i_this); +#if DEBUG + fapGm_HIO_c::stopCpuTimer("2D関係(描画処理)"); // 2D graphics (rendering) +#endif + return ret; } static int fopMsg_Execute(void* i_this) { msg_class* a_this = (msg_class*)i_this; - int ret = 1; - if (dScnPly_c::isPause()) { - ret = fpcMtd_Execute(&a_this->sub_method->base, i_this); +#if DEBUG + fapGm_HIO_c::startCpuTimer(); +#endif + if (!dScnPly_c::isPause()) { +#if DEBUG + if (fopMsg::MemCheck) { + mDoMch_HeapCheckAll(); + } +#endif + ret = fpcMtd_Execute(&((msg_class*)i_this)->sub_method->base, i_this); +#if DEBUG + if (fopMsg::MemCheck) { + mDoMch_HeapCheckAll(); + } +#endif } - +#if DEBUG + fapGm_HIO_c::stopCpuTimer("2D関係(計算処理)"); // 2D graphics (computational processing) +#endif return ret; } static int fopMsg_IsDelete(void* i_this) { - msg_class* a_this = (msg_class*)i_this; - - int ret = fpcMtd_IsDelete(&a_this->sub_method->base, i_this); + int ret = fpcMtd_IsDelete(&((msg_class*)i_this)->sub_method->base, i_this); if (ret == 1) { - fopDwTg_DrawQTo(&a_this->draw_tag); + fopDwTg_DrawQTo(&((msg_class*)i_this)->draw_tag); } return ret; @@ -39,7 +59,7 @@ static int fopMsg_IsDelete(void* i_this) { static int fopMsg_Delete(void* i_this) { msg_class* a_this = (msg_class*)i_this; - int ret = fpcMtd_Delete(&a_this->sub_method->base, i_this); + int ret = fpcMtd_Delete(&((msg_class*)i_this)->sub_method->base, i_this); fopDwTg_DrawQTo(&a_this->draw_tag); return ret; @@ -52,13 +72,15 @@ u8 fopMsg::MemCheck; static int fopMsg_MSG_TYPE; int fopMsg_Create(void* i_this) { + int ret; msg_class* a_this = (msg_class*)i_this; - if (fpcM_IsFirstCreating(a_this)) { - msg_process_profile_definition* profile = (msg_process_profile_definition*)fpcM_GetProfile(i_this); - a_this->type = fpcBs_MakeOfType(&fopMsg_MSG_TYPE); + if (fpcM_IsFirstCreating(i_this)) { + msg_process_profile_definition* profile = + (msg_process_profile_definition*)fpcM_GetProfile(i_this); + a_this->type = fpcM_MakeOfType(&fopMsg_MSG_TYPE); a_this->sub_method = profile->sub_method; - + fopDwTg_Init(&a_this->draw_tag, a_this); fopMsg_prm_class* append = fopMsgM_GetAppend(a_this); @@ -71,10 +93,9 @@ int fopMsg_Create(void* i_this) { } } - int ret = fpcMtd_Create(&a_this->sub_method->base, a_this); + ret = fpcMtd_Create(&a_this->sub_method->base, a_this); if (ret == cPhs_COMPLEATE_e) { - s32 priority = fpcM_DrawPriority(a_this); - fopDwTg_ToDrawQ(&a_this->draw_tag, priority); + fopDwTg_ToDrawQ(&a_this->draw_tag, fpcM_DrawPriority(a_this)); } return ret; diff --git a/src/f_op/f_op_overlap.cpp b/src/f_op/f_op_overlap.cpp index 6625931ac99..557e9bda085 100644 --- a/src/f_op/f_op_overlap.cpp +++ b/src/f_op/f_op_overlap.cpp @@ -4,26 +4,34 @@ */ #include "f_op/f_op_overlap.h" +#include "JSystem/JKernel/JKRExpHeap.h" #include "f_pc/f_pc_manager.h" +#include "m_Do/m_Do_ext.h" static s32 fopOvlp_Draw(void* i_this) { - overlap_task_class* a_this = (overlap_task_class*)i_this; - return fpcLf_DrawMethod(a_this->submethod, i_this); + s32 ret = fpcLf_DrawMethod(((overlap_task_class*)i_this)->submethod, i_this); + return ret; } static s32 fopOvlp_Execute(void* i_this) { - overlap_task_class* a_this = (overlap_task_class*)i_this; - return fpcMtd_Execute(&a_this->submethod->base, i_this); + s32 ret = fpcMtd_Execute(&((overlap_task_class*)i_this)->submethod->base, i_this); + return ret; } static s32 fopOvlp_IsDelete(void* i_this) { - overlap_task_class* a_this = (overlap_task_class*)i_this; - return fpcMtd_IsDelete(&a_this->submethod->base, i_this); + s32 ret = fpcMtd_IsDelete(&((overlap_task_class*)i_this)->submethod->base, i_this); + return ret; } static s32 fopOvlp_Delete(void* i_this) { - overlap_task_class* a_this = (overlap_task_class*)i_this; - return fpcMtd_Delete(&a_this->submethod->base, i_this); + s32 ret = 0; + ret = fpcMtd_Delete(&((overlap_task_class*)i_this)->submethod->base, i_this); +#if DEBUG + if (ret == 1 && mDoExt_getSafeZeldaHeapSize() >= 0) { + mDoExt_addSafeZeldaHeapSize(mDoExt_getZeldaHeap()->getSize(i_this)); + } +#endif + return ret; } static s32 fopOvlp_Create(void* i_this) { @@ -36,9 +44,15 @@ static s32 fopOvlp_Create(void* i_this) { cReq_Create(&a_this->request, 1); a_this->submethod = profile->sub_method; a_this->scene_id = fpcM_ERROR_PROCESS_ID_e; +#if DEBUG + if (mDoExt_getSafeZeldaHeapSize() >= 0) { + mDoExt_addSafeZeldaHeapSize(-mDoExt_getZeldaHeap()->getSize(i_this)); + } +#endif } - return fpcMtd_Create(&a_this->submethod->base, a_this); + s32 ret = fpcMtd_Create(&a_this->submethod->base, a_this); + return ret; } leafdraw_method_class g_fopOvlp_Method = { diff --git a/src/f_op/f_op_scene_pause.cpp b/src/f_op/f_op_scene_pause.cpp index 3628f188e8f..db980671439 100644 --- a/src/f_op/f_op_scene_pause.cpp +++ b/src/f_op/f_op_scene_pause.cpp @@ -19,7 +19,7 @@ int fopScnPause_Enable(scene_class* i_scene) { int fopScnPause_Disable(scene_class* i_scene) { if (i_scene != NULL) { - process_node_class* process_node = i_scene->base.base.layer_tag.layer->process_node; + process_node_class* process_node = fpcM_Layer(i_scene); if (process_node == NULL) { fpcM_PauseDisable(i_scene, 1); diff --git a/src/f_pc/f_pc_manager.cpp b/src/f_pc/f_pc_manager.cpp index 4e49170d594..a6acd65848c 100644 --- a/src/f_pc/f_pc_manager.cpp +++ b/src/f_pc/f_pc_manager.cpp @@ -7,6 +7,7 @@ #include "SSystem/SComponent/c_API_graphic.h" #include "d/d_error_msg.h" #include "d/d_lib.h" +#include "f_op/f_op_scene.h" #include "f_pc/f_pc_creator.h" #include "f_pc/f_pc_deletor.h" #include "f_pc/f_pc_draw.h"