d_event_debug equivalent & modifications to dEvLib_callback_c (#2359)

* WIP d_event_debug
* Implemented most functions close to matching
* Removed erroneous comment in d_com_inf_game.h
* Implemented getEventP in dEvDtBase_c
* Retyped dEvLib_callback_c function returns from BOOL to bool
* Implemented getHeader, getEventList, and setDbgData in dEvent_manager_c
* Moved relevant dEvDb_* classes from d_event.h to d_event_debug.h and changed to structs
* Extended JORFile mFilename character array from 8 to 256 characters
* Implemented combo boxes and update slider functionalities in JORMContext
* Named field_0xC of JORProperyEvent as id, based on use of field in d_event_debug.cpp
* Corrected debug event tables and created missing table
* Debug tables explicitly pasted in d_event_debug.cpp to circumvent ShiftJIS not properly encoding tables via #include directive

* Change return types for implemented virtual functions of actors that inherit from dEvLib_callback_c

* Add const modifier to several d_com_inf_game functions called in d_event_debug, and change respective fields in dEvDb_bit & reg_c to be const

* d_event_debug Equivalent
* Changed configure.py entry to equivalent instead of matching
* Preliminary documentation

* Remove debug tables from d_event.cpp
This commit is contained in:
Huitzi
2025-03-30 23:11:50 -04:00
committed by GitHub
parent 559d389e3d
commit 4ccca6b893
43 changed files with 9956 additions and 162 deletions
+1 -1
View File
@@ -31,7 +31,7 @@ public:
/* 80B9D548 */ void move();
/* 80B9D72C */ void init_modeWait();
/* 80B9D738 */ void modeWait();
/* 80B9D998 */ BOOL eventStart();
/* 80B9D998 */ bool eventStart();
/* 80B9D9BC */ void init_modeDropInit();
/* 80B9DA00 */ void modeDropInit();
/* 80B9DA44 */ void init_modeDrop();
+1 -1
View File
@@ -25,7 +25,7 @@ public:
/* 80BA0084 */ void setMtx();
/* 80BA0208 */ void rotateCheck();
/* 80BA045C */ void shotCheck();
/* 80BA0964 */ virtual BOOL eventStart();
/* 80BA0964 */ virtual bool eventStart();
/* 80BA0974 */ int CreateHeap();
/* 80BA09E4 */ int Create();
/* 80BA0A94 */ int Execute(Mtx** i_mtx);
+1 -1
View File
@@ -44,7 +44,7 @@ public:
/* 80BA1B58 */ void modeWait();
/* 80BA1BCC */ void init_modeWaitEvent();
/* 80BA1BD8 */ void modeWaitEvent();
/* 80BA1C90 */ BOOL eventStart();
/* 80BA1C90 */ bool eventStart();
/* 80BA1CB4 */ void init_modeClose();
/* 80BA1D48 */ void modeClose();
/* 80BA1DCC */ void init_modeCloseEvent();
+1 -1
View File
@@ -29,7 +29,7 @@ public:
/* 80C4DBBC */ int Execute(Mtx**);
/* 80C4E1B0 */ int Draw();
/* 80C4E254 */ int Delete();
/* 80C4E298 */ BOOL eventStart();
/* 80C4E298 */ bool eventStart();
int getSwNo() {
return fopAcM_GetParamBit(this, 0, 8);
+1 -1
View File
@@ -25,7 +25,7 @@ public:
/* 80C4F048 */ int Execute(Mtx**);
/* 80C4F344 */ int Draw();
/* 80C4F3E8 */ int Delete();
/* 80C4F498 */ BOOL eventStart();
/* 80C4F498 */ bool eventStart();
private:
/* 0x5B8 */ Mtx mNewBgMtx;
+1 -1
View File
@@ -38,7 +38,7 @@ public:
/* 80C59AA0 */ virtual int Delete();
/* 80C59D80 */ virtual ~daLv3Water_c();
/* 80C59AE0 */ virtual BOOL eventStart();
/* 80C59AE0 */ virtual bool eventStart();
int getParam() { return fpcM_GetParam(this) >> 0xC & 0x0FFF; }
int getParamSw() { return fpcM_GetParam(this) & 0xFF; }
+1 -1
View File
@@ -31,7 +31,7 @@ public:
/* 80C5ACE4 */ void mode_proc_levelCtrl();
/* 80C5ADA4 */ int Draw();
/* 80C5AEFC */ int Delete();
/* 80C5AF3C */ BOOL eventStart();
/* 80C5AF3C */ bool eventStart();
private:
/* 0x5B8 */ request_of_phase_process_class mPhase;
+1 -1
View File
@@ -40,7 +40,7 @@ public:
int getEventID() { return fopAcM_GetParamBit(this, 0x18, 8); }
/* 80C5D184 */ virtual ~dalv4CandleDemoTag_c();
/* 80C5CF78 */ virtual BOOL eventStart();
/* 80C5CF78 */ virtual bool eventStart();
private:
/* 0x584 */ u8 mMode;
+1 -1
View File
@@ -50,7 +50,7 @@ public:
/* 80CFC6AC */ void modeOffWait();
/* 80CFCA34 */ void init_modeOnWait();
/* 80CFCA40 */ void modeOnWait();
/* 80CFCCE0 */ BOOL eventStart();
/* 80CFCCE0 */ bool eventStart();
/* 80CFD034 */ virtual ~daObjSwHang_c() {}
daObjSwHang_c() : dEvLib_callback_c(this) {}
+1 -1
View File
@@ -29,7 +29,7 @@ public:
/* 80D02C54 */ void move();
/* 80D02E70 */ void init_modeWait();
/* 80D02E7C */ void modeWait();
/* 80D02F88 */ BOOL eventStart();
/* 80D02F88 */ bool eventStart();
/* 80D02FB8 */ void init_modeDropInit();
/* 80D03070 */ void modeDropInit();
/* 80D030A8 */ static void* searchWaterPillar(void*, void*);
+1 -1
View File
@@ -107,7 +107,7 @@ public:
/* 80D23904 */ int draw();
/* 80D23A0C */ int _delete();
/* 80D22DDC */ virtual BOOL eventStart();
/* 80D22DDC */ virtual bool eventStart();
/* 80D23B24 */ virtual ~daObjVolcBall_c() {}
u8 getSwBit() { return fopAcM_GetParamBit(this, 0, 8); }
+1 -1
View File
@@ -34,7 +34,7 @@ public:
/* 80D2D278 */ void effectSet2();
/* 80D2D3FC */ void actionSwWaitInit();
/* 80D2D408 */ void actionSwWait();
/* 80D2D488 */ virtual BOOL eventStart();
/* 80D2D488 */ virtual bool eventStart();
/* 80D2D4AC */ void actionWaitInit();
/* 80D2D588 */ void actionWait();
/* 80D2D5C0 */ void actionUpFirstInit();
+9 -11
View File
@@ -1171,12 +1171,10 @@ inline void dComIfGs_setBottleNum(u8 i_bottleIdx, u8 i_bottleNum) {
g_dComIfG_gameInfo.info.getPlayer().getItemRecord().setBottleNum(i_bottleIdx, i_bottleNum);
}
inline void dComIfGs_onEventBit(u16 i_flag) {
inline void dComIfGs_onEventBit(const u16 i_flag) {
g_dComIfG_gameInfo.info.getSavedata().getEvent().onEventBit(i_flag);
}
// debug rom says `i_flag` is not const, but it's needed to match in some places?
// missing some other inline maybe?
inline BOOL dComIfGs_isEventBit(const u16 i_flag) {
return g_dComIfG_gameInfo.info.getEvent().isEventBit(i_flag);
}
@@ -1310,7 +1308,7 @@ inline u16 dComIfGs_getLife() {
return g_dComIfG_gameInfo.info.getPlayer().getPlayerStatusA().getLife();
}
inline void dComIfGs_offEventBit(u16 i_flag) {
inline void dComIfGs_offEventBit(const u16 i_flag) {
g_dComIfG_gameInfo.info.getSavedata().getEvent().offEventBit(i_flag);
}
@@ -1482,7 +1480,7 @@ inline s32 dComIfGs_isGetMagicUseFlag() {
return g_dComIfG_gameInfo.info.getPlayer().getPlayerStatusA().isMagicFlag(0);
}
inline void dComIfGs_offTmpBit(u16 i_flag) {
inline void dComIfGs_offTmpBit(const u16 i_flag) {
g_dComIfG_gameInfo.info.getTmp().offEventBit(i_flag);
}
@@ -1490,11 +1488,11 @@ inline BOOL dComIfGs_isDarkClearLV(int i_no) {
return g_dComIfG_gameInfo.info.getPlayer().getPlayerStatusB().isDarkClearLV(i_no);
}
inline BOOL dComIfGs_isTmpBit(u16 i_flag) {
inline BOOL dComIfGs_isTmpBit(const u16 i_flag) {
return g_dComIfG_gameInfo.info.getTmp().isEventBit(i_flag);
}
inline void dComIfGs_onTmpBit(u16 i_flag) {
inline void dComIfGs_onTmpBit(const u16 i_flag) {
g_dComIfG_gameInfo.info.getTmp().onEventBit(i_flag);
}
@@ -1828,19 +1826,19 @@ inline void dComIfGs_onLightDropGetFlag(u8 i_nowLevel) {
g_dComIfG_gameInfo.info.getPlayer().getLightDrop().onLightDropGetFlag(i_nowLevel);
}
inline void dComIfGs_setTmpReg(u16 i_reg, u8 i_no) {
inline void dComIfGs_setTmpReg(const u16 i_reg, u8 i_no) {
g_dComIfG_gameInfo.info.getTmp().setEventReg(i_reg, i_no);
}
inline u8 dComIfGs_getTmpReg(u16 i_reg) {
inline u8 dComIfGs_getTmpReg(const u16 i_reg) {
return g_dComIfG_gameInfo.info.getTmp().getEventReg(i_reg);
}
inline u8 dComIfGs_getEventReg(u16 reg) {
inline u8 dComIfGs_getEventReg(const u16 reg) {
return g_dComIfG_gameInfo.info.getEvent().getEventReg(reg);
}
inline void dComIfGs_setEventReg(u16 reg, u8 value) {
inline void dComIfGs_setEventReg(const u16 reg, u8 value) {
g_dComIfG_gameInfo.info.getEvent().setEventReg(reg, value);
}
-34
View File
@@ -8,40 +8,6 @@ int dEv_noFinishSkipProc(void*, int);
struct dStage_MapEvent_dt_c;
class fopAc_ac_c;
#ifdef DEBUG
class dEvDb_bit_c {
public:
/* 0x00 */ char* mFlagName;
/* 0x04 */ char* mFlagDescription;
/* 0x08 */ char* mFlagAuthor;
/* 0x0C */ u16 mFlagValue;
/* 0x10 */ char* mArea; // Area in the game where flag is used
/* 0x14 */ u8 field_0x14;
/* 0x15 */ u8 field_0x15;
};
class dEvDb_reg_c {
public:
/* 0x00 */ char* mFlagName;
/* 0x04 */ char* mFlagDescription;
/* 0x08 */ char* mFlagAuthor;
/* 0x0C */ u16 mFlagValue;
/* 0x10 */ char* mArea; // Area in the game where flag is used
/* 0x14 */ u8 field_0x14;
/* 0x15 */ u8 field_0x15;
};
class dEvDb_flag_base_c {
public:
/* 0x00 */ dEvDb_bit_c* mBitTable;
/* 0x04 */ dEvDb_reg_c* mRegTable;
/* 0x08 */ int mBitNum;
/* 0x0C */ int mRegNum;
/* 0x10 */ int field_0x10;
/* 0x14 */ int field_0x14;
};
#endif
class dEvt_order_c {
public:
~dEvt_order_c() {}
+1
View File
@@ -205,6 +205,7 @@ public:
event_binary_data_header* getHeaderP() { return mHeaderP; }
dEvDtStaff_c* getStaffP(int i) { return &mStaffP[i]; }
dEvDtEvent_c* getEventP(int i) { return &mEventP[i]; }
dEvDtEvent_c* getEventP() { return mEventP; }
dEvDtData_c* getDataP(int i) { return &mDataP[i]; }
dEvDtCut_c* getCutP(int i) { return &mCutP[i]; }
char* getEventName(int i) { return mEventP[i].getName(); }
+173
View File
@@ -0,0 +1,173 @@
#ifndef D_EVENT_D_EVENT_DEBUG_H
#define D_EVENT_D_EVENT_DEBUG_H
#ifdef DEBUG
#include "JSystem/JHostIO/JORMContext.h"
#include "d/d_event.h"
struct dEvDb_bit_c {
/* 0x00 */ char* mFlagName;
/* 0x04 */ char* mFlagDescription;
/* 0x08 */ char* mFlagAuthor;
/* 0x0C */ const u16 mFlagValue;
/* 0x10 */ char* mArea; // Area in the game where flag is used
/* 0x14 */ u8 mRootBit;
/* 0x15 */ u8 field_0x15;
/* 0x16 */ u8 mIsSet;
};
struct dEvDb_reg_c {
/* 0x00 */ char* mFlagName;
/* 0x04 */ char* mFlagDescription;
/* 0x08 */ char* mFlagAuthor;
/* 0x0C */ const u16 mFlagValue;
/* 0x10 */ char* mArea; // Area in the game where flag is used
/* 0x14 */ u8 mRootReg;
/* 0x15 */ u8 field_0x15;
/* 0x16 */ u8 mIsSet;
};
struct dEvDb_flag_base_c {
/* 0x00 */ dEvDb_bit_c* mBitTable;
/* 0x04 */ dEvDb_reg_c* mRegTable;
/* 0x08 */ int mTotalBitNum;
/* 0x0C */ int mTotalRegNum;
/* 0x10 */ int mNumRootBits;
/* 0x14 */ int mNumRootRegs;
char* searchDirNameBit(int);
char* searchDirNameReg(int);
};
struct dEvM_play_HIO_c : public JORReflexible {
dEvM_play_HIO_c();
/* 0x04 */ s16 mTargetEvent;
/* 0x06 */ s16 field_0x6;
/* 0x08 */ s16 mEventCameraMode;
/* 0x0A */ s16 field_0xA;
void genMessage(JORMContext*);
void listenPropertyEvent(const JORPropertyEvent*);
void removeComboBox();
void addComboBox();
enum JOR_PROPERTY_EVENT_IDs_e {
LBL_EVENT_PLAYBACK_TESTING = (1 << 31) + 1,
BTN_PLAYBACK = (1 << 26) + 1,
BTN_STOP
};
enum CAMERA_MODES_e {
UNSET = 0,
PLAYBACK,
STOP
};
};
STATIC_ASSERT(sizeof(dEvM_play_HIO_c) == 0xC);
struct dEvM_reg_HIO_c : public JORReflexible {
dEvM_reg_HIO_c();
~dEvM_reg_HIO_c();
/* 0x04 */ dEvDb_flag_base_c* mFlagTables;
/* 0x08 */ u8 field_0x008;
/* 0x09 */ u8 mRootRegIdx;
void genMessage(JORMContext*);
void listenPropertyEvent(const JORPropertyEvent*);
void update();
enum JOR_PROPERTY_EVENT_IDs_e {
LBL_EVENT_SAVE_REGISTER = (1 << 31) + 1,
BTN_UPDATE = (1 << 28)
};
};
STATIC_ASSERT(sizeof(dEvM_reg_HIO_c) == 0xC);
struct dEvM_bit_HIO_c : public JORReflexible {
dEvM_bit_HIO_c();
~dEvM_bit_HIO_c();
/* 0x04 */ dEvDb_flag_base_c* mFlagTables;
/* 0x08 */ u8 field_0x008;
/* 0x09 */ u8 mRootBitIdx;
void genMessage(JORMContext*);
void listenPropertyEvent(const JORPropertyEvent*);
void update();
enum JOR_PROPERTY_EVENT_IDs_e {
LBL_EVENT_SAVE_BIT = (1 << 31) + 1,
BTN_UPDATE = (1 << 28)
};
};
STATIC_ASSERT(sizeof(dEvM_bit_HIO_c) == 0xC);
struct dEvM_root_bit_HIO_c : public JORReflexible {
dEvM_root_bit_HIO_c() {}
dEvM_bit_HIO_c mBit[100];
dEvDb_flag_base_c* mFlagTables;
void genMessage(JORMContext*);
};
STATIC_ASSERT(sizeof(dEvM_root_bit_HIO_c) == 0x4B8);
struct dEvM_root_reg_HIO_c : public JORReflexible {
dEvM_root_reg_HIO_c() {}
dEvM_reg_HIO_c mReg[100];
dEvDb_flag_base_c* mFlagTables;
void genMessage(JORMContext*);
};
STATIC_ASSERT(sizeof(dEvM_root_reg_HIO_c) == 0x4B8);
struct dEvM_HIO_c : public JORReflexible {
dEvM_HIO_c();
~dEvM_HIO_c();
/* 0x004 */ s8 field_0x004;
/* 0x005 */ u8 m_EVdata_output;
/* 0x006 */ u8 m_evm_debug;
/* 0x007 */ u8 m_evd_debug;
/* 0x008 */ u8 m_eve_debug;
/* 0x009 */ u8 m_evd_unfinished;
/* 0x00A */ u8 m_prioritize_file;
/* 0x00B */ u8 m_enable_skip;
/* 0x00C */ u8 field_0x00C;
/* 0x00D */ u8 m_prevent_scene_switch;
/* 0x010 */ f32 field_0x010;
/* 0x014 */ f32 field_0x014;
/* 0x018 */ f32 field_0x018;
/* 0x01C */ s32 m_corrective_sound_adjustment;
/* 0x020 */ dEvM_play_HIO_c m_playtest;
/* 0x02C */ dEvM_root_bit_HIO_c m_save_bit;
/* 0x4E4 */ dEvM_root_bit_HIO_c m_temp_bit;
/* 0x99C */ dEvM_root_reg_HIO_c m_save_reg;
/* 0xE54 */ dEvM_root_reg_HIO_c m_temp_reg;
void listenPropertyEvent(const JORPropertyEvent*);
void genMessage(JORMContext*);
bool setDebugCameraData(void*);
enum JOR_PROPERTY_EVENT_IDs_e {
LBL_EVENT_MANAGER_TESTING = (1 << 31) + 1,
BTN_READ,
BTN_FORCED_TERMINATION = (1 << 31) + 4
};
};
#endif /* DEBUG */
#endif /* D_EVENT_D_EVENT_DEBUG_H */
+13 -13
View File
@@ -7,7 +7,7 @@ class fopAc_ac_c;
template <typename A0>
struct action_class {
typedef BOOL (A0::*fptr)();
typedef bool (A0::*fptr)();
fptr init;
fptr execute;
@@ -28,21 +28,21 @@ public:
mAction = NULL;
}
/* 8004886C */ BOOL eventUpdate();
/* 800488A4 */ BOOL setEvent(int, int, int);
/* 8004886C */ bool eventUpdate();
/* 800488A4 */ bool setEvent(int, int, int);
/* 80048940 */ void orderEvent(int, int, int);
/* 80048970 */ BOOL setAction(action_class<dEvLib_callback_c>*);
/* 800489A8 */ BOOL initAction();
/* 800489F8 */ BOOL executeAction();
/* 80048A50 */ BOOL initStart();
/* 80048A70 */ BOOL executeStart();
/* 80048B1C */ BOOL initRun();
/* 80048B48 */ BOOL executeRun();
/* 80048970 */ bool setAction(action_class<dEvLib_callback_c>*);
/* 800489A8 */ bool initAction();
/* 800489F8 */ bool executeAction();
/* 80048A50 */ bool initStart();
/* 80048A70 */ bool executeStart();
/* 80048B1C */ bool initRun();
/* 80048B48 */ bool executeRun();
virtual ~dEvLib_callback_c() {}
virtual BOOL eventStart() { return TRUE; }
virtual BOOL eventRun() { return TRUE; }
virtual BOOL eventEnd() { return TRUE; }
virtual bool eventStart() { return true; }
virtual bool eventRun() { return true; }
virtual bool eventEnd() { return true; }
/* 0x4 */ fopAc_ac_c* mActor;
/* 0x8 */ action_class<dEvLib_callback_c>* mAction;
+4
View File
@@ -28,6 +28,7 @@ public:
class dEvent_manager_c {
public:
void* getSubstance(dEvDtData_c* p_data, int type);
void setDbgData(const char*);
dEvent_manager_c();
~dEvent_manager_c() {}
int create();
@@ -81,6 +82,9 @@ public:
int flagCheck(int flag) { return mFlags.flagCheck(flag); }
int cameraPlay() { return mCameraPlay; }
event_binary_data_header* getHeader(u8 idx) {return mEventList[idx].getHeaderP(); }
dEvDtEvent_c* getEventList(u8 idx) { return mEventList[idx].getEventP(); }
inline static s16 getIndexCompositId(s16 param_0) { return param_0 != -1 ? (s16)(param_0 & 0xff) : (s16)-1; }
static int getTypeCompositId(s16 param_0) { return param_0 == -1 ? 0 : param_0 >> 8; }