Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions config/RSBE01_02/rels/sora_melee/splits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ global_destructor_chain.c:
.dtors start:0x00000000 end:0x00000008
.bss start:0x00000000 end:0x00000004

mo_melee/sora_melee/so/model/so_model_module_simple.cpp:
.text start:0x0000E268 end:0x0000EEAC
.rodata start:0x00000318 end:0x00000320
.data start:0x000007D0 end:0x00000A88

mo_melee/sora_melee/so/model/so_model_module_impl_variable.cpp:
.text start:0x0000F288 end:0x0000FED0
.data start:0x00000A98 end:0x00000C78
Expand Down
178 changes: 89 additions & 89 deletions config/RSBE01_02/rels/sora_melee/symbols.txt

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions config/RSBE01_02/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2120,8 +2120,8 @@ fn_8000CF28 = .text:0x8000CF28; // type:function size:0x144
fn_8000D06C = .text:0x8000D06C; // type:function size:0x8
fn_8000D074 = .text:0x8000D074; // type:function size:0x8
fn_8000D07C = .text:0x8000D07C; // type:function size:0x14
fn_8000D090 = .text:0x8000D090; // type:function size:0x7C
fn_8000D10C = .text:0x8000D10C; // type:function size:0xAC
add__11gfSceneRootFQ211gfSceneRoot9LayerTypePQ34nw4r3g3d6ScnMdl = .text:0x8000D090; // type:function size:0x7C
remove__11gfSceneRootFPQ34nw4r3g3d6ScnMdl = .text:0x8000D10C; // type:function size:0xAC
fn_8000D1B8 = .text:0x8000D1B8; // type:function size:0x7C
fn_8000D234 = .text:0x8000D234; // type:function size:0x18
fn_8000D24C = .text:0x8000D24C; // type:function size:0x94
Expand Down Expand Up @@ -2904,8 +2904,8 @@ fn_8003F03C = .text:0x8003F03C; // type:function size:0x38
fn_8003F074 = .text:0x8003F074; // type:function size:0x88
fn_8003F0FC = .text:0x8003F0FC; // type:function size:0x1B0
fn_8003F2AC = .text:0x8003F2AC; // type:function size:0x24C
fn_8003F4F8 = .text:0x8003F4F8; // type:function size:0xA8
fn_8003F5A0 = .text:0x8003F5A0; // type:function size:0x2F8
mul__6MatrixCFPC6MatrixP6Matrix = .text:0x8003F4F8; // type:function size:0xA8
inverse__6MatrixCFP6Matrix = .text:0x8003F5A0; // type:function size:0x2F8
fn_8003F898 = .text:0x8003F898; // type:function size:0x64
fn_8003F8FC = .text:0x8003F8FC; // type:function size:0xAC
fn_8003F9A8 = .text:0x8003F9A8; // type:function size:0x6C
Expand Down Expand Up @@ -2976,13 +2976,13 @@ addLog__16mtPrngLogManagerFPC9mtPrngLog = .text:0x80043A94; // type:function siz
__sinit_\mt_prng_log_cpp = .text:0x80043AEC; // type:function size:0x2C scope:local
moUnResolvedMessage__FPCc = .text:0x80043B18; // type:function size:0x4
moGetStageModuleName__FQ26Stages11srStageKind = .text:0x80043B1C; // type:function size:0x50
fn_80043B6C = .text:0x80043B6C; // type:function size:0x9C
fn_80043C08 = .text:0x80043C08; // type:function size:0x54
fn_80043C5C = .text:0x80043C5C; // type:function size:0x54
fn_80043CB0 = .text:0x80043CB0; // type:function size:0x70
fn_80043D20 = .text:0x80043D20; // type:function size:0x40
fn_80043D60 = .text:0x80043D60; // type:function size:0x4C
fn_80043DAC = .text:0x80043DAC; // type:function size:0x70
nwSMGetGlobalPosition__FPCQ34nw4r3g3d12ScnMdlSimpleUlPC5Vec3f = .text:0x80043B6C; // type:function size:0x9C
nwSMGetGlobalPosition__FPCQ34nw4r3g3d12ScnMdlSimpleUl = .text:0x80043C08; // type:function size:0x54
nwSMGetLocalPosition__FPCQ34nw4r3g3d12ScnMdlSimpleUl = .text:0x80043C5C; // type:function size:0x54
nwSMGetGlobalRotation__FPCQ34nw4r3g3d12ScnMdlSimpleUl = .text:0x80043CB0; // type:function size:0x70
nwSMSetVisibility__FPQ34nw4r3g3d12ScnMdlSimpleb = .text:0x80043D20; // type:function size:0x40
nwSMSetNodeVisibility__FPQ34nw4r3g3d6ScnMdlUlb = .text:0x80043D60; // type:function size:0x4C
nwSMSetNodeVisibility__FPQ34nw4r3g3d6ScnMdllPCUlb = .text:0x80043DAC; // type:function size:0x70
__ct__10utRelocateFPvUl = .text:0x80043E1C; // type:function size:0x150
__dt__10utRelocateFv = .text:0x80043F6C; // type:function size:0x40
getPublicAddress__10utRelocateFPCc = .text:0x80043FAC; // type:function size:0x90
Expand Down Expand Up @@ -7195,7 +7195,7 @@ fn_8018ECCC = .text:0x8018ECCC; // type:function size:0x44
GetResNode__Q34nw4r3g3d6ResMdlCFPCc = .text:0x8018ED10; // type:function size:0x44
fn_8018ED54 = .text:0x8018ED54; // type:function size:0x50
GetResNode__Q34nw4r3g3d6ResMdlCFi = .text:0x8018EDA4; // type:function size:0x54
GetResNode__Q34nw4r3g3d6ResMdlCFUx = .text:0x8018EDF8; // type:function size:0x54
GetResNode__Q34nw4r3g3d6ResMdlCFUl = .text:0x8018EDF8; // type:function size:0x54
GetResNodeNumEntries__Q34nw4r3g3d6ResMdlFv = .text:0x8018EE4C; // type:function size:0x34
fn_8018EE80 = .text:0x8018EE80; // type:function size:0x50
fn_8018EED0 = .text:0x8018EED0; // type:function size:0x54
Expand Down Expand Up @@ -7857,7 +7857,7 @@ fn_801AE31C = .text:0x801AE31C; // type:function size:0x34C
fn_801AE668 = .text:0x801AE668; // type:function size:0x890
fn_801AEEF8 = .text:0x801AEEF8; // type:function size:0x48
fn_801AEF40 = .text:0x801AEF40; // type:function size:0x40
fn_801AEF80 = .text:0x801AEF80; // type:function size:0x144
GetScnMtxPos__Q34nw4r3g3d12ScnMdlSimpleCFPQ34nw4r4math5MTX34Q44nw4r3g3d6ScnObj13ScnObjMtxTypeUl = .text:0x801AEF80; // type:function size:0x144
fn_801AF0C4 = .text:0x801AF0C4; // type:function size:0x5FC
fn_801AF6C0 = .text:0x801AF6C0; // type:function size:0x178
fn_801AF838 = .text:0x801AF838; // type:function size:0xEC
Expand Down
1 change: 1 addition & 0 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,7 @@ def MatchingFor(*versions):
"cflags": cflags_rel,
"host": False,
"objects": [
Object(Matching, "mo_melee/sora_melee/so/model/so_model_module_simple.cpp"),
Object(Matching, "mo_melee/sora_melee/so/model/so_model_module_impl_variable.cpp"),
Object(Matching, "mo_melee/sora_melee/so/anim/so_anim_chr.cpp"),
Object(Matching, "mo_melee/sora_melee/so/so_controller_module_link_ref.cpp"),
Expand Down
20 changes: 10 additions & 10 deletions src/mo_melee/sora_melee/so/model/so_model_module_impl_variable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Vec3f soModelModuleImplVariable::getNodeGlobalPosition(u32 p1, bool p2) {
return soModelModuleImpl::getNodeGlobalPosition(getRealNodeId(p1), p2);
}

Vec3f soModelModuleImplVariable::getNodeGlobalPosition(u32 p1, Vec3f* p2, bool p3, bool p4) {
Vec3f soModelModuleImplVariable::getNodeGlobalPosition(u32 p1, const Vec3f* p2, bool p3, bool p4) {
return soModelModuleImpl::getNodeGlobalPosition(getRealNodeId(p1), p2, p3, p4);
}

Expand All @@ -112,8 +112,8 @@ Vec3f soModelModuleImplVariable::getNodeGlobalRotation(u32 p1, bool p2) {
return soModelModuleImpl::getNodeGlobalRotation(getRealNodeId(p1), p2);
}

bool soModelModuleImplVariable::isNode(int p1) {
return soModelModuleImpl::isNode(getRealNodeId(p1));
bool soModelModuleImplVariable::isNode(u32 id) {
return soModelModuleImpl::isNode(getRealNodeId(id));
}

Vec3f soModelModuleImplVariable::getResFileNodeTranslate(u32 p1) {
Expand All @@ -136,19 +136,19 @@ void soModelModuleImplVariable::renderNodeAxis(u32 p1, float f1) {
return soModelModuleImpl::renderNodeAxis(getRealNodeId(p1), f1);
}

void soModelModuleImplVariable::setNodeVisibility(u32 p1, bool p2, bool p3) {
u32 realId = getRealNodeId(p1);
void soModelModuleImplVariable::setNodeVisibility(u32 nodeId, bool vis, bool p3) {
u32 realId = getRealNodeId(nodeId);
if (realId != 0xFFFFFFFF) {
soModelModuleImpl::setNodeVisibility(realId, p2, p3);
soModelModuleImpl::setNodeVisibility(realId, vis, p3);
}
}

void soModelModuleImplVariable::setNodeVisibility(int p1, u32* p2, bool p3, bool p4) {
void soModelModuleImplVariable::setNodeVisibility(s32 numIds, const u32* nodeIds, bool vis, bool p4) {
if (getScnMdl(p4)) {
for (s32 i = 0; i < p1; i++) {
u32 realId = getRealNodeId(p2[i]);
for (s32 i = 0; i < numIds; i++) {
u32 realId = getRealNodeId(nodeIds[i]);
if (realId != 0xFFFFFFFF) {
soModelModuleImpl::setNodeVisibility(realId, p3, p4);
soModelModuleImpl::setNodeVisibility(realId, vis, p4);
}
}
}
Expand Down
234 changes: 234 additions & 0 deletions src/mo_melee/sora_melee/so/model/so_model_module_simple.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
#include <gf/gf_3d_scene.h>
#include <mt/mt_matrix.h>
#include <mt/mt_vector.h>
#include <nw4r/g3d/g3d_resmdl.h>
#include <nw4r/g3d/g3d_resnode.h>
#include <nw4r/g3d/g3d_scnmdlsmpl.h>
#include <nw4r/g3d/g3d_scnmdl.h>
#include <so/model/so_model_module_simple.h>
#include <types.h>
#include <ut/ut_nw.h>

static inline gfSceneRoot* getRoot() {
return g_gfSceneRoot;
}

soModelModuleSimple::soModelModuleSimple() : m_scnMdl(nullptr) { }

soModelModuleSimple::~soModelModuleSimple() { }

void soModelModuleSimple::setScnMdl(nw4r::g3d::ScnMdl* mdl, void*,
gfSceneRoot::LayerType lt) {
m_scnMdl = mdl;
getRoot()->add(lt, getScnMdl());
}

nw4r::g3d::ScnMdl* soModelModuleSimple::detachScnMdl(void*) {
nw4r::g3d::ScnMdl* mdl = getScnMdl();
getRoot()->remove(mdl);
m_scnMdl = nullptr;
return mdl;
}

void soModelModuleSimple::resetLayerType(gfSceneRoot::LayerType lt) {
if (getScnMdl() &&
getRoot()->remove(getScnMdl()) &&
getRoot()->add(lt, getScnMdl())) {
m_layerType = lt;
}
}

int soModelModuleSimple::getNodeId(const char* nodeName) {
if (getScnMdl()) {
nw4r::g3d::ResMdl resMdl = getScnMdl()->m_resMdl;
nw4r::g3d::ResNode nd = resMdl.GetResNode(nodeName);
if (nd.IsValid()) {
return nd.IsValid() ? nd->m_nodeIndex : 0;
}
}
return -1;
}

const char* soModelModuleSimple::getNodeName(u32 p1) {
if (getScnMdl()) {
nw4r::g3d::ResMdl resMdl = getScnMdl()->m_resMdl;
if (p1 >= resMdl.GetResNodeNumEntries()) {
return nullptr;
}
const nw4r::g3d::ResNodeData* nd = resMdl.GetResNode(p1).ptr();
if (!nd) {
goto end;
}
if (nd->m_nodeNameStrOffset) {
return reinterpret_cast<const char*>(nd) +
nd->m_nodeNameStrOffset;
}
return nullptr;
}
end:
return nullptr;
}

void soModelModuleSimple::getNodeGlobalMtx(u32 idx, Matrix* outMtx, bool) {
getScnMdl()->GetScnMtxPos(outMtx, nw4r::g3d::ScnMdl::MTX_WORLD, idx);
}

Vec3f soModelModuleSimple::getNodeGlobalPosition(u32 correctNodeId, bool) {
return nwSMGetGlobalPosition(getScnMdl(), correctNodeId);
}

Vec3f soModelModuleSimple::getNodeGlobalPosition(u32 correctNodeId, const Vec3f* pos, bool p3, bool p4) {
return nwSMGetGlobalPosition(getScnMdl(), correctNodeId, pos);
}

Vec3f soModelModuleSimple::getNodeLocalPosition(u32 correctNodeId, bool p2) {
return nwSMGetLocalPosition(getScnMdl(), correctNodeId);
}

void soModelModuleSimple::getNodeLocalMtxFromNode(u32 nodeId1, u32 nodeId2, Matrix* outMtx, bool) {
Matrix stack68(true);
Matrix stack38(true);
Matrix stack8(true);
getNodeGlobalMtx(nodeId2, &stack38, false);
getNodeGlobalMtx(nodeId1, &stack68, false);

stack68.inverse(&stack8);
stack8.mul(&stack38, outMtx);
}

Vec3f soModelModuleSimple::getNodeGlobalRotation(u32 nodeId, bool p2) {
return nwSMGetGlobalRotation(getScnMdl(), nodeId);
}

bool soModelModuleSimple::isNode(u32 id) {
if (id != 0xFFFFFFFF && id < getNodeNum()) {
return true;
}
return false;
}

u32 soModelModuleSimple::getNodeNum() const {
nw4r::g3d::ResMdl resMdl = getScnMdl()->m_resMdl;
return resMdl.GetResNodeNumEntries();
}

Vec3f soModelModuleSimple::getNodeGlobalOffsetFromTop(u32 nodeId) {
Vec3f top = getNodeGlobalPosition(0, false);
Vec3f nodePos = getNodeGlobalPosition(nodeId, false);
Vec3f res;

Vec3fSub(&res, &nodePos, &top);
return res;
}

Vec3f soModelModuleSimple::getTopNodeGlobalPosFromNode(u32 nodeId, Vec3f* pos) {
Vec3f topOffset = getNodeGlobalOffsetFromTop(nodeId);
Vec3f res;

Vec3fSub(&res, pos, &topOffset);
return res;
}

bool soModelModuleSimple::setAnmObj(nw4r::g3d::AnmObj* obj) {
if (getScnMdl()) {
return getScnMdl()->SetAnmObj(obj, nw4r::g3d::ScnMdl::ANMOBJTYPE_NOT_SPECIFIED);
}
return false;
}

bool soModelModuleSimple::setOption(u32 option, u32 value) {
if (getScnMdl()) {
return getScnMdl()->SetScnObjOption(option, value);
}
return false;
}

bool soModelModuleSimple::getResMdl(nw4r::g3d::ResMdl* resMdl) {
if (getScnMdl()) {
*resMdl = getScnMdl()->m_resMdl;
return true;
}
return false;
}

bool soModelModuleSimple::removeAnmObj(nw4r::g3d::ScnMdlSimple::AnmObjType type) {
if (getScnMdl()) {
return getScnMdl()->RemoveAnmObj(type) != nullptr;
}
return false;
}

void soModelModuleSimple::setVisibility(bool vis) {
if (getScnMdl()) {
nwSMSetVisibility(getScnMdl(), vis);
}
}

void soModelModuleSimple::setNodeVisibility(u32 nodeId, bool vis) {
if (getScnMdl()) {
nwSMSetNodeVisibility(getScnMdl(), nodeId, vis);
}
}

void soModelModuleSimple::setNodeVisibility(s32 numIds, const u32* nodeIds, bool vis) {
if (getScnMdl()) {
nwSMSetNodeVisibility(getScnMdl(), numIds, nodeIds, vis);
}
}

void soModelModuleSimple::setDisposeInstanceImm(bool) { }
void soModelModuleSimple::setShadowNode(int) { }
Matrix* soModelModuleSimple::getWorldMtxArray() { return nullptr; }
void soModelModuleSimple::preShadowCalcView() { }
bool soModelModuleSimple::isRefFB() { return false; }
void soModelModuleSimple::switchEnvMap(bool) { }
bool soModelModuleSimple::isEnvMap() { return false; }
bool soModelModuleSimple::isAddEnvMapMat() { return false; }
void soModelModuleSimple::setVirtualNodeUpdate(u32 virtualNodeIndex, bool) { }
void soModelModuleSimple::initVirtualNode(int, u32, u32, void*, Matrix*) { }
void soModelModuleSimple::changeMaterialTex(soResourceModule*, const char* resMat, const char* resPlt, nw4r::g3d::ResFile) { }
void soModelModuleSimple::renderNodeAxis(u32 nodeIndex, float) { }
void soModelModuleSimple::setNodeVisibility(u32 nodeId, bool visibility, bool) { }
void soModelModuleSimple::setNodeVisibility(s32 numIds, const u32* nodeIds, bool visibility, bool) { }
void soModelModuleSimple::setVisibility(bool visibility, bool) { }
gfSceneRoot::LayerType soModelModuleSimple::getLayerType() { return m_layerType; }
void soModelModuleSimple::setScaleZ(float) { }
void soModelModuleSimple::setScale(float) { }
float soModelModuleSimple::getScale() { return 1.0f; }
Vec3f soModelModuleSimple::getResFileNodeRotation(u32 nodeIndex) { return Vec3f(0, 0, 0); }
Vec3f soModelModuleSimple::getResFileNodeTranslate(u32 nodeIndex) { return Vec3f(0, 0, 0); }
int soModelModuleSimple::getTransNNodeId() { return -1; }
const char* soModelModuleSimple::getTransNNodeName() { return nullptr; }
void soModelModuleSimple::setTransNNodeId(int) { }
u32 soModelModuleSimple::getNodeNum(bool) const { return 0; }
void soModelModuleSimple::setNodeGlobalMtx(u32 index, Matrix*, bool) { }
int soModelModuleSimple::getCorrectNodeId(u32) { return -1; }
void soModelModuleSimple::setNodeTranslate(u32, Vec3f* xlate) { }
Vec3f soModelModuleSimple::getNodeTranslate(u32 p1) { return Vec3f(0, 0, 0); }
void soModelModuleSimple::setNodeRotate(u32 , Vec3f* rot) { }
void soModelModuleSimple::setNodeRotateZ(u32 , float z) { }
void soModelModuleSimple::setNodeRotateY(u32 , float y) { }
void soModelModuleSimple::setNodeRotateX(u32 , float x) { }
Vec3f soModelModuleSimple::getNodeRotate(u32 nodeIndex) { return Vec3f(0, 0, 0); }
void soModelModuleSimple::setNodeScale(u32 , Vec3f* ) { }
Vec3f soModelModuleSimple::getNodeScale(u32 nodeIndex) { return Vec3f(1, 1, 1); }
void soModelModuleSimple::setNodeSRT(u32 , Vec3f* scale, Vec3f* rot, Vec3f* xlate) { }
void soModelModuleSimple::clearNodeSRT(u32 p1) { }
void soModelModuleSimple::clearNodeSetUp() { }
void soModelModuleSimple::setLockMtx(bool) { }
void soModelModuleSimple::setScnMdlExtern(nw4r::g3d::ScnMdl* p) { m_scnMdl = p; }
void soModelModuleSimple::setLoupeNo(s8) { }
s8 soModelModuleSimple::getLoupeNo() { static s8 val = 0xFF; return val; }
nw4r::g3d::ScnMdl* soModelModuleSimple::getScnMdl(bool) const { return nullptr; }
void soModelModuleSimple::begin(bool) { }
void soModelModuleSimple::activate() { }
void soModelModuleSimple::deactivate() { }
void soModelModuleSimple::destructInstance() { }
void soModelModuleSimple::constructInstance(gfSceneRoot::LayerType, u32 flags,
bool, s8, nw4r::g3d::ResFile, const char*, const char*, s16 mdlResId,
void*, u8 loupeNo, int priorityDrawXlu) { }
void soModelModuleSimple::clearSetUpMtx() { }
void soModelModuleSimple::setUpSkinningMtx() { }
void soModelModuleSimple::setUpMtx(u32 nodeId) { }
void soModelModuleSimple::setUpMtx(u32* nodeIds, s32 numNodeIds) { }
void soModelModuleSimple::setUpMtxFinal() { }
Loading