From cc3031161c29459212dfae080ecf94db693f590a Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sat, 31 Oct 2026 23:41:29 +0000 Subject: [PATCH] Decompile fn_17157 (UIWindowMgr::GetHotkeyBehavior) Batch #8970 by ragnarok-clanker: 0 byte-identical, 1 confirmed by peer review. - fn_17157 UIWindowMgr::GetHotkeyBehavior: logic confirmed by peer review Peer-reviewed-by: gordaoprogramas, youko, KWDev, dori Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Script/LuaScript.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Source/Script/LuaScript.cpp b/Source/Script/LuaScript.cpp index 885bbe6d..6f8a5237 100644 --- a/Source/Script/LuaScript.cpp +++ b/Source/Script/LuaScript.cpp @@ -1251,3 +1251,27 @@ void LuaScript::Register(std::string name, int (*function)(lua_State*)) { } // OFFSET: 0x00A91200 +// FUNCTION: fn_17157 +int UIWindowMgr::GetHotkeyBehavior() { + int behavior = -1; + const int mode = static_cast(g_session.m_options.Get(10)); + g_luaScript->Call("GetBehaviorOfHotKey2", "ddd>d", mode, this->keyCode, this->modifierKey, &behavior); + if (behavior != -1) { + return behavior; + } + + if (this->modifierKey == VK_SHIFT && !g_inputSuggestionsEnabled) { + UIWindow* parent = this->hoverWindow ? this->hoverWindow->parent : nullptr; + if (!parent || parent == this->window_01C8 || parent->geometry.visible == 0) { + const int count = HotkeyCount(*g_luaScript, 0); + for (int index = 0; index < count; ++index) { + const HotkeyInfo hotkey = GetHotkeyInfo(*g_luaScript, 0, index); + if (hotkey.key1 == this->keyCode && g_session.m_shortcutSlots[index].unknown_0000 != 0) { + return index; + } + } + } + } + + return -1; +}