From bfd6001afd06954e10bc771a3572a8cc5aa80fef Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sat, 31 Oct 2026 03:15:49 +0000 Subject: [PATCH] Decompile fn_14469 (CUIFrameWnd::~CUIFrameWnd) Batch #7020 by aDw: 0 byte-identical, 1 confirmed by peer review. - fn_14469 CUIFrameWnd::~CUIFrameWnd: logic confirmed by peer review Peer-reviewed-by: eAthena, Lumen Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/UI/FrameSkin.cpp | 42 ++++++++++++++++++++++++++++++++ Source/UI/FrameSkin.h | 1 + Source/UI/Window/UIRegisterMgr.h | 11 ++++++--- 3 files changed, 50 insertions(+), 4 deletions(-) diff --git a/Source/UI/FrameSkin.cpp b/Source/UI/FrameSkin.cpp index 17ae6d16..013b3592 100644 --- a/Source/UI/FrameSkin.cpp +++ b/Source/UI/FrameSkin.cpp @@ -1,8 +1,50 @@ #include "UI/FrameSkin.h" #include "Resource/ResourceMgr.h" #include "Resource/TextureNames.h" +#include "UI/Window/UIRegisterMgr.h" #include "UI/Window/WindowBorder.h" +#include +#include + +// GLOBAL: gl_25106 +template <> +CUIRegisterMgr* Singleton::s_instance = nullptr; + +__declspec(noinline) CUIRegisterMgr::CUIRegisterMgr() { + InitializeCriticalSection(&this->lock); +} + +// OFFSET: 0x009E69D0 +// FUNCTION: fn_14469 +CUIFrameWnd::~CUIFrameWnd() { + if (static_cast(this->unknown_00B4) != 0) { + if (CUIRegisterMgr::s_instance == nullptr) { + CUIRegisterMgr::s_instance = new (std::nothrow) CUIRegisterMgr; + } + std::map>& positions = CUIRegisterMgr::s_instance->unknown_000C; + std::map>::iterator position = positions.lower_bound(this->geometry.id); + if (position == positions.end() || this->geometry.id < position->first) { + position = positions.insert(position, std::map>::value_type(this->geometry.id, std::pair())); + } + position->second.first = this->geometry.x; + position->second.second = this->geometry.y; + } + + if (static_cast(this->unknown_00B4 >> 8) != 0) { + if (CUIRegisterMgr::s_instance == nullptr) { + CUIRegisterMgr::s_instance = new (std::nothrow) CUIRegisterMgr; + } + std::map>& sizes = CUIRegisterMgr::s_instance->unknown_0014; + std::map>::iterator size = sizes.lower_bound(this->geometry.id); + if (size == sizes.end() || this->geometry.id < size->first) { + size = sizes.insert(size, std::map>::value_type(this->geometry.id, std::pair())); + } + size->second.first = this->geometry.width; + size->second.second = this->geometry.height; + } +} + // OFFSET: 0x009E6C70 // FUNCTION: fn_14470 void CUIFrameWnd::RefreshSkinColors() { diff --git a/Source/UI/FrameSkin.h b/Source/UI/FrameSkin.h index 1521a72e..666b6997 100644 --- a/Source/UI/FrameSkin.h +++ b/Source/UI/FrameSkin.h @@ -8,6 +8,7 @@ class CUIFrameWnd : public UIFrameWnd { public: + ~CUIFrameWnd() override; void Paint() override; void RefreshSkinColors(); void SetSkinColors(int backgroundColumn, int backgroundRow, int borderColumn, int borderRow); diff --git a/Source/UI/Window/UIRegisterMgr.h b/Source/UI/Window/UIRegisterMgr.h index 5c66ac1a..641d3135 100644 --- a/Source/UI/Window/UIRegisterMgr.h +++ b/Source/UI/Window/UIRegisterMgr.h @@ -1,18 +1,21 @@ #ifndef RAGNAROK_SOURCE_UI_WINDOW_UIREGISTERMGR_H #define RAGNAROK_SOURCE_UI_WINDOW_UIREGISTERMGR_H +#include "Utility/Singleton.h" + #include #include +#include #include -class CUIRegisterMgr { +class CUIRegisterMgr : public Singleton { public: + __declspec(noinline) CUIRegisterMgr(); bool sub_A970A0(int key); - /* 0000 */ void* vtable; /* 0004 */ std::map entries; - /* 000C */ std::map unknown_000C; - /* 0014 */ std::map unknown_0014; + /* 000C */ std::map> unknown_000C; + /* 0014 */ std::map> unknown_0014; /* 001C */ CRITICAL_SECTION lock; };