From 725bdaddebcd2a58b35e29ce7b10f863d4ee4c21 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Tue, 10 Nov 2026 01:22:09 +0000 Subject: [PATCH] Decompile 2 functions in Source/UI/Lists/UIComboBoxEx.cpp Batch #15460 by youko: 0 byte-identical, 2 confirmed by peer review. - fn_11510 UIComboBoxEx::Refresh: logic confirmed by peer review - fn_11530 UIComboBoxEx::Resize: logic confirmed by peer review Peer-reviewed-by: ragnarok-clanker, Yommy, alisonrag Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/UI/Lists/UIComboBoxEx.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/Source/UI/Lists/UIComboBoxEx.cpp b/Source/UI/Lists/UIComboBoxEx.cpp index 885ccb14e..848e61d60 100644 --- a/Source/UI/Lists/UIComboBoxEx.cpp +++ b/Source/UI/Lists/UIComboBoxEx.cpp @@ -56,11 +56,13 @@ void UIComboBoxEx::OnCreate(int width, int height) { void UIComboBoxEx::Resize(int width, int height) { this->UIListBoxEx::Resize(width, height); this->topLine = 0; - this->verticalBar->position = 0; - this->verticalBar->Move((width - 13), 0); + this->verticalBar->position = this->topLine; if (this->verticalOverflow != 0) { + this->verticalBar->Move((width - 13), 0); this->verticalBar->Invalidate(); + } else { + this->verticalBar->Move((width - 13), 0); } } @@ -108,24 +110,27 @@ void UIComboBoxEx::Refresh() { const int overflow = std::max((count - visible), 0); this->verticalOverflow = overflow != 0; auto* bar = this->verticalBar; - bar->visible = visible; - bar->total = count; - bar->maximum = overflow != 0 ? (overflow + this->bottomMargin) : 0; - bar->Invalidate(); - - if (bar->position > bar->maximum) { - bar->position = bar->maximum; - } if (overflow != 0) { + bar->SetRange((this->bottomMargin + overflow), visible, count); + if (this->selected < this->topLine) { this->topLine = this->selected; } else if ((this->topLine + visible) <= this->selected) { this->topLine = ((this->selected - visible) + 1); } - this->topLine = std::clamp(this->topLine, 0, overflow); + if (this->topLine < 0) { + this->topLine = 0; + } + + if (this->topLine > overflow) { + this->topLine = overflow; + } + this->verticalBar->position = this->topLine; + } else { + bar->SetRange(0, visible, count); } this->verticalBar->Invalidate();