From 6805deb8aaf2759f00ddbb5a6c6bd2145044b7be Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Wed, 28 Oct 2026 13:15:27 +0000 Subject: [PATCH] Decompile fn_10410 (EncodeNavigationNumber) Batch #1448 by Yommy: 0 byte-identical, 1 confirmed by peer review. - fn_10410 EncodeNavigationNumber: logic confirmed by peer review Peer-reviewed-by: ragnarok-clanker Reviewed-by: ragnarok-clanker --- Source/UI/Text/NavigationLink.cpp | 21 +++++++++++++++++++++ Source/UI/Text/NavigationLink.h | 1 + 2 files changed, 22 insertions(+) diff --git a/Source/UI/Text/NavigationLink.cpp b/Source/UI/Text/NavigationLink.cpp index b28f8bb2..c9d6bca8 100644 --- a/Source/UI/Text/NavigationLink.cpp +++ b/Source/UI/Text/NavigationLink.cpp @@ -3,6 +3,7 @@ #include #include #include +#include // OFFSET: 0x00833160 // FUNCTION: fn_10409 @@ -30,6 +31,26 @@ int DecodeNavigationNumber(std::string value) { return static_cast(result); } +// OFFSET: 0x00833270 +// FUNCTION: fn_10410 +std::string EncodeNavigationNumber(int value) { + const char digits[] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + std::vector characters; + + do { + characters.push_back(digits[value % 62]); + value /= 62; + } while (value >= 62); + characters.push_back(digits[value]); + + std::string result; + const std::size_t count = characters.size(); + for (std::size_t index = 0; index < count; ++index) { + result += characters[count - 1 - index]; + } + return result; +} + // OFFSET: 0x00835890 // FUNCTION: fn_10420 bool ParseNavigationLink(std::string value, std::string& name, int& x, int& y) { diff --git a/Source/UI/Text/NavigationLink.h b/Source/UI/Text/NavigationLink.h index ceab1a7d..679ee8a3 100644 --- a/Source/UI/Text/NavigationLink.h +++ b/Source/UI/Text/NavigationLink.h @@ -4,6 +4,7 @@ #include int DecodeNavigationNumber(std::string value); +std::string EncodeNavigationNumber(int value); bool ParseNavigationLink(std::string value, std::string& name, int& x, int& y); std::string FormatNavigationLink(std::string value, bool brackets); void DisplayNavigationLink(std::string& output, std::string value);