From 5edd042708926b3f7c407c36ac4f110b80cedd60 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Fri, 30 Oct 2026 05:48:17 +0000 Subject: [PATCH] Decompile 2 functions in Source/UI/Text/NavigationLink.cpp, Source/UI/Text/NavigationLink.h, ... Batch #4903 by youko: 0 byte-identical, 2 confirmed by peer review. - fn_10407 NavigationLinkParser::HasLink: logic confirmed by peer review - fn_10408 NavigationLinkParser::ExpandMessages: logic confirmed by peer review Peer-reviewed-by: eAthena, alisonrag, Lumen Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/UI/Text/CreateLineInfo.h | 10 +++++ Source/UI/Text/NavigationLink.cpp | 61 +++++++++++++++++++++++++++++++ Source/UI/Text/NavigationLink.h | 3 ++ 3 files changed, 74 insertions(+) diff --git a/Source/UI/Text/CreateLineInfo.h b/Source/UI/Text/CreateLineInfo.h index f72a38746..1f1ce2dfd 100644 --- a/Source/UI/Text/CreateLineInfo.h +++ b/Source/UI/Text/CreateLineInfo.h @@ -8,7 +8,10 @@ #include #include +class FontCache; class UIWindow; +struct TextLocale; +struct tagSIZE; enum LineSegmentType { LINE_SEGMENT_URL = 0x1B5, @@ -60,6 +63,13 @@ public: static std::string NextCharacter(std::string text); static std::tuple SplitLinkInfo(std::string text, int type); static std::vector SplitString(std::string text, const std::string& delimiter); + static tagSIZE MeasureText(FontCache& fonts, const TextLocale& locale, UIWindow* window, std::string text, const LineTextStyle& style); + static std::string FitText( + FontCache& fonts, const TextLocale& locale, UIWindow* window, std::string text, const LineTextStyle& style, int width + ); + static std::vector SplitLines( + FontCache& fonts, const TextLocale& locale, UIWindow* window, std::string text, const LineTextStyle& style, int width + ); /* 0004 */ UIWindow* m_parent; /* 0008 */ int m_width; diff --git a/Source/UI/Text/NavigationLink.cpp b/Source/UI/Text/NavigationLink.cpp index c6c5d6429..4360d5d7a 100644 --- a/Source/UI/Text/NavigationLink.cpp +++ b/Source/UI/Text/NavigationLink.cpp @@ -164,6 +164,61 @@ static const std::string g_questCloseTag = ""; // GLOBAL: gl_24836 std::vector CCreateLineInfo::s_fontStackCache; +// OFFSET: 0x00832500 +// FUNCTION: fn_10407 +bool NavigationLinkParser::HasLink(std::string text) { + return text.find(g_naviLinkTag) != std::string::npos || text.find(g_naviLinkCloseTag) != std::string::npos || + text.find(g_itemLinkTag) != std::string::npos || text.find(g_itemLinkCloseTag) != std::string::npos; +} + +// OFFSET: 0x00832640 +// FUNCTION: fn_10408 +std::string NavigationLinkParser::ExpandMessages(std::string text) { + std::string expanded; + + for (;;) { + std::string work; + if (expanded.empty()) { + work = text; + } else { + work = expanded; + } + + const std::size_t begin = work.find(g_messageTag); + if (begin == std::string::npos) { + return text; + } + + work = work.substr(begin + std::strlen(g_messageTag.c_str())); + const std::size_t end = work.find(g_messageCloseTag); + if (end == std::string::npos) { + return text; + } + + work = work.substr(0, end); + int messageId; + if (work.find("MSI_") != std::string::npos) { + messageId = FindMessageId(work.c_str()); + } else { + messageId = std::atoi(work.c_str()); + } + + const std::string message = FormatMessageArguments(work, messageId); + work.clear(); + work = expanded.empty() ? text : expanded; + const std::string head = work.substr(0, begin); + const std::string tail = work.substr(work.find(g_messageCloseTag) + std::strlen(g_messageCloseTag.c_str())); + expanded.clear(); + expanded += head; + expanded += message; + expanded += tail; + + if (expanded.find(g_messageTag) == std::string::npos) { + return expanded; + } + } +} + // OFFSET: 0x00833160 // FUNCTION: fn_10409 int DecodeNavigationNumber(std::string value) { @@ -527,6 +582,10 @@ std::size_t CCreateLineInfo::FindTag(std::string text, std::string keyword, bool return text.find(keyword, 0); } +// OFFSET: 0x00839420 + +// OFFSET: 0x00839860 + // OFFSET: 0x00839D60 // FUNCTION: fn_10460 std::pair CCreateLineInfo::GetLinkTags(int type) { @@ -552,6 +611,8 @@ std::pair CCreateLineInfo::GetLinkTags(int type) { } } +// OFFSET: 0x00839FA0 + // OFFSET: 0x0083A180 // FUNCTION: fn_10462 void CCreateLineInfo::ApplyFont(std::string tag) { diff --git a/Source/UI/Text/NavigationLink.h b/Source/UI/Text/NavigationLink.h index f09c680c9..9b21f0a38 100644 --- a/Source/UI/Text/NavigationLink.h +++ b/Source/UI/Text/NavigationLink.h @@ -7,6 +7,9 @@ struct NavigationLinkParser { NavigationLinkParser(); ~NavigationLinkParser(); + bool HasLink(std::string text); + std::string ExpandMessages(std::string text); + /* 0000 */ bool m_ready; };