From 9de4931167c1c90ebddc6b0578154b22afed2383 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sat, 31 Oct 2026 05:06:31 +0000 Subject: [PATCH] Decompile fn_06991 (CEZ2STREffectMgr::Load) Batch #7092 by Landruca: 0 byte-identical, 1 confirmed by peer review. - fn_06991 CEZ2STREffectMgr::Load: logic confirmed by peer review Peer-reviewed-by: alisonrag, Lumen, Snow Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Contents/EffectResourceSwitcher.cpp | 31 ++++++++++++++++++++++ Source/Contents/EffectResourceSwitcher.h | 1 + Source/Utility/JsonCppLoader.h | 4 +++ 3 files changed, 36 insertions(+) diff --git a/Source/Contents/EffectResourceSwitcher.cpp b/Source/Contents/EffectResourceSwitcher.cpp index 6b8b67a2a..57d68097e 100644 --- a/Source/Contents/EffectResourceSwitcher.cpp +++ b/Source/Contents/EffectResourceSwitcher.cpp @@ -9,13 +9,17 @@ #include "Contents/Effects/EffectPrimitiveState.h" #include "Contents/Effects/Particle.h" #include "Contents/World/World.h" +#include "File/File.h" #include "Network/TextEncoding.h" #include "Resource/World/TerrainResource.h" +#include "Utility/JsonCppLoader.h" #include #include +#include #include #include +#include // GLOBAL: gl_24485 template <> @@ -554,3 +558,30 @@ std::vector CEZ2STREffectMgr::EffectIds() { } return ids; } + +// OFFSET: 0x00700E30 +// FUNCTION: fn_06991 +bool CEZ2STREffectMgr::Load() { + CFile file; + if (!file.Open("ContentData\\EffectData\\EZ2STREffect.bson", 0, true, false)) { + return false; + } + + const auto* data = static_cast(file.GetData()); + std::vector buffer(data, data + file.GetSize()); + + JsonCppLoader loader; + if (!loader.sub_4F3C70(buffer, true)) { + return false; + } + + std::map records; + if (!loader.sub_50C2A0(&records)) { + return false; + } + + this->effects.clear(); + std::for_each(records.begin(), records.end(), InfoInserter{this}); + return true; +} + diff --git a/Source/Contents/EffectResourceSwitcher.h b/Source/Contents/EffectResourceSwitcher.h index 7d7ebe519..29e35e481 100644 --- a/Source/Contents/EffectResourceSwitcher.h +++ b/Source/Contents/EffectResourceSwitcher.h @@ -48,6 +48,7 @@ public: EZ2STREffectInfo* FindById(int id); int EffectId(const std::string& name); std::vector EffectIds(); + bool Load(); }; class CEZ2STREffect : public CEffect { diff --git a/Source/Utility/JsonCppLoader.h b/Source/Utility/JsonCppLoader.h index 99411d164..456ecb18a 100644 --- a/Source/Utility/JsonCppLoader.h +++ b/Source/Utility/JsonCppLoader.h @@ -10,6 +10,8 @@ #include #include +struct EZ2STREffectRecord; + class JsonValue; typedef std::pair JsonMember; @@ -154,6 +156,8 @@ public: void Fail(const char* format, ...); bool GetMapStringBoolValue(const JsonValue& node, const std::string& key, std::map* out); + bool sub_4F3C70(std::vector& buffer, bool bson); + bool sub_50C2A0(std::map* out); /* 0000 */ unsigned char unknown_0000[0x08]; /* 0008 */ JsonValue document;