Realmatch dStage_roomControl_c's static weak functions

This commit is contained in:
LagoLunatic
2024-02-03 16:23:18 -05:00
parent 74f571ff97
commit 2103305ac9
7 changed files with 17 additions and 45 deletions
+2 -2
View File
@@ -344,7 +344,7 @@ config.libs = [
Object(Matching, "d/d_com_lib_game.cpp"),
Object(NonMatching, "d/d_com_static.cpp"),
Object(NonMatching, "d/d_lib.cpp"),
Object(Matching, "d/d_save.cpp"),
Object(Matching, "d/d_save.cpp", extra_cflags=['-pragma "nosyminline on"']),
Object(Matching, "d/d_save_init.cpp"),
Object(Matching, "d/d_shop.cpp", extra_cflags=['-pragma "nosyminline on"']),
Object(Matching, "d/d_jnt_hit.cpp"),
@@ -489,7 +489,7 @@ config.libs = [
Object(Matching, "d/d_s_open.cpp"),
Object(NonMatching, "d/d_s_open_sub.cpp"),
Object(Matching, "d/d_s_play.cpp", extra_cflags=['-pragma "nosyminline on"']),
Object(Matching, "d/d_s_room.cpp"),
Object(Matching, "d/d_s_room.cpp", extra_cflags=['-pragma "nosyminline on"']),
Object(Matching, "d/d_s_title.cpp"),
Object(NonMatching, "d/d_scope.cpp"),
Object(Matching, "d/d_throwstone.cpp"),
+3 -3
View File
@@ -1791,7 +1791,7 @@ inline int dComIfGp_roomControl_getStayNo() {
}
inline dBgW* dComIfGp_roomControl_getBgW(int i_roomNo) {
return dStage_roomControl_c::getBgW(i_roomNo);
return g_dComIfG_gameInfo.play.getRoomControl()->getBgW(i_roomNo);
}
inline void dComIfGp_roomControl_setBgW(int i_roomNo, dBgW * i_bgw) {
@@ -1799,11 +1799,11 @@ inline void dComIfGp_roomControl_setBgW(int i_roomNo, dBgW * i_bgw) {
}
inline s32 dComIfGp_roomControl_getZoneNo(int i_roomNo) {
return dStage_roomControl_c::getZoneNo(i_roomNo);
return g_dComIfG_gameInfo.play.getRoomControl()->getZoneNo(i_roomNo);
}
inline void dComIfGp_roomControl_setZoneNo(int i_roomNo, int i_zoneNo) {
dStage_roomControl_c::setZoneNo(i_roomNo, i_zoneNo);
g_dComIfG_gameInfo.play.getRoomControl()->setZoneNo(i_roomNo, i_zoneNo);
}
inline dKy_tevstr_c* dComIfGp_roomControl_getTevStr(int room_no) {
+9 -9
View File
@@ -849,7 +849,12 @@ public:
void checkDrawArea() const;
dStage_darkStatus_c* getDarkStatus();
u32 getDarkMode();
static dBgW* getBgW(int i_roomNo);// { return mStatus[i_roomNo].mpBgW; }
dKy_tevstr_c* getTevStr(int i_roomNo) { return &mStatus[i_roomNo].mTevStr; }
BOOL checkStatusFlag(int i_roomNo, u8 flag) const { return cLib_checkBit(mStatus[i_roomNo].mFlags, flag); }
void offStatusFlag(int i_roomNo, u8 flag) { cLib_offBit(mStatus[i_roomNo].mFlags, flag); }
void onStatusFlag(int i_roomNo, u8 flag) { cLib_onBit(mStatus[i_roomNo].mFlags, flag); }
void setStatusFlag(int i_roomNo, u8 flag) { mStatus[i_roomNo].mFlags = flag; }
static JKRExpHeap* createMemoryBlock(int, u32);
static void destroyMemoryBlock();
@@ -857,14 +862,12 @@ public:
static JKRExpHeap* getMemoryBlock(int);
static void setStayNo(int);
static s32 GetTimePass();
static void setZoneNo(int i_roomNo, int i_zoneNo);// { mStatus[i_roomNo].mZoneNo = i_zoneNo; }
static int getZoneNo(int i_roomNo);// { return mStatus[i_roomNo].mZoneNo; }
static void setZoneNo(int i_roomNo, int i_zoneNo) { mStatus[i_roomNo].mZoneNo = i_zoneNo; }
static int getZoneNo(int i_roomNo) { return mStatus[i_roomNo].mZoneNo; }
static void setZoneCount(int i_roomNo, int count) { mStatus[i_roomNo].mZoneCount = count; }
static s8 getStayNo() { return mStayNo; }
static s8 getMemoryBlockID(int i_roomNo) { return mStatus[i_roomNo].mMemBlockID; }
dKy_tevstr_c* getTevStr(int i_roomNo) { return &mStatus[i_roomNo].mTevStr; }
void setStatusFlag(int i_roomNo, u8 flag) { mStatus[i_roomNo].mFlags = flag; }
static void onStatusDraw(int i_roomNo) { mStatus[i_roomNo].mDraw = true; }
static void setProcID(u32 id) { mProcID = id; }
static u32 getProcID() { return mProcID; }
@@ -879,12 +882,9 @@ public:
mStatus[i_roomNo].mMemBlockID = i_blockID;
}
static dBgW* getBgW(int i_roomNo) { return mStatus[i_roomNo].mpBgW; }
static void setBgW(int i_roomNo, dBgW* i_bgw) { mStatus[i_roomNo].mpBgW = i_bgw; }
BOOL checkStatusFlag(int i_roomNo, u8 flag) const { return cLib_checkBit(mStatus[i_roomNo].mFlags, flag); }
void offStatusFlag(int i_roomNo, u8 flag) { cLib_offBit(mStatus[i_roomNo].mFlags, flag); }
void onStatusFlag(int i_roomNo, u8 flag) { cLib_onBit(mStatus[i_roomNo].mFlags, flag); }
static JKRExpHeap* mMemoryBlock[16];
static dStage_roomStatus_c mStatus[64];
static dStage_darkStatus_c mDarkStatus[8];
+1 -1
View File
@@ -973,7 +973,7 @@ BOOL daArrow_c::procStop_BG() {
field_0x6a0--;
if (field_0x6a0 < 60) {
// This matches but probably isn't what they actually wrote.
// Fakematch
u32 signBit = ((u32)field_0x6a0)>>31;
if ((((field_0x6a0&1) ^ signBit) - signBit) == 0) {
field_0x698 = false;
-15
View File
@@ -463,18 +463,3 @@ static void dummy2() {
OSReport("\033[43;30m**************************************\ndBgS_ObjAcch::copy constructer called.\n**************************************\n\033[m");
dBgS_ObjAcch acch; // fakematch to get dBgS_ObjAcch's vtable and destructor to show up in this TU
}
// TODO: Figure out what's going on with dStage_roomControl_c's weak functions. This is a fakematch.
// dStage_roomControl_c::getBgW is supposed to be a weak function defined in d_stage.h, but putting it in the class body
// makes it inline, and putting it outside the class body causes it to be included in every TU that includes d_stage.h.
// It should only appear in d_bg_s_acch, but putting it in d_bg_s_acch.cpp would normally screw up the order of weak
// functions in this TU because of the `-sym on` compiler flag.
// This can be fixed by putting the function in a fake separate file and including it in only this TU.
// But in this case we simulate this by using the #line directive's second argument to force the filename for this one
// function to be different from the other functions in this file. This tricks `-sym on` into splitting it into its own
// .text section, and the weak function order winds up being correct.
#line 1 "d_stage.h"
/* 800A4434-800A444C .text getBgW__20dStage_roomControl_cFi */
dBgW* dStage_roomControl_c::getBgW(int i_roomNo) {
return mStatus[i_roomNo].mpBgW;
}
+2 -9
View File
@@ -161,8 +161,7 @@ BOOL dScnRoom_Delete(room_of_scene_class* i_this) {
/* 80236D24-80236D58 .text phase_0__FP19room_of_scene_class */
s32 phase_0(room_of_scene_class* i_this) {
s32 roomNo = fopScnM_GetParam(i_this);
// g_dComIfG_gameInfo.play.getRoomControl()->setStatusProcID(roomNo, fopScnM_GetID(i_this));
g_dComIfG_gameInfo.play.getRoomControl()->mStatus[roomNo].mProcID = fopScnM_GetID(i_this);
dStage_roomControl_c::setStatusProcID(roomNo, fopScnM_GetID(i_this));
return cPhs_NEXT_e;
}
@@ -200,7 +199,7 @@ s32 phase_2(room_of_scene_class* i_this) {
s32 zoneNo = dComIfGp_roomControl_getZoneNo(roomNo);
if (zoneNo < 0) {
zoneNo = dComIfGs_createZone(roomNo);
dComIfGp_roomControl_setZoneNo(roomNo, zoneNo); // this isn't getting inlined for some reason
dComIfGp_roomControl_setZoneNo(roomNo, zoneNo);
}
i_this->mpRoomDt = dComIfGp_roomControl_getStatusRoomDt(roomNo);
@@ -235,12 +234,6 @@ s32 phase_2(room_of_scene_class* i_this) {
return cPhs_NEXT_e;
}
// TODO: Not sure why this weak function doesn't get inlined.
/* 802370A0-802370B8 .text setZoneNo__20dStage_roomControl_cFii */
void dStage_roomControl_c::setZoneNo(int i_roomNo, int i_zoneNo) {
mStatus[i_roomNo].mZoneNo = i_zoneNo;
}
/* 802370B8-802371D0 .text phase_3__FP19room_of_scene_class */
s32 phase_3(room_of_scene_class* i_this) {
if (dStage_roomControl_c::getDemoArcName()[0] != '\0') {
-6
View File
@@ -1485,12 +1485,6 @@ void dSv_info_c::onSwitch(int i_no, int i_roomNo) {
}
}
// TODO: Not sure why this weak function doesn't get inlined.
/* 8005DCD0-8005DCEC .text getZoneNo__20dStage_roomControl_cFi */
int dStage_roomControl_c::getZoneNo(int i_roomNo) {
return mStatus[i_roomNo].mZoneNo;
}
/* 8005DCEC-8005DE98 .text offSwitch__10dSv_info_cFii */
void dSv_info_c::offSwitch(int i_no, int i_roomNo) {
JUT_ASSERT(VERSION_SELECT(3421, 3448, 3448),