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).
This commit is contained in:
ragnarok-clanker 2026-11-07 12:50:43 +00:00
commit 2e3786bbb1
2 changed files with 39 additions and 39 deletions

View file

@ -404,6 +404,45 @@ void UITagListBox::AppendText(std::intptr_t argument1, std::intptr_t argument2,
this->Invalidate();
}
// OFFSET: 0x009BA1D0
// FUNCTION: fn_13882
std::vector<STagString> ExtractTextTags(std::string text) {
std::vector<STagString> 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 = "<INFO>";

View file

@ -1,40 +1 @@
#include "UI/TextTags.h"
// OFFSET: 0x009BA1D0
// FUNCTION: fn_13882
std::vector<STagString> ExtractTextTags(std::string text) {
std::vector<STagString> 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;
}