akabe/swheavy create_heap: Found a slightly cleaner fakematch

This commit is contained in:
LagoLunatic
2025-03-17 19:49:14 -04:00
parent 20317a1942
commit 455ff4a571
4 changed files with 18 additions and 17 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ namespace daObjAkabe {
s32 prm_get_arg0() const { return daObj::PrmAbstract(this, PRM_ARG0_W, PRM_ARG0_S); }
s32 _create();
BOOL create_heap();
u8 create_heap();
bool _delete();
void init_scale();
void init_mtx();
+1 -1
View File
@@ -43,7 +43,7 @@ namespace daObjSwheavy {
void rev_switch() const { fopAcM_revSwitch(const_cast<Act_c*>(this), prm_get_swSave()); }
static BOOL solidHeapCB(fopAc_ac_c*);
BOOL create_heap();
u8 create_heap();
s32 _create();
bool _delete();
void set_mtx();
+12 -13
View File
@@ -8,9 +8,6 @@
#include "d/res/res_akabed.h"
#include "d/res/res_akabek.h"
#include "d/res/res_nbox.h"
#include "d/d_item.h"
#include "d/d_item_data.h"
#include "d/d_cc_d.h"
#include "d/d_procname.h"
#include "d/d_com_inf_game.h"
#include "m_Do/m_Do_mtx.h"
@@ -25,12 +22,12 @@ namespace daObjAkabe {
/* 00000078-0000009C .text solidHeapCB__Q210daObjAkabe5Act_cFP10fopAc_ac_c */
BOOL Act_c::solidHeapCB(fopAc_ac_c* i_this) {
return ((Act_c*)i_this)->create_heap() & 0xFF; // Fakematch (see comment in create_heap)
return ((Act_c*)i_this)->create_heap();
}
/* 0000009C-000001A4 .text create_heap__Q210daObjAkabe5Act_cFv */
BOOL Act_c::create_heap() {
bool rt = false;
u8 Act_c::create_heap() {
bool ret = false;
mpBgW = new dBgW();
if (mpBgW != NULL) {
@@ -38,15 +35,16 @@ namespace daObjAkabe {
cBgD_t * bgw_data = (cBgD_t*)dComIfG_getObjectRes(M_arcname[mType], dzb[mType]);
JUT_ASSERT(0x82, bgw_data != NULL);
if (!mpBgW->Set(bgw_data, cBgW::MOVE_BG_e, &mMtx))
rt = true;
ret = true;
}
// Fakematch: create_heap should have return type bool based on the clrlwi in solidHeapCB,
// but this part doesn't match unless the return variable and the return type are both BOOL.
BOOL ret = rt;
if (!rt)
if (!ret) {
mpBgW = NULL;
return ret;
}
// Fakematch? This function should probably have return type bool, but the codegen towards the
// end here doesn't work unless the return type is u8.
return ret;
}
@@ -96,8 +94,9 @@ namespace daObjAkabe {
/* 00000360-000003F8 .text _delete__Q210daObjAkabe5Act_cFv */
bool Act_c::_delete() {
if (mbAppear) {
if (mpBgW != NULL && mpBgW->ChkUsed())
dComIfG_Bgsp()->Release(mpBgW);
if (mpBgW != NULL && mpBgW->ChkUsed()) {
dComIfG_Bgsp()->Release(mpBgW);
}
dComIfG_resDelete(&mPhs, M_arcname[mType]);
}
+4 -2
View File
@@ -57,11 +57,11 @@ const daObjSwheavy::Attr_c daObjSwheavy::Act_c::M_attr[4] = {
/* 00000078-0000009C .text solidHeapCB__Q212daObjSwheavy5Act_cFP10fopAc_ac_c */
BOOL daObjSwheavy::Act_c::solidHeapCB(fopAc_ac_c* i_this) {
return static_cast<daObjSwheavy::Act_c*>(i_this)->create_heap() & 0xFF; // Fakematch?
return static_cast<daObjSwheavy::Act_c*>(i_this)->create_heap();
}
/* 0000009C-0000032C .text create_heap__Q212daObjSwheavy5Act_cFv */
BOOL daObjSwheavy::Act_c::create_heap() {
u8 daObjSwheavy::Act_c::create_heap() {
J3DModelData* mdl_1_data = (J3DModelData*) dComIfG_getObjectRes(M_arcname, HHBOT_BDL_HHBOT1);
JUT_ASSERT(0x116, mdl_1_data != NULL);
mpModel1 = mDoExt_J3DModel__create(mdl_1_data, 0x80000, 0x11000022);
@@ -99,6 +99,8 @@ BOOL daObjSwheavy::Act_c::create_heap() {
mpBgW1 = NULL;
mpBgW2 = NULL;
}
// Fakematch? This function should probably have return type bool, but the codegen towards the
// end here doesn't work unless the return type is u8.
return success;
}