From 15e55e4fe084cd4e1036f6148ccb4e634afacf3c Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sun, 1 Nov 2026 13:29:12 +0000 Subject: [PATCH] Decompile 2 functions in Source/UI/Lists/UIListBox.cpp, Source/UI/Lists/UIChatHisBox.h Batch #9433 by gordaoprogramas: 0 byte-identical, 2 confirmed by peer review. - fn_11198 UIChatHisBox3::AddText: logic confirmed by peer review - fn_11199 UIChatHisBox::AddText: 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/Lists/UIChatHisBox.h | 2 ++ Source/UI/Lists/UIListBox.cpp | 65 ++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) diff --git a/Source/UI/Lists/UIChatHisBox.h b/Source/UI/Lists/UIChatHisBox.h index 0904cc51..cf6bc234 100644 --- a/Source/UI/Lists/UIChatHisBox.h +++ b/Source/UI/Lists/UIChatHisBox.h @@ -27,6 +27,8 @@ public: void Clear() override; virtual void AddText(const char* text, int color, const char* style); void AddTextWrapped(const char* text, int color, const char* style); + void sub_89DC30(const char* text, int& color, int& mode); + void sub_89E0F0(const char* text, int& color, int& mode); const char* HistoryText(unsigned int index); bool SaveChatLog(const char* path); void PlaceNaviLinks(int line); diff --git a/Source/UI/Lists/UIListBox.cpp b/Source/UI/Lists/UIListBox.cpp index 0a12af31..a735cd8e 100644 --- a/Source/UI/Lists/UIListBox.cpp +++ b/Source/UI/Lists/UIListBox.cpp @@ -140,8 +140,73 @@ void UIChatHisBox::AddTextWrapped(const char* text, int color, const char* style } // OFFSET: 0x008752F0 +// FUNCTION: fn_11198 +void UIChatHisBox3::AddText(const char* text, int color) { + const bool atBottom = + this->verticalOverflow == 0 || this->topLine == ((static_cast(this->lines.size()) - this->geometry.height / this->lineHeight) + this->bottomMargin); + + if (this->lines.size() >= this->maxLines) { + this->ShiftNaviLinks(); + this->ShiftItemTags(); + this->DropOldestLines(); + } + + this->unknown_00E4.push_back(color); + + int mode = 3; + const auto* bytes = reinterpret_cast(text); + + if (_mbsstr(bytes, reinterpret_cast("")) || _mbsstr(bytes, reinterpret_cast(""))) { + this->sub_89DC30(text, color, mode); + } else if (g_navigationLinkParser->HasLink(std::string(text))) { + this->sub_89E0F0(text, color, mode); + } else { + this->UIListBox::AddLine(text); + } + + if (this->verticalOverflow != 0 && atBottom && this->unknown_0130 != 0) { + this->topLine = (static_cast(this->lines.size()) - this->geometry.height / this->lineHeight) + this->bottomMargin; + this->verticalBar->position = this->topLine; + this->verticalBar->Invalidate(); + } + + this->Invalidate(); +} // OFFSET: 0x00875520 +// FUNCTION: fn_11199 +void UIChatHisBox::AddText(const char* text, int color, const char* style) { + const bool atBottom = + this->verticalOverflow == 0 || this->topLine == ((static_cast(this->lines.size()) - this->geometry.height / this->lineHeight) + this->bottomMargin); + + if (this->lines.size() >= this->maxLines) { + this->ShiftNaviLinks(); + this->ShiftItemTags(); + this->DropOldestLines(); + } + + this->history.push_back(style ? std::string(style) : std::string()); + this->unknown_00E4.push_back(color); + + int mode = 4; + const auto* bytes = reinterpret_cast(text); + + if (_mbsstr(bytes, reinterpret_cast("")) || _mbsstr(bytes, reinterpret_cast(""))) { + this->sub_89DC30(text, color, mode); + } else if (g_navigationLinkParser->HasLink(std::string(text))) { + this->sub_89E0F0(text, color, mode); + } else { + this->UIListBox::AddLine(text); + } + + if (this->verticalOverflow != 0 && atBottom) { + this->topLine = (static_cast(this->lines.size()) - this->geometry.height / this->lineHeight) + this->bottomMargin; + this->verticalBar->position = this->topLine; + this->verticalBar->Invalidate(); + } + + this->Invalidate(); +} // OFFSET: 0x00875A70 // FUNCTION: fn_11201