From 2857ec2b3315d850195d0690b5ce851ad4a3a369 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Thu, 29 Oct 2026 01:56:55 +0000 Subject: [PATCH] Decompile fn_14684 (CUITab::Paint) Batch #2031 by ragnarok-clanker: 1 byte-identical, 0 confirmed by peer review. - fn_14684 CUITab::Paint: byte-identical Merged automatically: every function is byte-identical to the original. --- Source/UI/Lists/UIThumb.h | 40 ++++++++++++++++ Source/UI/Lists/UIVScrollBar.h | 5 +- Source/UI/Window/UIControl.cpp | 84 ++++++++++++++++++++++++++++++++++ Source/UI/Window/UIControl.h | 5 ++ 4 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 Source/UI/Lists/UIThumb.h diff --git a/Source/UI/Lists/UIThumb.h b/Source/UI/Lists/UIThumb.h new file mode 100644 index 0000000..d8486f2 --- /dev/null +++ b/Source/UI/Lists/UIThumb.h @@ -0,0 +1,40 @@ +#ifndef RAGNAROK_SOURCE_UI_LISTS_UITHUMB_H +#define RAGNAROK_SOURCE_UI_LISTS_UITHUMB_H + +#include "UI/Window/UIControl.h" + +#include +#include +#include + +class CBitmapRes; + +class CUIThumb : public CUIControl { +public: + void ResetCursor(int x, int y) override; + + /* 0084 */ unsigned char unknown_0084[0x08]; + /* 008C */ CBitmapRes* bitmap; + /* 0090 */ int dragOrigin; + /* 0094 */ unsigned char unknown_0094[0x04]; + /* 0098 */ std::string unknown_0098; + /* 00B0 */ std::string unknown_00B0; + /* 00C8 */ std::string unknown_00C8; + /* 00E0 */ std::string unknown_00E0; + /* 00F8 */ std::function onDrag; +}; + +class CUIVThumb : public CUIThumb { +public: + void Slot25(int x, int y) override; + void Slot27(int x, int y) override; + void Slot31(int x, int y) override; +}; + +#if defined(_WIN32) && !defined(_WIN64) +static_assert(offsetof(CUIThumb, dragOrigin) == 0x90); +static_assert(offsetof(CUIThumb, onDrag) == 0xF8); +static_assert(sizeof(CUIThumb) == 0x120); +#endif + +#endif diff --git a/Source/UI/Lists/UIVScrollBar.h b/Source/UI/Lists/UIVScrollBar.h index ce4d316..d1ae8c4 100644 --- a/Source/UI/Lists/UIVScrollBar.h +++ b/Source/UI/Lists/UIVScrollBar.h @@ -8,6 +8,9 @@ class CUIVScrollBar : public CUIControl { public: + void Show(int visible) override; + void Slot25(int x, int y) override; + void Slot35(int value) override; virtual void Slot54(); void SetTotal(int value); @@ -19,7 +22,7 @@ public: /* 008C */ int unknown_008C; /* 0090 */ int total; /* 0094 */ int visible; - /* 0098 */ int unknown_0098; + /* 0098 */ int step; /* 009C */ int position; /* 00A0 */ int maximum; /* 00A4 */ int trackLength; diff --git a/Source/UI/Window/UIControl.cpp b/Source/UI/Window/UIControl.cpp index 46498ea..6a6d56c 100644 --- a/Source/UI/Window/UIControl.cpp +++ b/Source/UI/Window/UIControl.cpp @@ -1,5 +1,7 @@ #include "UI/Window/UIControl.h" #include "UI/Lists/UIListBoxTemplate.h" +#include "UI/Lists/UIThumb.h" +#include "Client/Mode/ModeCursor.h" #include "Resource/Bitmap/BitmapResource.h" #include "Resource/ResourceMgr.h" #include "Resource/TextureNames.h" @@ -193,6 +195,65 @@ void CUIVScrollBar::SetPosition(int value) { this->Invalidate(); } +// OFFSET: 0x009F23B0 +// FUNCTION: fn_14709 +void CUIVScrollBar::Slot25(int, int y) { + const int top = this->thumb->geometry.y; + if (y < top) { + this->SetPosition(this->position - this->step); + } else if (y > this->thumb->geometry.height + top) { + this->SetPosition(this->position + this->step); + } +} + +// OFFSET: 0x009F0F00 +// FUNCTION: fn_14684 +void CUITab::Paint() { + this->ClearSurface(0xFFFF00FF); +} + +// OFFSET: 0x009F2400 +// FUNCTION: fn_14710 +void CUIVThumb::Slot25(int, int y) { + g_windowMgr.SetCapture(this); + this->dragOrigin = y; +} + +// OFFSET: 0x009F2420 +// FUNCTION: fn_14711 +void CUIVThumb::Slot31(int, int y) { + if (this == g_windowMgr.Capture()) { + g_windowMgr.ReleaseCapture(); + } + this->dragOrigin = y; +} + +// OFFSET: 0x009F24B0 +// FUNCTION: fn_14713 +void CUIVThumb::Slot27(int, int y) { + if (this == g_windowMgr.Capture() && y != this->dragOrigin && this->onDrag) { + this->onDrag(y - this->dragOrigin); + } +} + +// OFFSET: 0x009F24F0 +// FUNCTION: fn_14714 +void CUIThumb::ResetCursor(int, int) { + this->m_context->cursor.Set(2, this->m_context->cursorTick); +} + +// OFFSET: 0x009F2500 +// FUNCTION: fn_14715 +void CUIVScrollBar::Slot35(int value) { + this->SetPosition(value > 0 ? this->position - this->step : this->step + this->position); +} + +// OFFSET: 0x009F2BC0 +// FUNCTION: fn_14727 +void CUIVScrollBar::Show(int visible) { + this->geometry.visible = this->unknown_00A9[0] ? 0 : visible; +} + // OFFSET: 0x009F25C0 // FUNCTION: fn_14717 void CUIVScrollBar::Slot54() { @@ -213,6 +274,12 @@ void CUIVScrollBar::Slot54() { } // OFFSET: 0x009F01F0 +// FUNCTION: fn_14657 +void CUIListItem::Slot31(int, int) { + if (this == g_windowMgr.Capture()) { + g_windowMgr.ReleaseCapture(); + } +} // OFFSET: 0x009F0230 // FUNCTION: fn_14659 @@ -223,6 +290,18 @@ void CUIListItem::Slot27(int, int) { } // OFFSET: 0x009F0250 +// FUNCTION: fn_14660 +void CUIListItem::SetHighlighted(bool highlighted) { + if (this->selected != 1) { + const int state = highlighted * 2; + if (this->selected != state) { + this->selected = state; + if (!this->frozen) { + this->Invalidate(); + } + } + } +} // OFFSET: 0x009F0290 // FUNCTION: fn_14661 @@ -236,6 +315,11 @@ void CUIListItem::SetSelected(bool selected) { } // OFFSET: 0x009F02C0 +// FUNCTION: fn_14662 +void CUIListItem::SetFrozen(bool frozen) { + this->frozen = frozen; + this->Invalidate(); +} template void CUIListBox::Resize(int, int); template void CUIListBox::Resize(int, int); diff --git a/Source/UI/Window/UIControl.h b/Source/UI/Window/UIControl.h index 4196fc7..64b5ad1 100644 --- a/Source/UI/Window/UIControl.h +++ b/Source/UI/Window/UIControl.h @@ -34,6 +34,11 @@ public: /* 007C */ unsigned char hitEnabled; }; +class CUITab : public CUIControl { +public: + void Paint() override; +}; + #if defined(_WIN32) && !defined(_WIN64) static_assert(sizeof(CUIControl) == 132); #endif