From 0db522c66bdffa635db5be6ce85201501e4237f8 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sat, 7 Nov 2026 12:36:13 +0000 Subject: [PATCH] Decompile 5 functions in Source/UI/Window/UIControl.cpp Batch #14647 by Yommy: 0 byte-identical, 5 confirmed by peer review. - fn_14028 CUIVScrollBar::SetOnChange: logic confirmed by peer review - fn_14513 CUITextViewer::Slot15: logic confirmed by peer review - fn_14596 CUIHScrollBar::Slot15: logic confirmed by peer review - fn_14689 CUITabButton::Paint: logic confirmed by peer review - fn_14706 CUIVScrollBar::Slot15: logic confirmed by peer review Peer-reviewed-by: secret, codeplay, raiken Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/UI/Window/UIControl.cpp | 60 ++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/Source/UI/Window/UIControl.cpp b/Source/UI/Window/UIControl.cpp index 26c3aa5b8..2ab1f25a1 100644 --- a/Source/UI/Window/UIControl.cpp +++ b/Source/UI/Window/UIControl.cpp @@ -46,6 +46,12 @@ const char* g_uiInfoPath = "savedata\\UIInfo.lua"; // GLOBAL: gl_25443 const char* g_uiInfoScriptPath = "Lua Files\\OptionInfo\\UIInfo_F"; +// INLINED +template +static __forceinline void AssignHandler(std::function& target, const std::function& source) { + std::function(source).swap(target); +} + class CUIListBoxItemSelector { public: void SetHighlighted(CUIListItem* const& item); @@ -378,7 +384,7 @@ void CUIVScrollBar::SetTotal(int value) { // OFFSET: 0x009D3120 // FUNCTION: fn_14028 void CUIVScrollBar::SetOnChange(std::function handler) { - this->onChange = handler; + AssignHandler(this->onChange, handler); } // OFFSET: 0x009F2E80 @@ -3232,40 +3238,38 @@ void CUITabButton::Paint() { return; } - const int width = this->geometry.width; - const int height = this->geometry.height; if (this->orientation == 1) { if (this->state != 1) { - this->FillRegion(2, 1, width - 3, height - 2, this->normalColor); - this->FillRegion(1, 2, 1, height - 4, this->borderColor); + this->FillRegion(2, 1, this->geometry.width - 3, this->geometry.height - 2, this->normalColor); + this->FillRegion(1, 2, 1, this->geometry.height - 4, this->borderColor); this->FillRegion(2, 1, 1, 1, this->borderColor); - this->FillRegion(2, height - 2, 1, 1, this->borderColor); - this->FillRegion(3, 0, width - 3, 1, this->borderColor); - this->FillRegion(3, height - 1, width - 3, 1, this->borderColor); - this->FillRegion(width - 1, 0, 1, height, this->borderColor); + this->FillRegion(2, this->geometry.height - 2, 1, 1, this->borderColor); + this->FillRegion(3, 0, this->geometry.width - 3, 1, this->borderColor); + this->FillRegion(3, this->geometry.height - 1, this->geometry.width - 3, 1, this->borderColor); + this->FillRegion(this->geometry.width - 1, 0, 1, this->geometry.height, this->borderColor); } else { - this->FillRegion(1, 1, width - 1, height - 2, this->selectedColor); - this->FillRegion(0, 2, 1, height - 4, this->borderColor); + this->FillRegion(1, 1, this->geometry.width - 1, this->geometry.height - 2, this->selectedColor); + this->FillRegion(0, 2, 1, this->geometry.height - 4, this->borderColor); this->FillRegion(1, 1, 1, 1, this->borderColor); - this->FillRegion(1, height - 2, 1, 1, this->borderColor); - this->FillRegion(2, 0, width - 2, 1, this->borderColor); - this->FillRegion(2, height - 1, width - 2, 1, this->borderColor); + this->FillRegion(1, this->geometry.height - 2, 1, 1, this->borderColor); + this->FillRegion(2, 0, this->geometry.width - 2, 1, this->borderColor); + this->FillRegion(2, this->geometry.height - 1, this->geometry.width - 2, 1, this->borderColor); } } else if (this->state == 1) { - this->FillRegion(1, 1, width - 2, height - 1, this->selectedColor); - this->FillRegion(2, 0, width - 4, 1, this->borderColor); + this->FillRegion(1, 1, this->geometry.width - 2, this->geometry.height - 1, this->selectedColor); + this->FillRegion(2, 0, this->geometry.width - 4, 1, this->borderColor); this->FillRegion(1, 1, 1, 1, this->borderColor); - this->FillRegion(width - 2, 1, 1, 1, this->borderColor); - this->FillRegion(0, 2, 1, height - 2, this->borderColor); - this->FillRegion(width - 1, 2, 1, height - 2, this->borderColor); + this->FillRegion(this->geometry.width - 2, 1, 1, 1, this->borderColor); + this->FillRegion(0, 2, 1, this->geometry.height - 2, this->borderColor); + this->FillRegion(this->geometry.width - 1, 2, 1, this->geometry.height - 2, this->borderColor); } else { - this->FillRegion(1, 2, width - 2, height - 3, this->normalColor); - this->FillRegion(2, 1, width - 4, 1, this->borderColor); + this->FillRegion(1, 2, this->geometry.width - 2, this->geometry.height - 3, this->normalColor); + this->FillRegion(2, 1, this->geometry.width - 4, 1, this->borderColor); this->FillRegion(1, 2, 1, 1, this->borderColor); - this->FillRegion(width - 2, 2, 1, 1, this->borderColor); - this->FillRegion(0, 3, 1, height - 3, this->borderColor); - this->FillRegion(width - 1, 3, 1, height - 3, this->borderColor); - this->FillRegion(0, height - 1, width, 1, this->borderColor); + this->FillRegion(this->geometry.width - 2, 2, 1, 1, this->borderColor); + this->FillRegion(0, 3, 1, this->geometry.height - 3, this->borderColor); + this->FillRegion(this->geometry.width - 1, 3, 1, this->geometry.height - 3, this->borderColor); + this->FillRegion(0, this->geometry.height - 1, this->geometry.width, 1, this->borderColor); } this->CUITextButton::Slot55(); } @@ -3318,7 +3322,7 @@ void CUITextViewer::Slot15(int width, int height) { window->Show(window->geometry.y + window->geometry.height >= 0 && window->geometry.y < this->geometry.height); } }; - this->scrollBar->onChange = onChange; + AssignHandler(this->scrollBar->onChange, onChange); this->AddChild(this->scrollBar); } @@ -3560,7 +3564,7 @@ void CUIHScrollBar::Slot15(int, int) { this->thumb = new CUIHThumb(); this->thumb->Show(0); const std::function onDrag = [this](int value) { this->Slot55(value); }; - this->thumb->onDrag = onDrag; + AssignHandler(this->thumb->onDrag, onDrag); this->AddChild(this->thumb); } } @@ -3584,7 +3588,7 @@ void CUIVScrollBar::Slot15(int, int) { this->thumb = new CUIVThumb(); this->thumb->Show(0); const std::function onDrag = [this](int value) { this->Slot55(value); }; - this->thumb->onDrag = onDrag; + AssignHandler(this->thumb->onDrag, onDrag); this->AddChild(this->thumb); } }