Regalloc/debug/misc fixes (#2794)

* Fix "0" asserts

* More debug and regalloc fixes

* Fix PTMF syntax for compatibility with other compilers

* Fix some fakematches, link more TUs for J/P
This commit is contained in:
LagoLunatic
2025-11-10 18:25:00 -08:00
committed by GitHub
parent a02f72d8f3
commit 23a1c94063
87 changed files with 314 additions and 607 deletions
+1
View File
@@ -133,6 +133,7 @@ hioInit = .bss:0x00000048; // type:object size:0x1 data:byte
@3933 = .bss:0x0000004C; // type:object size:0xC scope:local
l_HIO = .bss:0x00000058; // type:object size:0x1C scope:global data:byte
@4275 = .bss:0x00000074; // type:object size:0xC scope:local
init$2218 = .bss:0x00000080; // type:object size:0x1 scope:local align:1
sc$4274 = .bss:0x00000084; // type:object size:0xC scope:local
sInstance__40JASGlobalInstance<19JASDefaultBankTable> = .bss:0x00000090; // type:object size:0x4 scope:global
sInstance__35JASGlobalInstance<14JASAudioThread> = .bss:0x00000094; // type:object size:0x4 scope:global
@@ -419,6 +419,7 @@ __global_destructor_chain = .bss:0x00000000; // type:object size:0x4 scope:globa
@4083 = .bss:0x00000048; // type:object size:0xC scope:local
l_HIO = .bss:0x00000054; // type:object size:0x4 scope:global data:4byte
@5080 = .bss:0x00000058; // type:object size:0xC scope:local
init$2720 = .bss:0x00000064; // type:object size:0x1 scope:local
eyeOffset$5079 = .bss:0x00000068; // type:object size:0xC scope:local
sInstance__40JASGlobalInstance<19JASDefaultBankTable> = .bss:0x00000074; // type:object size:0x4 scope:global
sInstance__35JASGlobalInstance<14JASAudioThread> = .bss:0x00000078; // type:object size:0x4 scope:global
+7 -7
View File
@@ -1777,7 +1777,7 @@ config.libs = [
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_e_ot"),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_e_ph"),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_e_pm"),
ActorRel(MatchingFor("GZ2E01"), "d_a_e_po"),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_e_po"),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_e_pz"),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_e_rb"),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_e_rdb"),
@@ -1861,7 +1861,7 @@ config.libs = [
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_npc_fairy"),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_npc_fguard"),
ActorRel(NonMatching, "d_a_npc_gnd"),
ActorRel(MatchingFor("GZ2E01"), "d_a_npc_gra", extra_cflags=[DANPCF_C_HACK]),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_npc_gra", extra_cflags=[DANPCF_C_HACK]),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_npc_grc", extra_cflags=[DANPCF_C_HACK]),
ActorRel(NonMatching, "d_a_npc_grd"),
ActorRel(NonMatching, "d_a_npc_grm"),
@@ -1948,7 +1948,7 @@ config.libs = [
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_npc_zelda"),
ActorRel(Equivalent, "d_a_npc_zra", extra_cflags=[DANPCF_C_HACK]), # weak func order
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_npc_zrc", extra_cflags=[DANPCF_C_HACK]),
ActorRel(MatchingFor("GZ2E01"), "d_a_npc_zrz", extra_cflags=[DANPCF_C_HACK]),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_npc_zrz", extra_cflags=[DANPCF_C_HACK]),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_Lv5Key"),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_Turara"),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_TvCdlst"),
@@ -2016,10 +2016,10 @@ config.libs = [
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_gb"),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_geyser"),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_glowSphere"),
ActorRel(MatchingFor("GZ2E01"), "d_a_obj_gm"),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_gm"),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_goGate"),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_gomikabe"),
ActorRel(MatchingFor("GZ2E01"), "d_a_obj_gra2"),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_gra2"),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_graWall"),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_gra_rock"),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_grave_stone"),
@@ -2148,7 +2148,7 @@ config.libs = [
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_pdoor"),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_pdtile"),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_pdwall"),
ActorRel(MatchingFor("GZ2E01"), "d_a_obj_picture"),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_picture"),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_pillar"),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_pleaf"),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_poCandle"),
@@ -2240,7 +2240,7 @@ config.libs = [
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_waterfall"),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_wchain"),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_wdStick"),
ActorRel(MatchingFor("GZ2E01"), "d_a_obj_web0"),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_web0"),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_web1"),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_well_cover"),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_wflag"),
+3 -3
View File
@@ -564,7 +564,7 @@ struct J2DColorChanInfo {
/* 0x0 */ u8 field_0x3;
};
inline u8 J2DCalcColorChanID(const J2DColorChanInfo& info) { return info.field_0x1; }
inline u16 J2DCalcColorChanID(u8 param_0) { return param_0; }
extern const J2DColorChanInfo j2dDefaultColorChanInfo;
/**
@@ -577,11 +577,11 @@ public:
setColorChanInfo(j2dDefaultColorChanInfo);
}
J2DColorChan(const J2DColorChanInfo& info) {
mColorChan = J2DCalcColorChanID(info);
mColorChan = J2DCalcColorChanID(info.field_0x1);
}
void setColorChanInfo(const J2DColorChanInfo& info) {
mColorChan = J2DCalcColorChanID(info);
mColorChan = J2DCalcColorChanID(info.field_0x1);
}
u16 getMatSrc() const { return mColorChan & 1; }
+1 -1
View File
@@ -215,7 +215,7 @@ public:
chunk = chunk->getNextChunk();
}
JUT_PANIC(362,"Cannnot free for JASMemChunkPool")
JUT_PANIC(362, "Cannnot free for JASMemChunkPool");
}
/* 0x18 */ MemoryChunk* field_0x18;
+1 -1
View File
@@ -89,7 +89,7 @@ private:
/* 0x5BC */ u8 field_0x5bc[0x5DC - 0x5BC];
/* 0x5DC */ u8 mDoorAction;
/* 0x5E0 */ dPath* mpPath;
/* 0x5E4 */ cXyz mPoint;
/* 0x5E4 */ Vec mPoint;
/* 0x5F0 */ u8 mPathIndex;
/* 0x5F4 */ int mPointIndex;
/* 0x5F8 */ u8 mBossHealth;
-15
View File
@@ -10,9 +10,6 @@ class J3DModelData;
class dBgW;
struct fs_weed_s {
/* 8086FED8 */ ~fs_weed_s();
/* 8086FF38 */ fs_weed_s();
/* 0x00 */ cXyz field_0x00[15];
/* 0xB4 */ f32 field_0xb4;
/* 0xB8 */ f32 field_0xb8;
@@ -20,9 +17,6 @@ struct fs_weed_s {
};
struct fs_tsubo_s {
/* 8086FE98 */ ~fs_tsubo_s();
/* 8086FED4 */ fs_tsubo_s();
/* 0x00 */ cXyz field_0x00;
/* 0x0C */ u8 field_0x0c[0x14 - 0x0c];
/* 0x14 */ J3DModel* field_0x14;
@@ -34,9 +28,6 @@ struct fs_tsubo_s {
};
struct fs_rod_s {
/* 8086FF84 */ ~fs_rod_s();
/* 8086FFC0 */ fs_rod_s();
/* 0x00 */ cXyz field_0x00;
/* 0x0C */ u8 field_0x0C[0x14 - 0x0C];
/* 0x14 */ J3DModel* field_0x14;
@@ -49,9 +40,6 @@ struct fs_rod_s {
};
struct fs_lure_s {
/* 8086FFDC */ ~fs_lure_s();
/* 80870018 */ fs_lure_s();
/* 0x00 */ cXyz field_0x00;
/* 0x0C */ s16 field_0x0c;
/* 0x0E */ s16 field_0x0e;
@@ -72,9 +60,6 @@ struct fs_lure_s {
};
struct fs_koro2_s {
/* 8086FD78 */ ~fs_koro2_s();
/* 8086FDB4 */ fs_koro2_s();
/* 0x00 */ J3DModel* mpModel;
/* 0x04 */ Mtx field_0x04;
/* 0x34 */ s8 field_0x34;
+1 -1
View File
@@ -1112,7 +1112,7 @@ public:
struct daNpcF_anmPlayData {
u16 idx;
f32 morf;
s32 numLoops;
int numLoops;
};
enum AnmFlags {
+1 -1
View File
@@ -195,7 +195,7 @@ public:
return true;
}
void doNormalAction() {
void doNormalAction(int) {
mOrderEvtNo = 0;
if (mpNextActionFn != NULL) {
if (mpNextActionFn == mpActionFn) {
+1 -1
View File
@@ -244,7 +244,7 @@ public:
break;
default:
OS_REPORT("%s: Line.%d arg=%d\n", "d_a_passer_mng.cpp", 1049, param_1);
JUT_PANIC(1050, 0);
JUT_ASSERT(1050, FALSE);
break;
}
return paramLow << 8;
+1
View File
@@ -273,6 +273,7 @@ public:
class dEvDtFlag_c {
public:
dEvDtFlag_c() {}
~dEvDtFlag_c() {}
BOOL flagCheck(int flag);
BOOL flagSet(int flag);
BOOL flagMaxCheck(int flag);
+1
View File
@@ -10,6 +10,7 @@ class fopAc_ac_c;
class dEvent_exception_c {
public:
dEvent_exception_c() { mEventInfoIdx = -1; }
~dEvent_exception_c() {}
void init();
int setStartDemo(int mapToolID);
const char* getEventName();
+1 -4
View File
@@ -831,10 +831,7 @@ public:
/* 0x2DB */ u8 door_light_influence_ratio;
/* 0x2DC */ s16 unk_light_influence_ratio;
/* 0x2DE */ u8 fish_pond_colreg_adjust_ON;
/* 0x2E0 */ s16 fish_pond_colreg_c0_R;
/* 0x2E2 */ s16 fish_pond_colreg_c0_G;
/* 0x2E4 */ s16 fish_pond_colreg_c0_B;
/* 0x2E6 */ u8 field_0x2E6[0x2E8 - 0x2E6];
/* 0x2E0 */ GXColorS10 fish_pond_colreg_c0;
/* 0x2E8 */ u8 water_mud_adjust_ON;
/* 0x2EA */ s16 field_0x2ea;
/* 0x2EC */ s16 field_0x2ec;
+2 -2
View File
@@ -180,7 +180,7 @@ public:
void setArchiveName(char* name) { mArchiveName = name; }
u8 getMapToolId() { return mMapToolId; }
s16 getEventId() { return mEventId; }
s16 getIdx() { return mIndex; }
s16 getIdx() { return (s8)mIndex; }
void setIdx(u8 i_idx) { mIndex = i_idx; }
char* getArchiveName() { return mArchiveName; }
BOOL chkCondition(u16 condition) { return (mCondition & condition) == condition; }
@@ -195,7 +195,7 @@ public:
/* 0x06 */ u16 mCondition;
/* 0x08 */ s16 mEventId;
/* 0x0A */ u8 mMapToolId;
/* 0x0B */ s8 mIndex;
/* 0x0B */ u8 mIndex;
/* 0x0C */ char* mArchiveName;
/* 0x10 */ u8 field_0x10;
/* 0x14 */ void (*field_0x14)(void*);
+1 -1
View File
@@ -1661,7 +1661,7 @@ int daAlink_c::procCutTurnInit(int param_0, int param_1) {
if (param_0) {
var_f31 = cutData->mRightTurnInputStartFrame;
} else {
var_f31 = cutData->mRightTurnAnm.mStartFrame;
var_f31 = anm_data->mStartFrame;
}
field_0x3484 = cutData->mRightAttackStartFrame;
+6 -3
View File
@@ -1303,7 +1303,7 @@ void daB_DS_c::executeOpeningDemo() {
mMode++;
}
break;
case 2:
case 2: {
f32 calc_center = cLib_addCalcPos(&mCameraCenter, mOpCenterDt[1], 0.3f, 2.0f, 1.0f);
f32 calc_eye = cLib_addCalcPos(&mCameraEye, mOpEyeDt[1], 0.3f, 2.0f, 1.0f);
if (calc_center > 2.0f || calc_eye > 2.0f || cLib_calcTimer(&mModeTimer) != 0) {
@@ -1323,6 +1323,7 @@ void daB_DS_c::executeOpeningDemo() {
fopAcM_OffStatus(this, 0x4000);
mMode++;
// fallthrough
}
case 3:
mPedestalFallTimer = l_HIO.mPedestalFallTime;
@@ -1519,7 +1520,7 @@ void daB_DS_c::executeOpeningDemo() {
dComIfGp_getVibration().StartShock(4, 0x1f, cXyz(0.0f, 1.0f, 0.0f));
mMode++;
// fallthrough
case 26:
case 26: {
if (!field_0x85e && mpZantMorf->isStop()) {
mpZantMorf->setAnm(static_cast<J3DAnmTransform*>(dComIfG_getObjectRes("B_DS", 67)),
J3DFrameCtrl::EMode_LOOP, 1.0f, 1.0f, 0.0f, -1.0f);
@@ -1562,6 +1563,7 @@ void daB_DS_c::executeOpeningDemo() {
mMode = 30;
field_0x85e = false;
// fallthrough
}
case 30:
mCameraCenter.set(mOpCenterDt[12]);
mCameraEye.set(mOpEyeDt[12]);
@@ -2325,7 +2327,7 @@ void daB_DS_c::executeDamage() {
mMode = 100;
mSound.startCreatureSound(Z2SE_EN_DS_MDEMO_FALL, 0, -1);
// fallthrough
case 100:
case 100: {
gravity = -0.2f;
if (current.pos.y > -1600.0f) {
if (current.pos.y <= -300.0f) {
@@ -2346,6 +2348,7 @@ void daB_DS_c::executeDamage() {
&p2_angle, NULL, 0xff);
mMode = 101;
// fallthrough
}
case 101:
cLib_addCalc2(&mCameraCenter.y, down_center_dt[4].y, 0.7f, 10.0f);
cLib_addCalc2(&mCameraEye.y, down_eye_dt[4].y, 0.7f, 10.0f);
-2
View File
@@ -444,7 +444,6 @@ void daBalloon2D_c::setComboAlpha() {
}
/* 80654730-80654E8C 001350 075C+00 1/1 0/0 0/0 .text drawAddScore__13daBalloon2D_cFv */
// NONMATCHING - field_0x0.x, regalloc
void daBalloon2D_c::drawAddScore() {
for (s32 i = 19; i >= 0; i--) {
if (field_0x5f8[i].field_0xe != 0) {
@@ -591,7 +590,6 @@ void daBalloon2D_HIO_c::resetAddScoreSetFlag() {
}
/* 80655250-80655304 001E70 00B4+00 1/0 0/0 0/0 .text daBalloon2D_create__FP13daBalloon2D_c */
// NONMATCHING - vtable
static int daBalloon2D_create(daBalloon2D_c* i_this) {
fopAcM_ct(i_this, daBalloon2D_c);
return i_this->create();
+7
View File
@@ -408,6 +408,13 @@ int daBg_c::draw() {
break;
}
#ifdef DEBUG
s16 sp56 = 0xFF;
if (g_kankyoHIO.navy.fish_pond_colreg_adjust_ON) {
sp50 = g_kankyoHIO.navy.fish_pond_colreg_c0;
}
#endif
f32 var_f31 = bgPart->tevstr->AmbCol.r / 10.0f;
var_f31 *= var_f31;
if (var_f31 > 1.0f) {
+4 -5
View File
@@ -131,7 +131,6 @@ u8* daBgObj_c::spec_data_c::initFarInfoBlock(u8* i_dataPtr) {
/* 80459904-80459B64 000324 0260+00 1/1 0/0 1/1 .text Set__Q29daBgObj_c11spec_data_cFPv
*/
// NONMATCHING - close-ish
bool daBgObj_c::spec_data_c::Set(void* i_ptr) {
JUT_ASSERT(496, i_ptr != NULL);
@@ -160,7 +159,7 @@ bool daBgObj_c::spec_data_c::Set(void* i_ptr) {
default:
// Invalid data block type
OS_REPORT_ERROR("データブロックタイプが不正です<%d>\n", block_type);
JUT_PANIC(527, "0");
JUT_ASSERT(527, FALSE);
}
if (block_type == 0) {
@@ -201,7 +200,7 @@ bool daBgObj_c::spec_data_c::Set(void* i_ptr) {
default:
// Invalid data block type
OS_REPORT_ERROR("データブロックタイプが不正です<%d>\n", block_type);
JUT_PANIC(570, "0");
JUT_ASSERT(570, FALSE);
}
if (block_type == 0) {
@@ -242,7 +241,7 @@ bool daBgObj_c::spec_data_c::Set(void* i_ptr) {
default:
// "Data Block type invalid<%d>\n"
OSReport_Error("データブロックタイプが不正です<%d>\n", block_type);
JUT_PANIC(619, "0");
JUT_ASSERT(619, FALSE);
break;
}
@@ -980,7 +979,7 @@ void daBgObj_c::setParticle() {
default:
// Multi MoveBG: Particle model number is invalid <%d>
OS_REPORT_ERROR("マルチMoveBG:パーティクルモデル番号が不正<%d>\n", modelNumber);
JUT_PANIC(1689, "0");
JUT_ASSERT(1689, FALSE);
break;
}
JPABaseEmitter* emitter = dComIfGp_particle_set(
+2 -3
View File
@@ -932,7 +932,6 @@ void daBoomerang_c::setEffect() {
}
/* 804A0874-804A0F0C 002834 0698+00 2/0 0/0 0/0 .text procWait__13daBoomerang_cFv */
// NONMATCHING - small regalloc
int daBoomerang_c::procWait() {
daAlink_c* player = daAlink_getAlinkActorClass();
speedF = 0.0f;
@@ -973,7 +972,7 @@ int daBoomerang_c::procWait() {
offStateFlg0(FLG0_10);
}
current.angle.y += 0x1830;
current.angle.y += (s16)0x1830;
shape_angle.x = current.angle.x;
shape_angle.y = current.angle.y;
shape_angle.z = 0x1000;
@@ -993,7 +992,7 @@ int daBoomerang_c::procWait() {
procMove();
} else if (dCam_getBody()->Mode() != 8) {
if (dComIfGp_checkPlayerStatus0(0, 0x80000) && player->getAtnActor() != NULL && m_lockCnt < BOOMERANG_LOCK_MAX) {
fpc_ProcID atn_actor_id = fopAcM_GetID(player->getAtnActor());
fpc_ProcID atn_actor_id = (fpc_ProcID)fopAcM_GetID(player->getAtnActor());
int var_r27 = 0;
while (var_r27 < m_lockCnt) {

Some files were not shown because too many files have changed in this diff Show More