d_a_obj_junk_repairing OK (#27)

* d_a_obj_junk_repairing OK

* Fix rel_sieve with multi-file RELs
This commit is contained in:
robojumper
2024-09-15 20:54:45 +02:00
committed by GitHub
parent 63365331d8
commit 2f7ceff5b1
11 changed files with 210 additions and 64 deletions
@@ -17,3 +17,9 @@ REL/global_destructor_chain.c:
REL/d/a/obj/d_a_obj_junk_repairing.cpp:
.text start:0x000000F0 end:0x00000D08
.ctors start:0x00000000 end:0x00000004
.rodata start:0x00000000 end:0x00000030
.data start:0x00000000 end:0x000001C8
.bss start:0x00000008 end:0x00000060
REL/d/a/obj/d_a_obj_junk_repairing_data.cpp:
.data start:0x000001C8 end:0x000001F0
@@ -3,62 +3,62 @@ _epilog = .text:0x00000030; // type:function size:0x2C scope:global
_unresolved = .text:0x00000060; // type:function size:0x4 scope:global
__register_global_object = .text:0x00000070; // type:function size:0x1C scope:global
__destroy_global_chain = .text:0x00000090; // type:function size:0x54 scope:global
fn_116_F0 = .text:0x000000F0; // type:function size:0xDC
fn_116_1D0 = .text:0x000001D0; // type:function size:0x58
fn_116_230 = .text:0x00000230; // type:function size:0x58
fn_116_290 = .text:0x00000290; // type:function size:0x6C
fn_116_300 = .text:0x00000300; // type:function size:0xA0
fn_116_3A0 = .text:0x000003A0; // type:function size:0xA4
fn_116_450 = .text:0x00000450; // type:function size:0x60
fn_116_4B0 = .text:0x000004B0; // type:function size:0x48
fn_116_500 = .text:0x00000500; // type:function size:0x98
fn_116_5A0 = .text:0x000005A0; // type:function size:0xD4
fn_116_680 = .text:0x00000680; // type:function size:0x10
fn_116_690 = .text:0x00000690; // type:function size:0x8
fn_116_6A0 = .text:0x000006A0; // type:function size:0x54
fn_116_700 = .text:0x00000700; // type:function size:0x10
fn_116_710 = .text:0x00000710; // type:function size:0xB8
fn_116_7D0 = .text:0x000007D0; // type:function size:0x48
fn_116_820 = .text:0x00000820; // type:function size:0x4
fn_116_830 = .text:0x00000830; // type:function size:0x4
fn_116_840 = .text:0x00000840; // type:function size:0x4
fn_116_850 = .text:0x00000850; // type:function size:0xE8
fn_116_940 = .text:0x00000940; // type:function size:0x10
fn_116_950 = .text:0x00000950; // type:function size:0x60
fn_116_9B0 = .text:0x000009B0; // type:function size:0xC
fn_116_9C0 = .text:0x000009C0; // type:function size:0x1C
fn_116_9E0 = .text:0x000009E0; // type:function size:0x1C
fn_116_A00 = .text:0x00000A00; // type:function size:0x1C
fn_116_A20 = .text:0x00000A20; // type:function size:0x10
fn_116_A30 = .text:0x00000A30; // type:function size:0x10
fn_116_A40 = .text:0x00000A40; // type:function size:0x10
fn_116_A50 = .text:0x00000A50; // type:function size:0x10
fn_116_A60 = .text:0x00000A60; // type:function size:0x10
fn_116_A70 = .text:0x00000A70; // type:function size:0x10
fn_116_A80 = .text:0x00000A80; // type:function size:0x30
fn_116_AB0 = .text:0x00000AB0; // type:function size:0x30
fn_116_AE0 = .text:0x00000AE0; // type:function size:0x30
fn_116_B10 = .text:0x00000B10; // type:function size:0x10C
fn_116_C20 = .text:0x00000C20; // type:function size:0x58
fn_116_C80 = .text:0x00000C80; // type:function size:0x88
dAcOJunkRep_c_classInit__Fv = .text:0x000000F0; // type:function size:0xDC
__dt__17dMyShadowCircle_cFv = .text:0x000001D0; // type:function size:0x58
__dt__26sFState_c<13dAcOJunkRep_c>Fv = .text:0x00000230; // type:function size:0x58
__dt__29sFStateFct_c<13dAcOJunkRep_c>Fv = .text:0x00000290; // type:function size:0x6C
__dt__82sStateMgr_c<13dAcOJunkRep_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x00000300; // type:function size:0xA0
__dt__52sFStateMgr_c<13dAcOJunkRep_c,20sStateMethodUsr_FI_c>Fv = .text:0x000003A0; // type:function size:0xA4
loadMdl__13dAcOJunkRep_cFRQ23m3d6smdl_cPCc = .text:0x00000450; // type:function size:0x60
getState__13dAcOJunkRep_cFv = .text:0x000004B0; // type:function size:0x48
createHeap__13dAcOJunkRep_cFv = .text:0x00000500; // type:function size:0x98
create__13dAcOJunkRep_cFv = .text:0x000005A0; // type:function size:0xD4
changeState__82sStateMgr_c<13dAcOJunkRep_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>FRC12sStateIDIf_c = .text:0x00000680; // type:function size:0x10
doDelete__13dAcOJunkRep_cFv = .text:0x00000690; // type:function size:0x8
actorExecute__13dAcOJunkRep_cFv = .text:0x000006A0; // type:function size:0x54
executeState__82sStateMgr_c<13dAcOJunkRep_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x00000700; // type:function size:0x10
draw__13dAcOJunkRep_cFv = .text:0x00000710; // type:function size:0xB8
realizeState__13dAcOJunkRep_cFv = .text:0x000007D0; // type:function size:0x48
initializeState_Wait__13dAcOJunkRep_cFv = .text:0x00000820; // type:function size:0x4
executeState_Wait__13dAcOJunkRep_cFv = .text:0x00000830; // type:function size:0x4
finalizeState_Wait__13dAcOJunkRep_cFv = .text:0x00000840; // type:function size:0x4
__dt__13dAcOJunkRep_cFv = .text:0x00000850; // type:function size:0xE8
getStateID__82sStateMgr_c<13dAcOJunkRep_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x00000940; // type:function size:0x10
build__29sFStateFct_c<13dAcOJunkRep_c>FRC12sStateIDIf_c = .text:0x00000950; // type:function size:0x60
dispose__29sFStateFct_c<13dAcOJunkRep_c>FRP10sStateIf_c = .text:0x000009B0; // type:function size:0xC
initialize__26sFState_c<13dAcOJunkRep_c>Fv = .text:0x000009C0; // type:function size:0x1C
execute__26sFState_c<13dAcOJunkRep_c>Fv = .text:0x000009E0; // type:function size:0x1C
finalize__26sFState_c<13dAcOJunkRep_c>Fv = .text:0x00000A00; // type:function size:0x1C
initializeState__82sStateMgr_c<13dAcOJunkRep_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x00000A20; // type:function size:0x10
finalizeState__82sStateMgr_c<13dAcOJunkRep_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x00000A30; // type:function size:0x10
refreshState__82sStateMgr_c<13dAcOJunkRep_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x00000A40; // type:function size:0x10
getState__82sStateMgr_c<13dAcOJunkRep_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x00000A50; // type:function size:0x10
getNewStateID__82sStateMgr_c<13dAcOJunkRep_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x00000A60; // type:function size:0x10
getOldStateID__82sStateMgr_c<13dAcOJunkRep_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x00000A70; // type:function size:0x10
finalizeState__28sFStateID_c<13dAcOJunkRep_c>CFR13dAcOJunkRep_c = .text:0x00000A80; // type:function size:0x30
executeState__28sFStateID_c<13dAcOJunkRep_c>CFR13dAcOJunkRep_c = .text:0x00000AB0; // type:function size:0x30
initializeState__28sFStateID_c<13dAcOJunkRep_c>CFR13dAcOJunkRep_c = .text:0x00000AE0; // type:function size:0x30
__sinit_\d_a_obj_junk_repairing_cpp = .text:0x00000B10; // type:function size:0x10C scope:local
__dt__28sFStateID_c<13dAcOJunkRep_c>Fv = .text:0x00000C20; // type:function size:0x58
isSameName__28sFStateID_c<13dAcOJunkRep_c>CFPCc = .text:0x00000C80; // type:function size:0x88
_ctors = .ctors:0x00000000; // type:label scope:global
_dtors = .dtors:0x00000000; // type:label scope:global
__destroy_global_chain_reference = .dtors:0x00000000; // type:object size:0x4 scope:global
lbl_116_rodata_0 = .rodata:0x00000000; // type:object size:0x30 data:float
lbl_116_data_0 = .data:0x00000000; // type:object size:0x10 data:4byte
lbl_116_data_10 = .data:0x00000010; // type:object size:0x8
lbl_116_data_18 = .data:0x00000018; // type:object size:0x20
lbl_116_data_38 = .data:0x00000038; // type:object size:0x80
lbl_116_data_B8 = .data:0x000000B8; // type:object size:0x30
lbl_116_data_E8 = .data:0x000000E8; // type:object size:0x30
lbl_116_data_118 = .data:0x00000118; // type:object size:0x18
lbl_116_data_130 = .data:0x00000130; // type:object size:0x18
lbl_116_data_148 = .data:0x00000148; // type:object size:0x4C
lbl_116_data_194 = .data:0x00000194; // type:object size:0x34
lbl_116_data_1C8 = .data:0x000001C8; // type:object size:0x14
lbl_116_data_1DC = .data:0x000001DC; // type:object size:0x14
lbl_116_rodata_0 = .rodata:0x00000000; // type:object size:0x30 scope:local data:float
g_profile_OBJ_JUNK_REPAIR = .data:0x00000000; // type:object size:0x10 data:4byte
lbl_116_data_10 = .data:0x00000010; // type:object size:0x8 scope:local
lbl_116_data_18 = .data:0x00000018; // type:object size:0x20 scope:local
__vt__13dAcOJunkRep_c = .data:0x00000038; // type:object size:0x80
__vt__52sFStateMgr_c<13dAcOJunkRep_c,20sStateMethodUsr_FI_c> = .data:0x000000B8; // type:object size:0x30
__vt__82sStateMgr_c<13dAcOJunkRep_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c> = .data:0x000000E8; // type:object size:0x30
__vt__29sFStateFct_c<13dAcOJunkRep_c> = .data:0x00000118; // type:object size:0x14
__vt__26sFState_c<13dAcOJunkRep_c> = .data:0x00000130; // type:object size:0x18
__vt__17dMyShadowCircle_c = .data:0x00000148; // type:object size:0xC
lbl_116_data_194 = .data:0x00000194; // type:object size:0x34 scope:local
sMdlName1__13dAcOJunkRep_c = .data:0x000001C8; // type:object size:0x14
sMdlName2__13dAcOJunkRep_c = .data:0x000001DC; // type:object size:0x14
__global_destructor_chain = .bss:0x00000000; // type:object size:0x4 scope:global
lbl_116_bss_8 = .bss:0x00000008; // type:object size:0x10
lbl_116_bss_18 = .bss:0x00000018; // type:object size:0x30 data:4byte
lbl_116_bss_48 = .bss:0x00000048; // type:object size:0x8 data:byte
lbl_116_bss_50 = .bss:0x00000050; // type:object size:0x10 data:float
lbl_116_bss_8 = .bss:0x00000008; // type:object size:0x10 scope:local
StateID_Wait__13dAcOJunkRep_c = .bss:0x00000018; // type:object size:0x30 data:4byte
@GUARD@draw__13dAcOJunkRep_cFv@rot = .bss:0x00000048; // type:object size:0x1 scope:local data:byte
@LOCAL@draw__13dAcOJunkRep_cFv@rot = .bss:0x00000050; // type:object size:0x10 scope:local data:float
+1 -1
View File
@@ -1136,7 +1136,7 @@ fn_8002EB90 = .text:0x8002EB90; // type:function size:0xD8
drawModelType1__12dAcObjBase_cFPQ23m3d6smdl_c = .text:0x8002EC70; // type:function size:0x60
fn_8002ECD0 = .text:0x8002ECD0; // type:function size:0x50
fn_8002ED20 = .text:0x8002ED20; // type:function size:0x88
fn_8002EDB0 = .text:0x8002EDB0; // type:function size:0x8C
fn_8002edb0__12dAcObjBase_cFRQ23m3d15mShadowCircle_cRQ23m3d6smdl_cPC7mQuat_cllf = .text:0x8002EDB0; // type:function size:0x8C
fn_8002EE40 = .text:0x8002EE40; // type:function size:0xFC
fn_8002EF40 = .text:0x8002EF40; // type:function size:0x24
fn_8002EF70 = .text:0x8002EF70; // type:function size:0x28
+13 -1
View File
@@ -255,6 +255,15 @@ def Rel(status, rel_name, cpp_name, extra_cflags=[]):
],
}
def MultiRel(rel_name, objects, extra_cflags=[]):
return {
"lib": rel_name,
"mw_version": "Wii/1.6",
"cflags": cflags_rel + extra_cflags,
"host": False,
"objects": objects,
}
def EGGLib(lib_name, objects):
return {
@@ -899,7 +908,10 @@ config.libs = [
Rel(NonMatching, "d_a_obj_island_nusi", "REL/d/a/obj/d_a_obj_island_nusi.cpp"),
Rel(NonMatching, "d_a_obj_item_heart_container", "REL/d/a/obj/d_a_obj_item_heart_container.cpp"),
Rel(NonMatching, "d_a_obj_ivy_rope", "REL/d/a/obj/d_a_obj_ivy_rope.cpp"),
Rel(NonMatching, "d_a_obj_junk_repairing", "REL/d/a/obj/d_a_obj_junk_repairing.cpp"),
MultiRel("d_a_obj_junk_repairing", [
Object(Matching, "REL/d/a/obj/d_a_obj_junk_repairing.cpp"),
Object(Matching, "REL/d/a/obj/d_a_obj_junk_repairing_data.cpp"),
]),
Rel(NonMatching, "d_a_obj_kanban_stone", "REL/d/a/obj/d_a_obj_kanban_stone.cpp"),
Rel(NonMatching, "d_a_obj_kibako", "REL/d/a/obj/d_a_obj_kibako.cpp"),
Rel(NonMatching, "d_a_obj_kumite_wall", "REL/d/a/obj/d_a_obj_kumite_wall.cpp"),
+3 -1
View File
@@ -3,6 +3,8 @@
#include "d/a/d_a_base.h"
#include "m/m_mtx.h"
#include "m/m3d/m_smdl.h"
#include "m/m3d/m_shadow.h"
#include "m/types_m.h"
#include "nw4r/g3d/g3d_resfile.h"
@@ -102,7 +104,7 @@ public:
// Disabling make Lava and other objects Disappear
/* 8002ecd0 */ void drawModel2();
/* 8002ed20 */ void fn_8002ed20();
/* 8002edb0 */ void fn_8002edb0();
/* 8002edb0 */ void fn_8002edb0(m3d::mShadowCircle_c& shadow, m3d::smdl_c& smdl, const mQuat_c *rot, s32, s32, f32);
/* 8002ee40 */ void drawShadow();
/* 8002ef40 */ void createChildAttached(fProfile::PROFILE_NAME_e actorId, u32 params1, mVec3_c *pos, mAng3_c *rot,
mVec3_c *scale, u32 params2, u32 roomId);
+42
View File
@@ -0,0 +1,42 @@
#ifndef D_A_OBJ_JUNK_REPAIRING_H
#define D_A_OBJ_JUNK_REPAIRING_H
#include <d/a/obj/d_a_obj_base.h>
#include <m/m3d/m_smdl.h>
#include <m/m3d/m_shadow.h>
#include <s/s_State.hpp>
#include <s/s_StateMgr.hpp>
class dMyShadowCircle_c : public m3d::mShadowCircle_c {};
class dAcOJunkRep_c : public dAcObjBase_c {
public:
dAcOJunkRep_c() : mStateMgr(*this, sStateID::null), mpModelToUse(nullptr) {}
virtual ~dAcOJunkRep_c() {}
virtual bool createHeap() override;
virtual int create() override;
virtual int actorExecute() override;
virtual int draw() override;
virtual int doDelete() override;
STATE_FUNC_DECLARE(dAcOJunkRep_c, Wait);
private:
static const f32 sSomeFloat;
static char sMdlName1[];
static char sMdlName2[];
bool loadMdl(m3d::smdl_c &mdl, const char *name);
void realizeState();
bool getState();
nw4r::g3d::ResFile mResFile;
m3d::smdl_c *mpModelToUse;
m3d::smdl_c mModel1;
m3d::smdl_c mModel2;
dMyShadowCircle_c mShadow;
STATE_MGR_DECLARE(dAcOJunkRep_c);
};
#endif
+1
View File
@@ -9,6 +9,7 @@ namespace EGG {
struct Quatf : public Vector3f {
Quatf() {}
Quatf(f32 f, Vector3f v) : w(f), Vector3f(v) {}
Quatf(f32 f, f32 x, f32 y, f32 z) : w(f), Vector3f(Vector3f(x, y, z)) {}
~Quatf() {}
friend Quatf operator*(const Quatf &q, const Vector3f &vec) {
+2
View File
@@ -6,6 +6,8 @@
class mQuat_c : public EGG::Quatf {
public:
mQuat_c() {}
mQuat_c(f32 x, f32 y, f32 z, f32 w): EGG::Quatf(w, x, y, z) {}
void fn_802F2780(const mQuat_c &other);
};
@@ -0,0 +1,78 @@
#include <d/a/obj/d_a_obj_junk_repairing.h>
#include <toBeSorted/item_story_flag_manager.h>
SPECIAL_ACTOR_PROFILE(OBJ_JUNK_REPAIR, dAcOJunkRep_c, fProfile::OBJ_JUNK_REPAIR, 0x027B, 0, 3);
STATE_DEFINE(dAcOJunkRep_c, Wait);
const f32 dAcOJunkRep_c::sSomeFloat = 0.0f;
bool dAcOJunkRep_c::loadMdl(m3d::smdl_c &mdl, const char *name) {
nw4r::g3d::ResMdl resMdl = mResFile.GetResMdl(name);
return mdl.create(resMdl, &heap_allocator, 0x120);
}
bool dAcOJunkRep_c::getState() {
return StoryFlagManager::sInstance->getCounterOrFlag(0x143) == 1;
}
bool dAcOJunkRep_c::createHeap() {
mResFile = getOarcResFile("Junk");
if (!loadMdl(mModel1, sMdlName1)) {
return false;
}
if (!loadMdl(mModel2, sMdlName2)) {
return false;
}
realizeState();
return static_cast<bool>(mpModelToUse);
}
int dAcOJunkRep_c::create() {
if (!initAllocatorWork1Heap(-1, "dAcOJunkRep_c::m_allocator", 0x20)) {
return FAILED;
}
forwardAccel = -1.0f;
forwardMaxSpeed = -40.0f;
mStateMgr.changeState(StateID_Wait);
setBoundingBox(
mVec3_c(-30.0f, -0.0f, -20.0f),
mVec3_c(30.0f, 120.0f, 20.0f)
);
return SUCCEEDED;
}
int dAcOJunkRep_c::doDelete() {
return 1;
}
int dAcOJunkRep_c::actorExecute() {
mStateMgr.executeState();
updateMatrix();
mpModelToUse->setLocalMtx(worldMatrix);
return 1;
}
int dAcOJunkRep_c::draw() {
drawModelType1(mpModelToUse);
static mQuat_c rot(0.0f, 37.5f, 0.0f, 75.0f);
fn_8002edb0(mShadow, *mpModelToUse, &rot, -1, -1, sSomeFloat);
return 1;
}
void dAcOJunkRep_c::realizeState() {
if (getState()) {
mpModelToUse = &mModel2;
} else {
mpModelToUse = &mModel1;
}
}
void dAcOJunkRep_c::initializeState_Wait() {}
void dAcOJunkRep_c::executeState_Wait() {}
void dAcOJunkRep_c::finalizeState_Wait() {}
@@ -0,0 +1,4 @@
#include <d/a/obj/d_a_obj_junk_repairing.h>
char dAcOJunkRep_c::sMdlName1[] = "JunkRepairobject";
char dAcOJunkRep_c::sMdlName2[] = "JunkRepairobjectB";
+5 -6
View File
@@ -67,12 +67,11 @@ def main():
if folder.startswith('d_') and not folder[:-2] in matched_names:
data[folder] = []
s_files = glob.glob(f'./build/SOUE01/{folder}/asm/REL/d/**/*.s', recursive=True)
# maybe won't be true at some point?
assert len(s_files) == 1
text = pathlib.Path(s_files[0]).read_text()
for [sym, comment] in BLOCKING_SYMBOLS:
if sym in text:
data[folder].append(comment)
for f in s_files:
text = pathlib.Path(f).read_text()
for [sym, comment] in BLOCKING_SYMBOLS:
if sym in text:
data[folder].append(comment)
output = sorted([