Decompile 3 functions in Source/UI/Edit/ItemTagRetirement.cpp, Source/UI/Text/UITextViewer.cpp, ...

Batch #5486 by Yommy: 0 byte-identical, 3 confirmed by peer review.

- fn_11219 UIItemTagOnMail::CanInsertTag: logic confirmed by peer review
- fn_11228 UITextViewEX::Clear: logic confirmed by peer review
- fn_11232 UIListBoxNavi::ResetLineColors: logic confirmed by peer review

Peer-reviewed-by: willerthal, Snow, 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 12:15:28 +00:00
commit fbc4ca54b5
7 changed files with 61 additions and 1 deletions

View file

@ -1,8 +1,10 @@
#include "UI/Window/InputFocus.h"
#include "UI/Edit/ItemTagRetirement.h"
#include "UI/Edit/UIItemTagCtrl.h"
#include "UI/Rodex/UIRodexComposeWnd.h"
#include "UI/Text/TextFitting.h"
#include "UI/Window/UIWindow.h"
#include "UI/Window/UIWindowMgr.h"
// INLINED
FocusedItemTagRemoval::FocusedItemTagRemoval(InputFocus& focus) : m_focus(focus) {
@ -16,6 +18,29 @@ void FocusedItemTagRemoval::Remove(UIWindow* child) {
}
}
// OFFSET: 0x00879830
// OFFSET: 0x00879A10
// FUNCTION: fn_11219
bool UIItemTagOnMail::CanInsertTag(const std::string& name, int width) {
if (this->tags.size() > 2) {
return false;
}
std::string tag = "<";
this->tagWidth = width;
tag += FitText(*this->geometry.surface, name, width / 2);
tag += ">";
UIRodexEditCtrl3* contents = reinterpret_cast<UIRodexComposeWnd*>(g_windowMgr.unknown_0458)->m_contents;
const unsigned int maximum = contents->maximum;
this->taggedText = contents->text;
std::string text = this->taggedText += tag;
return text.size() <= maximum;
}
// OFFSET: 0x0087ABB0
// OFFSET: 0x0087A2F0
// FUNCTION: fn_11231
void ItemTagRetirement::Clear() {

View file

@ -10,7 +10,8 @@ struct InputFocus;
struct ItemTagRecord {
/* 0000 */ UIWindow* child;
/* 0004 */ std::array<std::byte, 452> unknown_0004;
/* 0004 */ std::array<std::byte, 64> unknown_0004;
/* 0044 */ char name[388];
};
class ItemTagRemoval {
@ -40,6 +41,7 @@ struct ItemTagRetirement {
static_assert(sizeof(ItemTagRecord) == 456);
static_assert(offsetof(ItemTagRecord, child) == 0x0000);
static_assert(offsetof(ItemTagRecord, unknown_0004) == 0x0004);
static_assert(offsetof(ItemTagRecord, name) == 0x0044);
#endif
#endif

View file

@ -13,6 +13,7 @@ public:
virtual bool CanInsertTag(const std::string& name, int width);
std::string AppendTag(const std::string& name);
bool SyncTagsWithText();
/* 011C */ int unknown_011C;
/* 0120 */ std::list<ItemTagRecord> tags;
@ -21,8 +22,14 @@ public:
/* 0158 */ int tagWidth;
};
class UIItemTagOnChat : public UIItemTagCtrl {
public:
bool CanInsertTag(const std::string& name, int width) override;
};
class UIItemTagOnMail : public UIItemTagCtrl {
public:
bool CanInsertTag(const std::string& name, int width) override;
void SetLines(const std::vector<std::string>& lines);
/* 015C */ std::vector<std::string> m_lines;

View file

@ -17,6 +17,7 @@ public:
void SetDefaultLineColor(std::uint32_t color);
void SetLineColor(int line, std::uint32_t color);
void ResetLineColors();
};
#endif

View file

@ -90,6 +90,18 @@ void UITextViewEX::Configure(int x, int y, int width, int height, unsigned char
this->lineHeight = 21;
}
// OFFSET: 0x0087A1E0
// FUNCTION: fn_11228
void UITextViewEX::Clear() {
for (UIWindow* link : this->extraLinks) {
this->RemoveChild(link, 1);
}
this->extraLinks.clear();
this->lineLinks.clear();
UITextViewer::Clear();
this->Invalidate();
}
// OFFSET: 0x0087B780
// FUNCTION: fn_11249
void UITextViewer::Configure(int x, int y, int width, int height, unsigned char value) {

View file

@ -72,6 +72,10 @@ private:
class UITextViewEX : public UITextViewer {
public:
void Configure(int x, int y, int width, int height, unsigned char transparent) override;
void Clear() override;
std::vector<UIWindow*> extraLinks;
std::vector<std::vector<UITextButton*>> lineLinks;
};
#if defined(_WIN32) && !defined(_WIN64)

View file

@ -175,6 +175,15 @@ void UIListBoxNavi::Clear() {
this->lineOffset = -1;
}
// OFFSET: 0x0087A390
// FUNCTION: fn_11232
void UIListBoxNavi::ResetLineColors() {
for (std::vector<std::uint32_t>::iterator color = this->lineColors.begin(); color != this->lineColors.end(); ++color) {
*color = 0;
}
this->Invalidate();
}
// OFFSET: 0x00877020
// FUNCTION: fn_11209
bool UITextViewer::AddQuestLinks(std::string text, unsigned addedLines) {