From 6d568f53dbd33efe673534365a82b4dd97fde3d3 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Wed, 28 Oct 2026 22:37:37 +0000 Subject: [PATCH] Decompile 6 functions in Source/Contents/Effects/EffectLists.cpp, Source/Contents/Effects/EffectLists.h, ... Batch #1818 by Yommy: 0 byte-identical, 6 confirmed by peer review. - fn_18772 EffectLists::RetireActor: logic confirmed by peer review - fn_18777 EffectLists::Retire: logic confirmed by peer review - fn_18778 EffectLists::Retire: logic confirmed by peer review - fn_18779 EffectLists::Retire: logic confirmed by peer review - fn_18780 EffectLists::Clear: logic confirmed by peer review - fn_18781 EffectLists::Release: logic confirmed by peer review Reviewed-by: ragnarok-clanker --- Source/Contents/Effects/Effect.h | 12 ++++- Source/Contents/Effects/EffectLists.cpp | 59 ++++++++++++++----------- Source/Contents/Effects/EffectLists.h | 33 +++++++++----- 3 files changed, 63 insertions(+), 41 deletions(-) diff --git a/Source/Contents/Effects/Effect.h b/Source/Contents/Effects/Effect.h index 49729e4..e8f24f8 100644 --- a/Source/Contents/Effects/Effect.h +++ b/Source/Contents/Effects/Effect.h @@ -19,19 +19,23 @@ struct EffectEvent { class CEffect { public: explicit CEffect(int id); - virtual ~CEffect(); - virtual void Close(); virtual void Slot00(int argument); virtual void Slot01(); + virtual void Slot02() = 0; + virtual void Slot03() {} virtual void Slot04(); + virtual void Close(); + virtual bool Slot06() = 0; virtual void Slot07(); virtual void Slot08(int argument1, int argument2, int argument3); + virtual void Slot09(int) {} virtual void Slot10(int argument); virtual void Slot11(std::string name); virtual void Slot12(); virtual void Slot13(int argument); virtual void Slot14(int argument); virtual void Slot15(int argument); + virtual void Slot16(int) {} virtual void Slot17(int argument); virtual void Slot18(int argument); virtual void Slot19(int argument); @@ -44,7 +48,11 @@ public: virtual void Slot26(int argument); virtual void Slot27(int argument); virtual int Slot28(); + virtual void Slot29(int id) = 0; + virtual ~CEffect(); + virtual void Slot31() {} virtual void Slot32(); + virtual bool Slot33() = 0; void AddEvent(int kind, const char* text, int frame, int argument); void SetEventFrame(int kind, int frame); diff --git a/Source/Contents/Effects/EffectLists.cpp b/Source/Contents/Effects/EffectLists.cpp index 09cc13f..318dc1e 100644 --- a/Source/Contents/Effects/EffectLists.cpp +++ b/Source/Contents/Effects/EffectLists.cpp @@ -33,23 +33,14 @@ CEffect* EffectLists::Find(int actor, int instance, int id) const { return nullptr; } -// INLINED -void EffectLists::RemoveActive(CEffect* effect) { - const auto found = this->active.find(static_cast(effect->actor)); - - if (found != this->active.end()) { - found->second.remove(effect); - } -} - // OFFSET: 0x00B253A0 // FUNCTION: fn_18779 void EffectLists::Retire(CEffect* effect, unsigned char removeActive) { if (effect) { - this->retirement.effects.push_back(effect); + this->retired.push_back(effect); - if (removeActive == 1) { - this->RemoveActive(effect); + if (removeActive == 1 && this->active.find(static_cast(effect->actor)) != this->active.end()) { + this->active[static_cast(effect->actor)].remove(effect); } } } @@ -58,8 +49,11 @@ void EffectLists::Retire(CEffect* effect, unsigned char removeActive) { // FUNCTION: fn_18777 void EffectLists::Retire(int actor, int id) { if (CEffect* effect = this->Find(actor, id)) { - this->retirement.effects.push_back(effect); - this->RemoveActive(effect); + this->retired.push_back(effect); + + if (this->active.find(static_cast(effect->actor)) != this->active.end()) { + this->active[static_cast(effect->actor)].remove(effect); + } } } @@ -68,8 +62,11 @@ void EffectLists::Retire(int actor, int id) { void EffectLists::Retire(int actor, int instance, int id) { if (actor > 0 && instance > 0) { if (CEffect* effect = this->Find(actor, instance, id)) { - this->retirement.effects.push_back(effect); - this->RemoveActive(effect); + this->retired.push_back(effect); + + if (this->active.find(static_cast(effect->actor)) != this->active.end()) { + this->active[static_cast(effect->actor)].remove(effect); + } } } } @@ -79,13 +76,15 @@ void EffectLists::Retire(int actor, int instance, int id) { void EffectLists::RetireActor(int actor) { const auto found = this->active.find(actor); - if (found != this->active.end()) { - for (CEffect* effect : found->second) { - this->retirement.effects.push_back(effect); - } - - found->second.clear(); + if (found == this->active.end()) { + return; } + + for (auto effect = found->second.begin(); effect != found->second.end(); ++effect) { + this->retired.push_back(*effect); + } + + found->second.clear(); } // OFFSET: 0x00B25830 @@ -120,21 +119,27 @@ void EffectLists::Add(int actor, CEffect* effect) { // OFFSET: 0x00B254C0 // FUNCTION: fn_18780 void EffectLists::Clear() { - for (auto& [actor, effects] : this->active) { - this->RetireActor(actor); + for (auto entry = this->active.begin(); entry != this->active.end(); ++entry) { + this->RetireActor(entry->first); } this->active.clear(); this->RetireActor(0); this->indexed.clear(); - this->retirement.Clear(); + + for (auto effect = this->retired.begin(); effect != this->retired.end(); ++effect) { + (*effect)->Close(); + delete *effect; + } + + this->retired.clear(); } // OFFSET: 0x00B255B0 // FUNCTION: fn_18781 void EffectLists::Release() { - for (auto& [id, allocator] : this->allocators) { - delete allocator; + for (auto entry = this->allocators.begin(); entry != this->allocators.end(); ++entry) { + delete entry->second; } this->allocators.clear(); diff --git a/Source/Contents/Effects/EffectLists.h b/Source/Contents/Effects/EffectLists.h index 50a1f31..2ccebb4 100644 --- a/Source/Contents/Effects/EffectLists.h +++ b/Source/Contents/Effects/EffectLists.h @@ -3,21 +3,25 @@ #include "Contents/Effects/Effect.h" +#include +#include #include +#include -class EffectAllocator { -public: - virtual ~EffectAllocator() = default; +struct CAllocator { + virtual ~CAllocator() = default; virtual CEffect* Create() = 0; }; -struct EffectLists { - std::map>& active; - EffectRetirement& retirement; - std::map>& indexed; - std::map& allocators; +class EffectLists { +public: + /* 0004 */ bool initialized; + /* 0008 */ std::map allocators; + /* 0010 */ std::map> active; + /* 0018 */ std::list retired; + /* 0020 */ std::map> indexed; - ~EffectLists(); + virtual ~EffectLists(); CEffect* Find(int actor, int id) const; CEffect* Find(int actor, int instance, int id) const; @@ -29,11 +33,16 @@ struct EffectLists { void RetireActor(int actor); void Clear(); void Release(); - -private: - void RemoveActive(CEffect* effect); }; +#if defined(_WIN32) && !defined(_WIN64) +static_assert(sizeof(EffectLists) == 0x28); +static_assert(offsetof(EffectLists, allocators) == 0x08); +static_assert(offsetof(EffectLists, active) == 0x10); +static_assert(offsetof(EffectLists, retired) == 0x18); +static_assert(offsetof(EffectLists, indexed) == 0x20); +#endif + void DestroyEffectMgr(); extern EffectLists* g_effectMgr;