From 0c8fef1bbbf3acabbb87d064774cccdee925c5a8 Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Tue, 23 Dec 2025 17:51:27 -0500 Subject: [PATCH] Fix more fakematches --- include/d/d_com_inf_game.h | 2 +- include/d/d_menu_fmap.h | 1 + include/d/d_meter2_info.h | 10 +--------- src/d/actor/d_a_kago.cpp | 8 ++++++-- src/d/actor/d_a_npc2.cpp | 7 +------ src/d/actor/d_a_obj_table.cpp | 2 +- src/d/actor/d_a_obj_volcbom.cpp | 10 ++++------ src/d/actor/d_a_tag_Lv6Gate.cpp | 4 ++-- src/d/actor/d_a_tag_Lv7Gate.cpp | 4 ++-- src/d/actor/d_a_tag_lantern.cpp | 3 ++- src/d/actor/d_a_tag_msg.cpp | 3 ++- src/d/actor/d_a_vrbox2.cpp | 2 +- src/d/d_attention.cpp | 10 +--------- src/d/d_camera.cpp | 3 +-- src/d/d_menu_fmap.cpp | 5 +---- 15 files changed, 27 insertions(+), 47 deletions(-) diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index 388e2d6a4df..df64a28249d 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -840,7 +840,7 @@ public: ~dComIfG_inf_c() {} void ct(); void createBaseCsr(); - dComIfG_play_c& getPlay() { return play; } + dComIfG_play_c& getPlay() { return play; } // fake inline #if PLATFORM_WII || VERSION == VERSION_SHIELD_DEBUG class baseCsr_c : public mDoGph_gInf_c::csr_c { diff --git a/include/d/d_menu_fmap.h b/include/d/d_menu_fmap.h index bd95772c598..2b450aa577d 100644 --- a/include/d/d_menu_fmap.h +++ b/include/d/d_menu_fmap.h @@ -1,6 +1,7 @@ #ifndef D_MENU_D_MENU_FMAP_H #define D_MENU_D_MENU_FMAP_H +#include "JSystem/JHostIO/JORReflexible.h" #include "SSystem/SComponent/c_xyz.h" #include "d/d_menu_map_common.h" #include "d/d_msg_flow.h" diff --git a/include/d/d_meter2_info.h b/include/d/d_meter2_info.h index 45f165341b6..4738c7faf6e 100644 --- a/include/d/d_meter2_info.h +++ b/include/d/d_meter2_info.h @@ -124,10 +124,7 @@ public: void resetPauseStatus() { mPauseStatus = 0; } u8 getPauseStatus() { return mPauseStatus; } bool isGameStatus(int i_status) { return (mGameStatus & (u16)i_status) != 0 ? true : false; } - bool isTouchKeyCheck(int i_status) { return mTouchKeyCheck & (1 << i_status); } - - // fake function, should be isTouchKeyCheck - bool isTouchKeyCheck_alt(int i_status) { return (mTouchKeyCheck >> i_status) & 1; } + bool isTouchKeyCheck(int i_status) { return mTouchKeyCheck & (u16)(1 << i_status) ? true : false; } void setMapKeyDirection(u16 i_direction) { mMapKeyDirection = i_direction; } bool isSub2DStatus(int i_flag) { return (mSub2DStatus & (u16)(1 << i_flag)) != 0 ? true : false; } @@ -486,11 +483,6 @@ inline bool dMeter2Info_isTouchKeyCheck(int i_status) { return g_meter2_info.isTouchKeyCheck(i_status); } -// fake function, should be dMeter2Info_isTouchKeyCheck -inline bool dMeter2Info_isTouchKeyCheck_alt(int i_status) { - return g_meter2_info.isTouchKeyCheck_alt(i_status); -} - inline void dMeter2Info_setMapKeyDirection(u16 i_direction) { g_meter2_info.setMapKeyDirection(i_direction); } diff --git a/src/d/actor/d_a_kago.cpp b/src/d/actor/d_a_kago.cpp index 35d9653073b..494f85bd724 100644 --- a/src/d/actor/d_a_kago.cpp +++ b/src/d/actor/d_a_kago.cpp @@ -1740,8 +1740,12 @@ void daKago_c::initPerchDemo() { } cXyz cStack_54 = dPath_GetPnt(mpPath2, local_80)->m_position; - s16 temp = (s16)sVar5 - cLib_targetAngleY(¤t.pos, &cStack_48); - sVar5 = temp < 0 ? (s16)((s16)sVar5 - 0x1000) : (s16)((s16)sVar5 + 0x1000); // fakematch + s16 sp08 = cLib_targetAngleY(¤t.pos, &cStack_48); + if ((s16)(sVar5 - sp08) < 0) { + sVar5 = sVar5 - 0x1000; + } else { + sVar5 = sVar5 + 0x1000; + } shape_angle.y = current.angle.y = sVar5; shape_angle.x = shape_angle.z = 0; diff --git a/src/d/actor/d_a_npc2.cpp b/src/d/actor/d_a_npc2.cpp index 59023245d85..6f5b85bc0f6 100644 --- a/src/d/actor/d_a_npc2.cpp +++ b/src/d/actor/d_a_npc2.cpp @@ -263,12 +263,7 @@ void daBaseNpc_lookat_c::limitter(s16 i_value, s16* o_value_p, s16 i_max, s16 i_ } if (i_min < i_value) { - //TODO: fakematch -#if VERSION == VERSION_SHIELD_DEBUG - *o_value_p -= tmp - i_min; -#else - *o_value_p -= tmp - (s16)i_min; -#endif + *o_value_p = *o_value_p - (tmp - i_min); return; } diff --git a/src/d/actor/d_a_obj_table.cpp b/src/d/actor/d_a_obj_table.cpp index a791d369e11..fdd92a010a4 100644 --- a/src/d/actor/d_a_obj_table.cpp +++ b/src/d/actor/d_a_obj_table.cpp @@ -144,7 +144,7 @@ int daObjTable_c::Execute(Mtx** i_mtx) { if (dComIfGp_event_runCheck()) { if (eventInfo.checkCommandTalk()) { if (mMsgFlow.doFlow(this, NULL, 0) != 0) { - gameInfo.getPlay().getEvent().reset(this); // Fake match? + gameInfo.play.getEvent().reset(this); // Fake match? eventInfo.setArchiveName("Table"); dComIfGp_getEventManager().setObjectArchive(eventInfo.getArchiveName()); mEventID = dComIfGp_getEventManager().getEventIdx(this, "TABLE_MAP", -1); diff --git a/src/d/actor/d_a_obj_volcbom.cpp b/src/d/actor/d_a_obj_volcbom.cpp index 18e59f8150d..7711aefa25b 100644 --- a/src/d/actor/d_a_obj_volcbom.cpp +++ b/src/d/actor/d_a_obj_volcbom.cpp @@ -598,15 +598,13 @@ void daObjVolcBom_c::actionWait() { } daMidna_c* midna = daPy_py_c::getMidnaActor(); - daPy_py_c* player = (daPy_py_c*)daPy_getPlayerActorClass(); + daPy_py_c* player = daPy_getPlayerActorClass(); - // Probably fake match since ebug calls different manager functions - dEvent_manager_c& evtMgr = g_dComIfG_gameInfo.play.getEvtManager(); - if (evtMgr.startCheck(mEventId)) { - if (strcmp(evtMgr.getRunEventName(), "PORTAL_WARP_BIGVOLC") == 0) { + if (dComIfGp_evmng_startCheck(mEventId)) { + if (strcmp(dComIfGp_getEventManager().getRunEventName(), "PORTAL_WARP_BIGVOLC") == 0) { player->onWarpObjDemo(); dComIfGp_getEvent().setPt2(this); - mStaffId = evtMgr.getMyStaffId(l_staff_name, 0, 0); + mStaffId = dComIfGp_evmng_getMyStaffId(l_staff_name, 0, 0); setAction(ACTION_WARP_EVENT); demoProc(); } diff --git a/src/d/actor/d_a_tag_Lv6Gate.cpp b/src/d/actor/d_a_tag_Lv6Gate.cpp index b93814ea842..d2b2b729a58 100644 --- a/src/d/actor/d_a_tag_Lv6Gate.cpp +++ b/src/d/actor/d_a_tag_Lv6Gate.cpp @@ -116,8 +116,8 @@ inline bool daTagLv6Gate_c::checkOpenArea() { } inline int daTagLv6Gate_c::execute() { - dComIfG_inf_c& game_info = g_dComIfG_gameInfo; // Fake match? - + // TODO: gameInfo fake match to force reuse of pointer + dComIfG_inf_c& game_info = g_dComIfG_gameInfo; if (game_info.getPlay().getEvent().runCheck() && !eventInfo.checkCommandTalk()) { dEvent_manager_c& eventManager = dComIfGp_getEventManager(); s32 cut_index = eventManager.getMyStaffId(l_arcName, NULL, 0); diff --git a/src/d/actor/d_a_tag_Lv7Gate.cpp b/src/d/actor/d_a_tag_Lv7Gate.cpp index 8d216db3cee..4ef355cc28d 100644 --- a/src/d/actor/d_a_tag_Lv7Gate.cpp +++ b/src/d/actor/d_a_tag_Lv7Gate.cpp @@ -218,8 +218,8 @@ void daTagLv7Gate_c::flyAnime() { } int daTagLv7Gate_c::execute() { - // Fakematch - dComIfG_play_c& play = g_dComIfG_gameInfo.getPlay(); + // TODO: gameInfo fake match to force reuse of pointer + dComIfG_play_c& play = g_dComIfG_gameInfo.play; if (dComIfGp_event_runCheck() != 0 && !eventInfo.checkCommandTalk()) { dEvent_manager_c& evtMgr = dComIfGp_getEventManager(); s32 cut_index = evtMgr.getMyStaffId(l_arcName, NULL, 0); diff --git a/src/d/actor/d_a_tag_lantern.cpp b/src/d/actor/d_a_tag_lantern.cpp index c01e2a0dd3a..e04fe2ecd35 100644 --- a/src/d/actor/d_a_tag_lantern.cpp +++ b/src/d/actor/d_a_tag_lantern.cpp @@ -22,7 +22,8 @@ int daTag_Lantern_c::Delete() { } int daTag_Lantern_c::Execute() { - dComIfG_play_c& play = g_dComIfG_gameInfo.getPlay(); // fake match + // TODO: gameInfo fake match to force reuse of pointer + dComIfG_play_c& play = g_dComIfG_gameInfo.play; if (dComIfGp_event_runCheck()) { if (eventInfo.checkCommandTalk()) { diff --git a/src/d/actor/d_a_tag_msg.cpp b/src/d/actor/d_a_tag_msg.cpp index 486719cb97e..25e2469c8ea 100644 --- a/src/d/actor/d_a_tag_msg.cpp +++ b/src/d/actor/d_a_tag_msg.cpp @@ -66,7 +66,8 @@ int daTag_Msg_c::execute() { eyePos.set(current.pos.x, current.pos.y + 150.0f, current.pos.z); attention_info.position = eyePos; - dComIfG_play_c& play = g_dComIfG_gameInfo.play; // FAKE, event inlines need to be fixed + // TODO: gameInfo fake match to force reuse of pointer + dComIfG_play_c& play = g_dComIfG_gameInfo.play; if (play.getEvent().runCheck()) { set_event = false; diff --git a/src/d/actor/d_a_vrbox2.cpp b/src/d/actor/d_a_vrbox2.cpp index 4793e5b0d8b..94cd1510de1 100644 --- a/src/d/actor/d_a_vrbox2.cpp +++ b/src/d/actor/d_a_vrbox2.cpp @@ -386,7 +386,7 @@ static int daVrbox2_color_set(vrbox2_class* i_this) { } static int daVrbox2_Execute(vrbox2_class* i_this) { - i_this = i_this; // ?? fakematch? only needed for debug + UNUSED(i_this); if (g_env_light.daytime > 255.0f) { i_this->mSunBtk.play(); diff --git a/src/d/d_attention.cpp b/src/d/d_attention.cpp index d41cef2b19f..96f5d0ad69a 100644 --- a/src/d/d_attention.cpp +++ b/src/d/d_attention.cpp @@ -1761,17 +1761,9 @@ void dAttCatch_c::proc() { mCatchItemNo = fpcNm_ITEM_WATER_BOTTLE; } -// FAKEMATCH: this fixes regalloc in `dAttCatch_c::request` but breaks most other calls -// some more accurate fix should be found eventually -inline fopAc_ac_c* dComIfGp_getPlayer_fakematch(int idx) { - daAlink_c* const link = (daAlink_c* const)g_dComIfG_gameInfo.play.getPlayer(idx); - fopAc_ac_c* player = (fopAc_ac_c*)link; - return player; -} - int dAttCatch_c::request(fopAc_ac_c* i_reqActor, u8 i_itemNo, f32 i_horizontalDist, f32 i_upDist, f32 i_downDist, s16 i_angle, int param_7) { - fopAc_ac_c* player = (fopAc_ac_c*)dComIfGp_getPlayer_fakematch(0); + fopAc_ac_c* player = dComIfGp_getPlayer(0); if (param_7 > field_0x4) { return 0; } diff --git a/src/d/d_camera.cpp b/src/d/d_camera.cpp index de6ce1101df..9425cfdde48 100644 --- a/src/d/d_camera.cpp +++ b/src/d/d_camera.cpp @@ -720,8 +720,7 @@ void dCamera_c::initPad() { mHoldY = mDoCPd_c::getHoldY(mPadID) ? true : false; mTrigY = mDoCPd_c::getTrigY(mPadID) ? true : false; - // fakematch (doesn't match in debug) - mHoldZ = (u8)mDoCPd_c::getHoldZ(mPadID) ? true : false; + mHoldZ = mDoCPd_c::getHoldZ(mPadID) ? true : false; mTrigZ = mDoCPd_c::getTrigZ(mPadID) ? true : false; field_0x21f = 0; diff --git a/src/d/d_menu_fmap.cpp b/src/d/d_menu_fmap.cpp index bfe946f7266..649df3039f1 100644 --- a/src/d/d_menu_fmap.cpp +++ b/src/d/d_menu_fmap.cpp @@ -1383,12 +1383,9 @@ void dMenu_Fmap_c::portal_demo5_init() { void dMenu_Fmap_c::portal_demo5_move() { mpStick->checkTrigger(); - // fakematch: the call to the fake inline function dMeter2Info_isTouchKeyCheck_alt - // should actually call dMeter2Info_isTouchKeyCheck, but for some reason the generated asm - // is different from every other call to dMeter2Info_isTouchKeyCheck if (dMw_B_TRIGGER() || dMw_Z_TRIGGER() || dMw_START_TRIGGER() || dMw_UP_TRIGGER() || dMw_DOWN_TRIGGER() || dMw_LEFT_TRIGGER() || dMw_RIGHT_TRIGGER() - || dMeter2Info_isTouchKeyCheck_alt(0xc)) + || dMeter2Info_isTouchKeyCheck(0xc)) { dMsgObject_setTalkHeap(mpTalkHeap); fopMsgM_messageSet(2015, 1000);