From 5f2aa63bb7055dcaf7f86bfc82702e5c57cb2edd Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sat, 31 Oct 2026 16:17:04 +0000 Subject: [PATCH] Decompile 2 functions in Source/UI/Window/UIHotKeyWnd.cpp, Source/UI/Window/UIHotKeyWnd.h, ... Batch #8292 by pedrao: 0 byte-identical, 2 confirmed by peer review. - fn_12609 UIHotKeyWnd::RowFromPoint: logic confirmed by peer review - fn_12693 UIHotKeyWnd::Slot25: logic confirmed by peer review Peer-reviewed-by: eAthena, System4z Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/UI/Text/UIBalloonText.h | 1 + Source/UI/Window/UIHotKeyWnd.cpp | 121 +++++++++++++++++++++++++++++++ Source/UI/Window/UIHotKeyWnd.h | 2 + 3 files changed, 124 insertions(+) diff --git a/Source/UI/Text/UIBalloonText.h b/Source/UI/Text/UIBalloonText.h index 19a05f4e..946dff00 100644 --- a/Source/UI/Text/UIBalloonText.h +++ b/Source/UI/Text/UIBalloonText.h @@ -19,6 +19,7 @@ struct BalloonTextContext { class UIBalloonText : public UIWindow { friend class UIBalloonOpenBtn; + friend class UIHotKeyWnd; public: UIBalloonText(UIWindowContext& windows, BalloonTextContext& text); diff --git a/Source/UI/Window/UIHotKeyWnd.cpp b/Source/UI/Window/UIHotKeyWnd.cpp index 92629a8c..74c1130e 100644 --- a/Source/UI/Window/UIHotKeyWnd.cpp +++ b/Source/UI/Window/UIHotKeyWnd.cpp @@ -1,9 +1,12 @@ #include "UI/Window/UIHotKeyWnd.h" +#include "Client/Session.h" #include "Contents/MessageTable.h" #include "Script/LuaScript.h" #include "UI/Buttons/UIButton.h" +#include "UI/Text/UIBalloonText.h" #include "UI/Window/UIWindowMgr.h" +#include "UI/Window/WindowOrdering.h" #include "Utility/Text/FormatString.h" #include @@ -57,3 +60,121 @@ void UIHotKeyWnd::SaveHotkeys() { g_windowMgr.SendNotice(1, reinterpret_cast(message), 0xFFFF, 1, 0, 0); } } + + +// OFFSET: 0x0091BD80 +// FUNCTION: fn_12609 +int UIHotKeyWnd::RowFromPoint(int x, int y) { + if (x < this->unknown_00C8 || x > this->geometry.width - this->unknown_00C8) { + return -1; + } + + if (y < this->unknown_00C4 + this->unknown_00BC + this->unknown_00CC) { + return -1; + } + + if (y > (this->geometry.height - this->unknown_00C0) - this->unknown_00CC) { + return -1; + } + + int row = (((y - this->unknown_00BC) - this->unknown_00C4) - this->unknown_00CC) / this->unknown_00D0; + if (x > this->geometry.width / 2) { + row += this->m_rowsPerPage; + } + + int count = 0; + if (g_session.m_hotkeyScript->Call("GetOriginalHotKeyListSize", "d>d", this->m_tab + 1, &count) && this->m_tab == 1) { + int hidden = 0; + for (int index = 30; index < count; ++index) { + switch (index) { + case 30: + case 33: + case 34: + case 36: + case 43: + case 45: + case 53: + case 58: + case 62: + case 64: + case 65: + case 66: + case 67: + ++hidden; + break; + default: + break; + } + } + count -= hidden; + } + + if (row < count) { + return row; + } + return -1; +} + +// OFFSET: 0x00930B80 +// FUNCTION: fn_12693 +void UIHotKeyWnd::Slot25(int x, int y) { + if (y < this->unknown_00BC) { + UIFrameWnd::Slot25(x, y); + } + + const int previous = this->m_selectedRow; + this->m_selectedRow = this->RowFromPoint(x, y); + + int count = 0; + if (g_session.m_hotkeyScript->Call("GetOriginalHotKeyListSize", "d>d", this->m_tab + 1, &count) && this->m_tab == 1) { + int hidden = 0; + for (int index = 30; index < count; ++index) { + switch (index) { + case 30: + case 33: + case 34: + case 36: + case 43: + case 45: + case 53: + case 58: + case 62: + case 64: + case 65: + case 66: + case 67: + ++hidden; + break; + default: + break; + } + } + count -= hidden; + } + + if (this->m_selectedRow + (this->m_page * 9 - 9) * 4 < count) { + if (this->m_selectedRow < 0) { + this->m_balloon->Show(0); + } else { + int screenX = 0; + int screenY = 0; + this->ToScreen(screenX, screenY); + const char* text = LookupMessage(0x5CE); + this->m_balloon->SetText(text, 0x3C); + this->m_balloon->m_textColor = 0xFFFFFF; + this->m_balloon->m_outlineColor = 0; + this->m_balloon->Move( + (this->geometry.width - this->m_balloon->geometry.width) / 2 + screenX, + (this->m_selectedRow % this->m_rowsPerPage - 1) * this->unknown_00D0 + this->unknown_00CC + this->unknown_00C4 + screenY + this->unknown_00BC + ); + this->m_balloon->Show(1); + reinterpret_cast(g_windowMgr).Promote(this->m_balloon); + } + + if (previous == this->m_selectedRow) { + return; + } + } + + this->Invalidate(); +} diff --git a/Source/UI/Window/UIHotKeyWnd.h b/Source/UI/Window/UIHotKeyWnd.h index 4f0a856f..fe80358d 100644 --- a/Source/UI/Window/UIHotKeyWnd.h +++ b/Source/UI/Window/UIHotKeyWnd.h @@ -12,7 +12,9 @@ class UIButton; class UIHotKeyWnd : public UIFrameWnd { public: UIHotKeyWnd(UIWindowContext& windows, UIFrameContext& frames); + void Slot25(int x, int y) override; void Slot32(int x, int y) override; + int RowFromPoint(int x, int y); void UpdatePageButtons(); void SaveHotkeys(); void SetHotkey(int tab, int index, HotkeyInfo info);