From b68718f749db05791f787f633cb1771f859268aa Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Wed, 28 Oct 2026 22:53:13 +0000 Subject: [PATCH] Decompile 5 functions in Source/Resource/Models/ModelResource.cpp, Source/Resource/Models/ModelResource.h, ... Batch #1850 by Yommy: 2 byte-identical, 3 confirmed by peer review. - fn_08014 C3dModelRes::ForEachRootName: logic confirmed by peer review - fn_08015 C3dGrannyModelRes::GetTriangleCount: logic confirmed by peer review - fn_08016 C3dGrannyModelRes::GetRigidVertices: logic confirmed by peer review - fn_08017 GrannyAnimationLibrary::Initialize: byte-identical - fn_08018 C3dModelRes::Load: byte-identical Reviewed-by: ragnarok-clanker --- Source/Resource/Models/GrannyModelResource.h | 3 ++ Source/Resource/Models/ModelResource.cpp | 35 ++++++++++++++++++++ Source/Resource/Models/ModelResource.h | 3 ++ 3 files changed, 41 insertions(+) diff --git a/Source/Resource/Models/GrannyModelResource.h b/Source/Resource/Models/GrannyModelResource.h index c2ac2a9..f72136f 100644 --- a/Source/Resource/Models/GrannyModelResource.h +++ b/Source/Resource/Models/GrannyModelResource.h @@ -143,6 +143,7 @@ struct GrannyModelInstance { class GrannyAnimationLibrary { public: bool Load(const char* name, int job, int action); + void Initialize(); void FreeInstance(); granny_file* ReadAnimationFile(const char* name, const char* suffix); @@ -170,6 +171,8 @@ public: void FreeControl(granny_control* control); granny_control* PlayAnimation(unsigned action, granny_model_instance* instance, granny_control* control, int loopCount); bool ProjectBounds(float* rect, const AffineMatrix& view, const AffineMatrix& world, const float* eye) const; + int GetTriangleCount(int mesh) const; + unsigned char* GetRigidVertices(int mesh) const; /* 0110 */ unsigned char unknown_0110[0x150]; /* 0260 */ void* file; diff --git a/Source/Resource/Models/ModelResource.cpp b/Source/Resource/Models/ModelResource.cpp index 7cad582..e4b8de3 100644 --- a/Source/Resource/Models/ModelResource.cpp +++ b/Source/Resource/Models/ModelResource.cpp @@ -501,6 +501,41 @@ void GrannyAnimationLibrary::FreeInstance() { this->instance = nullptr; } +// OFFSET: 0x00759550 +// FUNCTION: fn_08014 +void C3dModelRes::ForEachRootName(std::function callback) const { + std::for_each(this->rootNames.begin(), this->rootNames.end(), callback); +} + +// OFFSET: 0x007597A0 +// FUNCTION: fn_08015 +int C3dGrannyModelRes::GetTriangleCount(int mesh) const { + return GrannyGetMeshIndexCount(this->instance->meshes[mesh].mesh) / 3; +} + +// OFFSET: 0x007597E0 +// FUNCTION: fn_08016 +unsigned char* C3dGrannyModelRes::GetRigidVertices(int mesh) const { + const GrannyMeshEntry& entry = this->instance->meshes[mesh]; + + if (!GrannyMeshIsRigid(entry.mesh)) { + return nullptr; + } + + return entry.vertices; +} + +// OFFSET: 0x00759820 +// FUNCTION: fn_08017 +void GrannyAnimationLibrary::Initialize() { +} + +// OFFSET: 0x00759830 +// FUNCTION: fn_08018 +bool C3dModelRes::Load(const char*) { + return false; +} + // OFFSET: 0x00757390 // FUNCTION: fn_08005 bool GrannyAnimationLibrary::Load(const char* name, int job, int action) { diff --git a/Source/Resource/Models/ModelResource.h b/Source/Resource/Models/ModelResource.h index 90e02e9..3bc522b 100644 --- a/Source/Resource/Models/ModelResource.h +++ b/Source/Resource/Models/ModelResource.h @@ -4,6 +4,7 @@ #include "Resource/Models/ModelMesh.h" #include "Resource/Resource.h" +#include #include #include #include @@ -103,8 +104,10 @@ class C3dModelRes : public CRes { public: explicit C3dModelRes(ModelResourceContext& context); ~C3dModelRes() override; + bool Load(const char* name) override; void Unload() override; ModelNode* FindNode(const char* name) const; + void ForEachRootName(std::function callback) const; void RegisterMovies(class BinkMovies& movies, const float* position) const; /* 0110 */ int major;