summaryrefslogtreecommitdiff
path: root/src/d/d_s_play.cpp
diff options
context:
space:
mode:
authorTakaRikka <38417346+TakaRikka@users.noreply.github.com>2026-03-01 13:19:48 -0800
committerGitHub <noreply@github.com>2026-03-01 13:19:48 -0800
commit6e149819e13b1f70ecbf8a4c66b030c17ffed2bb (patch)
treec0891f81261457accd576ac633c1ceeff4206c67 /src/d/d_s_play.cpp
parent6a48380461bc9baabe1706ba57ca0cedfa2d0c51 (diff)
d_s_logo / d_s_play debug work, d_a_kago cleanup, misc cleanup (#3116)
* d_a_kago cleanup * d_s_logo wii/shield work * d_s_logo / d_s_play debug work * fix missing profile class sizeof's * fix phase->id values * build fixes * fix dCamera_c and camera profile
Diffstat (limited to 'src/d/d_s_play.cpp')
-rw-r--r--src/d/d_s_play.cpp1032
1 files changed, 942 insertions, 90 deletions
diff --git a/src/d/d_s_play.cpp b/src/d/d_s_play.cpp
index 1e4636c457..4f3c6807f0 100644
--- a/src/d/d_s_play.cpp
+++ b/src/d/d_s_play.cpp
@@ -26,13 +26,33 @@
#include "m_Do/m_Do_graphic.h"
#include "d/actor/d_a_suspend.h"
#include "d/actor/d_a_ykgr.h"
+#include "JSystem/JHostIO/JORFile.h"
+#include "JSystem/JHostIO/JORServer.h"
+#include "JSystem/JKernel/JKRExpHeap.h"
+#include "JSystem/JFramework/JFWSystem.h"
+#include "f_ap/f_ap_game.h"
+#include "d/d_bg_parts.h"
+#include "f_op/f_op_kankyo_mng.h"
+#include "d/actor/d_a_alink.h"
+#include "d/actor/d_a_midna.h"
+#include "JSystem/JKernel/JKRAram.h"
+#include "JSystem/JKernel/JKRAramArchive.h"
+
+#if DEBUG
+#include "d/d_s_menu.h"
+#include "d/d_debug_pad.h"
+#include "d/d_jpreviewer.h"
+#include "d/d_jcam_editor.h"
+#include "d/d_a_obj.h"
+#include "d/d_debug_viewer.h"
+#endif
#include <cstring>
#if PLATFORM_WII
#include "d/d_cursor_mng.h"
#endif
-static void dScnPly_Create(scene_class*);
+static int dScnPly_Create(scene_class*);
static int dScnPly_Delete(dScnPly_c*);
static int dScnPly_IsDelete(dScnPly_c);
static int dScnPly_Execute(dScnPly_c*);
@@ -54,6 +74,10 @@ static request_of_phase_process_class resPhase[1];
static request_of_phase_process_class dylPhase[1];
+#if DEBUG
+static OSTime dylPreLoadTime0;
+#endif
+
static OSTime dylPreLoadTime1;
static OSTime resPreLoadTime0;
@@ -66,6 +90,47 @@ s8 dScnPly_c::pauseTimer;
s8 dScnPly_c::nextPauseTimer;
+#if DEBUG
+u8 dScnPly_c::debugPause;
+#endif
+
+static const s16 T_JOINT_dylKeyTbl[1] = {
+ PROC_COW,
+};
+
+static const char* T_JOINT_resName[1] = {"Always"};
+
+struct PreLoadInfo {
+ const char* stageName;
+ const s16* profNameTbl;
+ const char** resNameTbl;
+ u8 dylKeyTblNum;
+ u8 resNameNum;
+};
+
+static PreLoadInfo const PreLoadInfoT[1] = {
+ {
+ "T_JOINT",
+ T_JOINT_dylKeyTbl,
+ T_JOINT_resName,
+ ARRAY_SIZE(T_JOINT_dylKeyTbl),
+ ARRAY_SIZE(T_JOINT_resName),
+ },
+};
+
+static s8 preLoadNo = -1;
+
+static u8 doPreLoad = 1;
+
+#if DEBUG
+void dScnPly_preLoad_HIO_c::genMessage(JORMContext* mctx) {
+ mctx->startComboBox("プリロード", &doPreLoad);
+ mctx->genComboBoxItem("しない", 0);
+ mctx->genComboBoxItem("する", 1);
+ mctx->endComboBox();
+}
+#endif
+
s8 dScnPly_c::calcPauseTimer() {
if (nextPauseTimer != 0) {
pauseTimer = nextPauseTimer;
@@ -76,18 +141,281 @@ s8 dScnPly_c::calcPauseTimer() {
}
}
-static const s16 T_JOINT_dylKeyTbl[1] = {
- 0x0106,
-};
+#if DEBUG
+dScnPly_reg_childHIO_c::dScnPly_reg_childHIO_c() {
+ for (int i = 0; i < 30; i++) {
+ mFloatReg[i] = 0.0f;
+ }
+
+ for (int i = 0; i < 10; i++) {
+ mShortReg[i] = 0;
+ }
+}
+
+void dScnPly_reg_childHIO_c::genMessage(JORMContext* mctx) {
+ char textbuf[8];
+
+ for (int i = 0; i < 20; i++) {
+ sprintf(textbuf, " F(%02d)", i);
+ mctx->genSlider(textbuf, &mFloatReg[i], -100000.0f, 100000.0f);
+ }
+
+ for (int i = 20; i < 25; i++) {
+ sprintf(textbuf, " F(%02d)", i);
+ mctx->genSlider(textbuf, &mFloatReg[i], 0.0f, 1.0f);
+ }
+
+ for (int i = 25; i < 30; i++) {
+ sprintf(textbuf, " F(%02d)", i);
+ mctx->genSlider(textbuf, &mFloatReg[i], -1.0f, 1.0f);
+ }
+
+ for (int i = 0; i < 10; i++) {
+ sprintf(textbuf, " S(%02d)", i);
+ mctx->genSlider(textbuf, &mShortReg[i], -0x8000, 0x7FFF);
+ }
+}
+
+void dScnPly_reg_HIO_c::genMessage(JORMContext* mctx) {
+ static const char l_nodeName[][20] = {
+ "森田(T)",
+ "まつたに(D)",
+ "イワワキ(I)",
+ "ささ(S)",
+ "うめみや(U)",
+ "おがわ(O)",
+ "坂口(Y)",
+ "さかい(K)",
+ "ハラ(B)",
+ "すみよし(M)",
+ "(空)-たけした(A)",
+ "吉田茂樹(P)",
+ "(空)-のま(N)",
+ "(空)-にしわき(W)",
+ "(空)-榊原政郎(J)",
+ "はやかわ(H)",
+ "(空)-定本(V)",
+ "(空)-西川(X)",
+ "(空)-鈴木(ゆ)(Z)",
+ "なかにし(n)",
+ "くわじま(k)",
+ "おかじま(o)",
+ "山崎(y)",
+ "芦田(a)",
+ "岡田(h)",
+ "高橋(t)",
+ };
+
+ // "Example usage"
+ mctx->genLabel("使い方例", 0);
+ mctx->genLabel("R_HS(00-09) ... はやかわレジスタ -32768 - +32767(short)", 0);
+ mctx->genLabel("R_HF(00-19) ... はやかわレジスタ -100000.0 - +100000.0", 0);
+ mctx->genLabel("R_HF(20-24) ... はやかわレジスタ 0.0f - 1.0f", 0);
+ mctx->genLabel("R_HF(25-29) ... はやかわレジスタ -1.0f - 1.0f", 0);
+
+ for (int i = 0; i < 26; i++) {
+ mctx->genNode(l_nodeName[i], &mChildReg[i], 0, 0);
+ }
+}
+
+dScnPly_preset_HIO_c::dScnPly_preset_HIO_c() {
+ field_0x5 = 0;
+ memset(mPresetData, 0, sizeof(mPresetData));
+ memset(filename_buf, 0, sizeof(filename_buf));
+ field_0x2716 = 0;
+ field_0x2717 = 0;
+}
+
+void dScnPly_preset_HIO_c::exePreset() {
+ JORFile file;
+
+ if (g_presetHIO.filename_buf[0] != 0) {
+ if (file.open((char*)filename_buf, 1, "", NULL, NULL, NULL)) {
+ memset(mPresetData, 0, sizeof(mPresetData));
+ field_0x2716 = 0;
+ field_0x2717 = 1;
+
+ file.readData(mPresetData, 0);
+ file.close();
+
+ if (dSm_read_stageset(mPresetData)) {
+ field_0x2717 = 2;
+ }
+ } else {
+ // "\nLoading error loop"
+ OS_REPORT("\n読み込みしっぱいのまきまき");
+ }
+
+ g_presetHIO.filename_buf[0] = 0;
+ }
+}
+
+void dScnPly_preset_HIO_c::genMessage(JORMContext* mctx) {
+ // "Load situation file"
+ mctx->genLabel("【状況ファイルを読みこみ】", 0x80000001);
+ // "Items and Status can be set in a file"
+ mctx->genLabel(" アイテムやステータスの状態をファイルで指定することが出来ます。", 0x80000001);
+ mctx->genLabel("", 0x80000001);
+
+ // "Click here to select a file to load!"
+ mctx->genButton("ここを押して読込ファイルを指定して下さい!", 0x40000001);
+ mctx->genLabel("", 0x80000001);
+
+ // "- Loading during gameplay will automatically return you to the debug menu."
+ mctx->genLabel("・ゲーム中に読み込むと自動的にデバッグメニューへ戻ります。", 0x80000001);
+ // "- When loading a file from the debug menu,"
+ mctx->genLabel("・デバッグメニューでファイルを読み込んだ際", 0x80000001);
+ // " if a stage command exists the game will temporarily load then return to the menu."
+ mctx->genLabel(" stage命令がある場合は一旦ゲームに入りメニューへと戻ります。", 0x80000001);
+ // " (To position the cursor)"
+ mctx->genLabel(" (カーソルを合わせる為)", 0x80000001);
+ mctx->genLabel("", 0x80000001);
+
+ // "Reset state to before loading situation file"
+ mctx->genButton("状況ファイルを読み込んでいない状態に戻す", 0x40000003);
+ mctx->genLabel("", 0x80000001);
+ mctx->genLabel("", 0x80000001);
+
+ // "Click here for the situation file location!"
+ mctx->genButton("状況ファイルの格納場所はコチラを押下!", 0x40000005);
+ mctx->genLabel("\\\\10.121.2.9\\zelda$\\JMAP_FOLDER\\situation", 0x80000001);
+ // "For details about the situation file contents, please refer to Nakamura-san's website"
+ mctx->genLabel("ファイルの内容については中村さんのHPをご参照ください", 0x80000001);
+ // "Click here to launch browser and view webpage."
+ mctx->genButton("ここを押すとブラウザが起動し表示されます。", 0x40000004);
+ mctx->genLabel("http://www-ead/~nakamuh/gc-zelda_2/misc/spec-situation_file.html", 0x80000001);
+}
+
+void dScnPly_preset_HIO_c::listenPropertyEvent(const JORPropertyEvent* event) {
+ JORReflexible::listenPropertyEvent(event);
+ JORFile file;
+
+ switch ((int)event->id) {
+ case 0x40000001:
+ if (file.open(1, "すべてのファイル(*.*)\0*.*", NULL, NULL, NULL)) {
+ memset(mPresetData, 0, sizeof(mPresetData));
+ field_0x2716 = 0;
+ field_0x2717 = 1;
+
+ file.readData(mPresetData, 0);
+ file.close();
+
+ if (dSm_read_stageset(mPresetData)) {
+ field_0x2717 = 2;
+ }
+ }
+ break;
+ case 0x40000003:
+ memset(mPresetData, 0, sizeof(mPresetData));
+ break;
+ case 0x40000004:
+ JORShellExecute(NULL, "http://www-ead/~nakamuh/gc-zelda_2/misc/spec-situation_file.html", NULL, NULL, 1);
+ break;
+ case 0x40000005:
+ JORShellExecute(NULL, "\\\\10.121.2.9\\zelda$\\ZELDA2_JMAP_FOLDER\\situation", NULL, NULL, 1);
+ break;
+ }
+}
+#endif
dScnPly_env_otherHIO_c::dScnPly_env_otherHIO_c() {
mShadowDensity = 255.0f;
- mAdjustLODBias = 1;
- mDisplayTransparentCyl = false;
+ mAdjustLODBias = TRUE;
+ mDisplayTransparentCyl = FALSE;
+
+ #if DEBUG
+ mAdjustCullFar = FALSE;
+ mCullFarValue = 4000.0f;
+ mDisplayShadows = TRUE;
+ mDisplayShadowImage = FALSE;
+ mDisplayShadowPoly = FALSE;
+ mDisplayCullBox = FALSE;
+ mLoadAllRooms = FALSE;
+ mDepthOfField = TRUE;
+
+ mRailSize = 5.0f;
+ mRailColorR = 0x50;
+ mRailColorG = 0x50;
+ mRailColorB = 0x50;
+
+ field_0x1a = 0xFF;
+ mDisplayParticleInfo = 0;
+ field_0x4e = 0;
+ field_0x4f = 0;
+
+ for (int i = 0; i < 20; i++) {
+ field_0x1c[i] = -1;
+ }
+ #endif
}
-void dScnPly_env_otherHIO_c::genMessage(JORMContext* ctx) {
+void dScnPly_env_otherHIO_c::genMessage(JORMContext* mctx) {
+ #if DEBUG
+ mctx->genCheckBox("影表示", &mDisplayShadows, 1);
+ mctx->genSlider("影濃さ", &mShadowDensity, 0.0f, 255.0f);
+ mctx->genCheckBox("被写界深度", &mDepthOfField, 1);
+ mctx->genCheckBox("LODバイアス変更", &mAdjustLODBias, 1);
+ mctx->genCheckBox("カリングFar変更", &mAdjustCullFar, 1);
+ mctx->genSlider("カリングFar値", &mCullFarValue, 0.0f, 50000.0f);
+ mctx->genCheckBox("影イメージ表示", &mDisplayShadowImage, 1);
+ mctx->genCheckBox("影ポリゴン表示", &mDisplayShadowPoly, 1);
+ mctx->genCheckBox("透明円柱表示", &mDisplayTransparentCyl, 1);
+ mctx->genCheckBox("カリングボックス表示", &mDisplayCullBox, 1);
+ mctx->genCheckBox("パーティクル情報表示", &mDisplayParticleInfo, 1);
+ mctx->genButton("パーティクル履歴", 0x4000003);
+ mctx->genCheckBox("全部屋読み込み", &mLoadAllRooms, 1);
+ mctx->genButton("部屋メモリ", 0x4000001);
+ mctx->genButton("草、花、低木本数", 0x4000002);
+ mctx->genSlider("レールサイズ", &mRailSize, 0.0f, 100.0f);
+ mctx->genSlider("レールカラー(R)", &mRailColorR, 0, 0xff);
+ mctx->genSlider("レールカラー(G)", &mRailColorG, 0, 0xff);
+ mctx->genSlider("レールカラー(B)", &mRailColorB, 0, 0xff);
+ #endif
+}
+
+#if DEBUG
+void dScnPly_env_otherHIO_c::listenPropertyEvent(const JORPropertyEvent* event) {
+ JORReflexible::listenPropertyEvent(event);
+ JORFile file;
+
+ switch ((int)event->id) {
+ case 0x4000001:
+ OS_REPORT("#############################################\n");
+ break;
+ case 0x4000002:
+ break;
+ case 0x4000003:
+ g_envHIO.mOther.field_0x4e = 1;
+ break;
+ }
+}
+
+void dScnPly_env_otherHIO_c::printParticle() {
+ dDbVw_Report(20, 100, "Emitter Num <%d> X=<%d>", dComIfGp_particle_getEmitterNum(), dComIfGp_particle_getHeapSize());
+ dDbVw_Report(20, 120, "Particle Num <%d> Y=<%d>", dComIfGp_particle_getParticleNum(), dComIfGp_particle_getSceneHeapSize() - 0x180000);
+
+ int var_r26 = 0xA0;
+ int var_r28 = field_0x4f;
+ if (field_0x4e != 0) {
+ OS_REPORT("Particle Error !!\n");
+
+ for (int i = 0; i < 20; i++) {
+ var_r28--;
+ if (var_r28 < 0) {
+ var_r28= 19;
+ }
+
+ if (field_0x1c[var_r28] != 0xFFFF) {
+ OS_REPORT(" <ID=%d : %s>\n", field_0x1c[var_r28], dPa_name::getName(field_0x1c[var_r28]));
+ }
+
+ var_r26 += 20;
+ }
+
+ field_0x4e = 0;
+ }
}
+#endif
dScnPly_env_debugHIO_c::dScnPly_env_debugHIO_c() {
mBoxCullMinSize.set(-100.0f, -100.0f, -100.0f);
@@ -96,31 +424,152 @@ dScnPly_env_debugHIO_c::dScnPly_env_debugHIO_c() {
mSphereCullRadius = 100.0f;
}
-void dScnPly_env_debugHIO_c::genMessage(JORMContext* ctx) {
+void dScnPly_env_debugHIO_c::genMessage(JORMContext* mctx) {
+ #if DEBUG
+ mctx->genLabel("【ボックスカリング(CULLSIZE_DEBUG)サイズ】", 0x80000001);
+ mctx->genSlider("最小X", &mBoxCullMinSize.x, -10000.0f, 10000.0f);
+ mctx->genSlider("最小Y", &mBoxCullMinSize.y, -10000.0f, 10000.0f);
+ mctx->genSlider("最小Z", &mBoxCullMinSize.z, -10000.0f, 10000.0f);
+ mctx->genSlider("最大X", &mBoxCullMaxSize.x, -10000.0f, 10000.0f);
+ mctx->genSlider("最大Y", &mBoxCullMaxSize.y, -10000.0f, 10000.0f);
+ mctx->genSlider("最大Z", &mBoxCullMaxSize.z, -10000.0f, 10000.0f);
+
+ mctx->genLabel("【球カリング(CULLSIZE_Q_DEBUG)サイズ】", 0x80000001);
+ mctx->genSlider("中心X", &mSphereCullCenter.x, -10000.0f, 10000.0f);
+ mctx->genSlider("中心Y", &mSphereCullCenter.y, -10000.0f, 10000.0f);
+ mctx->genSlider("中心Z", &mSphereCullCenter.z, -10000.0f, 10000.0f);
+ mctx->genSlider("半径", &mSphereCullRadius, -10000.0f, 10000.0f);
+ #endif
+}
+
+#if DEBUG
+void dScnPly_env_debugHIO_c::listenPropertyEvent(const JORPropertyEvent* event) {
+ JORReflexible::listenPropertyEvent(event);
+
+ l_cullSizeBox[fopAc_CULLBOX_14_e].min = mBoxCullMinSize;
+ l_cullSizeBox[fopAc_CULLBOX_14_e].max = mBoxCullMaxSize;
+ l_cullSizeSphere[fopAc_CULLSPHERE_8_e - fopAc_CULLSPHERE_0_e].center = mSphereCullCenter;
+ l_cullSizeSphere[fopAc_CULLSPHERE_8_e - fopAc_CULLSPHERE_0_e].radius = mSphereCullRadius;
}
+void dScnPly_env_HIO_c::genMessage(JORMContext* mctx) {
+ mctx->genNode("デバッグ用", &mDebug, 0, 0);
+ mctx->genNode("その他", &mOther, 0, 0);
+}
+
+static u32 l_usedMemoryBlockSize = 0xFFFFFFFF;
+
+static int checkObjectSize(void* i_process, void* i_data) {
+ s16 profname = fpcM_GetProfName(i_process);
+ if (profname == PROC_BG) {
+ fopAc_ac_c* actor = (fopAc_ac_c*)i_process;
+ *((u32*)i_data) += ((l_usedMemoryBlockSize != 0 && actor->heap == NULL) ? 0 : actor->heap->getHeapSize()) + actor->base.base.profile->process_size;
+ } else if (profname == PROC_PLAY_SCENE || profname == PROC_ROOM_SCENE) {
+ *((u32*)i_data) += ((base_process_class*)i_process)->profile->process_size;
+ } else if (fopKyM_IsKy(i_process)) {
+ *((u32*)i_data + 1) += ((base_process_class*)i_process)->profile->process_size;
+ } else if (fopAcM_IsActor(i_process)) {
+ fopAc_ac_c* actor = (fopAc_ac_c*)i_process;
+ *((u32*)i_data + 1) += (actor->heap == NULL ? 0 : actor->heap->getHeapSize()) + actor->base.base.profile->process_size;
+
+ if (profname == PROC_ALINK) {
+ daAlink_c* alink = (daAlink_c*)actor;
+ *((u32*)i_data + 1) += alink->getOtherHeapSize();
+ } else if (profname == PROC_MIDNA) {
+ daMidna_c* midna = (daMidna_c*)actor;
+ *((u32*)i_data + 1) += midna->getOtherHeapSize();
+ }
+ }
+
+ return 1;
+}
+
+static void initUsedHeapSize() {
+ l_usedMemoryBlockSize = 0;
+ for (int i = 0; i < 19; i++) {
+ JKRHeap* heap = dStage_roomControl_c::getMemoryBlockHeap(i);
+ if (heap != NULL) {
+ l_usedMemoryBlockSize += heap->getHeapSize();
+ }
+ }
+}
+
+static bool lbl_8074CADB;
+
+static void drawUsedHeapSize() {
+ if (mDoCPd_c::getHoldL(PAD_3) && mDoCPd_c::getHoldR(PAD_3) && mDoCPd_c::getTrigZ(PAD_3)) {
+ lbl_8074CADB = !lbl_8074CADB;
+ }
+
+ if (lbl_8074CADB) {
+ int gameSize = mDoExt_getSafeGameHeapSize() - mDoExt_getGameHeap()->getTotalFreeSize();
+ int zeldaSize = mDoExt_getSafeZeldaHeapSize() - mDoExt_getZeldaHeap()->getTotalFreeSize();
+ int archiveSize = mDoExt_getSafeArchiveHeapSize() - mDoExt_getArchiveHeap()->getTotalFreeSize();
+ int j2dSize = mDoExt_getSafeJ2dHeapSize() - mDoExt_getJ2dHeap()->getTotalFreeSize();
+
+ u32 sizes[2];
+ sizes[0] = dComIfG_getStageAllSize();
+ sizes[1] = dComIfG_getObjectAllSize() - (dComIfG_getObjectSize("CamParam")
+ + dComIfG_getObjectSize("Event")
+ + dComIfG_getObjectSize("Always")
+ + dComIfG_getObjectSize("Alink")
+ + dComIfG_getObjectSize("Midna"));
+
+ fpcLyIt_All(checkObjectSize, sizes);
+ if (l_usedMemoryBlockSize != 0) {
+ sizes[0] = l_usedMemoryBlockSize + dComIfG_getStageSize("Stg_00") + dComIfG_getStageSize("Xtg_00");
+ }
+
+ int var_r25 = JKRGetAramFreeSize() / 1024;
+ JUTReport(380, 300, "Stage : %d(K)", (sizes[0] + 0x3FF) / 1024);
+ JUTReport(380, 316, "Obj : %d(K)", (sizes[1] + 0x3FF) / 1024);
+ JUTReport(380, 332, "C-ARAM : %d(K)", var_r25);
+ JUTReport(380, 348, ">Game : %d(K)", (gameSize + 0x3FF) / 1024);
+ JUTReport(380, 364, ">Zelda : %d(K)", (zeldaSize + 0x3FF) / 1024);
+ JUTReport(380, 380, ">Archive : %d(K)", (archiveSize + 0x3FF) / 1024);
+ JUTReport(380, 380, ">J2d : %d(K)", (j2dSize + 0x3FF) / 1024);
+ }
+}
+#endif
+
static int dScnPly_Draw(dScnPly_c* i_this) {
static s16 l_wipeType[] = {
- 0x0000, 0x0000, 0x0011, 0x0002, 0x0002, 0x0001, 0x0003, 0x0001, 0x0004, 0x0004, 0x0005, 0x0005,
- 0x0006, 0x0007, 0x0000, 0x0000, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0008, 0x0008,
+ 0, 0, 17, 2, 2, 1, 3, 1, 4, 4, 5, 5, 6, 7, 0, 0, 2, 2, 2, 2, 2, 8, 8,
};
+ #if DEBUG
+ fapGm_HIO_c::startCpuTimer();
+ fpc_ProcID id = fpcM_GetID(i_this);
+ drawUsedHeapSize();
+ dStage_DebugDisp();
+ #endif
+
dComIfG_Ccsp()->Move();
dComIfG_Bgsp().ClrMoveFlag();
- u8 useWhiteColor;
if (!fopOvlpM_IsPeek() && !dComIfG_resetToOpening(i_this)) {
- if (dComIfGp_isEnableNextStage()) {
+ if (dComIfGp_isEnableNextStage()
+ #if DEBUG
+ && !dScnMenu_c::isAutoSelect()
+ #endif
+ ) {
+ JUT_ASSERT(1019, dComIfGp_getNextStageWipe() < ARRAY_SIZEU(l_wipeType));
+
u8 wipe = dComIfGp_getNextStageWipe();
- fopScnM_ChangeReq(i_this, PROC_PLAY_SCENE, l_wipeType[wipe], 5);
+ #if DEBUG
+ if (g_kankyoHIO.navy.wipe_test_ON != 0xFF) {
+ wipe = g_kankyoHIO.navy.wipe_test_ON;
+ }
+ #endif
+
+ int rt = fopScnM_ChangeReq(i_this, PROC_PLAY_SCENE, l_wipeType[wipe], 5);
int hour = dKy_getdaytime_hour();
- useWhiteColor = hour >= 6 && hour < 18 ? true : false;
- BOOL tmp = useWhiteColor == 0 ? 1 : 0;
+ BOOL isDaytime = (hour >= 6 && hour < 18) ? FALSE : TRUE;
if (wipe == 1 || wipe == 2 || wipe == 7 || wipe == 17 || wipe == 21 ||
- ((wipe == 8 || wipe == 10 || wipe == 18) && tmp) ||
- ((wipe == 9 || wipe == 11 || wipe == 19) && !tmp))
+ ((wipe == 8 || wipe == 10 || wipe == 18) && isDaytime) ||
+ ((wipe == 9 || wipe == 11 || wipe == 19) && !isDaytime))
{
mDoGph_gInf_c::setFadeColor(*(JUtility::TColor*)&g_saftyWhiteColor);
} else if (wipe == 14 || wipe == 20) {
@@ -136,42 +585,142 @@ static int dScnPly_Draw(dScnPly_c* i_this) {
}
}
}
+
dMdl_mng_c::reset();
- if (!dComIfGp_isPauseFlag() && dScnPly_c::pauseTimer == 0) {
+ if (!dComIfGp_isPauseFlag() && !dScnPly_c::isPause()
+ #if DEBUG
+ && !fapGm_HIO_c::isCaptureScreen()
+ #endif
+ ) {
if (fpcM_GetName(i_this) == PROC_PLAY_SCENE) {
dComIfGp_getVibration().Run();
}
daSus_c::execute();
dComIfG_Bgsp().Move();
+ #if VERSION == VERSION_SHIELD_DEBUG
+ dPath_Move();
+ #endif
dComIfGp_particle_calc3D();
dComIfGp_particle_calc2D();
cCt_execCounter();
} else {
dPa_control_c::onStatus(1);
- if (dScnPly_c::pauseTimer == 0) {
+
+ if (!dScnPly_c::isPause()) {
dPa_control_c::onStatus(2);
}
+
if (dScnPly_c::pauseTimer == 0) {
dComIfGp_getVibration().Pause();
}
}
+ #if DEBUG
+ if (fopOvlpM_IsDoingReq() != TRUE) {
+ if (dScnMenu_c::isAutoSelect() || dComIfG_isSceneResetButton() || g_presetHIO.field_0x2717 != 0) {
+ if (g_presetHIO.field_0x2717 != 0) {
+ dSm_read_stageset(g_presetHIO.mPresetData);
+ g_presetHIO.field_0x2717 = 0;
+ }
+
+ s16 spA = 0;
+ if (dDemo_c::getMode() == 1) {
+ dDemo_c::end();
+ spA = 7;
+ }
+
+ fopScnM_ChangeReq(i_this, PROC_MENU_SCENE, spA, 5);
+ mDoAud_bgmStop(30);
+
+ if (fpcM_GetName(i_this) != PROC_PLAY_SCENE) {
+ dComIfG_playerStatusD();
+ }
+ }
+ }
+
+ dDebugPad.Update();
+
+ fapGm_HIO_c::printCpuTimer("");
+ fapGm_HIO_c::stopCpuTimer("ゲーム管理(計算処理2)");
+ fapGm_HIO_c::printCpuTimer("");
+ #endif
+
for (create_tag_class* i = fopDwIt_Begin(); i != NULL; i = fopDwIt_Next(i)) {
- fpcM_Draw(i->mpTagData);
+ void* process = i->mpTagData;
+ fpcM_Draw(process);
}
+ #if DEBUG
+ fapGm_HIO_c::startCpuTimer();
+ #endif
+
if (!dComIfGp_isPauseFlag()) {
dEyeHL_mng_c::update();
+
+ #if VERSION == VERSION_SHIELD_DEBUG
+ dBgp_c::drawShare();
+ #endif
+ #if DEBUG
+ daSus_c::draw();
+ #endif
+
dComIfG_Ccsp()->Draw();
- dComIfGp_getAttention()->Draw();
+ #if DEBUG
+ dComIfG_Bgsp().Draw();
+ dPath_Draw();
+ #endif
+
+ dAttention_c* attention = dComIfGp_getAttention();
+ attention->Draw();
}
+ #if DEBUG
+ if (g_envHIO.mOther.mDisplayParticleInfo) {
+ g_envHIO.mOther.printParticle();
+ }
+
+ fapGm_HIO_c::printCpuTimer("");
+ fapGm_HIO_c::stopCpuTimer("ゲーム管理(描画処理)");
+ #endif
+
return 1;
}
+#if DEBUG
+static BOOL l_pause;
+static f32 l_pauseFrame;
+static u8 lbl_8074CAE4;
+static u32 l_sceneChangeStartTick;
+#endif
+
static int dScnPly_Execute(dScnPly_c* i_this) {
+ #if DEBUG
+ fapGm_HIO_c::startCpuTimer();
+ #endif
+
i_this->offReset();
+
+ #if DEBUG
+ if (lbl_8074CAE4) {
+ u32 var_r27 = OSGetTick() - l_sceneChangeStartTick;
+ OS_REPORT("\x1b[33m");
+ // "Scene transition time: %f seconds\n"
+ OS_REPORT("シーン切り替え時間 %f秒\n\x1B[m", (f32)OSTicksToMicroseconds(var_r27) / 1000000.0f);
+ lbl_8074CAE4 = 0;
+
+ initUsedHeapSize();
+ OS_REPORT("Game Heap <%d,%d,%d>\n", mDoExt_getGameHeap()->getTotalUsedSize(), mDoExt_getGameHeap()->getTotalFreeSize(), mDoExt_getGameHeap()->getFreeSize());
+ OS_REPORT("Zelda Heap <%d,%d,%d>\n", mDoExt_getZeldaHeap()->getTotalUsedSize(), mDoExt_getZeldaHeap()->getTotalFreeSize(), mDoExt_getZeldaHeap()->getFreeSize());
+ OS_REPORT("Archive Heap <%d,%d,%d>\n", mDoExt_getArchiveHeap()->getTotalUsedSize(), mDoExt_getArchiveHeap()->getTotalFreeSize(), mDoExt_getArchiveHeap()->getFreeSize());
+ OS_REPORT("最終残り %d(%fM)\n", JFWSystem::getRootHeap()->getTotalFreeSize(), (f32)JFWSystem::getRootHeap()->getTotalFreeSize() / (f32)0x100000);
+ OS_REPORT("拡張最終残り %d(%fM)\n", JKRGetRootHeap2()->getTotalFreeSize(), (f32)JKRGetRootHeap2()->getTotalFreeSize() / (f32)0x100000);
+ OS_REPORT("\x1b[m");
+ }
+ #endif
+
+ BOOL comboTrig = FALSE;
+
dStage_roomControl_c::offNoChangeRoom();
dStage_roomControl_c::setRoomReadId(0xFF);
@@ -188,11 +737,63 @@ static int dScnPly_Execute(dScnPly_c* i_this) {
}
dKy_itudemo_se();
+
+ #if DEBUG
+ if (mDoCPd_c::isConnect(PAD_3)) {
+ if (mDoCPd_c::getTrigStart(PAD_1) && !fapGmHIO_get2Ddraw()) {
+ comboTrig = TRUE;
+ } else if (mDoCPd_c::getHoldR(PAD_2) && mDoCPd_c::getTrigStart(PAD_2)) {
+ comboTrig = TRUE;
+ }
+
+ if (comboTrig == TRUE) {
+ if (l_pause) {
+ l_pause = FALSE;
+ } else {
+ l_pause = TRUE;
+ l_pauseFrame = 0.0f;
+ }
+ }
+
+ if (l_pause) {
+ l_pauseFrame += mDoCPd_c::getAnalogR(PAD_2);
+ if (!mDoCPd_c::getTrigZ(PAD_2) && l_pauseFrame < 1.0f) {
+ i_this->onDebugPause();
+ return 1;
+ }
+
+ l_pauseFrame -= 1.0f;
+ }
+
+ i_this->offDebugPause();
+ }
+ #endif
+
if (!dComIfGp_isPauseFlag()) {
+ #if DEBUG
+ dJprev_c::get()->update();
+ #endif
+
dDemo_c::update();
+
+ #if DEBUG
+ dJcame_c::get()->update();
+ #endif
+
+ #if VERSION == VERSION_SHIELD_DEBUG
+ dBgp_c::executeShare();
+ #endif
+
dComIfGp_getEvent()->Step();
dComIfGp_getAttention()->Run();
}
+
+ #if DEBUG
+ fapGm_HIO_c::printCpuTimer("");
+ fapGm_HIO_c::stopCpuTimer("ゲーム管理(計算処理1)");
+ fapGm_HIO_c::printCpuTimer("");
+ #endif
+
return 1;
}
@@ -201,40 +802,34 @@ static int dScnPly_IsDelete(dScnPly_c i_this) {
return 1;
}
-struct PreLoadInfo {
- const char* stageName;
- const s16* profNameTbl;
- const char** resNameTbl;
- u8 dylKeyTblNum;
- u8 resNameNum;
-};
-
-static const char* T_JOINT_resName[1] = {"Always"};
-
-static PreLoadInfo const PreLoadInfoT[1] = {
- {
- "T_JOINT",
- T_JOINT_dylKeyTbl,
- T_JOINT_resName,
- 1,
- 1,
- },
-};
-
-static s8 preLoadNo = -1;
-
-static u8 doPreLoad = 1;
-
static int dScnPly_Delete(dScnPly_c* i_this) {
+ UNUSED(i_this);
+
+ #if VERSION == VERSION_SHIELD_DEBUG
+ for (int i = 0; i < 32; i++) {
+ char* bank = dStage_roomControl_c::getArcBank(i);
+ if (strcmp(bank, "") != 0) {
+ int rt = dComIfG_syncObjectRes(bank);
+ if (rt > 0) {
+ return 0;
+ }
+ }
+ }
+ #endif
+
daSus_c::reset();
dMpath_c::remove();
dTres_c::remove();
- dComIfGp_getAttention()->~dAttention_c();
+ dAttention_c* attention = dComIfGp_getAttention();
+ attention->~dAttention_c();
dComIfGp_getVibration().Remove();
dComIfG_Bgsp().Dt();
dComIfG_Ccsp()->Dt();
+ #if VERSION == VERSION_SHIELD_DEBUG
+ dPath_Dt();
+ #endif
dStage_Delete();
dComIfGp_event_remove();
@@ -244,6 +839,11 @@ static int dScnPly_Delete(dScnPly_c* i_this) {
dComIfGp_getMsgDtArchive(1)->removeResourceAll();
JKRUnmountArchive(dComIfGp_getMsgDtArchive(1));
+ #if DEBUG
+ dJcame_c::remove();
+ dJprev_c::remove();
+ #endif
+
dDemo_c::remove();
fopMsgM_destroyExpHeap(dComIfGp_getExpHeap2D());
@@ -256,11 +856,25 @@ static int dScnPly_Delete(dScnPly_c* i_this) {
mDoGph_gInf_c::getBloom()->remove();
+ #if VERSION == VERSION_SHIELD_DEBUG
+ dBgp_c::removeShare();
+ #endif
+
dComIfGs_offPlayerFieldLastStayFieldDataExistFlag();
+
+ #if DEBUG
+ daObj::HioObj_c::clean();
+ mDoHIO_deleteChild(g_envHIO.field_0x4);
+ mDoHIO_deleteChild(g_save_bit_HIO.field_0x4);
+ g_preLoadHIO.removeHIO();
+ #endif
+
dComIfGp_setWindowNum(0);
dComIfGd_setView(NULL);
if (preLoadNo >= 0) {
+ OS_REPORT("\x1b[32mプリロード解放\n\x1b[m");
+
const char** resname_table = PreLoadInfoT[preLoadNo].resNameTbl;
int res_num = PreLoadInfoT[preLoadNo].resNameNum;
if (resname_table != NULL && (*resname_table != NULL)) {
@@ -288,6 +902,113 @@ static int dScnPly_Delete(dScnPly_c* i_this) {
return 1;
}
+#if DEBUG
+static u32 getArchiveHeapSize(JKRHeap* i_heap, dRes_info_c* i_resInfo) {
+ if (i_resInfo == NULL) {
+ return 0;
+ }
+
+ u32 size = 0;
+ int var_r29;
+ JKRArchive* archive = i_resInfo->getArchive();
+ if (archive != NULL) {
+ var_r29 = i_heap->getSize(archive);
+ if (var_r29 > 0) {
+ size += var_r29 + 0x10;
+ }
+
+ var_r29 = i_heap->getSize(((JKRAramArchive*)archive)->mBlock);
+ if (var_r29 > 0) {
+ size += var_r29 + 0x10;
+ }
+ }
+
+ JKRSolidHeap* dataHeap = i_resInfo->getDataHeap();
+ if (dataHeap != NULL) {
+ int var_r26 = i_heap->getSize(dataHeap);
+ if (var_r26 > 0) {
+ size += var_r26 + 0x10;
+ }
+ }
+
+ return size;
+}
+
+static u32 getArchiveBankHeapSize(JKRHeap* i_heap) {
+ u32 size = 0;
+ for (int i = 0; i < 32; i++) {
+ char* bank = dStage_roomControl_c::getArcBank(i);
+ if (strcmp(bank, "") != 0) {
+ size += getArchiveHeapSize(i_heap, dComIfG_getObjectResInfo(bank));
+ }
+ }
+
+ return size;
+}
+
+static u32 getStageHeapSize(JKRHeap* i_heap) {
+ u32 size = 0;
+ for (int i = 0; i < 19; i++) {
+ JKRHeap* heap = dStage_roomControl_c::getMemoryBlockHeap(i);
+ if (heap != NULL) {
+ int var_r26 = i_heap->getSize(heap);
+ if (var_r26 > 0) {
+ size += var_r26 + 0x10;
+ }
+ }
+ }
+
+ if (size == 0) {
+ for (int i = 0; i < 64; i++) {
+ size += getArchiveHeapSize(i_heap, dComIfG_getStageResInfo(dComIfG_getRoomArcName(i)));
+ }
+ }
+
+ size += getArchiveHeapSize(i_heap, dComIfG_getStageResInfo("Stg_00")) + getArchiveHeapSize(i_heap, dComIfG_getStageResInfo("Xtg_00"));
+ return size;
+}
+
+static BOOL heapSizeCheck(const char* i_label, JKRExpHeap* i_heap, s32 i_base, BOOL param_3) {
+ s32 free = i_heap->getFreeSize();
+ s32 total = i_heap->getTotalUsedSize();
+
+ if (param_3) {
+ total -= getArchiveBankHeapSize(i_heap);
+ total -= getStageHeapSize(i_heap);
+ }
+
+ s32 archiveHeapSize = mDoExt_getSafeArchiveHeapSize();
+ f32 totalRatio = (f32)total / (f32)archiveHeapSize;
+ f32 freeRatio = (f32)free / (f32)total;
+ OS_REPORT("%s Free<%d> Total<%d> Base<%d> TotalRatio<%f> FreeRatio<%f>\n",
+ i_label,
+ free,
+ total,
+ i_base,
+ totalRatio,
+ freeRatio
+ );
+
+ int var_r30 = std::abs(total - i_base);
+ if (var_r30 > 64) {
+ // "%d (0x%x) byte difference!\n"
+ OS_REPORT("%d (0x%x) バイトの差があります!\n", var_r30, var_r30);
+ i_heap->dump();
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static BOOL heapSizeCheck() {
+ return heapSizeCheck("ArchiveHeap", mDoExt_getArchiveHeap(), mDoExt_getSafeArchiveHeapSize(), TRUE)
+ && heapSizeCheck("J2dHeap", mDoExt_getJ2dHeap(), mDoExt_getSafeJ2dHeapSize(), FALSE)
+ && heapSizeCheck("GameHeap", mDoExt_getGameHeap(), mDoExt_getSafeGameHeapSize(), TRUE)
+ && heapSizeCheck("ZeldaHeap", mDoExt_getZeldaHeap(), mDoExt_getSafeZeldaHeapSize(), FALSE)
+ && heapSizeCheck("CommandHeap", mDoExt_getCommandHeap(), mDoExt_getSafeCommandHeapSize(), FALSE);
+}
+#endif
+
bool dScnPly_c::resetGame() {
if (fpcM_GetName(this) == PROC_OPENING_SCENE) {
if (!dStage_roomControl_c::resetArchiveBank(0)) {
@@ -302,6 +1023,7 @@ bool dScnPly_c::resetGame() {
field_0x1d4 = 1;
}
} else {
+ #if VERSION != VERSION_SHIELD_DEBUG
if (dComIfGp_getNextStagePoint() == -4 || (dComIfGs_getLastSceneMode() & 0xF) == 0xC ||
!strcmp(dComIfGp_getNextStageName(), "F_SP109") ||
(!strcmp(dComIfGp_getNextStageName(), "F_SP116") &&
@@ -311,6 +1033,7 @@ bool dScnPly_c::resetGame() {
return false;
}
}
+ #endif
}
dComIfG_setBrightness(255);
@@ -323,8 +1046,10 @@ void dScnPly_c::offReset() {
if (field_0x1d4 != 0 && !fopOvlpM_IsPeek()) {
mDoRst::offReset();
mDoRst::offResetPrepare();
+ #if VERSION != VERSION_SHIELD_DEBUG
JUTGamePad::C3ButtonReset::sResetOccurred = false;
JUTGamePad::setResetCallback(mDoRst_resetCallBack, NULL);
+ #endif
field_0x1d4 = 0;
}
}
@@ -332,14 +1057,35 @@ void dScnPly_c::offReset() {
static int phase_00(dScnPly_c* i_this) {
if (!i_this->resetGame()) {
return cPhs_INIT_e;
- } else {
- #if PLATFORM_WII
- data_8053a730 = 1;
- #endif
+ }
- mDoGph_gInf_c::offBlure();
- return cPhs_NEXT_e;
+ #if PLATFORM_WII
+ data_8053a730 = 1;
+ #endif
+
+ #if DEBUG
+ l_sceneChangeStartTick = OSGetTick();
+ lbl_8074CAE4 = 1;
+
+ mDoExt_setSafeGameHeapSize();
+ mDoExt_setSafeZeldaHeapSize();
+ mDoExt_setSafeCommandHeapSize();
+ mDoExt_setSafeArchiveHeapSize();
+ mDoExt_setSafeJ2dHeapSize();
+ #endif
+
+ mDoGph_gInf_c::offBlure();
+
+ #if DEBUG
+ if (!heapSizeCheck()) {
+ BOOL isDispWarning = mDoCPd_c::isConnect(PAD_3);
+ if (isDispWarning) {
+ JUT_WARN(2046, "%s", "Memory Danger !!");
+ }
}
+ #endif
+
+ return cPhs_NEXT_e;
}
static int phase_01(dScnPly_c* i_this) {
@@ -353,6 +1099,7 @@ static int phase_01(dScnPly_c* i_this) {
mDoAud_setInDarkness(false);
}
+
mDoAud_setSceneName(dComIfGp_getStartStageName(),
dComIfGp_getStartStageRoomNo(),
dComIfG_play_c::getLayerNo_common(dComIfGp_getStartStageName(), dComIfGp_getStartStageRoomNo(),
@@ -370,19 +1117,17 @@ static int phase_0(dScnPly_c* i_this) {
}
static int phase_1(dScnPly_c* i_this) {
- u32 id = fopScnM_GetID(i_this);
- dStage_roomControl_c::setProcID(id);
+ dStage_roomControl_c::setProcID(fopScnM_GetID(i_this));
dComIfGp_setStartStage(dComIfGp_getNextStartStage());
if (dComIfGp_getStartStageLayer() < 0 && daPy_py_c::checkRoomRestartStart()) {
- const char* stage = dComIfGp_getStartStageName();
- s8 room = dComIfGp_getStartStageRoomNo();
- s8 layer = dComIfGp_getStartStageLayer();
- if (dComIfG_play_c::getLayerNo_common_common(stage, room, layer) < 0) {
+ int layer = dComIfG_play_c::getLayerNo_common_common(dComIfGp_getStartStageName(), dComIfGp_getStartStageRoomNo(), dComIfGp_getStartStageLayer());
+ if (layer < 0) {
dComIfGp_setStartStageLayer(dComIfGp_getLayerOld());
}
}
+
dComIfGp_offEnableNextStage();
// Stage: Faron Woods, Room: Faron Spring
@@ -431,14 +1176,32 @@ static int phase_1(dScnPly_c* i_this) {
dComIfGp_world_dark_set(0);
}
+ #if DEBUG
+ if (dKy_darkworld_check()) {
+ if (dComIfGp_getStartStageLayer() != -1 && dComIfGp_getStartStageLayer() < 10 && dComIfG_play_c::getLayerNo(0) < 10) {
+ if (strcmp(dComIfGp_getStartStageName(), "D_MN08") != 0) {
+ // "Twilight layer spec error! sasaki"
+ OSReport_Error("\nトワイライトのレイヤー指定異常です! sasaki");
+ // "(If loaded from the debug menu, you can directly specify layers, so I can't tell if it's invalid.)"
+ OSReport_Error("\n(デバグメニューからの場合はレイヤー直指定できるので危険なのかは予測つきません。)");
+
+ OSReport_Error("\nstage[%s]", dComIfGp_getStartStageName());
+ OSReport_Error("\nroom[%d]", dComIfGp_getStartStageRoomNo());
+ OSReport_Error("\nlayer[%d]", dComIfG_play_c::getLayerNo(0));
+ OSReport_Error("\nTW1[%d]", dComIfGs_isDarkClearLV(0));
+ OSReport_Error("\nTW2[%d]", dComIfGs_isDarkClearLV(1));
+ OSReport_Error("\nTW3[%d]", dComIfGs_isDarkClearLV(2));
+ OSReport_Error("\nTW4[%d]", dComIfGs_isDarkClearLV(3));
+ }
+ }
+ }
+ #endif
+
// Stage: Lake Hylia, Room: Fountain
if (!strcmp(dComIfGp_getStartStageName(), "F_SP115") && dComIfGp_getStartStageRoomNo() == 1 &&
dComIfGp_getStartStageLayer() < 0)
{
- const char* stage = dComIfGp_getStartStageName();
- s8 room = dComIfGp_getStartStageRoomNo();
- s8 layer = dComIfGp_getStartStageLayer();
- if (dComIfG_play_c::getLayerNo_common(stage, room, layer) == 9) {
+ if (dComIfG_play_c::getLayerNo_common(dComIfGp_getStartStageName(), dComIfGp_getStartStageRoomNo(), dComIfGp_getStartStageLayer()) == 9) {
dComIfGp_setStartStageLayer(9);
}
}
@@ -467,6 +1230,14 @@ static int phase_1(dScnPly_c* i_this) {
dComIfGs_onSaveDunSwitch(30);
}
+ #if DEBUG
+ if (!strcmp(dComIfGp_getStartStageName(), "NPC_GND") && dComIfGp_getStartStageRoomNo() == 0 &&
+ dComIfGp_getStartStageLayer() >= 12)
+ {
+ dComIfGp_world_dark_set(1);
+ }
+ #endif
+
dKy_darkworld_Area_set(dComIfGp_getStartStageName(), dComIfGp_getStartStageRoomNo());
// Stage: Hyrule Castle Sewers, Room: Prison Cell
@@ -507,21 +1278,36 @@ static int phase_1(dScnPly_c* i_this) {
}
dComIfGs_BossLife_public_Set(0xFF);
+
+ #if DEBUG
+ if (g_env_light.light_mask_type & 0xF0) {
+ g_env_light.light_mask_type = g_env_light.light_mask_type & 0xF;
+ } else {
+ g_env_light.light_mask_type = 0;
+ }
+ #else
g_env_light.light_mask_type = 0;
+ #endif
JUTReportConsole_f("Start StageName:RoomNo [%s:%d]\n", dComIfGp_getStartStageName(),
dComIfGp_getStartStageRoomNo());
dComIfGp_setStatus(0);
+
if (dComIfG_syncStageRes("Stg_00") < 0) {
- dComIfG_setStageRes("Stg_00", NULL);
+ int rt = dComIfG_setStageRes("Stg_00", NULL);
+ JUT_ASSERT(2442, rt == 1);
}
+
return cPhs_NEXT_e;
}
static int phase_1_0(dScnPly_c* i_this) {
static char camparamarc[10] = "CamParam";
- if (dComIfG_syncStageRes("Stg_00")) {
+ int rt = dComIfG_syncStageRes("Stg_00");
+ JUT_ASSERT(2469, rt >= 0);
+
+ if (rt != 0) {
return cPhs_INIT_e;
} else {
dStage_infoCreate();
@@ -533,8 +1319,8 @@ static int phase_1_0(dScnPly_c* i_this) {
}
static int phase_2(dScnPly_c* i_this) {
- int tmp = dComIfG_syncAllObjectRes();
- if (tmp >= 0 && tmp != 0) {
+ int rt = dComIfG_syncAllObjectRes();
+ if (rt >= 0 && rt != 0) {
return cPhs_INIT_e;
}
@@ -544,6 +1330,13 @@ static int phase_2(dScnPly_c* i_this) {
particle_no = dStage_stagInfo_GetParticleNo(dComIfGp_getStage()->getStagInfo());
}
+ #if DEBUG
+ if (fapGm_HIO_c::mParticle254Fix) {
+ particle_no = 0xFE;
+ }
+ #endif
+
+ OS_REPORT("============== sceneParticleNo=%d\n", particle_no);
dComIfGp_particle_readScene(particle_no, &i_this->sceneCommand);
dMsgObject_readMessageGroup(&i_this->field_0x1d0);
return cPhs_NEXT_e;
@@ -558,6 +1351,10 @@ static int phase_3(dScnPly_c* i_this) {
return cPhs_INIT_e;
}
+ #if VERSION == VERSION_SHIELD_DEBUG
+ dBgp_c::createShare();
+ #endif
+
return cPhs_NEXT_e;
}
@@ -570,9 +1367,16 @@ dScnPly_preset_HIO_c g_presetHIO;
#endif
static int phase_4(dScnPly_c* i_this) {
+ #if VERSION == VERSION_SHIELD_DEBUG
+ if (!dBgp_c::executeShare()) {
+ return cPhs_INIT_e;
+ }
+ #endif
+
if (i_this->sceneCommand) {
+ JUT_ASSERT(2610, i_this->sceneCommand->getMemAddress() != NULL);
dComIfGp_particle_createScene(i_this->sceneCommand->getMemAddress());
- i_this->sceneCommand->destroy();
+ delete i_this->sceneCommand;
} else {
dComIfGp_particle_createScene(NULL);
}
@@ -583,13 +1387,25 @@ static int phase_4(dScnPly_c* i_this) {
}
dComIfGp_calcNowRegion();
+ #if DEBUG
+ dComIfG_initStopwatch();
+ #endif
dComIfG_Bgsp().Ct();
fopAcM_lc_c::getLineCheck()->ClearPi();
fopAcM_gc_c::getGroundCheck()->ClearPi();
fopAcM_rc_c::getRoofCheck()->ClearPi();
fopAcM_wt_c::getWaterCheck()->ClearPi();
dComIfG_Ccsp()->Ct();
+ #if VERSION == VERSION_SHIELD_DEBUG
+ dPath_Ct();
+ #endif
dDemo_c::create();
+ dEyeHL_mng_c::create();
+
+ #if DEBUG
+ dJcame_c::create(dDemo_c::getSystem(), 0.03333334f, *mDoCPd_c::getGamePad(PAD_4));
+ dJprev_c::create((JStudio::TControl*)dDemo_c::getControl(), *mDoCPd_c::getGamePad(PAD_4));
+ #endif
dComIfGp_setPlayerInfo(0, NULL, 0);
for (int i = 0; i < 2; i++) {
@@ -602,11 +1418,19 @@ static int phase_4(dScnPly_c* i_this) {
dComIfGd_setViewport(NULL);
dComIfGd_setView(NULL);
- dComIfGp_setExpHeap2D(fopMsgM_createExpHeap(0xBB800, NULL));
- dComIfGp_setMsgExpHeap(fopMsgM_createExpHeap(0xA800, NULL));
+ JKRExpHeap* heap = fopMsgM_createExpHeap(0xBB800, NULL);
+ JUT_ASSERT(2704, heap != NULL);
+ dComIfGp_setExpHeap2D(heap);
+
+ JKRExpHeap* heap2 = fopMsgM_createExpHeap(0xA800, NULL);
+ JUT_ASSERT(2709, heap2 != NULL);
+ dComIfGp_setMsgExpHeap(heap2);
if (fpcM_GetName(i_this) == PROC_OPENING_SCENE) {
fopAcM_create(PROC_TITLE, 0, NULL, -1, NULL, NULL, -1);
+ #if DEBUG
+ g_playerKind = 0;
+ #endif
dComIfGs_init();
dComIfGs_setOptPointer(0);
dComIfGs_setLife(12);
@@ -622,10 +1446,20 @@ static int phase_4(dScnPly_c* i_this) {
dComIfGp_createSimpleModel();
dMdl_mng_c::create();
- mDoGph_gInf_c::setTickRate((OS_BUS_CLOCK / 4) / 30);
- g_envHIO.field_0x4 = -1;
- g_save_bit_HIO.field_0x4 = -1;
- new (dComIfGp_getAttention()) dAttention_c(dComIfGp_getPlayer(0), 0);
+ mDoGph_gInf_c::setTickRate(OS_TIMER_CLOCK / 30);
+
+ #if DEBUG
+ g_preLoadHIO.entryHIO("プリロード制御");
+ #endif
+ g_envHIO.field_0x4 = mDoHIO_CREATE_CHILD("描画設定", &g_envHIO);
+ g_save_bit_HIO.field_0x4 = mDoHIO_CREATE_CHILD("記録ビット", &g_save_bit_HIO);
+
+ #if DEBUG
+ daObj::HioObj_c::init();
+ #endif
+
+ dAttention_c* attention = dComIfGp_getAttention();
+ new (attention) dAttention_c(dComIfGp_getPlayer(0), 0);
dComIfGp_getVibration().Init();
daYkgr_c::init();
@@ -650,6 +1484,7 @@ static int phase_4(dScnPly_c* i_this) {
return cPhs_COMPLEATE_e;
}
+ OS_REPORT("\x1b[32mプリロードやります\n\x1b[m");
resPreLoadTime0 = OSGetTime();
return cPhs_NEXT_e;
}
@@ -657,25 +1492,30 @@ static int phase_4(dScnPly_c* i_this) {
static int phase_5(dScnPly_c* i_this) {
if (preLoadNo >= 0) {
int phase_state = cPhs_NEXT_e;
+ int goodLoads = 0;
+ int loadNum = 0;
const char** resNames = PreLoadInfoT[preLoadNo].resNameTbl;
s32 resNameNum = PreLoadInfoT[preLoadNo].resNameNum;
if (resNames != NULL && *resNames != NULL) {
JUT_ASSERT(2830, resNameNum <= ARRAY_SIZEU(resPhase));
- int goodLoads = 0;
- int loadNum = 0;
+
for (int i = 0; i < resNameNum; i++) {
- if (dComIfG_resLoad(&resPhase[i], resNames[i]) == 4) {
- goodLoads++;
- } else {
+ int load_phase = dComIfG_resLoad(&resPhase[i], resNames[i]);
+ if (load_phase != cPhs_COMPLEATE_e) {
phase_state = cPhs_INIT_e;
+ } else {
+ goodLoads++;
}
loadNum++;
}
+
+ OS_REPORT("\x1b[32mリソースプリロード %d/%d\n\x1b[m", goodLoads, loadNum);
}
if (phase_state == cPhs_COMPLEATE_e) {
resPreLoadTime1 = OSGetTime();
+ OS_REPORT("\x1b[32mリソースプリロード %lld ms\n\x1b[m", OSTicksToMilliseconds(resPreLoadTime1 - resPreLoadTime0));
}
return phase_state;
@@ -687,25 +1527,30 @@ static int phase_5(dScnPly_c* i_this) {
static int phase_6(dScnPly_c* i_this) {
if (preLoadNo >= 0) {
int phase_state = cPhs_NEXT_e;
+ int goodLoads = 0;
+ int loadNum = 0;
const s16* dylKeyTbl = PreLoadInfoT[preLoadNo].profNameTbl;
s32 dylKeyTblNum = PreLoadInfoT[preLoadNo].dylKeyTblNum;
if (dylKeyTbl != NULL && *dylKeyTbl != 0) {
JUT_ASSERT(2864, dylKeyTblNum <= ARRAY_SIZEU(dylPhase));
- int goodLoads = 0;
- int loadNum = 0;
+
for (int i = 0; i < dylKeyTblNum; i++) {
- if (cDylPhs::Link(&dylPhase[i], dylKeyTbl[i]) == cPhs_COMPLEATE_e) {
- goodLoads++;
- } else {
+ int load_phase = cDylPhs::Link(&dylPhase[i], dylKeyTbl[i]);
+ if (load_phase != cPhs_COMPLEATE_e) {
phase_state = cPhs_INIT_e;
+ } else {
+ goodLoads++;
}
loadNum++;
}
+
+ OS_REPORT("\x1b[32mダイナミックリンクプリロード %d/%d\n\x1b[m", goodLoads, loadNum);
}
if (phase_state == cPhs_COMPLEATE_e) {
dylPreLoadTime1 = OSGetTime();
+ OS_REPORT("\x1b[32mダイナミックリンクプリロード %lld ms\n\x1b[m", OSTicksToMilliseconds(dylPreLoadTime1 - dylPreLoadTime0));
}
return phase_state;
@@ -718,17 +1563,24 @@ static int phase_compleate(void* i_this) {
return cPhs_COMPLEATE_e;
}
-static void dScnPly_Create(scene_class* i_this) {
+static int dScnPly_Create(scene_class* i_this) {
static request_of_phase_process_fn l_method[] = {
- (request_of_phase_process_fn)phase_00, (request_of_phase_process_fn)phase_1,
- (request_of_phase_process_fn)phase_1_0, (request_of_phase_process_fn)phase_01,
- (request_of_phase_process_fn)phase_0, (request_of_phase_process_fn)phase_2,
- (request_of_phase_process_fn)phase_3, (request_of_phase_process_fn)phase_4,
- (request_of_phase_process_fn)phase_5, (request_of_phase_process_fn)phase_6,
+ (request_of_phase_process_fn)phase_00,
+ (request_of_phase_process_fn)phase_1,
+ (request_of_phase_process_fn)phase_1_0,
+ (request_of_phase_process_fn)phase_01,
+ (request_of_phase_process_fn)phase_0,
+ (request_of_phase_process_fn)phase_2,
+ (request_of_phase_process_fn)phase_3,
+ (request_of_phase_process_fn)phase_4,
+ (request_of_phase_process_fn)phase_5,
+ (request_of_phase_process_fn)phase_6,
(request_of_phase_process_fn)phase_compleate,
};
- dComLbG_PhaseHandler(&static_cast<dScnPly_c*>(i_this)->field_0x1c4, l_method, i_this);
+ dScnPly_c* a_this = (dScnPly_c*)i_this;
+ int phase_state = dComLbG_PhaseHandler(&a_this->field_0x1c4, l_method, a_this);
+ return phase_state;
}
static scene_method_class l_dScnPly_Method = {