mirror of
https://github.com/zeldaret/ss
synced 2026-06-22 16:42:53 -04:00
dAcObstonec OK (#132)
This commit is contained in:
@@ -11,3 +11,5 @@ REL/executor.c:
|
||||
|
||||
REL/d/a/obj/d_a_obj_bstone.cpp:
|
||||
.text start:0x00000070 end:0x00000534
|
||||
.rodata start:0x00000000 end:0x00000028
|
||||
.data start:0x00000000 end:0x000000E0
|
||||
|
||||
@@ -2,17 +2,17 @@ _prolog = .text:0x00000000; // type:function size:0x2C scope:global
|
||||
_epilog = .text:0x00000030; // type:function size:0x2C scope:global
|
||||
_unresolved = .text:0x00000060; // type:function size:0x4 scope:global
|
||||
dAcObstonec_classInit__Fv = .text:0x00000070; // type:function size:0x64
|
||||
AcObstonec__initModels = .text:0x000000E0; // type:function size:0x190
|
||||
AcObstonec__init = .text:0x00000270; // type:function size:0xE4
|
||||
fn_18_360 = .text:0x00000360; // type:function size:0x8
|
||||
AcObstonec__update = .text:0x00000370; // type:function size:0xE4
|
||||
AcObstonec__draw = .text:0x00000460; // type:function size:0x54
|
||||
createHeap__11dAcObstonecFv = .text:0x000000E0; // type:function size:0x190
|
||||
create__11dAcObstonecFv = .text:0x00000270; // type:function size:0xE4
|
||||
doDelete__11dAcObstonecFv = .text:0x00000360; // type:function size:0x8
|
||||
actorExecute__11dAcObstonecFv = .text:0x00000370; // type:function size:0xE4
|
||||
draw__11dAcObstonecFv = .text:0x00000460; // type:function size:0x54
|
||||
__dt__11dAcObstonecFv = .text:0x000004C0; // type:function size:0x74
|
||||
_ctors = .ctors:0x00000000; // type:label scope:global
|
||||
_dtors = .dtors:0x00000000; // type:label scope:global
|
||||
lbl_18_rodata_0 = .rodata:0x00000000; // type:object size:0x4 data:float
|
||||
lbl_18_rodata_4 = .rodata:0x00000004; // type:object size:0x20 data:float
|
||||
lbl_18_rodata_24 = .rodata:0x00000024; // type:object size:0x4 data:float
|
||||
g_profile_OBJ_BSTONE = .data:0x00000000; // type:object size:0x40
|
||||
lbl_18_data_40 = .data:0x00000040; // type:object size:0x20
|
||||
AcObstonec__vtable = .data:0x00000060; // type:object size:0x80
|
||||
lbl_18_rodata_0 = .rodata:0x00000000; // type:object size:0x4 scope:local data:float
|
||||
lbl_18_rodata_4 = .rodata:0x00000004; // type:object size:0x20 scope:local data:float
|
||||
lbl_18_rodata_24 = .rodata:0x00000024; // type:object size:0x4 scope:local data:float
|
||||
g_profile_OBJ_BSTONE = .data:0x00000000; // type:object size:0x10
|
||||
lbl_18_data_40 = .data:0x00000040; // type:object size:0x20 scope:local
|
||||
__vt__11dAcObstonec = .data:0x00000060; // type:object size:0x80
|
||||
|
||||
+1
-1
@@ -1329,7 +1329,7 @@ config.libs = [
|
||||
NonMatching, "d_a_obj_bridge_stretch", "REL/d/a/obj/d_a_obj_bridge_stretch.cpp"
|
||||
),
|
||||
Rel(NonMatching, "d_a_obj_bridge_time", "REL/d/a/obj/d_a_obj_bridge_time.cpp"),
|
||||
Rel(NonMatching, "d_a_obj_bstone", "REL/d/a/obj/d_a_obj_bstone.cpp"),
|
||||
Rel(Matching, "d_a_obj_bstone", "REL/d/a/obj/d_a_obj_bstone.cpp"),
|
||||
Rel(NonMatching, "d_a_obj_bubble", "REL/d/a/obj/d_a_obj_bubble.cpp"),
|
||||
Rel(NonMatching, "d_a_obj_building", "REL/d/a/obj/d_a_obj_building.cpp"),
|
||||
Rel(NonMatching, "d_a_obj_bulb_switch", "REL/d/a/obj/d_a_obj_bulb_switch.cpp"),
|
||||
|
||||
@@ -2,13 +2,27 @@
|
||||
#define D_A_OBJ_BSTONE_H
|
||||
|
||||
#include "d/a/obj/d_a_obj_base.h"
|
||||
#include "d/col/bg/d_bg_w.h"
|
||||
#include "m/m3d/m_smdl.h"
|
||||
#include "nw4r/g3d/res/g3d_resfile.h"
|
||||
|
||||
class dAcObstonec : public dAcObjBase_c {
|
||||
public:
|
||||
dAcObstonec() {}
|
||||
virtual ~dAcObstonec() {}
|
||||
|
||||
virtual bool createHeap() override;
|
||||
virtual int create() override;
|
||||
virtual int doDelete() override;
|
||||
virtual int actorExecute() override;
|
||||
virtual int draw() override;
|
||||
|
||||
private:
|
||||
/* 0x330 */ nw4r::g3d::ResFile mRes;
|
||||
/* 0x334 */ m3d::smdl_c mMdl;
|
||||
/* 0x350 */ dBgW mBg;
|
||||
/* 0x560 */ f32 mScaleMag;
|
||||
/* 0x564 */ u8 mVariant;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -176,8 +176,8 @@ public:
|
||||
void SetPriority(PRIORITY priority) {
|
||||
mPriority = priority;
|
||||
}
|
||||
void SetUnkBase() {
|
||||
mField_0x18.field_0x00 = 1;
|
||||
void SetUnkBase(u8 val) {
|
||||
mField_0x18.field_0x00 = val;
|
||||
}
|
||||
void OnStickWall() {
|
||||
field_0x24 |= 1;
|
||||
|
||||
@@ -1,3 +1,81 @@
|
||||
#include "d/a/obj/d_a_obj_bstone.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/a/obj/d_a_obj_base.h"
|
||||
#include "d/col/bg/d_bg_s.h"
|
||||
#include "f/f_base.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "nw4r/g3d/res/g3d_resfile.h"
|
||||
#include "nw4r/g3d/res/g3d_resmdl.h"
|
||||
#include "nw4r/math/math_arithmetic.h"
|
||||
#include "rvl/GX.h" // IWYU pragma: export
|
||||
#include "toBeSorted/time_area_mgr.h"
|
||||
|
||||
SPECIAL_ACTOR_PROFILE(OBJ_BSTONE, dAcObstonec, fProfile::OBJ_BSTONE, 0x130, 0, 2);
|
||||
|
||||
bool dAcObstonec::createHeap() {
|
||||
mRes = nw4r::g3d::ResFile(getOarcResFile("Bstone"));
|
||||
nw4r::g3d::ResMdl mdl = mRes.GetResMdl("model0");
|
||||
TRY_CREATE(mMdl.create(mdl, &heap_allocator, 0xA0));
|
||||
if (mVariant == 1) {
|
||||
mMdl.setPriorityDraw(0xB, 0);
|
||||
mMdl.setBlendModeAll(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_CLEAR, false);
|
||||
}
|
||||
void *dzb = getOarcFile("Bstone", "dzb/model0.dzb");
|
||||
void *plc = getOarcFile("Bstone", "dat/model0.plc");
|
||||
|
||||
updateMatrix();
|
||||
mMdl.setLocalMtx(mWorldMtx);
|
||||
mMdl.setScale(mScale);
|
||||
mScaleMag = nw4r::math::FSqrt(mScale.squaredLength()) * 350.0f;
|
||||
mMdl.calc(false);
|
||||
return !mBg.Set((cBgD_t *)dzb, (PLC *)plc, cBgW::MOVE_BG_e, &mWorldMtx, &mScale);
|
||||
}
|
||||
|
||||
int dAcObstonec::create() {
|
||||
mVariant = params & 0xF;
|
||||
CREATE_ALLOCATOR(dAcObstonec);
|
||||
|
||||
if (mVariant == 1) {
|
||||
mBg.SetUnkBase(2);
|
||||
} else {
|
||||
mBg.SetUnkBase(1);
|
||||
}
|
||||
|
||||
forwardAccel = -1.0f;
|
||||
forwardMaxSpeed = -40.0f;
|
||||
boundingBox.Set(mVec3_c(-350.0f, -60.0f, -240.0f), mVec3_c(350.0f, 600.0f, 240.0f));
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
int dAcObstonec::doDelete() {
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
int dAcObstonec::actorExecute() {
|
||||
f32 tmp = 1.0f;
|
||||
if (mVariant != 0) {
|
||||
tmp = dTimeAreaMgr_c::GetInstance()->checkPositionIsInPastState(roomid, position, nullptr, mScaleMag);
|
||||
if (mVariant != 1) {
|
||||
if (tmp > 0.0f) {
|
||||
mMdl.setPriorityDraw(0xB, 0);
|
||||
} else {
|
||||
mMdl.setPriorityDraw(0x7F, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tmp > 0.0f) {
|
||||
dBgS::GetInstance()->Regist(&mBg, this);
|
||||
} else {
|
||||
dBgS::GetInstance()->Release(&mBg);
|
||||
}
|
||||
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
int dAcObstonec::draw() {
|
||||
if (mVariant != 1 || mBg.ChkUsed()) {
|
||||
drawModelType1(&mMdl);
|
||||
}
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
+1
-1
@@ -254,7 +254,7 @@ bool dRoom_c::setupBg() {
|
||||
}
|
||||
|
||||
if (mCanHavePastState && !mHasAnmTexPat) {
|
||||
bg->SetUnkBase();
|
||||
bg->SetUnkBase(1);
|
||||
}
|
||||
// ???
|
||||
dBgS::GetInstance()->Regist(bg, (dAcObjBase_c *)nullptr);
|
||||
|
||||
@@ -4,49 +4,68 @@
|
||||
objdiff allows one to map symbols from the target binary to the source binary.
|
||||
this script will take those symbols you have mapped, and write them to `symbols.txt`.
|
||||
|
||||
use case: say you have changed the signature/name of a function.
|
||||
use case: say you have changed the signature/name of a function.
|
||||
now, your source file says `foo_Ful`, but symbols.txt says `bar__Fl`.
|
||||
objdiff allows you to map the `foo_Ful` in the target object to `bar__Fl` in the source object.
|
||||
this script allows you to replace `foo_Ful` with `bar__Fl` in `symbols.txt`.
|
||||
"""
|
||||
|
||||
import json
|
||||
import re
|
||||
|
||||
game_id = "SOUE01"
|
||||
|
||||
with open("./objdiff.json") as f:
|
||||
objdiff_config = json.load(f)
|
||||
|
||||
main_obj_re = re.compile(f"^build/{game_id}/obj/")
|
||||
rel_obj_re = re.compile(f"^build/{game_id}/([A-Za-z_0-9\\-]+)/obj/")
|
||||
|
||||
|
||||
def module_for_unit(unit):
|
||||
"""Finds the REL name, or MAIN for the given unit, so that the
|
||||
correct symbols.txt can be updated"""
|
||||
if main_obj_re.match(unit["target_path"]):
|
||||
return "MAIN"
|
||||
elif match := rel_obj_re.match(unit["target_path"]):
|
||||
return match.group(1)
|
||||
|
||||
|
||||
# lol python has types. it's typython. typescript all over again
|
||||
units: list = objdiff_config["units"]
|
||||
symbol_mappings_list = list(
|
||||
filter(None, [unit.get("symbol_mappings") for unit in units])
|
||||
)
|
||||
|
||||
symbol_mappings = {}
|
||||
symbol_mappings_per_file = {}
|
||||
for unit in units:
|
||||
module = module_for_unit(unit)
|
||||
symbol_mapping = unit.get("symbol_mappings")
|
||||
if symbol_mapping is None:
|
||||
continue
|
||||
symbol_mappings.update(symbol_mapping)
|
||||
del unit['symbol_mappings']
|
||||
symbol_mappings_per_file.setdefault(module, {}).update(symbol_mapping)
|
||||
del unit["symbol_mappings"]
|
||||
|
||||
for module, symbol_mappings in symbol_mappings_per_file.items():
|
||||
symbols_file = (
|
||||
f"./config/{game_id}/symbols.txt"
|
||||
if module == "MAIN"
|
||||
else f"./config/{game_id}/rels/{module}/symbols.txt"
|
||||
)
|
||||
with open(symbols_file) as f:
|
||||
symbols = f.readlines()
|
||||
|
||||
with open("./config/SOUE01/symbols.txt") as f:
|
||||
symbols = f.readlines()
|
||||
for i, line in enumerate(symbols):
|
||||
tokens = line.split()
|
||||
old_symbol = tokens[0]
|
||||
|
||||
for i, line in enumerate(symbols):
|
||||
tokens = line.split()
|
||||
old_symbol = tokens[0]
|
||||
new_symbol = symbol_mappings.get(old_symbol)
|
||||
|
||||
new_symbol = symbol_mappings.get(old_symbol)
|
||||
if new_symbol is None:
|
||||
continue
|
||||
|
||||
if new_symbol is None:
|
||||
continue
|
||||
tokens[0] = new_symbol
|
||||
symbols[i] = " ".join(tokens) + "\n"
|
||||
|
||||
tokens[0] = new_symbol
|
||||
symbols[i] = " ".join(tokens) + "\n"
|
||||
|
||||
with open("./config/SOUE01/symbols.txt", "w") as f:
|
||||
f.writelines(symbols)
|
||||
with open(symbols_file, "w") as f:
|
||||
f.writelines(symbols)
|
||||
|
||||
with open("./objdiff.json", "w") as f:
|
||||
json.dump(objdiff_config, f)
|
||||
|
||||
Reference in New Issue
Block a user