process class inheritance vtable fix

This commit is contained in:
PJB3005
2026-03-01 14:34:07 +01:00
parent eaed93ac3a
commit eaff191b47
10 changed files with 53 additions and 12 deletions
+9 -1
View File
@@ -20,7 +20,7 @@ typedef struct state_class {
} state_class;
typedef struct base_process_class {
/* 0x00 */ int type;
/* 0x00 */ int type; // DUSK NOTE: fopAcM_ct_placement relies on this being the *very* first field!
/* 0x04 */ fpc_ProcID id;
/* 0x08 */ s16 name;
/* 0x0A */ s8 unk_0xA;
@@ -37,6 +37,14 @@ typedef struct base_process_class {
/* 0xAC */ void* append;
/* 0xB0 */ u32 parameters;
/* 0xB4 */ int subtype;
#if !__MWERKS__
// MSVC places vtables at the start of a class, *even* if that class inherits from something
// without vtable. This breaks everything.
// TO avoid issues with pointer casting, we make base_process_class also have a vtable and
// ensure we're using inheritance on it.
virtual ~base_process_class();
#endif
} base_process_class; // Size: 0xB8
BOOL fpcBs_Is_JustOfType(int i_typeA, int i_typeB);
+8
View File
@@ -13,8 +13,16 @@ typedef struct leafdraw_method_class {
/* 0x10 */ process_method_func draw_method;
} leafdraw_method_class;
#if __MWERKS__
#define LEAFDRAW_BASE(val) (val)->base
typedef struct leafdraw_class {
/* 0x00 */ base_process_class base;
#else
#define LEAFDRAW_BASE(val) (*(base_process_class*)val)
typedef struct leafdraw_class : base_process_class {
#endif
/* 0xB8 */ leafdraw_method_class* leaf_methods;
/* 0xBC */ s8 unk_0xBC;
/* 0xBD */ u8 unk_0xBD;