Debug build improvements (#1170)

This commit is contained in:
LagoLunatic
2026-08-16 12:09:07 -04:00
committed by GitHub
parent 80c7719636
commit e08dff3c73
26 changed files with 1445 additions and 33 deletions
+7 -6
View File
@@ -189,10 +189,11 @@ bool daObj_Canon_c::checkTgHit() {
}
if(cLib_calcTimer(&field_0x440) == 0) {
cXyz hitPos;
CcAtInfo atInfo;
atInfo.pParticlePos = NULL;
cCcD_Obj* tg = mSph.GetTgHitObj();
cXyz hitPos = *mSph.GetTgHitPosP();
hitPos = *mSph.GetTgHitPosP();
atInfo.mpObj = mSph.GetTgHitObj();
if (tg == NULL) {
return false;
@@ -335,7 +336,7 @@ void daObj_Canon_c::modeWait() {
temp += tmp;
}
s16 temp2 = fopAcM_searchActorAngleY(this, daPy_getPlayerActorClass());
s16 temp2 = fopAcM_searchPlayerAngleY(this);
field_0x2CC.x -= temp * cM_ssin(temp2);
field_0x2CC.z -= temp * cM_scos(temp2);
@@ -384,7 +385,7 @@ void daObj_Canon_c::modeDeleteInit() {
setEffect(dPa_name::ID_IT_SN_MJTAIHOU_SENKO00);
setEffect(dPa_name::ID_IT_JN_MJTAIHOU_SMOKE01);
fopAcM_OffStatus(this, fopAcStts_SHOWMAP_e | 0x1F);
fopAcM_ClearStatusMap(this);
}
/* 00001174-00001178 .text modeDelete__13daObj_Canon_cFv */
@@ -395,7 +396,7 @@ void daObj_Canon_c::modeDelete() {
/* 00001178-00001194 .text modeSwWaitInit__13daObj_Canon_cFv */
void daObj_Canon_c::modeSwWaitInit() {
field_0x46C = 120.0f;
fopAcM_OffStatus(this, fopAcStts_SHOWMAP_e | 0x1F);
fopAcM_ClearStatusMap(this);
}
/* 00001194-000011F4 .text modeSwWait__13daObj_Canon_cFv */
@@ -485,12 +486,12 @@ bool daObj_Canon_c::_execute() {
temp.x = l_HIO.field_0x14;
temp.y = l_HIO.field_0x18 * scale.x;
temp.z = l_HIO.field_0x1C;
mDoMtx_multVec(mpModel->getAnmMtx(WALLBOM_JNT_SHOT_e), &temp, &field_0x450);
cMtx_multVec(mpModel->getAnmMtx(WALLBOM_JNT_SHOT_e), &temp, &field_0x450);
Vec temp2 = {0.0f, 0.0f, 0.0f};
temp2.x = REG12_F(0);
temp2.y = (REG12_F(1) + 60.0f) * scale.x;
temp2.z = REG12_F(2);
mDoMtx_multVec(mpModel->getAnmMtx(WALLBOM_JNT_SHOT_e), &temp2, &field_0x45C);
cMtx_multVec(mpModel->getAnmMtx(WALLBOM_JNT_SHOT_e), &temp2, &field_0x45C);
if(field_0x470.getEmitter()) {
if(cLib_calcTimer(&field_0x484) == 0) {
+1 -1
View File
@@ -110,7 +110,7 @@ BOOL daObjJump::Act_c::Create() {
}
#if VERSION > VERSION_DEMO
if (mType == Type_SPRING_ON_BOX_e) {
actor_status &= ~0x3F;
fopAcM_ClearStatusMap(this);
gbaName = 0;
}
#endif
+55 -6
View File
@@ -4,9 +4,11 @@
//
#include "d/d_cc_d.h"
#include "d/d_debug_viewer.h"
#include "f_op/f_op_actor_mng.h"
#include "dolphin/types.h"
#include "JSystem/JUtility/JUTAssert.h"
#include "m_Do/m_Do_mtx.h"
/* 800AB2AC-800AB328 .text GetAc__22dCcD_GAtTgCoCommonBaseFv */
fopAc_ac_c* dCcD_GAtTgCoCommonBase::GetAc() {
@@ -273,17 +275,58 @@ void dCcD_Cps::Set(const dCcD_SrcCps& src) {
cCcD_CpsAttr::Set(src.mCpsAttr);
}
#ifdef DEBUG
void dCcD_Cps::Draw(const GXColor& color) {
Mtx auStack_68;
Mtx auStack_98;
Mtx auStack_c8;
MTXIdentity(auStack_68);
cXyz cStack_d8;
CalcVec(&cStack_d8);
cMtx_trans(auStack_98, GetStartP()->x, GetStartP()->y, GetStartP()->z);
cM3d_UpMtx(cStack_d8, auStack_c8);
cMtx_concat(auStack_98, auStack_c8, auStack_68);
cMtx_scale(auStack_98, GetR(), 0.5f * GetLen(), GetR());
cMtx_concat(auStack_68, auStack_98, auStack_68);
cMtx_trans(auStack_98, 0.0f, 1.0f, 0.0f);
cMtx_concat(auStack_68, auStack_98, auStack_68);
cMtx_XrotS(auStack_98, 0x4000);
cMtx_concat(auStack_68, auStack_98, auStack_68);
dDbVw_drawCylinderMXlu(auStack_68, color, 1);
dDbVw_drawSphereXlu(*GetStartP(), GetR(), color, 1);
dDbVw_drawSphereXlu(*GetEndP(), GetR(), color, 1);
}
#endif
/* 800ABD34-800ABD54 .text Set__8dCcD_TriFRC11dCcD_SrcTri */
void dCcD_Tri::Set(const dCcD_SrcTri& src) {
dCcD_GObjInf::Set(src.mObjInf);
}
#if DEBUG
void dCcD_Tri::Draw(const GXColor& color) {
cXyz cStack_34[3];
cStack_34[0] = mA;
cStack_34[1] = mB;
cStack_34[2] = mC;
dDbVw_drawTriangleXlu(cStack_34, color, 1);
}
#endif
/* 800ABD54-800ABDCC .text Set__8dCcD_CylFRC11dCcD_SrcCyl */
void dCcD_Cyl::Set(const dCcD_SrcCyl& src) {
dCcD_GObjInf::Set(src.mObjInf);
cCcD_CylAttr::Set(src.mCylAttr);
}
#if DEBUG
void dCcD_Cyl::Draw(const GXColor& color) {
dDbVw_drawCylinderXlu(*GetCP(), GetR(), GetH(), color, 1);
}
#endif
/* 800ABDCC-800ABE18 .text StartCAt__8dCcD_CylFR4cXyz */
void dCcD_Cyl::StartCAt(cXyz& pos) {
cXyz vel = cXyz::Zero;
@@ -300,8 +343,8 @@ void dCcD_Cyl::StartCTg(cXyz& pos) {
/* 800ABE64-800ABEE0 .text MoveCAtTg__8dCcD_CylFR4cXyz */
void dCcD_Cyl::MoveCAtTg(cXyz& pos) {
cXyz& center = GetC();
cXyz vel = pos - center;
const cXyz* center = GetCP();
cXyz vel = pos - *center;
SetAtVec(vel);
SetTgVec(vel);
SetC(pos);
@@ -309,16 +352,16 @@ void dCcD_Cyl::MoveCAtTg(cXyz& pos) {
/* 800ABEE0-800ABF50 .text MoveCAt__8dCcD_CylFR4cXyz */
void dCcD_Cyl::MoveCAt(cXyz& pos) {
cXyz& center = GetC();
cXyz vel = pos - center;
const cXyz* center = GetCP();
cXyz vel = pos - *center;
SetAtVec(vel);
SetC(pos);
}
/* 800ABF50-800ABFC0 .text MoveCTg__8dCcD_CylFR4cXyz */
void dCcD_Cyl::MoveCTg(cXyz& pos) {
cXyz& center = GetC();
cXyz vel = pos - center;
const cXyz* center = GetCP();
cXyz vel = pos - *center;
SetTgVec(vel);
SetC(pos);
}
@@ -329,6 +372,12 @@ void dCcD_Sph::Set(const dCcD_SrcSph& src) {
cCcD_SphAttr::Set(src.mSphAttr);
}
#ifdef DEBUG
void dCcD_Sph::Draw(const GXColor& color) {
dDbVw_drawSphereXlu(*GetCP(), GetR(), color, 1);
}
#endif
/* 800AC02C-800AC078 .text StartCAt__8dCcD_SphFR4cXyz */
void dCcD_Sph::StartCAt(cXyz& pos) {
cXyz atVec = cXyz::Zero;
+125 -1
View File
@@ -6,6 +6,67 @@
#include "d/d_cc_s.h"
#include "d/d_cc_d.h"
#include "d/d_com_inf_game.h"
#include "m_Do/m_Do_hostIO.h"
#if DEBUG
class dCcS_HIO : public JORReflexible {
public:
enum flags_e {
FLAG_CAM_COL_DISP_e = 0x1, // TP only?
FLAG_AT_ON_e = 0x2,
FLAG_TG_ON_e = 0x4,
FLAG_CO_ON_e = 0x8,
FLAG_DRAW_CLEAR_OFF_e = 0x10,
FLAG_COUNTER_e = 0x20,
FLAG_MOVE_OFF_e = 0x40,
FLAG_MASS_OFF_e = 0x80,
FLAG_MOVE_TIMER_e = 0x100,
FLAG_MASS_TIMER_e = 0x200,
FLAG_MASS_COUNTER_e = 0x400,
FLAG_ALL_MASS_TIMER_e = 0x800,
};
dCcS_HIO() {
m_flags = 0;
m_shield_range = 0x4000;
}
virtual ~dCcS_HIO();
void genMessage(JORMContext*);
BOOL ChkMoveTimer() { return m_flags & FLAG_MOVE_TIMER_e; }
BOOL ChkMoveOff() { return m_flags & FLAG_MOVE_OFF_e; }
BOOL ChkAllMassTimer() { return m_flags & FLAG_ALL_MASS_TIMER_e; }
BOOL ChkDrawClearOff() { return m_flags & FLAG_DRAW_CLEAR_OFF_e; }
BOOL ChkCounter() { return m_flags & FLAG_COUNTER_e; }
BOOL CheckCoOn() { return m_flags & FLAG_CO_ON_e; }
BOOL CheckTgOn() { return m_flags & FLAG_TG_ON_e; }
BOOL CheckAtOn() { return m_flags & FLAG_AT_ON_e; }
BOOL ChkMassCounter() { return m_flags & FLAG_MASS_COUNTER_e; }
BOOL ChkMassOff() { return m_flags & FLAG_MASS_OFF_e; }
BOOL ChkMassTimer() { return m_flags & FLAG_MASS_TIMER_e; }
s16 GetShFrontRange() { return m_shield_range; }
/* 0x4 */ s8 id;
/* 0x6 */ u16 m_flags;
/* 0x8 */ s16 m_shield_range;
};
dCcS_HIO::~dCcS_HIO() {}
void dCcS_HIO::genMessage(JORMContext* mctx) {
UNUSED(mctx);
}
static OSStopwatch s_move_timer;
static OSStopwatch s_mass_timer;
static dCcS_HIO s_Hio;
int g_mass_counter;
#endif
/* 800AD5B0-800AD5E4 .text Ct__4dCcSFv */
void dCcS::Ct() {
@@ -460,8 +521,71 @@ void dCcS::Move() {
/* 800AE83C-800AE878 .text Draw__4dCcSFv */
void dCcS::Draw() {
#if DEBUG
if (s_Hio.ChkMassCounter()) {
OSReport("Mass Counter %d\n", g_mass_counter);
g_mass_counter = 0;
}
if (s_Hio.CheckAtOn()) {
for (int i = 0; i < mObjAtDrawCount; i++) {
if (mpObjAt[i] != NULL && mpObjAt[i]->ChkAtSet()) {
dCcD_GObjInf* gobj = (dCcD_GObjInf*)mpObjAt[i]->GetGObjInf();
if (gobj->ChkAtHit()) {
GXColor color = {0xFF, 0, 0, 0xB4};
mpObjAt[i]->Draw(color);
} else {
GXColor color = {0xFF, 0, 0, 0x50};
mpObjAt[i]->Draw(color);
}
}
}
}
if (s_Hio.CheckTgOn()) {
for (int i = 0; i < mObjTgDrawCount; i++) {
if (mpObjTg[i] != NULL && mpObjTg[i]->ChkTgSet()) {
dCcD_GObjInf* gobj = (dCcD_GObjInf*)mpObjTg[i]->GetGObjInf();
if (gobj->ChkTgHit()) {
GXColor color = {0, 0xFF, 0, 0xB4};
mpObjTg[i]->Draw(color);
} else {
GXColor color = {0, 0xFF, 0, 0x50};
mpObjTg[i]->Draw(color);
}
}
}
}
if (s_Hio.CheckCoOn()) {
for (int i = 0; i < mObjCoDrawCount; i++) {
if (mpObjCo[i] != NULL && mpObjCo[i]->ChkCoSet()) {
dCcD_GObjInf* gobj = (dCcD_GObjInf*)mpObjCo[i]->GetGObjInf();
if (gobj->ChkCoHit()) {
GXColor color = {0xFF, 0xFF, 0xFF, 0xB4};
mpObjCo[i]->Draw(color);
} else {
GXColor color = {0xFF, 0xFF, 0xFF, 0x50};
mpObjCo[i]->Draw(color);
}
}
}
}
if (s_Hio.ChkCounter()) {
OSReport("At:%d,Tg:%d,Co:%d\n", mObjAtDrawCount, mObjTgDrawCount, mObjCoDrawCount);
}
#endif
DrawAfter();
DrawClear();
#if DEBUG
if (!s_Hio.ChkDrawClearOff())
#endif
{
DrawClear();
}
mMass_Mng.Clear();
}
+95
View File
@@ -0,0 +1,95 @@
// Debug-only file. This file is known to have existed for TWW based on the debug maps.
// The contents of this are copied from the TP debug build decomp and may or may not match the actual TWW debug build.
#include "d/d_debug_pad.h"
#include "m_Do/m_Do_controller_pad.h"
#include "JSystem/JUtility/JUTDbPrint.h"
#include "JSystem/JUtility/JUTReport.h"
#include "f_ap/f_ap_game.h"
#include "stdio.h"
#include "stdarg.h"
dDebugPad_c::dDebugPad_c() {
mIsActive = false;
mMode = MODE_CAMERA_e;
mTrigger = false;
}
const char dDebugPad_c::mode_name[MODE_MAX_e][9] = {
"CAMERA",
"BsLight",
"WindTest",
"SDCARD",
};
bool dDebugPad_c::Update() {
mTrigger = false;
if (CPad_CHECK_TRIG_START(PAD_3)) {
mIsActive = mIsActive ? false : true;
mTrigger = true;
}
if (mIsActive) {
if (CPad_CHECK_TRIG_Z(PAD_3)) {
mMode = (mMode + 1) % MODE_MAX_e;
}
int x = 10;
int y = 40;
int line_height = 15;
JUtility::TColor sp40(0xC8, 0x80, 0xFF, 0xC0);
JUtility::TColor sp3C(0xFF, 0xC0, 0xC0, 0xFF);
Report(x, y, sp40, "+-DEBUG-PAD-+");
int i;
for (i = 0; i < MODE_MAX_e; i++) {
y += line_height;
if (i == mMode) {
Report(x, y, sp40, "| |");
Report(x, y, sp3C, " @%-8s ", mode_name[i]);
} else {
Report(x, y, sp40, "| %-8s |", mode_name[i]);
}
}
for (i = 0; i < 1; i++) {
y += line_height;
Report(x, y, sp40, "| |");
}
y += line_height;
Report(x, y, sp40, "+-----------+");
}
return mIsActive;
}
bool dDebugPad_c::Report(int x, int y, JUtility::TColor color, const char* message, ...) {
char buffer[256];
static JUtility::TColor ShadowDarkColor(0, 0, 0, 0x80);
if (mIsActive) {
va_list list;
va_start(list, message);
vsnprintf(buffer, sizeof(buffer), message, list);
va_end(list);
JUTDbPrint::getManager()->flush();
JUTDbPrint::getManager()->setCharColor(ShadowDarkColor);
JUTReport(x + 2, y + 2, buffer);
JUTDbPrint::getManager()->flush();
JUTDbPrint::getManager()->setCharColor(color);
JUTReport(x, y, buffer);
JUTDbPrint::getManager()->flush();
JUTDbPrint::getManager()->setCharColor(g_HIO.mColor);
return true;
}
return false;
}
dDebugPad_c dDebugPad;
+156
View File
@@ -0,0 +1,156 @@
// Debug-only file. This file is known to have existed for TWW based on the debug maps.
// The contents of this are copied from the TP debug build decomp and may or may not match the actual TWW debug build.
#include "d/dolzel.h" // IWYU pragma: keep
#include "d/d_debug_viewer.h"
#include "d/d_debug_pad.h"
#include "d/d_com_inf_game.h"
#include "f_ap/f_ap_game.h"
#include "JSystem/J3DGraphBase/J3DDrawBuffer.h"
#include "JSystem/JUtility/JUTDbPrint.h"
#include "JSystem/JUtility/JUTReport.h"
#include "stdio.h"
J3DPacket* l_drawPacketList[1000];
int l_drawPacketListNum;
J3DPacket* dDbVw_setDrawPacketList(J3DPacket* i_packet, int i_bufferType) {
if (i_packet == NULL) {
return NULL;
}
if (l_drawPacketListNum >= 1000) {
delete (void*)i_packet;
return NULL;
}
l_drawPacketList[l_drawPacketListNum++] = i_packet;
j3dSys.getDrawBuffer(i_bufferType)->entryImm(i_packet, 0);
return i_packet;
}
void dDbVw_deleteDrawPacketList() {
for (int i = 0; i < l_drawPacketListNum; i++) {
delete (void*)l_drawPacketList[i];
}
l_drawPacketListNum = 0;
}
void dDbVw_drawCube8p(int i_bufferType, cXyz* i_points, const GXColor& i_color) {
mDoExt_cube8pPacket* packet = new mDoExt_cube8pPacket(i_points, i_color);
dDbVw_setDrawPacketList(packet, i_bufferType);
}
void dDbVw_drawCube(int i_bufferType, cXyz& i_pos, cXyz& i_size, csXyz& i_angle, const GXColor& i_color) {
mDoExt_cubePacket* packet = new mDoExt_cubePacket(i_pos, i_size, i_angle, i_color);
dDbVw_setDrawPacketList(packet, i_bufferType);
}
void dDbVw_drawTriangle(int i_bufferType, cXyz* i_points, const GXColor& i_color, u8 i_clipZ) {
mDoExt_trianglePacket* packet = new mDoExt_trianglePacket(i_points, i_color, i_clipZ);
dDbVw_setDrawPacketList(packet, i_bufferType);
}
void dDbVw_drawQuad(int i_bufferType, cXyz* i_points, const GXColor& i_color, u8 i_clipZ) {
mDoExt_quadPacket* packet = new mDoExt_quadPacket(i_points, i_color, i_clipZ);
dDbVw_setDrawPacketList(packet, i_bufferType);
}
void dDbVw_drawQuad(int i_bufferType, cXyz* param_1, cXyz* param_2, cXyz* i_pos, s16 i_rotY, const GXColor& i_color, u8 i_clipZ) {
cXyz points[4];
points[0] = *param_1;
points[2] = *param_2;
points[1].x = param_2->x;
points[1].y = param_1->y;
points[1].z = param_1->z;
points[3].x = param_1->x;
points[3].y = param_1->y;
points[3].z = param_2->z;
mDoMtx_stack_c::transS(*i_pos);
mDoMtx_stack_c::YrotM(i_rotY);
for (int i = 0; i < 4; i++) {
mDoMtx_stack_c::multVec(&points[i], &points[i]);
}
mDoExt_quadPacket* packet = new mDoExt_quadPacket(points, i_color, i_clipZ);
dDbVw_setDrawPacketList(packet, i_bufferType);
}
void dDbVw_drawLine(int i_bufferType, cXyz& i_start, cXyz& i_end, const GXColor& i_color, u8 i_clipZ, u8 i_width) {
mDoExt_linePacket* packet = new mDoExt_linePacket(i_start, i_end, i_color, i_clipZ, i_width);
dDbVw_setDrawPacketList(packet, i_bufferType);
}
void dDbVw_drawArrow(int i_bufferType, cXyz& i_pos, cXyz& param_2, const GXColor& i_color, u8 i_clipZ, u8 i_width) {
mDoExt_ArrowPacket* packet = new mDoExt_ArrowPacket(i_pos, param_2, i_color, i_clipZ, i_width);
dDbVw_setDrawPacketList(packet, i_bufferType);
}
void dDbVw_drawPoint(int i_bufferType, cXyz& i_pos, const GXColor& i_color, u8 i_clipZ, u8 i_width) {
mDoExt_pointPacket* packet = new mDoExt_pointPacket(i_pos, i_color, i_clipZ, i_width);
dDbVw_setDrawPacketList(packet, i_bufferType);
}
void dDbVw_drawCircle(int i_bufferType, cXyz& i_pos, f32 i_radius, const GXColor& i_color, u8 i_clipZ, u8 i_width) {
mDoExt_circlePacket* packet = new mDoExt_circlePacket(i_pos, i_radius, i_color, i_clipZ, i_width);
dDbVw_setDrawPacketList(packet, i_bufferType);
}
void dDbVw_drawSphere(int i_bufferType, cXyz& i_pos, f32 i_size, const GXColor& i_color, u8 i_clipZ) {
mDoExt_spherePacket* packet = new mDoExt_spherePacket(i_pos, i_size, i_color, i_clipZ);
dDbVw_setDrawPacketList(packet, i_bufferType);
}
void dDbVw_drawCylinder(int i_bufferType, cXyz& i_pos, f32 i_radius, f32 i_height, const GXColor& i_color, u8 i_clipZ) {
mDoExt_cylinderPacket* packet = new mDoExt_cylinderPacket(i_pos, i_radius, i_height, i_color, i_clipZ);
dDbVw_setDrawPacketList(packet, i_bufferType);
}
void dDbVw_drawCylinderM(int i_bufferType, Mtx i_mtx, const GXColor& i_color, u8 i_clipZ) {
mDoExt_cylinderMPacket* packet = new mDoExt_cylinderMPacket(i_mtx, i_color, i_clipZ);
dDbVw_setDrawPacketList(packet, i_bufferType);
}
static bool reportOK() {
return !dComIfG_isDebugMode() && !dDebugPad.Active();
}
static JUtility::TColor ShadowDarkColor(0, 0, 0, 0x80);
static JUtility::TColor ShadowLightColor(0xFF, 0xFF, 0xFF, 0x80);
int dDbVw_Report(int x, int y, char const* string, ...) {
UNUSED(string);
char buffer[256];
if (reportOK()) {
va_list list;
va_start(list, string);
vsnprintf(buffer, sizeof(buffer), string, list);
va_end(list);
JUTDbPrint::getManager()->flush();
if (g_HIO.mColor & 0xF0F0F000) {
JUTDbPrint::getManager()->setCharColor(ShadowDarkColor);
} else {
JUTDbPrint::getManager()->setCharColor(ShadowLightColor);
}
JUTReport(x + 2, y + 2, buffer);
JUTDbPrint::getManager()->flush();
JUTDbPrint::getManager()->setCharColor(g_HIO.mColor);
JUTReport(x, y, buffer);
JUTDbPrint::getManager()->flush();
return 1;
}
return 0;
}