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; +}