d_s_room / d_s_name / d_a_title debug work (#3123)

* d_s_room / d_s_name debug work

* camera_class rtti fix

* d_a_title debug / handle shield rel changes

* fix shield build

* fix regressions
This commit is contained in:
TakaRikka
2026-03-06 22:30:25 -08:00
committed by GitHub
parent a2b179f952
commit 8e2545f2ec
140 changed files with 1293 additions and 1042 deletions
+182 -117
View File
@@ -11,147 +11,177 @@
#include "d/d_s_room.h"
#include "d/d_bg_parts.h"
#include "m_Do/m_Do_Reset.h"
#include "f_ap/f_ap_game.h"
#include <cstdio>
#include <cstring>
static int dScnRoom_Draw(room_of_scene_class* i_this) {
fpc_ProcID id = fpcM_GetID(i_this);
return 1;
}
static int getResetArchiveBank(int param_1, u8 const** param_2) {
dStage_roomControl_c::nameData* arcBankName = dStage_roomControl_c::getArcBankName();
int local_30 = 0;
static int getResetArchiveBank(int i_roomNo, const u8** o_bankIDList) {
dStage_roomControl_c::dStage_bankName* arcBankName = dStage_roomControl_c::getArcBankName();
int bankNum = 0;
*o_bankIDList = NULL;
*param_2 = NULL;
if (arcBankName != NULL) {
dStage_roomControl_c::bankData* arcBankData = dStage_roomControl_c::getArcBankData();
dStage_roomControl_c::bankDataEntry* entries = arcBankData->m_entries;
dStage_roomControl_c::dStage_bankData* arcBankData = dStage_roomControl_c::getArcBankData();
dStage_roomControl_c::dStage_bankDataEntry* entries = arcBankData->m_entries;
for (int i = 0; i < arcBankData->m_num; entries++, i++) {
if (entries->field_0x0 == param_1) {
if (entries->mLayerNo == dComIfG_play_c::getLayerNo(0)) {
local_30 = 0x20;
*param_2 = entries->field_0x2;
if (entries->roomNo == i_roomNo) {
if (entries->layerNo == dComIfG_play_c::getLayerNo(0)) {
bankNum = 32;
*o_bankIDList = entries->nameIDs;
break;
}
}
}
}
u8 const* pbVar1 = *param_2;
for (int i = 0; i < local_30; pbVar1++, i++) {
const u8* pbank = *o_bankIDList;
for (int i = 0; i < bankNum; pbank++, i++) {
char* arcBank = dStage_roomControl_c::getArcBank(i);
char* name = "";
int id = *pbVar1;
if (id != 0xff) {
int id = *pbank;
if (id != 0xFF) {
JUT_ASSERT(160, 0 <= id && id < arcBankName->m_num);
name = arcBankName->m_names[id];
}
if (strcmp(arcBank, name) != 0) {
#if DEBUG
if (strcmp(arcBank, "") != 0) {
// "archive has been deleted from bank! <%d:%s!=%s>"
OSReport_Warning("バンクから削除するアーカイブが発生しました! <%d:%s!=%s>\n", i, arcBank, name);
}
#endif
return i;
}
}
return local_30;
return bankNum;
}
static bool resetArchiveBank(int param_0) {
const u8* tmp;
return dStage_roomControl_c::resetArchiveBank(getResetArchiveBank(param_0, &tmp));
static bool resetArchiveBank(int i_roomNo) {
const u8* bankIDList;
return dStage_roomControl_c::resetArchiveBank(getResetArchiveBank(i_roomNo, &bankIDList));
}
static bool setArchiveBank(int param_0) {
u8* arr[4];
int bank_no = getResetArchiveBank(param_0, (u8 const**)&arr);
if (arr[0] == NULL) {
static bool setArchiveBank(int i_roomNo) {
u8* bankIDList;
int bankNo = getResetArchiveBank(i_roomNo, (const u8**)&bankIDList);
if (bankIDList == NULL) {
return true;
}
dStage_roomControl_c::nameData* arcBankName = dStage_roomControl_c::getArcBankName();
for (; (int)bank_no < 0x20; bank_no++) {
dStage_roomControl_c::dStage_bankName* arcBankName = dStage_roomControl_c::getArcBankName();
for (; bankNo < 32; bankNo++) {
const char* name = "";
int id = arr[0][bank_no];
if (id != 0xff) {
int id = bankIDList[bankNo];
if (id != 0xFF) {
JUT_ASSERT(216, 0 <= id && id < arcBankName->m_num);
name = arcBankName->m_names[id];
}
if (strcmp(name, "") != 0) {
if (strnicmp(name, "pack", 4) == 0) {
int syncres = dComIfG_syncObjectRes(name);
if (syncres < 0) {
if (!dComIfG_setObjectRes(name, 0, mDoExt_getArchiveHeap())) {
OSReport_Error("Bank[%d] : %s.arc Read Error !!\n", bank_no, name);
} else {
#if DEBUG
if (fapGm_HIO_c::mPackArchiveMode)
#endif
{
int rt = dComIfG_syncObjectRes(name);
if (rt < 0) {
if (!dComIfG_setObjectRes(name, 0, mDoExt_getArchiveHeap())) {
OSReport_Error("Bank[%d] : %s.arc Read Error !!\n", bankNo, name);
} else {
return false;
}
} else if (rt != 0) {
return false;
}
} else if (syncres != 0) {
return false;
}
} else {
if (!dComIfG_setObjectRes(name, 0, mDoExt_getArchiveHeap())) {
OSReport_Error("Bank[%d] : %s.arc Read Error !!\n", bank_no, name);
OSReport_Error("Bank[%d] : %s.arc Read Error !!\n", bankNo, name);
}
}
}
dStage_roomControl_c::setArcBank(bank_no, name);
OS_REPORT(">>>>>>>>>>> create Bank[%d] : %s\n", bankNo, name);
dStage_roomControl_c::setArcBank(bankNo, name);
}
return true;
}
static int objectDeleteJugge(void* i_obj, void*) {
if (fpcM_GetProfName(i_obj) != PROC_BG) {
if (fopAcM_IsActor(i_obj) && !fopAcM_CheckCondition((fopAc_ac_c*)i_obj, 4)) {
return 0;
static int objectDeleteJugge(void* i_process, void* i_data) {
if (fpcM_GetProfName(i_process) != PROC_BG) {
if (fopAcM_IsActor(i_process)) {
#if DEBUG
char namebuf[16];
fopAcM_getNameString((fopAc_ac_c*)i_process, namebuf);
#endif
if (!fopAcM_CheckCondition((fopAc_ac_c*)i_process, fopAcCnd_NODRAW_e)) {
return 0;
}
OS_REPORT("削除!<%s>\n", namebuf);
}
fpcM_Delete(i_obj);
fpcM_Delete(i_process);
}
return 0;
}
static int deleteJugge(void* i_obj, void*) {
fpcM_Delete(i_obj);
static int deleteJugge(void* i_process, void* i_data) {
fpcM_Delete(i_process);
return 0;
}
static void* isCreatingCallback(create_tag* param_1, fpc_ProcID* param_2) {
create_request* create_req = (create_request*)param_1->base.mpTagData;
if (create_req->layer->layer_id == *param_2) {
static void* isCreatingCallback(create_tag* i_createTag, fpc_ProcID* i_procId) {
create_request* create_req = (create_request*)i_createTag->base.mpTagData;
if (create_req->layer->layer_id == *i_procId) {
return create_req;
}
return NULL;
}
static bool isCreating(fpc_ProcID param_0) {
return fpcCtIt_Judge((fpcCtIt_JudgeFunc)isCreatingCallback, &param_0);
static u8 isCreating(fpc_ProcID i_id) {
if (fpcCtIt_Judge((fpcCtIt_JudgeFunc)isCreatingCallback, &i_id)) {
return TRUE;
}
return FALSE;
}
static int loadDemoArchive(int room_no) {
static int loadDemoArchive(int i_roomNo) {
if (*dStage_roomControl_c::getDemoArcName() == 0) {
dStage_Lbnk_c* lbnk = dComIfGp_roomControl_getStatusRoomDt(room_no)->getLbnk();
dStage_Lbnk_c* lbnk = dComIfGp_roomControl_getStatusRoomDt(i_roomNo)->getLbnk();
if (lbnk != NULL) {
dStage_Lbnk_dt_c* entries = lbnk->entries;
if (entries != NULL) {
int bank = entries[dComIfG_play_c::getLayerNo(room_no)].bank;
if (bank != 0xff) {
int bank = entries[dComIfG_play_c::getLayerNo(i_roomNo)].bank;
if (bank != 0xFF) {
JUT_ASSERT(350, 0 <= bank && bank < 100);
u8 bank2 = entries[dComIfG_play_c::getLayerNo(room_no)].bank2;
int bank2 = entries[dComIfG_play_c::getLayerNo(i_roomNo)].bank2;
JUT_ASSERT(353, 0 <= bank2 && bank2 < 100);
sprintf(dStage_roomControl_c::getDemoArcName(), "Demo%02d_%02d", bank, bank2);
if (!dComIfG_setObjectRes(dStage_roomControl_c::getDemoArcName(), 0,
(JKRHeap*)NULL))
{
if (!dComIfG_setObjectRes(dStage_roomControl_c::getDemoArcName(), 0, (JKRHeap*)NULL)) {
const char* name = dStage_roomControl_c::getDemoArcName();
*dStage_roomControl_c::getDemoArcName() = 0;
} else {
// "Loading demo archive <%s>"
OS_REPORT("デモアーカイブ読み込み<%s>\n", dStage_roomControl_c::getDemoArcName());
return 1;
}
}
@@ -180,30 +210,33 @@ static bool objectSetCheck(room_of_scene_class* i_this) {
return 0;
}
if (i_this->mpDzrRes != NULL) {
if (i_this->roomInfo != NULL) {
loadDemoArchive(roomNo);
}
break;
default:
if (*dStage_roomControl_c::getDemoArcName() != '\0') {
int phase = dComIfG_syncObjectRes(dStage_roomControl_c::getDemoArcName());
if (phase < 0) {
#if VERSION == VERSION_WII_USA_R0
dStage_escapeRestart();
#endif
} else if (phase > 0) {
return 0;
}
}
fopAcM_create(PROC_BG, roomNo, NULL, -1, NULL, NULL, -1);
dComIfGp_getPEvtManager()->demoInit();
dComIfGp_getPEvtManager()->roomInit(roomNo);
dStage_dt_c_roomReLoader(i_this->mpDzrRes, i_this->mpRoomDt, roomNo);
dComIfGp_ret_wp_set(roomNo);
i_this->field_0x1d4 = -1;
i_this->field_0x1d5 = 1;
JUT_ASSERT(417, 0);
}
if (*dStage_roomControl_c::getDemoArcName() != '\0') {
int phase = dComIfG_syncObjectRes(dStage_roomControl_c::getDemoArcName());
if (phase < 0) {
#if VERSION == VERSION_WII_USA_R0
dStage_escapeRestart();
#endif
} else if (phase > 0) {
return 0;
}
}
fopAcM_create(PROC_BG, roomNo, NULL, -1, NULL, NULL, -1);
dComIfGp_getPEvtManager()->demoInit();
dComIfGp_getPEvtManager()->roomInit(roomNo);
dStage_dt_c_roomReLoader(i_this->roomInfo, i_this->roomDt, roomNo);
dComIfGp_ret_wp_set(roomNo);
i_this->field_0x1d4 = -1;
i_this->field_0x1d5 = 1;
}
} else if (status_flag_8) {
if (isCreating(fpcM_LayerID(i_this))) {
@@ -212,6 +245,10 @@ static bool objectSetCheck(room_of_scene_class* i_this) {
fpcM_LyJudge(&i_this->base, (fpcLyIt_JudgeFunc)deleteJugge, NULL);
g_dComIfG_gameInfo.play.getParticle()->levelAllForceOnEventMove();
// "Object deleted! <%d>"
OS_REPORT("\x1b[32mオブジェクト削除!<%d>\n\x1b[m", roomNo);
dComIfGs_clearRoomSwitch(dComIfGp_roomControl_getZoneNo(roomNo));
dComIfGs_clearRoomItem(dComIfGp_roomControl_getZoneNo(roomNo));
dComIfGp_roomControl_offStatusFlag(roomNo, 0x20);
@@ -233,14 +270,14 @@ static int dScnRoom_Execute(room_of_scene_class* i_this) {
} else if (objectSetCheck(i_this)) {
if (dComIfGp_roomControl_checkStatusFlag(roomNo, 4)) {
fopScnM_DeleteReq(i_this);
} else if (i_this->field_0x1d4 < 0 && i_this->field_0x1d5 != 0 &&
!dComIfGp_event_runCheck() &&
(int)fopScnM_GetParam(i_this) == dComIfGp_roomControl_getStayNo())
{
if (isCreating(fpcM_LayerID(i_this))) {
dScnPly_c::nextPauseTimer = 2;
} else {
i_this->field_0x1d5 = 0;
} else if (i_this->field_0x1d4 < 0 && i_this->field_0x1d5 != 0 && !dComIfGp_event_runCheck()) {
int param = fopScnM_GetParam(i_this);
if (param == dComIfGp_roomControl_getStayNo()) {
if (isCreating(fpcM_LayerID(i_this))) {
dScnPly_c::setPauseTimer(2);
} else {
i_this->field_0x1d5 = 0;
}
}
}
}
@@ -252,27 +289,27 @@ static int dScnRoom_IsDelete(room_of_scene_class*) {
return 1;
}
static bool isReadRoom(int param_0) {
static bool isReadRoom(int i_roomNo) {
roomRead_class* room = dComIfGp_getStageRoom();
if (room == NULL) {
return false;
}
if (room->num <= param_0) {
if (room->num <= i_roomNo) {
return false;
}
JUT_ASSERT(589, 0 <= dComIfGp_getNextStageRoomNo() && dComIfGp_getNextStageRoomNo() < 64);
roomRead_data_class* roomData = room->m_entries[dComIfGp_getNextStageRoomNo()];
u8* tmp = roomData->m_rooms;
u8* room_data = roomData->m_rooms;
for (int i = 0; i < roomData->num; i++) {
if (dStage_roomRead_dt_c_ChkBg(*tmp) &&
param_0 == dStage_roomRead_dt_c_GetLoadRoomIndex(*tmp))
if (dStage_roomRead_dt_c_ChkBg(*room_data) &&
i_roomNo == dStage_roomRead_dt_c_GetLoadRoomIndex(*room_data))
{
return true;
}
tmp++;
room_data++;
}
return false;
@@ -283,7 +320,22 @@ inline const char* setArcName(room_of_scene_class* i_room) {
}
static int dScnRoom_Delete(room_of_scene_class* i_this) {
OS_REPORT("dScnRoom_Delete():room%d\n", fopScnM_GetParam(i_this));
int roomNo = fopScnM_GetParam(i_this);
#if DEBUG
dBgp_c* bgp = dStage_roomControl_c::getBgp(roomNo);
if (bgp != NULL) {
if (!bgp->remove()) {
return 0;
}
delete bgp;
dStage_roomControl_c::setBgp(roomNo, NULL);
}
#endif
dComIfGp_roomControl_setStatusFlag(roomNo, 0);
dComIfGp_roomControl_getStatusRoomDt(roomNo)->init();
@@ -297,6 +349,9 @@ static int dScnRoom_Delete(room_of_scene_class* i_this) {
if (heap != NULL) {
heap->freeAll();
}
} else {
// "Room(%d) data saved!"
OS_REPORT(">>> 部屋(%d)データ保持!\n", roomNo);
}
dComIfGp_roomControl_getStatusRoomDt(roomNo)->init();
@@ -305,6 +360,7 @@ static int dScnRoom_Delete(room_of_scene_class* i_this) {
}
static int phase_0(room_of_scene_class* i_this) {
int param = fopScnM_GetParam(i_this);
int roomNo = fopScnM_GetParam(i_this);
dStage_roomControl_c::setStatusProcID(roomNo, fopScnM_GetID(i_this));
return cPhs_NEXT_e;
@@ -320,18 +376,21 @@ static int phase_1(room_of_scene_class* i_this) {
JKRExpHeap* heap = dStage_roomControl_c::getMemoryBlock(roomNo);
if (heap != NULL) {
OS_REPORT("#######<%d>\n", heap->getTotalUsedSize());
if (heap->getTotalUsedSize() != 0) {
return cPhs_INIT_e;
}
} else {
stage_stag_info_class* stagInfo = dComIfGp_getStage()->getStagInfo();
if (dStage_staginfo_GetArchiveHeap(stagInfo) != FALSE) {
if (dStage_staginfo_GetArchiveHeap(dComIfGp_getStage()->getStagInfo()) != FALSE) {
heap = mDoExt_getArchiveHeap();
}
}
if (!dComIfG_setStageRes(arcName, heap)) {
int rt = dComIfG_setStageRes(arcName, heap);
if (!rt) {
//! In Wii USA Revision 0, if a stage's resources fail to load, the stage will restart as a failsafe.
//! In later versions this failsafe was removed, and the room will simply not load.
#if VERSION == VERSION_WII_USA_R0
dStage_escapeRestart();
#endif
@@ -344,9 +403,11 @@ static int phase_1(room_of_scene_class* i_this) {
static int phase_2(room_of_scene_class* i_this) {
const char* arcName = setArcName(i_this);
int rt = dComIfG_syncStageRes(arcName);
int rt = dComIfG_syncStageRes(arcName);
if (rt < 0) {
//! In Wii USA Revision 0, if a stage's resources fail to load, the stage will restart as a failsafe.
//! In later versions this failsafe was removed, and the room will simply not load.
#if VERSION == VERSION_WII_USA_R0
dStage_escapeRestart();
#endif
@@ -374,12 +435,12 @@ static int phase_2(room_of_scene_class* i_this) {
dComIfGp_roomControl_setZoneNo(roomNo, dComIfGs_createZone(roomNo));
}
i_this->mpRoomDt = dComIfGp_roomControl_getStatusRoomDt(roomNo);
i_this->mpRoomDt->setRoomNo(roomNo);
i_this->mpDzrRes = dComIfG_getStageRes(arcName, "room.dzr");
i_this->roomDt = dComIfGp_roomControl_getStatusRoomDt(roomNo);
i_this->roomDt->setRoomNo(roomNo);
i_this->roomInfo = dComIfG_getStageRes(arcName, "room.dzr");
if (i_this->mpDzrRes != NULL) {
dStage_dt_c_roomLoader(i_this->mpDzrRes, i_this->mpRoomDt, roomNo);
if (i_this->roomInfo != NULL) {
dStage_dt_c_roomLoader(i_this->roomInfo, i_this->roomDt, roomNo);
}
JKRHeap* old_heap = NULL;
@@ -390,12 +451,12 @@ static int phase_2(room_of_scene_class* i_this) {
}
#if DEBUG
void* mpat = dComIfGp_roomControl_getStatusRoomDt(roomNo)->getMapPath();
if (mpat != NULL) {
void* unit = dComIfGp_roomControl_getStatusRoomDt(roomNo)->getUnit();
if (unit != NULL) {
dBgp_c* bgp = new dBgp_c();
JUT_ASSERT(786, bgp != NULL);
bgp->create(roomNo, mpat);
bgp->create(roomNo, unit);
dStage_roomControl_c::setBgp(roomNo, bgp);
}
#endif
@@ -408,10 +469,10 @@ static int phase_2(room_of_scene_class* i_this) {
}
static int phase_3(room_of_scene_class* i_this) {
if (objectSetCheck(i_this)) {
return cPhs_NEXT_e;
} else {
if (!objectSetCheck(i_this)) {
return cPhs_INIT_e;
} else {
return cPhs_NEXT_e;
}
}
@@ -420,21 +481,25 @@ static int phase_4(room_of_scene_class* i_this) {
return cPhs_INIT_e;
}
if (objectSetCheck(i_this)) {
return cPhs_COMPLEATE_e;
} else {
if (!objectSetCheck(i_this)) {
return cPhs_INIT_e;
}
OS_REPORT("dScnRoom_Create(): End !! room%d\n", fopScnM_GetParam(i_this));
return cPhs_COMPLEATE_e;
}
static int dScnRoom_Create(scene_class* i_this) {
static int (*l_method[5])(void*) = {
(int (*)(void*))phase_0, (int (*)(void*))phase_1, (int (*)(void*))phase_2,
(int (*)(void*))phase_3, (int (*)(void*))phase_4,
static request_of_phase_process_fn l_method[5] = {
(request_of_phase_process_fn)phase_0,
(request_of_phase_process_fn)phase_1,
(request_of_phase_process_fn)phase_2,
(request_of_phase_process_fn)phase_3,
(request_of_phase_process_fn)phase_4,
};
room_of_scene_class* room = static_cast<room_of_scene_class*>(i_this);
return dComLbG_PhaseHandler(&room->field_0x1c4, l_method, i_this);
return dComLbG_PhaseHandler(&room->phase, l_method, i_this);
}
static scene_method_class l_dScnRoom_Method = {