Decompile 5 functions in Source/UI/Buttons/UITagButton.cpp, Source/UI/Buttons/UITagButton.h, ...

Batch #5008 by Yommy: 0 byte-identical, 5 confirmed by peer review.

- fn_13834 UITextButton::GetLine: logic confirmed by peer review
- fn_13844 UITagButton::Slot31: logic confirmed by peer review
- fn_13845 UITagButton::AddString: logic confirmed by peer review
- fn_13846 UITagButton::GetString: logic confirmed by peer review
- fn_13847 UITagButton::GetStringCount: logic confirmed by peer review

Peer-reviewed-by: youko, SapitoSucio
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
Adds to the build: Source/UI/Buttons/UITagButton.cpp
This commit is contained in:
ragnarok-clanker 2026-10-30 07:05:32 +00:00
commit db500e2ecf
5 changed files with 102 additions and 0 deletions

View file

@ -0,0 +1,63 @@
#include "UI/Buttons/UITagButton.h"
#include "UI/Window/UIWindowMgr.h"
#include <windows.h>
// GLOBAL: gl_24936
std::string g_emptyString;
// OFFSET: 0x009B54A0
// FUNCTION: fn_13844
void UITagButton::Slot31(int x, int y) {
if (this->m_disabled != 0) {
return;
}
if (HIBYTE(GetAsyncKeyState(VK_SHIFT))) {
if (g_windowMgr.GetHoverWindow() && this->item.identified) {
g_windowMgr.GetHoverWindow()->SendMsg(nullptr, 148, reinterpret_cast<std::intptr_t>(&this->item), 0, 0, 0);
}
return;
}
if (g_windowMgr.Capture() != this) {
return;
}
if (x < 0 || x >= this->geometry.width || y < 0 || y >= this->geometry.height) {
this->geometry.unknown_0030 = 0;
} else {
this->geometry.unknown_0030 = 1;
if (this->parent) {
this->parent->SendMsg(this, 98, this->geometry.id, this->m_value, 0, 0);
}
}
this->Invalidate();
g_windowMgr.ReleaseCapture();
}
// OFFSET: 0x009B5580
// FUNCTION: fn_13845
void UITagButton::AddString(std::string text) {
this->m_strings.push_back(text);
}
// OFFSET: 0x009B5600
// FUNCTION: fn_13846
std::string UITagButton::GetString(std::size_t index) {
if (index < this->m_strings.size()) {
return this->m_strings[index];
}
return std::string();
}
// OFFSET: 0x009B56C0
// FUNCTION: fn_13847
int UITagButton::GetStringCount() {
return static_cast<int>(this->m_strings.size());
}

View file

@ -0,0 +1,23 @@
#ifndef RAGNAROK_SOURCE_UI_BUTTONS_UITAGBUTTON_H
#define RAGNAROK_SOURCE_UI_BUTTONS_UITAGBUTTON_H
#include "Contents/Items/ItemInfo.h"
#include "UI/Buttons/UITextButton.h"
#include <cstddef>
#include <string>
#include <vector>
class UITagButton : public UITextButton {
public:
/* 00F8 */ ITEM_INFO item;
/* 01F0 */ std::vector<std::string> m_strings;
void Slot31(int x, int y) override;
void AddString(std::string text);
std::string GetString(std::size_t index);
int GetStringCount();
};
#endif

View file

@ -1653,3 +1653,13 @@ void UIImgMenu::Move(int x, int y) {
int UIString::SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) {
return UIWindow::SendMsg(sender, message, argument1, argument2, argument3, argument4);
}
// OFFSET: 0x009B4EF0
// FUNCTION: fn_13834
const std::string& UITextButton::GetLine(std::size_t index) const {
try {
return this->m_lines.at(index);
} catch (...) {
return g_emptyString;
}
}

View file

@ -3,6 +3,8 @@
#include "UI/Buttons/UIButton.h"
#include <cstddef>
#include <string>
#include <vector>
class UITextButton : public UIButton {
@ -21,6 +23,7 @@ public:
void Slot35(int value) override;
void Configure(const char* text, std::uint32_t color, int family, int height, unsigned char outline, unsigned char underline);
void ResizeToText();
const std::string& GetLine(std::size_t index) const;
protected:
/* 00B4 */ std::uint32_t m_color;
@ -36,6 +39,8 @@ protected:
/* 00EC */ std::vector<std::string> m_lines;
};
extern std::string g_emptyString;
#if defined(_WIN32) && !defined(_WIN64)
static_assert(sizeof(UITextButton) == 256);
#endif

View file

@ -801,6 +801,7 @@
"Source/UI/Buttons/UINaviLinkButton.cpp": 2,
"Source/UI/Buttons/UINoneVisibleButton.cpp": 2,
"Source/UI/Buttons/UIRadioBtn.cpp": 2,
"Source/UI/Buttons/UITagButton.cpp": 2,
"Source/UI/Buttons/UITextButton.cpp": 2,
"Source/UI/Buttons/UITextureButton.cpp": 2,
"Source/UI/CashShop/UICashShopWnd.cpp": 2,