Fix more fakematches

This commit is contained in:
LagoLunatic 2025-12-23 17:51:27 -05:00
parent 3572d6c3f2
commit 0c8fef1bbb
15 changed files with 27 additions and 47 deletions

View File

@ -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 {

View File

@ -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"

View File

@ -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);
}

View File

@ -1740,8 +1740,12 @@ void daKago_c::initPerchDemo() {
}
cXyz cStack_54 = dPath_GetPnt(mpPath2, local_80)->m_position;
s16 temp = (s16)sVar5 - cLib_targetAngleY(&current.pos, &cStack_48);
sVar5 = temp < 0 ? (s16)((s16)sVar5 - 0x1000) : (s16)((s16)sVar5 + 0x1000); // fakematch
s16 sp08 = cLib_targetAngleY(&current.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;

View File

@ -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;
}

View File

@ -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);

View File

@ -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();
}

View File

@ -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);

View File

@ -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);

View File

@ -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()) {

View File

@ -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;

View File

@ -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();

View File

@ -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;
}

View File

@ -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;

View File

@ -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);