From de0e8b046439ea8aeff448691b898856a8045b2e Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sat, 7 Nov 2026 00:48:16 +0000 Subject: [PATCH] Decompile fn_11547 (UIComboBoxV2Wnd::SendMsg) Batch #13917 by SapitoSucio: 0 byte-identical, 1 confirmed by peer review. - fn_11547 UIComboBoxV2Wnd::SendMsg: logic confirmed by peer review Peer-reviewed-by: eAthena, Yommy Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Client/ReplayPacketRecorder.cpp | 2 +- Source/UI/Buttons/UIButton.cpp | 2 +- Source/UI/Buttons/UITextButton.cpp | 2 +- Source/UI/Lists/UIComboBoxDefWnd.cpp | 2 +- Source/UI/StylingShop/UIStylingShopWnd.cpp | 2 +- Source/UI/Window/UIWindow.cpp | 2 +- Source/UI/Window/UIWindowMgr.h | 1 + Source/UI/Window/WindowPolicy.cpp | 22 +++++++++++++++++----- 8 files changed, 24 insertions(+), 11 deletions(-) diff --git a/Source/Client/ReplayPacketRecorder.cpp b/Source/Client/ReplayPacketRecorder.cpp index e22675f9d..f872567ed 100644 --- a/Source/Client/ReplayPacketRecorder.cpp +++ b/Source/Client/ReplayPacketRecorder.cpp @@ -264,7 +264,7 @@ void UIWindow::RecordDrop(int x, int y, const ModeDragState& drag, int target) { return; } - if (WindowPolicy(g_windowMgr.policy[0].actions, g_replayAnimationScaling != 0, 5, this->geometry.id) == 0) { + if (g_windowMgr.WindowPolicy(5, this->geometry.id) == 0) { return; } diff --git a/Source/UI/Buttons/UIButton.cpp b/Source/UI/Buttons/UIButton.cpp index 66e8a36f8..b8e1b5a9c 100644 --- a/Source/UI/Buttons/UIButton.cpp +++ b/Source/UI/Buttons/UIButton.cpp @@ -172,7 +172,7 @@ void UIButton::Slot31(int x, int y) { this->geometry.unknown_0030 = 1; UIWindow* parent = this->parent; if (parent) { - if (WindowPolicy(g_windowMgr.policy[0].actions, g_replayAnimationScaling != 0, 3, parent->geometry.id) != 0) { + if (g_windowMgr.WindowPolicy(3, parent->geometry.id) != 0) { int id = this->geometry.id; if (id == 185 && g_modeMgr.gameMode && g_modeMgr.gameMode->cursorType == 2) { const char* text = LookupMessage(17); diff --git a/Source/UI/Buttons/UITextButton.cpp b/Source/UI/Buttons/UITextButton.cpp index 7c6659c9c..bdd3e0fa1 100644 --- a/Source/UI/Buttons/UITextButton.cpp +++ b/Source/UI/Buttons/UITextButton.cpp @@ -860,7 +860,7 @@ int UIComboBoxV2Wnd::SendMsg(UIWindow* sender, int message, std::intptr_t argume return UIWindow::SendMsg(sender, message, argument1, argument2, argument3, argument4); } - if (WindowPolicy(g_windowMgr.policy[0].actions, g_replayAnimationScaling != 0, 3, this->parent->geometry.id) == 0) { + if (g_windowMgr.WindowPolicy(3, this->parent->geometry.id) == 0) { return 0; } diff --git a/Source/UI/Lists/UIComboBoxDefWnd.cpp b/Source/UI/Lists/UIComboBoxDefWnd.cpp index ec089f91a..7e0dbd9a2 100644 --- a/Source/UI/Lists/UIComboBoxDefWnd.cpp +++ b/Source/UI/Lists/UIComboBoxDefWnd.cpp @@ -186,7 +186,7 @@ int UIComboBoxDefWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, st return 0; case 39: - if (WindowPolicy(g_windowMgr.policy[0].actions, g_replayAnimationScaling != 0, 3, this->parent->geometry.id) == 0 || + if (g_windowMgr.WindowPolicy(3, this->parent->geometry.id) == 0 || value < 0) { return 0; } diff --git a/Source/UI/StylingShop/UIStylingShopWnd.cpp b/Source/UI/StylingShop/UIStylingShopWnd.cpp index cc4550e9c..b0e6b1e0a 100644 --- a/Source/UI/StylingShop/UIStylingShopWnd.cpp +++ b/Source/UI/StylingShop/UIStylingShopWnd.cpp @@ -151,7 +151,7 @@ void UIStylingShopButton::Slot31(int, int) { this->geometry.unknown_0030 = 2; UIWindow* parent = this->parent; if (parent) { - if (WindowPolicy(g_windowMgr.policy[0].actions, g_replayAnimationScaling != 0, 3, parent->geometry.id) != 0) { + if (g_windowMgr.WindowPolicy(3, parent->geometry.id) != 0) { int id = this->geometry.id; if (id == 185 && g_modeMgr.gameMode && g_modeMgr.gameMode->cursorType == 2) { const char* text = LookupMessage(17); diff --git a/Source/UI/Window/UIWindow.cpp b/Source/UI/Window/UIWindow.cpp index 9fdcb2bbe..658738626 100644 --- a/Source/UI/Window/UIWindow.cpp +++ b/Source/UI/Window/UIWindow.cpp @@ -2157,7 +2157,7 @@ static_assert(sizeof(EditTextsRecord) == 0x1000); // OFFSET: 0x00A834E0 // FUNCTION: fn_17004 int UIWindow::RecordEditTexts() { - if (Replay::Instance().state != 2 || !WindowPolicy(g_windowMgr.policy[0].actions, g_replayAnimationScaling != 0, 6, this->geometry.id)) { + if (Replay::Instance().state != 2 || !g_windowMgr.WindowPolicy(6, this->geometry.id)) { return 0; } diff --git a/Source/UI/Window/UIWindowMgr.h b/Source/UI/Window/UIWindowMgr.h index 4699e3058..72b585198 100644 --- a/Source/UI/Window/UIWindowMgr.h +++ b/Source/UI/Window/UIWindowMgr.h @@ -440,6 +440,7 @@ public: UIWindowMgr(); void InitializeWindowPolicy(); + int WindowPolicy(int action, unsigned int id) const; void ResetWindows(); void Shutdown(); void ClearMapWindows(); diff --git a/Source/UI/Window/WindowPolicy.cpp b/Source/UI/Window/WindowPolicy.cpp index c73718fcd..43f90a9d0 100644 --- a/Source/UI/Window/WindowPolicy.cpp +++ b/Source/UI/Window/WindowPolicy.cpp @@ -1,19 +1,31 @@ +#include "Client/Replay.h" +#include "UI/Window/UIWindowMgr.h" #include "UI/Window/WindowPolicy.h" // OFFSET: 0x00A970E0 // FUNCTION: fn_17200 -int WindowPolicy(const int* table, bool restricted, unsigned action, unsigned id) { +int UIWindowMgr::WindowPolicy(int action, unsigned int id) const { if (action == 3) { - if (!restricted) { + if (g_replayAnimationScaling == 0) { return 1; } - } else if (action >= 8) { - return 0; + } else { + if (action >= 8) { + return 0; + } + if (action < 0) { + return 0; + } } if (id <= 10040) { - return table[8 * id + action]; + return this->policy[id].actions[action]; } return 0; } + +// INLINED +int WindowPolicy(const int* table, bool restricted, unsigned action, unsigned id) { + return g_windowMgr.WindowPolicy(static_cast(action), id); +}