From 5a0b30c6699beec4ed8bc41a732ab3699c595147 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Thu, 5 Nov 2026 03:49:21 +0000 Subject: [PATCH] Decompile 4 functions in Source/Resource/Models/ModelResourceV2.cpp, Source/Resource/Models/ModelResource.h Batch #11599 by SapitoSucio: 0 byte-identical, 4 confirmed by peer review. - fn_07954 C3dModelResV2::Load: logic confirmed by peer review - fn_08020 C3dModelResV2::ReadVersion1: logic confirmed by peer review - fn_08021 C3dModelResV2::ReadVersion2: logic confirmed by peer review - fn_08022 C3dModelResV2::ReadVersion3: logic confirmed by peer review Peer-reviewed-by: Yommy, KWDev, cremane Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Resource/Models/ModelResource.h | 9 +++++---- Source/Resource/Models/ModelResourceV2.cpp | 20 +++++++++----------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/Source/Resource/Models/ModelResource.h b/Source/Resource/Models/ModelResource.h index 5f5a92fa..f8abffd0 100644 --- a/Source/Resource/Models/ModelResource.h +++ b/Source/Resource/Models/ModelResource.h @@ -14,6 +14,7 @@ class ResourceBytes; class TextureCache; struct ResourceByteReader; +class CFile; class C3dModelRes; struct ModelPositionKey { @@ -139,10 +140,10 @@ public: int animationLength; private: - void ReadVersion(ResourceByteReader& input, unsigned minor); - void ReadVersion1(ResourceByteReader& input); - void ReadVersion2(ResourceByteReader& input); - void ReadVersion3(ResourceByteReader& input); + void ReadVersion(CFile& input, unsigned minor); + void ReadVersion1(CFile& input); + void ReadVersion2(CFile& input); + void ReadVersion3(CFile& input); }; static_assert(sizeof(ModelPositionKey) == 16); diff --git a/Source/Resource/Models/ModelResourceV2.cpp b/Source/Resource/Models/ModelResourceV2.cpp index 8e0b2197..f5b3699a 100644 --- a/Source/Resource/Models/ModelResourceV2.cpp +++ b/Source/Resource/Models/ModelResourceV2.cpp @@ -5,14 +5,13 @@ #include "Render/Textures/TextureCache.h" #include "Resource/Bitmap/BitmapResource.h" #include "Resource/Models/ModelResource.h" -#include "Resource/ResourceByteReader.h" #include #include namespace { // INLINED - void ReadKeys(ResourceByteReader& input, std::vector& keys, bool scale) { + void ReadKeys(CFile& input, std::vector& keys, bool scale) { int count = 0; input.Read(&count, 4); @@ -44,7 +43,7 @@ C3dModelResV2* C3dModelResV2::Create() { } // INLINED -inline void C3dModelResV2::ReadVersion(ResourceByteReader& input, unsigned minor) { +inline void C3dModelResV2::ReadVersion(CFile& input, unsigned minor) { if (minor == 1) { this->ReadVersion1(input); } else if (minor == 2) { @@ -64,9 +63,8 @@ bool C3dModelResV2::Load(const char* name) { return false; } - ResourceByteReader input{static_cast(file.GetData()), static_cast(file.GetSize())}; char magic[5]{}; - input.Read(magic, 4); + file.Read(magic, 4); if (std::strcmp(magic, "GRSM") != 0) { constexpr char message[] = "모델파일이 아닙니다. 형식을 다시한번 확인해주세요."; @@ -78,12 +76,12 @@ bool C3dModelResV2::Load(const char* name) { unsigned char major = 0; unsigned char minor = 0; - input.Read(&major, 1); + file.Read(&major, 1); this->major = major; - input.Read(&minor, 1); + file.Read(&minor, 1); if (minor >= 1 && minor <= 3) { - this->ReadVersion(input, minor); + this->ReadVersion(file, minor); } file.Close(); @@ -95,7 +93,7 @@ bool C3dModelResV2::Load(const char* name) { // OFFSET: 0x00759ED0 // FUNCTION: fn_08020 -void C3dModelResV2::ReadVersion1(ResourceByteReader& input) { +void C3dModelResV2::ReadVersion1(CFile& input) { input.Read(&this->animationLength, 4); input.Read(&this->shade, 4); input.Read(&this->alpha, 1); @@ -224,7 +222,7 @@ void C3dModelResV2::ReadVersion1(ResourceByteReader& input) { // OFFSET: 0x0075AB20 // FUNCTION: fn_08021 -void C3dModelResV2::ReadVersion2(ResourceByteReader& input) { +void C3dModelResV2::ReadVersion2(CFile& input) { input.Read(&this->animationLength, 4); input.Read(&this->shade, 4); input.Read(&this->alpha, 1); @@ -343,7 +341,7 @@ void C3dModelResV2::ReadVersion2(ResourceByteReader& input) { // OFFSET: 0x0075B8E0 // FUNCTION: fn_08022 -void C3dModelResV2::ReadVersion3(ResourceByteReader& input) { +void C3dModelResV2::ReadVersion3(CFile& input) { input.Read(&this->animationLength, 4); input.Read(&this->shade, 4); input.Read(&this->alpha, 1);