From 84b010ff82d031eb0a20d1b762f11e6369c0af13 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Wed, 28 Oct 2026 17:22:25 +0000 Subject: [PATCH] Decompile fn_04058 (CUserHotkeyMgr::TabAt) Batch #1537 by ragnarok-clanker: 0 byte-identical, 1 confirmed by peer review. - fn_04058 CUserHotkeyMgr::TabAt: logic confirmed by peer review Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Contents/Hotkeys/UserHotkeyMgr.cpp | 64 +++++++++++++++++------ Source/Contents/Hotkeys/UserHotkeyMgr.h | 1 + 2 files changed, 49 insertions(+), 16 deletions(-) diff --git a/Source/Contents/Hotkeys/UserHotkeyMgr.cpp b/Source/Contents/Hotkeys/UserHotkeyMgr.cpp index 6a3ccecd..e10b6c48 100644 --- a/Source/Contents/Hotkeys/UserHotkeyMgr.cpp +++ b/Source/Contents/Hotkeys/UserHotkeyMgr.cpp @@ -4,22 +4,39 @@ #include namespace { + enum InterfaceHotkey { + HK_BATTLEFIELDWND = 30, + HK_PARTY_RECRUIT = 33, + HK_PARTY_BOOKING_LIST = 34, + HK_EXMACRO_SETUPWND = 36, + HK_BUTTONS_RELOCATE = 43, + HK_MENUICON_HIDE = 45, + HK_TWITTERWND = 53, + HK_HUNTINGQUEST_INFO_ONOFF = 58, + HK_UNKNOWN_62 = 62, + HK_UNKNOWN_64 = 64, + HK_UNKNOWN_65 = 65, + HK_UNKNOWN_66 = 66, + HK_UNKNOWN_67 = 67, + HK_FIRST_HIDDEN = HK_BATTLEFIELDWND, + }; + // INLINED bool HiddenInterfaceIndex(int 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: + case HK_BATTLEFIELDWND: + case HK_PARTY_RECRUIT: + case HK_PARTY_BOOKING_LIST: + case HK_EXMACRO_SETUPWND: + case HK_BUTTONS_RELOCATE: + case HK_MENUICON_HIDE: + case HK_TWITTERWND: + case HK_HUNTINGQUEST_INFO_ONOFF: + case HK_UNKNOWN_62: + case HK_UNKNOWN_64: + case HK_UNKNOWN_65: + case HK_UNKNOWN_66: + case HK_UNKNOWN_67: return true; default: return false; @@ -34,7 +51,7 @@ namespace { if (tab == 1) { int hidden = 0; - for (int index = 30; index < count; ++index) { + for (int index = HK_FIRST_HIDDEN; index < count; ++index) { hidden += HiddenInterfaceIndex(index); } @@ -48,8 +65,8 @@ namespace { // OFFSET: 0x00E12E50 // FUNCTION: fn_23820 int HotkeyIndex(LuaScript& script, int tab, int index) { - if (tab == 1 && index >= 30) { - for (int candidate = 30; candidate <= index; ++candidate) { + if (tab == 1 && index >= HK_FIRST_HIDDEN) { + for (int candidate = HK_FIRST_HIDDEN; candidate <= index; ++candidate) { index += HiddenInterfaceIndex(candidate); } } @@ -102,6 +119,21 @@ void CUserHotkeyMgr::Shutdown() { } } +// OFFSET: 0x005F80A0 +// FUNCTION: fn_04058 +int CUserHotkeyMgr::TabAt(int position) const { + switch (position) { + case 1: + return 3; + case 2: + return 1; + case 3: + return 2; + default: + return 0; + } +} + // OFFSET: 0x005F88D0 // FUNCTION: fn_04062 void CUserHotkeyMgr::Reset() { diff --git a/Source/Contents/Hotkeys/UserHotkeyMgr.h b/Source/Contents/Hotkeys/UserHotkeyMgr.h index 3c5d3c63..7a166c3f 100644 --- a/Source/Contents/Hotkeys/UserHotkeyMgr.h +++ b/Source/Contents/Hotkeys/UserHotkeyMgr.h @@ -14,6 +14,7 @@ public: static bool Initialize(); static void Shutdown(); void Reset(); + int TabAt(int position) const; void LoadV2(LuaScript& script, Json::Value& data); void Capture(LuaScript& script); bool HasUserAssignments(LuaScript& script) const;