From fbc4ca54b58a299218f7314d815dfca03714faaf Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Fri, 30 Oct 2026 12:15:28 +0000 Subject: [PATCH] Decompile 3 functions in Source/UI/Edit/ItemTagRetirement.cpp, Source/UI/Text/UITextViewer.cpp, ... Batch #5486 by Yommy: 0 byte-identical, 3 confirmed by peer review. - fn_11219 UIItemTagOnMail::CanInsertTag: logic confirmed by peer review - fn_11228 UITextViewEX::Clear: logic confirmed by peer review - fn_11232 UIListBoxNavi::ResetLineColors: logic confirmed by peer review Peer-reviewed-by: willerthal, Snow, SapitoSucio Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/UI/Edit/ItemTagRetirement.cpp | 25 +++++++++++++++++++++++++ Source/UI/Edit/ItemTagRetirement.h | 4 +++- Source/UI/Edit/UIItemTagCtrl.h | 7 +++++++ Source/UI/Lists/UIListBoxNavi.h | 1 + Source/UI/Text/UITextViewer.cpp | 12 ++++++++++++ Source/UI/Text/UITextViewer.h | 4 ++++ Source/UI/Text/UITextViewerLinks.cpp | 9 +++++++++ 7 files changed, 61 insertions(+), 1 deletion(-) diff --git a/Source/UI/Edit/ItemTagRetirement.cpp b/Source/UI/Edit/ItemTagRetirement.cpp index e08051053..560eb0f1c 100644 --- a/Source/UI/Edit/ItemTagRetirement.cpp +++ b/Source/UI/Edit/ItemTagRetirement.cpp @@ -1,8 +1,10 @@ #include "UI/Window/InputFocus.h" #include "UI/Edit/ItemTagRetirement.h" #include "UI/Edit/UIItemTagCtrl.h" +#include "UI/Rodex/UIRodexComposeWnd.h" #include "UI/Text/TextFitting.h" #include "UI/Window/UIWindow.h" +#include "UI/Window/UIWindowMgr.h" // INLINED FocusedItemTagRemoval::FocusedItemTagRemoval(InputFocus& focus) : m_focus(focus) { @@ -16,6 +18,29 @@ void FocusedItemTagRemoval::Remove(UIWindow* child) { } } +// OFFSET: 0x00879830 + +// OFFSET: 0x00879A10 +// FUNCTION: fn_11219 +bool UIItemTagOnMail::CanInsertTag(const std::string& name, int width) { + if (this->tags.size() > 2) { + return false; + } + + std::string tag = "<"; + this->tagWidth = width; + tag += FitText(*this->geometry.surface, name, width / 2); + tag += ">"; + + UIRodexEditCtrl3* contents = reinterpret_cast(g_windowMgr.unknown_0458)->m_contents; + const unsigned int maximum = contents->maximum; + this->taggedText = contents->text; + std::string text = this->taggedText += tag; + return text.size() <= maximum; +} + +// OFFSET: 0x0087ABB0 + // OFFSET: 0x0087A2F0 // FUNCTION: fn_11231 void ItemTagRetirement::Clear() { diff --git a/Source/UI/Edit/ItemTagRetirement.h b/Source/UI/Edit/ItemTagRetirement.h index e25083434..24c7069cd 100644 --- a/Source/UI/Edit/ItemTagRetirement.h +++ b/Source/UI/Edit/ItemTagRetirement.h @@ -10,7 +10,8 @@ struct InputFocus; struct ItemTagRecord { /* 0000 */ UIWindow* child; - /* 0004 */ std::array unknown_0004; + /* 0004 */ std::array unknown_0004; + /* 0044 */ char name[388]; }; class ItemTagRemoval { @@ -40,6 +41,7 @@ struct ItemTagRetirement { static_assert(sizeof(ItemTagRecord) == 456); static_assert(offsetof(ItemTagRecord, child) == 0x0000); static_assert(offsetof(ItemTagRecord, unknown_0004) == 0x0004); +static_assert(offsetof(ItemTagRecord, name) == 0x0044); #endif #endif diff --git a/Source/UI/Edit/UIItemTagCtrl.h b/Source/UI/Edit/UIItemTagCtrl.h index 43c83f6ca..cebea57c3 100644 --- a/Source/UI/Edit/UIItemTagCtrl.h +++ b/Source/UI/Edit/UIItemTagCtrl.h @@ -13,6 +13,7 @@ public: virtual bool CanInsertTag(const std::string& name, int width); std::string AppendTag(const std::string& name); + bool SyncTagsWithText(); /* 011C */ int unknown_011C; /* 0120 */ std::list tags; @@ -21,8 +22,14 @@ public: /* 0158 */ int tagWidth; }; +class UIItemTagOnChat : public UIItemTagCtrl { +public: + bool CanInsertTag(const std::string& name, int width) override; +}; + class UIItemTagOnMail : public UIItemTagCtrl { public: + bool CanInsertTag(const std::string& name, int width) override; void SetLines(const std::vector& lines); /* 015C */ std::vector m_lines; diff --git a/Source/UI/Lists/UIListBoxNavi.h b/Source/UI/Lists/UIListBoxNavi.h index 9cf9fc53c..576f159ba 100644 --- a/Source/UI/Lists/UIListBoxNavi.h +++ b/Source/UI/Lists/UIListBoxNavi.h @@ -17,6 +17,7 @@ public: void SetDefaultLineColor(std::uint32_t color); void SetLineColor(int line, std::uint32_t color); + void ResetLineColors(); }; #endif diff --git a/Source/UI/Text/UITextViewer.cpp b/Source/UI/Text/UITextViewer.cpp index feceb4d1a..88379e3c3 100644 --- a/Source/UI/Text/UITextViewer.cpp +++ b/Source/UI/Text/UITextViewer.cpp @@ -90,6 +90,18 @@ void UITextViewEX::Configure(int x, int y, int width, int height, unsigned char this->lineHeight = 21; } +// OFFSET: 0x0087A1E0 +// FUNCTION: fn_11228 +void UITextViewEX::Clear() { + for (UIWindow* link : this->extraLinks) { + this->RemoveChild(link, 1); + } + this->extraLinks.clear(); + this->lineLinks.clear(); + UITextViewer::Clear(); + this->Invalidate(); +} + // OFFSET: 0x0087B780 // FUNCTION: fn_11249 void UITextViewer::Configure(int x, int y, int width, int height, unsigned char value) { diff --git a/Source/UI/Text/UITextViewer.h b/Source/UI/Text/UITextViewer.h index e826ed84e..7514ccd91 100644 --- a/Source/UI/Text/UITextViewer.h +++ b/Source/UI/Text/UITextViewer.h @@ -72,6 +72,10 @@ private: class UITextViewEX : public UITextViewer { public: void Configure(int x, int y, int width, int height, unsigned char transparent) override; + void Clear() override; + + std::vector extraLinks; + std::vector> lineLinks; }; #if defined(_WIN32) && !defined(_WIN64) diff --git a/Source/UI/Text/UITextViewerLinks.cpp b/Source/UI/Text/UITextViewerLinks.cpp index 7eb07d6b3..1a0c9b8e9 100644 --- a/Source/UI/Text/UITextViewerLinks.cpp +++ b/Source/UI/Text/UITextViewerLinks.cpp @@ -175,6 +175,15 @@ void UIListBoxNavi::Clear() { this->lineOffset = -1; } +// OFFSET: 0x0087A390 +// FUNCTION: fn_11232 +void UIListBoxNavi::ResetLineColors() { + for (std::vector::iterator color = this->lineColors.begin(); color != this->lineColors.end(); ++color) { + *color = 0; + } + this->Invalidate(); +} + // OFFSET: 0x00877020 // FUNCTION: fn_11209 bool UITextViewer::AddQuestLinks(std::string text, unsigned addedLines) {