From 5df36e74a3e2aa2b0af1f8dfeb83d0c3e1dc8f2c Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Fri, 6 Nov 2026 01:55:56 +0000 Subject: [PATCH] Decompile 6 functions in Source/UI/Text/TextMarkup.cpp, Source/UI/Text/TextMarkup.h, ... Batch #12699 by Yommy: 0 byte-identical, 6 confirmed by peer review. - fn_11210 UITextViewer::SplitTextLinkArguments: logic confirmed by peer review - fn_11205 UITextViewer::AddItemLinks: logic confirmed by peer review - fn_11206 UITextViewer::AddNaviLinks: logic confirmed by peer review - fn_11209 UITextViewer::AddQuestLinks: logic confirmed by peer review - fn_11211 UITextViewer::AddTipLinks: logic confirmed by peer review - fn_11212 UITextViewer::AddUrlLinks: logic confirmed by peer review Peer-reviewed-by: Tanke, aDw, cremane Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/UI/Text/TextMarkup.cpp | 21 +++++++++++++------ Source/UI/Text/TextMarkup.h | 1 - Source/UI/Text/UITextViewer.h | 1 + Source/UI/Text/UITextViewerLinks.cpp | 30 ++++++++++++++-------------- 4 files changed, 31 insertions(+), 22 deletions(-) diff --git a/Source/UI/Text/TextMarkup.cpp b/Source/UI/Text/TextMarkup.cpp index 8b400d9c..1c9fd949 100644 --- a/Source/UI/Text/TextMarkup.cpp +++ b/Source/UI/Text/TextMarkup.cpp @@ -1,5 +1,7 @@ #include "UI/Text/ColoredText.h" #include "UI/Text/TextMarkup.h" +#include "UI/Buttons/UITextButton.h" +#include "UI/Text/UITextViewer.h" #include #include @@ -271,20 +273,27 @@ void ExtractTextLinks(const std::string& source, const std::string& begin, const } while (position != std::string::npos); } +// INLINED +static void AddTextLinkArgument(std::vector& lines, std::string argument) { + lines.push_back(argument); +} + // OFFSET: 0x00877650 // FUNCTION: fn_11210 -void SplitTextLinkArguments(std::string text, std::vector& arguments) { +void UITextViewer::SplitTextLinkArguments(std::string text, UITextButton* button) { if (text.empty()) { return; } - auto comma = text.find(','); + std::string remaining = text; + auto comma = remaining.find(","); while (comma != std::string::npos) { - arguments.push_back(text.substr(0, comma)); - text = text.substr(comma + 1); - comma = text.find(','); + const std::string argument = remaining.substr(0, comma); + AddTextLinkArgument(button->m_lines, argument); + remaining = remaining.substr(comma + 1); + comma = remaining.find(','); } - arguments.push_back(text); + AddTextLinkArgument(button->m_lines, remaining); } diff --git a/Source/UI/Text/TextMarkup.h b/Source/UI/Text/TextMarkup.h index 7c533c59..659466cb 100644 --- a/Source/UI/Text/TextMarkup.h +++ b/Source/UI/Text/TextMarkup.h @@ -27,7 +27,6 @@ void ExtractTextLinks(const std::string& source, const std::string& begin, const void ExtractNavigationTextLinks(const std::string& text, std::vector& links); void ExtractTipBoxTextLinks(const std::string& text, std::vector& links); void ExtractUrlTextLinks(const std::string& text, std::vector& links); -void SplitTextLinkArguments(std::string text, std::vector& arguments); #if defined(_WIN32) && !defined(_WIN64) static_assert(sizeof(TextLink) == 60); diff --git a/Source/UI/Text/UITextViewer.h b/Source/UI/Text/UITextViewer.h index 97e20c05..47a615aa 100644 --- a/Source/UI/Text/UITextViewer.h +++ b/Source/UI/Text/UITextViewer.h @@ -41,6 +41,7 @@ private: bool AddNaviLinks(std::string text, unsigned addedLines); bool AddQuestLinks(std::string text, unsigned addedLines); void AddTipLinks(std::string text, unsigned addedLines); + void SplitTextLinkArguments(std::string text, UITextButton* button); void AppendText(char* text, int width, int carriageReturns, int pixels); void Activate(UITextButton* button, int id); }; diff --git a/Source/UI/Text/UITextViewerLinks.cpp b/Source/UI/Text/UITextViewerLinks.cpp index df92fba7..fbbfb683 100644 --- a/Source/UI/Text/UITextViewerLinks.cpp +++ b/Source/UI/Text/UITextViewerLinks.cpp @@ -96,7 +96,7 @@ bool UITextViewer::AddItemLinks(std::string text, unsigned addedLines) { button->ResizeToTextClipped(width + 1, height); button->m_hoverColor = 0x00FF7864; button->SetId(464); - SplitTextLinkArguments(link.metadata, button->m_lines); + this->SplitTextLinkArguments(link.metadata, button); const auto position = this->LinkPosition(link.position, addedLines); button->m_value = position.first; button->Move(position.second, -100); @@ -143,7 +143,7 @@ bool UITextViewer::AddNaviLinks(std::string text, unsigned addedLines) { button->ResizeToTextClipped(width + 1, height); button->m_hoverColor = 0x00FF7864; button->SetId(438); - SplitTextLinkArguments(link.metadata, button->m_lines); + this->SplitTextLinkArguments(link.metadata, button); const auto position = this->LinkPosition(link.position, addedLines); button->m_value = position.first; button->Move(position.second, -100); @@ -245,7 +245,7 @@ bool UITextViewer::AddQuestLinks(std::string text, unsigned addedLines) { button->ResizeToTextClipped(width + 1, height); button->m_hoverColor = 0x00FF7864; button->SetId(539); - SplitTextLinkArguments(link.metadata, button->m_lines); + this->SplitTextLinkArguments(link.metadata, button); const auto position = this->LinkPosition(link.position, addedLines); button->m_value = position.first; button->Move(position.second, -100); @@ -281,13 +281,12 @@ void UITextViewer::AddTipLinks(std::string text, unsigned addedLines) { if (!extracted.empty()) { for (unsigned index = 0; index < extracted.size(); ++index) { - const TextLink& link = extracted[index]; if (this->splitTipLinks == 1) { std::vector labels; - const char* begin = link.display.c_str(); + const char* begin = extracted[index].display.c_str(); const char* const end = begin + std::strlen(begin); - std::uintptr_t limit = reinterpret_cast(begin) + 32u - link.position; + std::uintptr_t limit = reinterpret_cast(begin) + 32u - extracted[index].position; const char* current = begin; const char* breakAt = begin; @@ -327,8 +326,8 @@ void UITextViewer::AddTipLinks(std::string text, unsigned addedLines) { button->ResizeToTextClipped(width + 1, height); button->m_hoverColor = 0x00FF7864; button->SetId(517); - SplitTextLinkArguments(link.metadata, button->m_lines); - const auto position = this->LinkPosition(fragment == 0 ? link.position : 0, addedLines - fragment); + this->SplitTextLinkArguments(extracted[index].metadata, button); + const auto position = this->LinkPosition(fragment == 0 ? extracted[index].position : 0, addedLines - fragment); button->m_value = position.first; button->Move(position.second, -100); this->AddChild(button); @@ -336,14 +335,14 @@ void UITextViewer::AddTipLinks(std::string text, unsigned addedLines) { } } else { auto* button = new UITextButton(); - button->Configure(link.display.c_str(), 0x00F4934A, 0, 12, 0, 1); + button->Configure(extracted[index].display.c_str(), 0x00F4934A, 0, 12, 0, 1); const int height = button->geometry.height; - const int width = this->TextWidth(link.display.c_str(), 0, 0, 12, 0, 0); + const int width = this->TextWidth(extracted[index].display.c_str(), 0, 0, 12, 0, 0); button->ResizeToTextClipped(width + 1, height); button->m_hoverColor = 0x00FF7864; button->SetId(517); - SplitTextLinkArguments(link.metadata, button->m_lines); - const auto position = this->LinkPosition(link.position, addedLines); + this->SplitTextLinkArguments(extracted[index].metadata, button); + const auto position = this->LinkPosition(extracted[index].position, addedLines); button->m_value = position.first; button->Move(position.second, -100); this->AddChild(button); @@ -379,20 +378,21 @@ bool UITextViewer::AddUrlLinks(std::string text, unsigned addedLines) { return false; } - for (const auto& link : extracted) { + for (unsigned index = 0; index < extracted.size(); ++index) { + const TextLink& link = extracted[index]; auto* button = new UITextButton(); button->Configure(link.display.c_str(), 0x00E6A300, 0, 12, 0, 1); button->m_hoverColor = 0x00EFB700; button->SetId(437); const int height = button->geometry.height; const int width = this->TextWidth(link.display.c_str(), 0, 0, 12, 0, 0); - button->Resize(width + 1, height); + button->ResizeToTextClipped(width + 1, height); parsed = RemoveTextLinkInfo(parsed); const auto position = this->LinkPosition(link.position, addedLines); button->m_value = position.first; button->Move(position.second, -100); this->AddChild(button); - SplitTextLinkArguments(link.metadata, button->m_lines); + this->SplitTextLinkArguments(link.metadata, button); this->links.push_back(button); }