From 2e3786bbb1ab2e3709685b0ff2e2f7c69e67e6fb Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sat, 7 Nov 2026 12:50:43 +0000 Subject: [PATCH] Decompile 2 functions in Source/UI/Lists/UITagListBox.cpp, Source/UI/TextTagExtraction.cpp Batch #14653 by Yommy: 0 byte-identical, 2 confirmed by peer review. - fn_13882 ExtractTextTags: logic confirmed by peer review - fn_13874 UITagListBox::ParseTaggedText: logic confirmed by peer review (already on main) Peer-reviewed-by: secret, codeplay, raiken Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/UI/Lists/UITagListBox.cpp | 39 ++++++++++++++++++++++++++++++++ Source/UI/TextTagExtraction.cpp | 39 -------------------------------- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/Source/UI/Lists/UITagListBox.cpp b/Source/UI/Lists/UITagListBox.cpp index b956d494d..a083dd42b 100644 --- a/Source/UI/Lists/UITagListBox.cpp +++ b/Source/UI/Lists/UITagListBox.cpp @@ -404,6 +404,45 @@ void UITagListBox::AppendText(std::intptr_t argument1, std::intptr_t argument2, this->Invalidate(); } +// OFFSET: 0x009BA1D0 +// FUNCTION: fn_13882 +std::vector ExtractTextTags(std::string text) { + std::vector tags; + int index = 0; + + for (auto prototype = g_textTagRegistry.begin(); prototype != g_textTagRegistry.end(); ++prototype) { + std::string remaining = text; + + for (std::size_t offset = 0; offset < text.size();) { + const std::size_t begin = remaining.find(prototype->opening); + + if (begin == std::string::npos) { + break; + } + + std::size_t end = remaining.find(prototype->closing); + std::size_t advance; + + if (end == std::string::npos) { + advance = prototype->opening.size(); + remaining.erase(0, advance); + } else { + end += prototype->closing.size(); + STagString tag(index, offset + begin, remaining.substr(begin, end - begin)); + tags.push_back(tag); + remaining.erase(0, end); + advance = end; + } + + offset += advance; + } + + ++index; + } + + return tags; +} + // GLOBAL: gl_25151 std::string infoTagOpening = ""; diff --git a/Source/UI/TextTagExtraction.cpp b/Source/UI/TextTagExtraction.cpp index 6d72093fd..6e37a80d1 100644 --- a/Source/UI/TextTagExtraction.cpp +++ b/Source/UI/TextTagExtraction.cpp @@ -1,40 +1 @@ #include "UI/TextTags.h" - -// OFFSET: 0x009BA1D0 -// FUNCTION: fn_13882 -std::vector ExtractTextTags(std::string text) { - std::vector tags; - int index = 0; - - for (auto prototype = g_textTagRegistry.begin(); prototype != g_textTagRegistry.end(); ++prototype) { - std::string remaining = text; - - for (std::size_t offset = 0; offset < text.size();) { - const std::size_t begin = remaining.find(prototype->opening); - - if (begin == std::string::npos) { - break; - } - - std::size_t end = remaining.find(prototype->closing); - std::size_t advance; - - if (end == std::string::npos) { - advance = prototype->opening.size(); - remaining.erase(0, advance); - } else { - end += prototype->closing.size(); - STagString tag(index, offset + begin, remaining.substr(begin, end - begin)); - tags.push_back(tag); - remaining.erase(0, end); - advance = end; - } - - offset += advance; - } - - ++index; - } - - return tags; -}