From 3ebefb6ea84df47119a3a5dcd3e570acc78efff7 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sun, 1 Nov 2026 04:11:10 +0000 Subject: [PATCH] Decompile fn_17223 (UIWindowMgr::ProcessKeyDown) Batch #9197 by KWDev: 0 byte-identical, 1 confirmed by peer review. - fn_17223 UIWindowMgr::ProcessKeyDown: logic confirmed by peer review Peer-reviewed-by: secret, superintelligence, vinnyamancio Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/UI/Window/UIWindowMgr.cpp | 106 +++++++++++++++++++++++++++++++ Source/UI/Window/UIWindowMgr.h | 2 + 2 files changed, 108 insertions(+) diff --git a/Source/UI/Window/UIWindowMgr.cpp b/Source/UI/Window/UIWindowMgr.cpp index ae9f4f42..378a92c9 100644 --- a/Source/UI/Window/UIWindowMgr.cpp +++ b/Source/UI/Window/UIWindowMgr.cpp @@ -28,6 +28,8 @@ #include "Contents/MessageTable.h" #include "Contents/NavigationManager.h" #include "Contents/WorldView/WorldViewData.h" +#include "Contents/Skills/AutomaticSkills.h" +#include "UI/Window/UIHotKeyWnd.h" #include "UI/Window/UIWindow.h" #include "UI/Window/UIWindowMgr.h" #include "Client/Mode/CMode.h" @@ -1170,6 +1172,110 @@ int UIWindowMgr::LoadReplayReserved(const std::vector& data) { return static_cast(offset); } +// OFFSET: 0x00AA55C0 +// FUNCTION: fn_17223 +bool UIWindowMgr::ProcessKeyDown(int key, int keyData, int pressed) { + this->unknown_0025 = 1; + if (g_modeMgr.GetGameMode() == nullptr) { + return this->ProcessHotkeyAction(key, pressed); + } + + if (this->LookupWindow(0x9C) != nullptr) { + this->unknown_0025 = 0; + } else if (!this->unknown_0024) { + UIWindow* hover = this->hoverWindow; + UIWindow* parent = hover ? hover->parent : nullptr; + if (!hover || !parent || parent == this->window_01C8 || !parent->geometry.visible) { + this->unknown_0025 = 0; + } + } + + int action = this->TranslateHotkey(key, keyData); + if (this->unknown_0404 != nullptr) { + static_cast(this->unknown_0404)->AssignSelectedHotkey(action); + return false; + } + + bool hoverOnButton = false; + if (this->unknown_0024) { + const UIWindow* window = this->window_01C8; + if (window) { + UIWindow* const* buttons = reinterpret_cast(reinterpret_cast(window) + 0xBC); + if (this->hoverWindow == buttons[0] || this->hoverWindow == buttons[1]) { + hoverOnButton = true; + } + } + } + if (!hoverOnButton) { + UIWindow* hover = this->hoverWindow; + if (hover) { + UIWindow* parent = hover->parent; + if (parent && parent != this->window_01C8 && parent->geometry.visible) { + hoverOnButton = true; + } + } + } + + if (hoverOnButton) { + if (this->modifierKey == 0) { + switch (this->keyCode) { + case 0x09: + case 0x0D: + case 0x10: + case 0x11: + case 0x12: + case 0x14: + case 0x2D: + case 0x70: + case 0x71: + case 0x72: + case 0x73: + case 0x74: + case 0x75: + case 0x76: + case 0x77: + case 0x78: + case 0x79: + case 0x7A: + case 0x7B: + break; + default: + return this->ProcessHotkeyAction(key, pressed); + } + } else if (this->modifierKey == 0x10) { + return this->ProcessHotkeyAction(key, pressed); + } else if (this->modifierKey == 0x11) { + switch (this->keyCode) { + case 0x41: + case 0x43: + case 0x56: + case 0x58: + return this->ProcessHotkeyAction(key, pressed); + } + } + } + + int& lastKey = *reinterpret_cast(g_session.unknown_61A8_0000); + if (lastKey != key) { + if (pressed == 0) { + return this->ProcessHotkeyAction(key, pressed); + } + reinterpret_cast(g_session.unknown_7FB4)->DisableAll(); + } + lastKey = key; + + if ((key == 0x0D || key == 0x20) && this->sub_A8CA20()) { + return true; + } + if (!this->sub_AA35F0(action)) { + return this->ProcessHotkeyAction(key, pressed); + } + if (this->IsHoverParentVisible() || this->IsHoverOnWindow01C8Button()) { + this->unknown_0025 = 1; + } + return true; +} + // OFFSET: 0x00AA57E0 // FUNCTION: fn_17224 void UIWindowMgr::SendEmotionHotkey(int index) { diff --git a/Source/UI/Window/UIWindowMgr.h b/Source/UI/Window/UIWindowMgr.h index 46640bec..2228b200 100644 --- a/Source/UI/Window/UIWindowMgr.h +++ b/Source/UI/Window/UIWindowMgr.h @@ -558,6 +558,8 @@ public: int GetHotkeyBehavior(); std::vector SaveReplayWindows(); bool ProcessHotkeyAction(int action, int pressed); + bool sub_AA35F0(int action); + bool ProcessKeyDown(int key, int keyData, int pressed); void SendEmotionHotkey(int index); };