From 059ebe6a67a35c6b0ef5d539657af4ec9af817bc Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Fri, 30 Oct 2026 15:32:41 +0000 Subject: [PATCH] Decompile fn_14432 (CUIEditBoxEx::Create) Batch #5773 by willerthal: 0 byte-identical, 1 confirmed by peer review. - fn_14432 CUIEditBoxEx::Create: logic confirmed by peer review Peer-reviewed-by: Yommy, Qwenkler3.8, SapitoSucio Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/UI/Edit/UIEditBoxEx.cpp | 45 +++++++++++++++++++++++++++++++++- Source/UI/Edit/UIEditBoxEx.h | 7 ++++++ 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/Source/UI/Edit/UIEditBoxEx.cpp b/Source/UI/Edit/UIEditBoxEx.cpp index 565261b8..256ad9b3 100644 --- a/Source/UI/Edit/UIEditBoxEx.cpp +++ b/Source/UI/Edit/UIEditBoxEx.cpp @@ -1,4 +1,4 @@ -#include "UI/Edit/UIEditBoxEx.h" +#include "UI/Edit/UIEditBoxEx.h" #include "Network/TextEncoding.h" #include "UI/Buttons/UIButton.h" #include "UI/Lists/UIScrollBar.h" @@ -299,3 +299,46 @@ void CUIEditBoxEx::SetMask(char value) { void CUIEditBoxEx::SetText(const std::string& text) { this->edit->SetText(text.c_str()); } + +#include + +// OFFSET: 0x009E4410 +// FUNCTION: fn_14432 +void CUIEditBoxEx::Create(int width, int height, bool withScrollBar) { + UIEditContext& edits = this->edit->EditContext(); + this->RemoveChild(this->edit, 1); + CUIEditCtrlEx* edit = new CUIEditCtrlEx(*this->m_context, edits); + this->edit = edit; + edit->SetSize(width, height); + if (withScrollBar) { + reinterpret_cast(&edit->unknown_0184)[1] = 1; + } + this->AddChild(edit); + this->SetSize(width, height); +} + +// OFFSET: 0x009E45F0 + +// OFFSET: 0x009E4660 + +CUIEditCtrlEx::CUIEditCtrlEx(UIWindowContext& windows, UIEditContext& edit) : UIEditCtrl3(windows, edit) { + this->normalColor = 0; + this->unknown_018C = 0; + this->unknown_0190 = 0; + this->placeholderColor = 0x808080; + this->alignment = 0; + this->unknown_01B4 = 3; + this->verticalPadding = 1; + this->selectedAll = 0; + this->column = 0; + this->line = 0; + this->unknown_01D4 = -1; + this->unknown_01D8 = 0; + this->unknown_01DC = 0; + this->caretStart = std::chrono::system_clock::now(); + this->scrollMaximum = 0; + this->visibleLines = 0; + this->unknown_01F0 = 1; + this->scrollPosition = 0; + this->unknown_01F8 = 0; +} diff --git a/Source/UI/Edit/UIEditBoxEx.h b/Source/UI/Edit/UIEditBoxEx.h index f8bf89da..c504c6d1 100644 --- a/Source/UI/Edit/UIEditBoxEx.h +++ b/Source/UI/Edit/UIEditBoxEx.h @@ -20,6 +20,7 @@ struct EditLine { class CUIEditCtrlEx : public UIEditCtrl3 { public: + CUIEditCtrlEx(UIWindowContext& windows, UIEditContext& edit); void Paint() override; void Invalidate() override; void SelectAll() override; @@ -27,6 +28,11 @@ public: void RefreshPlaceholder(); void ResetDragState(); + void DrawCaret(int x, int y); + void PaintTextLines(); + UIEditContext& EditContext() { + return *this->m_edit; + } int LeadingBytesFitting(const std::string& text, int width); int TrailingOffsetFitting(const std::string& text, int width); @@ -60,6 +66,7 @@ public: void Paint() override; int SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) override; + void Create(int width, int height, bool withScrollBar); void ResetSelection(); void SetCursor(std::size_t position); int Length();