d_particle debug work (#2944)

* misc work

* more work

* fixed error

* more work

* PR cleanup

* missed cleanup

* error fix

* wii fix
This commit is contained in:
Carco_21
2025-12-12 23:54:42 -05:00
committed by GitHub
parent 2481e184fb
commit 87732304d1
17 changed files with 894 additions and 373 deletions
+2 -2
View File
@@ -151,11 +151,11 @@ public:
return NULL;
}
virtual u8 getTextureCount() const { return mTextureNum; }
virtual bool setBlack(JUtility::TColor i_black) {
/* vt 0x128 */ virtual bool setBlack(JUtility::TColor i_black) {
mBlack = i_black;
return true;
}
virtual bool setWhite(JUtility::TColor i_white) {
/* vt 0x12C */ virtual bool setWhite(JUtility::TColor i_white) {
mWhite = i_white;
return true;
}
@@ -86,7 +86,7 @@ public:
int removeMatColorAnimator(J3DAnmColor* anm) {
return mMaterialTable.removeMatColorAnimator(anm);
}
void syncJ3DSys() {
void syncJ3DSys() const {
syncJ3DSysFlags();
syncJ3DSysPointers();
}
+6
View File
@@ -17,6 +17,12 @@ inline int JMAAbs(int value) {
#endif
}
inline f32 JMAAbs(f32 x) {
#ifdef __MWERKS__
return __fabsf(x);
#endif
}
inline f32 JMAFastReciprocal(f32 value) {
#ifdef __MWERKS__
return __fres(value);
+16 -2
View File
@@ -134,6 +134,7 @@ public:
void setGlobalTranslation(f32 x, f32 y, f32 z) { mGlobalTrs.set(x, y, z); }
void setGlobalTranslation(const JGeometry::TVec3<f32>& trs) { mGlobalTrs.set(trs); }
void getLocalTranslation(JGeometry::TVec3<f32>& vec) { vec.set(mLocalTrs); }
void getLocalTranslation(JGeometry::TVec3<f32>* vec) const { vec->set(mLocalTrs); }
void setGlobalRotation(const JGeometry::TVec3<s16>& rot) {
JPAGetXYZRotateMtx(rot.x, rot.y, rot.z, mGlobalRot);
}
@@ -143,6 +144,7 @@ public:
void setGlobalAlpha(u8 alpha) { mGlobalPrmClr.a = alpha; }
u8 getGlobalAlpha() const { return mGlobalPrmClr.a; }
void getGlobalPrmColor(GXColor& color) { color = mGlobalPrmClr; }
void getGlobalPrmColor(_GXColor* color) const { *color = mGlobalPrmClr; }
void setGlobalPrmColor(u8 r, u8 g, u8 b) { mGlobalPrmClr.r = r; mGlobalPrmClr.g = g; mGlobalPrmClr.b = b; }
void setGlobalEnvColor(u8 r, u8 g, u8 b) { mGlobalEnvClr.r = r; mGlobalEnvClr.g = g; mGlobalEnvClr.b = b; }
void setVolumeSize(u16 size) { mVolumeSize = size; }
@@ -173,6 +175,18 @@ public:
scale.z = 1.0f;
#else
scale.set(mGlobalPScl.x, mGlobalPScl.y, 1.0f);
#endif
}
void getGlobalParticleScale(JGeometry::TVec3<f32>* scale) const {
//TODO: Possible fakematch. Debug and Wii indicate TVec3::set, but using it breaks regalloc
// in dPa_gen_b_light8PcallBack::draw on GCN (where the call to set would normally be
// inlined).
#if PLATFORM_GCN
scale->x = mGlobalPScl.x;
scale->y = mGlobalPScl.y;
scale->z = 1.0f;
#else
scale->set(mGlobalPScl.x, mGlobalPScl.y, 1.0f);
#endif
}
void setGlobalScale(const JGeometry::TVec3<f32>& scale) {
@@ -208,7 +222,7 @@ public:
void stopDrawParticle() { setStatus(JPAEmtrStts_StopDraw); }
void playDrawParticle() { clearStatus(JPAEmtrStts_StopDraw); }
uintptr_t getUserWork() { return mpUserWork; }
uintptr_t getUserWork() const { return mpUserWork; }
void setUserWork(uintptr_t userWork) { mpUserWork = userWork; }
u32 getParticleNumber() const {
return mAlivePtclBase.getNum() + mAlivePtclChld.getNum();
@@ -218,7 +232,7 @@ public:
}
void setDrawTimes(u8 drawTimes) { mDrawTimes = drawTimes; }
void setParticleCallBackPtr(JPAParticleCallBack* cb) { mpPtclCallBack = cb; }
JPAParticleCallBack* getParticleCallBackPtr() { return mpPtclCallBack; }
JPAParticleCallBack* getParticleCallBackPtr() const { return mpPtclCallBack; }
JPAEmitterCallBack* getEmitterCallBackPtr() const { return mpEmtrCallBack; }
u32 getAge() const { return mTick; }
@@ -6,6 +6,7 @@
#include "JSystem/JParticle/JPADrawInfo.h"
#include "JSystem/JSupport/JSUList.h"
#include "JSystem/JGeometry.h"
#include "JSystem/JUtility/JUTAssert.h"
class JPAEmitterCallBack;
class JPAParticleCallBack;
@@ -32,7 +33,12 @@ public:
void entryResourceManager(JPAResourceManager*, u8);
void clearResourceManager(u8);
void calcYBBCam();
JPAResourceManager* getResourceManager(u16 idx) { return pResMgrAry[idx]; }
JPAResourceManager* getResourceManager(u16 idx) const { return pResMgrAry[idx]; }
JPAResourceManager* getResourceManager(u8 res_mgr_id) const {
JUT_ASSERT(147, res_mgr_id < ridMax);
return pResMgrAry[res_mgr_id];
}
int getEmitterNumber() const { return emtrNum - mFreeEmtrList.getNumLinks(); }
public:
/* 0x00 */ JSUList<JPABaseEmitter>* pEmtrUseList;
+5 -1
View File
@@ -27,12 +27,14 @@ public:
bool canCreateChild(JPAEmitterWorkData*);
f32 getWidth(JPABaseEmitter const*) const;
f32 getHeight(JPABaseEmitter const*) const;
int getAge() { return mAge; }
int getAge() const { return mAge; }
void setOffsetPosition(const JGeometry::TVec3<f32>& pos) { mOffsetPosition.set(pos); }
void setOffsetPosition(f32 x, f32 y, f32 z) { mOffsetPosition.set(x, y, z); }
void getOffsetPosition(JGeometry::TVec3<f32>& pos) { pos.set(mOffsetPosition); }
void getOffsetPosition(JGeometry::TVec3<f32>* pos) const { pos->set(mOffsetPosition); }
u16 getRotateAngle() const { return mRotateAngle; }
void getGlobalPosition(JGeometry::TVec3<f32>& pos) const { pos.set(mPosition); }
void getGlobalPosition(JGeometry::TVec3<f32>* pos) const { pos->set(mPosition); }
f32 getParticleScaleX() const { return mParticleScaleX; }
f32 getParticleScaleY() const { return mParticleScaleY; }
void setStatus(u32 flag) { mStatus |= flag; }
@@ -42,7 +44,9 @@ public:
void setDeleteParticleFlag() { setStatus(2); }
void getVelVec(JGeometry::TVec3<f32>& vec) const { vec.set(mVelocity); }
void getLocalPosition(JGeometry::TVec3<f32>& vec) const { vec.set(mLocalPosition); }
void getLocalPosition(JGeometry::TVec3<f32>* vec) const { vec->set(mLocalPosition); }
void getBaseAxis(JGeometry::TVec3<f32>& vec) const { vec.set(mBaseAxis); }
void getBaseAxis(JGeometry::TVec3<f32>* vec) const { vec->set(mBaseAxis); }
public:
/* 0x00 */ JGeometry::TVec3<f32> mPosition;
+1
View File
@@ -75,6 +75,7 @@ public:
void setLevObjSE(u32 soundID, Vec* posPtr, s8 reverb);
void setMultiTriggerSE(u32 soundID, Vec* posPtr, s8 reverb);
void processSeFramework();
void playNaviFlySound(f32, f32);
bool isLevelSe(JAISoundID soundID);
bool isSoundCulling(JAISoundID soundID);
void resetCrowdSize() { mCrowdSize = 0; }
+60
View File
@@ -14,6 +14,7 @@
#include "f_op/f_op_actor.h"
#include "global.h"
#include "m_Do/m_Do_controller_pad.h"
#include "m_Do/m_Do_graphic.h"
class JKRAramArchive;
class dSmplMdl_draw_c;
@@ -838,8 +839,57 @@ public:
dComIfG_inf_c() { this->ct(); }
~dComIfG_inf_c() {}
void ct();
void createBaseCsr();
dComIfG_play_c& getPlay() { return play; }
#if PLATFORM_WII || VERSION == VERSION_SHIELD_DEBUG
class baseCsr_c : public mDoGph_gInf_c::csr_c {
public:
class navi_c {
public:
virtual ~navi_c() {}
int create();
bool draw(f32, f32, u8);
u32 getParticleId() { return mParticleId; }
JKRSolidHeap* m_heap;
J3DModel* m_model;
mDoExt_bckAnm m_bck;
mDoExt_brkAnm m_brk;
cXyz field_0x40;
csXyz field_0x4c;
f32 field_0x54;
f32 field_0x58;
f32 field_0x5c;
u32 mParticleId;
};
virtual ~baseCsr_c() {}
baseCsr_c(u8);
void draw(f32, f32);
void create();
static void particleExecute();
static navi_c* getNavi() { return m_navi; }
dDlst_blo_c field_0x8;
u8 field_0x13c;
u8 field_0x13d;
u8 field_0x13e;
static dPa_hermiteEcallBack_c m_blurCB;
static u32 _m_blurID;
static navi_c* m_navi;
};
class anmCsr_c : public mDoGph_gInf_c::csr_c {
public:
virtual ~anmCsr_c() {}
void draw(f32, f32);
dDlst_blo_c field_0x8;
};
#endif
/* 0x00000 */ dSv_info_c info;
/* 0x00F38 */ dComIfG_play_c play;
/* 0x05F64 */ dDlst_list_c drawlist;
@@ -858,6 +908,9 @@ public:
/* 0x1DE0C */ u8 field_0x1de0c;
static __d_timer_info_c dComIfG_mTimerInfo;
#if PLATFORM_WII || VERSION == VERSION_SHIELD_DEBUG
static baseCsr_c* m_baseCsr;
#endif
}; // Size: 0x1DE10
STATIC_ASSERT(122384 == sizeof(dComIfG_inf_c));
@@ -4430,4 +4483,11 @@ inline void dComIfGd_set3DlineMatDark(mDoExt_3DlineMat_c* param_0) {
g_dComIfG_gameInfo.drawlist.set3DlineMatDark(param_0);
}
#if PLATFORM_WII || VERSION == VERSION_SHIELD_DEBUG
inline void dComIfGd_setListCursor() {
g_dComIfG_gameInfo.drawlist.setOpaListCursor();
g_dComIfG_gameInfo.drawlist.setXluListCursor();
}
#endif
#endif /* D_COM_D_COM_INF_GAME_H */
+56
View File
@@ -2,6 +2,7 @@
#define D_D_DRAWLIST_H
#include "JSystem/J2DGraph/J2DPicture.h"
#include "JSystem/J2DGraph/J2DScreen.h"
#include "SSystem/SComponent/c_m3d_g_pla.h"
#include "f_op/f_op_view.h"
#include "m_Do/m_Do_ext.h"
@@ -35,6 +36,57 @@ public:
virtual void draw() {}
};
class dDlst_blo_c : public dDlst_base_c {
public:
virtual void draw();
bool create(JKRArchive* param_1, const char* param_2) {
return mScreen.setPriority(param_2, 0x20000, param_1) != 0;
}
J2DPane* getPane(u64 i_tag) {
return mScreen.search(i_tag);
}
J2DPicture* getPicture(u64 i_tag) {
J2DPane* pane = getPane(i_tag);
JUT_ASSERT(1553, pane != NULL);
if (pane->getTypeID() != 0x12) {
return NULL;
}
return (J2DPicture*)pane;
}
J2DScreen* getScreen() { return &mScreen; }
void setPos(u64 param_1, f32 param_2, f32 param_3) {
}
class anm_c {
public:
inline anm_c() {
field_0x4 = 0;
field_0x8 = 1.0f;
}
~anm_c() { remove(); }
void remove() {
if (field_0x4 != 0.0f) {
}
field_0x4 = 0.0f;
}
f32 field_0x4;
f32 field_0x8;
};
/* 0x004 */ int field_0x4;
/* 0x008 */ J2DScreen mScreen;
/* 0x120 */ anm_c anm;
};
class dDlst_snapShot_c : public dDlst_base_c {
public:
virtual void draw();
@@ -368,6 +420,10 @@ public:
void setXluListZxlu() { setXluDrawList(mDrawBuffers[DB_LIST_Z_XLU]); }
void setOpaListFilter() { setOpaDrawList(mDrawBuffers[DB_LIST_FILTER]); }
void setXluListFilter() { setXluDrawList(mDrawBuffers[DB_LIST_FILTER]); }
#if PLATFORM_WII || VERSION == VERSION_SHIELD_DEBUG
void setOpaListCursor() { setOpaDrawList(mDrawBuffers[DB_LIST_CURSOR]); }
void setXluListCursor() { setXluDrawList(mDrawBuffers[DB_LIST_CURSOR]); }
#endif
void set3DlineMat(mDoExt_3DlineMat_c *param_1) {
m3DLineMatSortPacket[param_1->getMaterialID()].setMat(param_1);
}
+4
View File
@@ -552,6 +552,10 @@ inline void dMsgObject_setInsectItemNo(u8 i_insectItemNo) {
dMsgObject_getMsgObjectClass()->setInsectItemNo(i_insectItemNo);
}
inline bool dMsgObject_isSelectTalkNowCheck() {
return dMsgObject_getMsgObjectClass()->getStatus() != 8 || (dMsgObject_getMsgObjectClass()->getStatus() != 9 && dMsgObject_getMsgObjectClass()->getStatus() != 20);
}
class dMsgObject_HowlHIO_c {
public:
dMsgObject_HowlHIO_c();
+30 -15
View File
@@ -1,6 +1,7 @@
#ifndef D_PARTICLE_D_PARTICLE_H
#define D_PARTICLE_D_PARTICLE_H
#include "JSystem/JParticle/JPAEmitterManager.h"
#include "SSystem/SComponent/c_m3d_g_pla.h"
#include "JSystem/JParticle/JPAEmitter.h"
#include "JSystem/JParticle/JPAParticle.h"
@@ -17,7 +18,7 @@ class JKRSolidHeap;
class dKy_tevstr_c;
class fopAc_ac_c;
class dPa_levelEcallBack : public JPAEmitterCallBack {
class dPa_levelEcallBack : public JPAEmitterCallBack {
public:
virtual ~dPa_levelEcallBack() { cleanup(); }
virtual void setup(JPABaseEmitter*, const cXyz*, const csXyz*, s8) = 0;
@@ -44,7 +45,7 @@ public:
virtual void draw(JPABaseEmitter*);
void removeEmitter() { mEmitter = NULL; }
u16 getID() const { return mID; }
u16 getID() { return mID; }
/* 0x04 */ JPABaseEmitter* mEmitter;
/* 0x08 */ u16 mID;
@@ -54,18 +55,18 @@ public:
/* 0x10 */ dPa_simpleData_c* mData;
}; // Size: 0x14
class dPa_windPcallBack : public JPAParticleCallBack {
public:
virtual ~dPa_windPcallBack() {}
virtual void execute(JPABaseEmitter*, JPABaseParticle*);
};
class dPa_modelPcallBack : public JPAParticleCallBack {
public:
virtual ~dPa_modelPcallBack() {}
virtual void draw(JPABaseEmitter*, JPABaseParticle*);
};
class dPa_windPcallBack : public JPAParticleCallBack {
public:
virtual ~dPa_windPcallBack() {}
virtual void execute(JPABaseEmitter*, JPABaseParticle*);
};
class dPa_modelEcallBack : public dPa_levelEcallBack {
public:
struct model_c {
@@ -73,16 +74,16 @@ public:
void setup();
void cleanup();
void draw(f32 (*)[4]);
model_c() { field_0x0 = NULL; }
model_c() { mModelData = NULL; }
void reset() {
field_0x0 = NULL;
mModelData = NULL;
}
u8 getRotAxis() { return mRotAxis; }
J3DModelData* getModelData() { return field_0x0; }
J3DModelData* getModelData() { return mModelData; }
J3DModelData* field_0x0;
J3DModelData* mModelData;
J3DAnmBase* field_0x4;
dKy_tevstr_c field_0x8;
u8 mRotAxis;
@@ -119,6 +120,9 @@ public:
static dPa_modelPcallBack mPcallback;
static model_c* mModel;
#if DEBUG
static u8 mNum;
#endif
};
class dPa_selectTexEcallBack : public dPa_levelEcallBack {
@@ -183,6 +187,7 @@ public:
class dPa_gen_d_light8EcallBack : public dPa_levelEcallBack {
public:
virtual ~dPa_gen_d_light8EcallBack() {}
virtual void draw(JPABaseEmitter*);
virtual void drawAfter(JPABaseEmitter*) { dPa_cleanupGX(); }
virtual void setup(JPABaseEmitter*, cXyz const*, csXyz const*, s8);
@@ -232,6 +237,7 @@ public:
virtual void setup(JPABaseEmitter*, cXyz const*, csXyz const*, s8);
void setRate(f32 rate) { mRate = rate; }
void setMaxCnt(int i_maxCnt) { mMaxCnt = i_maxCnt; }
private:
/* 0x04 */ f32 mRate;
@@ -282,11 +288,16 @@ public:
u32 getId() { return mId; }
void clearStatus() { mStatus = 0; }
#if DEBUG
void onEventMove() { mStatus |= (u8)2; }
void offEventMove() { mStatus &= (u8)~2; }
#else
void onEventMove() { mStatus |= 2; }
void offEventMove() { mStatus &= ~2; }
#endif
bool isEventMove() { return mStatus & 2; }
void offActive() { mStatus &= ~1; }
void offActive() { mStatus &= (u8)~1; }
bool isActive() { return mStatus & 1; }
u16 getNameId() { return mNameId; }
dPa_levelEcallBack* getCallback() { return mCallback; }
@@ -402,7 +413,7 @@ public:
void draw2DmenuBack(JPADrawInfo* i_drawInfo) { draw(i_drawInfo, 18); }
JKRSolidHeap* getHeap() { return mHeap; }
JKRSolidHeap* getSceneHeap() { return m_sceneHeap; }
JKRSolidHeap* getSceneHeap() { return mSceneHeap; }
JKRExpHeap* getResHeap() { return m_resHeap; }
void levelAllForceOnEventMove() { field_0x210.allForceOnEventMove(); }
@@ -423,6 +434,7 @@ public:
}
static JPAEmitterManager* getEmitterManager() { return mEmitterMng; }
static int getEmitterNum() { return mEmitterMng->getEmitterNumber(); };
static dPa_light8PcallBack* getLight8PcallBack() {
return &mLight8PcallBack;
@@ -479,7 +491,7 @@ private:
/* 0x000 */ JKRSolidHeap* mHeap;
/* 0x004 */ JPAResourceManager* mCommonResMng;
/* 0x008 */ JKRExpHeap* m_resHeap;
/* 0x00C */ JKRSolidHeap* m_sceneHeap;
/* 0x00C */ JKRSolidHeap* mSceneHeap;
/* 0x010 */ void* m_sceneRes;
/* 0x014 */ JPAResourceManager* mSceneResMng;
/* 0x018 */ u8 field_0x18;
@@ -488,6 +500,9 @@ private:
/* 0x01B */ u8 field_0x1b;
/* 0x01C */ dPa_simpleEcallBack field_0x1c[25];
/* 0x210 */ level_c field_0x210;
#if DEBUG
u8 mSceneCount;
#endif
};
#endif /* D_PARTICLE_D_PARTICLE_H */
+7 -1
View File
@@ -7,6 +7,12 @@ public:
virtual ~dScnPly_env_otherHIO_c() {}
void genMessage(JORMContext*);
void addSetEmitterID(u16 param_0) {
#if DEBUG
field_0x1c[field_0x4f++] = param_0;
field_0x4f %= 20;
#endif
}
#if DEBUG
/* 0x04 */ s8 field_0x04;
@@ -21,7 +27,7 @@ public:
/* 0x16 */ s16 mRailColorG;
/* 0x18 */ s16 mRailColorB;
/* 0x1A */ s16 field_0x1a;
/* 0x1C */ s16 field_0x1c[20];
/* 0x1C */ u16 field_0x1c[20];
#endif
/* 0x44 */ u8 mAdjustLODBias;
+6 -2
View File
@@ -55,12 +55,16 @@ public:
#if PLATFORM_WII || PLATFORM_SHIELD
class csr_c {
public:
virtual ~csr_c();
virtual ~csr_c() {}
virtual bool isPointer();
void particleExecute();
static void particleExecute();
static u32 getBlurID() { return m_blurID; }
static u32 m_blurID;
static cXyz m_oldEffPos;
static cXyz m_oldOldEffPos;
static cXyz m_nowEffPos;
};
static void entryBaseCsr(csr_c*);