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).
This commit is contained in:
ragnarok-clanker 2026-10-30 15:32:41 +00:00
commit 059ebe6a67
2 changed files with 51 additions and 1 deletions

View file

@ -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 <chrono>
// 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<unsigned char*>(&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;
}

View file

@ -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();