From dbbca8b41ec2f1162f419cb361c140b4568c19ef Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sun, 1 Nov 2026 13:48:49 +0000 Subject: [PATCH] Decompile fn_11388 (UIString::Paint) Batch #9453 by Lumen: 0 byte-identical, 1 confirmed by peer review. - fn_11388 UIString::Paint: logic confirmed by peer review Peer-reviewed-by: ragnarok-clanker, meitogi, Toshiro Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/UI/Buttons/UISlotBmpButton.h | 1 + Source/UI/Buttons/UITextButton.cpp | 35 +++++++++++++++++++++++++++++ Source/UI/Text/ColoredText.h | 1 + Source/UI/Text/UIString.h | 1 + 4 files changed, 38 insertions(+) diff --git a/Source/UI/Buttons/UISlotBmpButton.h b/Source/UI/Buttons/UISlotBmpButton.h index db1d58c1..fc2c026c 100644 --- a/Source/UI/Buttons/UISlotBmpButton.h +++ b/Source/UI/Buttons/UISlotBmpButton.h @@ -15,6 +15,7 @@ public: void Slot25(int x, int y) override; void Slot26(int x, int y) override; void Slot32(int x, int y) override; + int SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) override; void SetSlot(int slot, int fallback); protected: diff --git a/Source/UI/Buttons/UITextButton.cpp b/Source/UI/Buttons/UITextButton.cpp index da14bb7c..35c119a8 100644 --- a/Source/UI/Buttons/UITextButton.cpp +++ b/Source/UI/Buttons/UITextButton.cpp @@ -3512,3 +3512,38 @@ void UITreeView::Paint() { this->LayoutNodes(this->root->children, 0, 0); this->Slot53(); } + +// OFFSET: 0x0088F450 +// FUNCTION: fn_11388 +void UIString::Paint() { + if (this->unknown_00DC.empty()) { + return; + } + + std::uint32_t color = (static_cast(static_cast(this->unknown_00A4)) << 16) | + (static_cast(static_cast(this->unknown_00A0)) << 8) | + static_cast(static_cast(this->unknown_009C)); + + const char* cur = this->unknown_00DC.c_str(); + const char* end = cur + this->unknown_00DC.size(); + + if (!this->unknown_00AC.empty()) { + char path[128]; + std::memset(path, 0, sizeof(path)); + reinterpret_cast(&g_session)->IconPath(path, this->unknown_00AC.c_str(), 0); + CRes* res = ResourceMgr::Instance().Load(Resolve(path)); + if (!res) { + return; + } + this->DrawBitmap(0, 0, reinterpret_cast(res), true); + while (cur < end) { + cur = ParseColorCode(SegmentEnd(cur, end), color); + } + DrawColoredText(*this, 0, 24, 7, this->unknown_00DC.c_str(), static_cast(this->unknown_00DC.size()), color, 0, 12, false); + } else { + DrawColoredText(*this, 0, 0, 0, this->unknown_00DC.c_str(), static_cast(this->unknown_00DC.size()), color, 0, 12, false); + } +} + +// OFFSET: 0x00899780 + diff --git a/Source/UI/Text/ColoredText.h b/Source/UI/Text/ColoredText.h index 536e2998..e8774ba1 100644 --- a/Source/UI/Text/ColoredText.h +++ b/Source/UI/Text/ColoredText.h @@ -10,6 +10,7 @@ struct TextLocale; extern unsigned char g_hexDigits[256]; +const char* SegmentEnd(const char* text, const char* end); const char* ParseColorCode(const char* text, std::uint32_t& color); void DrawColoredText( diff --git a/Source/UI/Text/UIString.h b/Source/UI/Text/UIString.h index 125e3cb9..a98626f5 100644 --- a/Source/UI/Text/UIString.h +++ b/Source/UI/Text/UIString.h @@ -8,6 +8,7 @@ class UIString : public UIWindow { public: explicit UIString(UIWindowContext& windows); + void Paint() override; void ResetCursor(int x, int y) override; void Slot31(int x, int y) override; int SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) override;