From 4c543ff86f90c8071971f449003552f228b733ad Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Wed, 4 Nov 2026 23:43:15 +0000 Subject: [PATCH] Decompile 2 functions in Source/UI/Shortcuts/ShortcutBindings.cpp Batch #11301 by cremane: 0 byte-identical, 2 confirmed by peer review. - fn_23821 CSession::RotateShortcut: logic confirmed by peer review - fn_23913 CSession::AssignShortcut: logic confirmed by peer review Peer-reviewed-by: Yommy, kyoshi, dori Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/UI/Shortcuts/ShortcutBindings.cpp | 28 ++++++++++-------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/Source/UI/Shortcuts/ShortcutBindings.cpp b/Source/UI/Shortcuts/ShortcutBindings.cpp index 02e1dc8b..289910a9 100644 --- a/Source/UI/Shortcuts/ShortcutBindings.cpp +++ b/Source/UI/Shortcuts/ShortcutBindings.cpp @@ -11,17 +11,20 @@ // OFFSET: 0x00E12FC0 // FUNCTION: fn_23821 int CSession::RotateShortcut(int index, int bank) const { - if (bank != 0 && bank != 1) { + int rotation; + if (bank == 0) { + rotation = this->unknown_06FC; + } else if (bank == 1) { + rotation = this->unknown_06A8; + } else { return index; } - const int rotation = bank == 0 ? this->unknown_06FC : this->unknown_06A8; - if (rotation == 0) { - return index; + if (rotation != 0) { + const int value = index + 9 * rotation; + return value < 36 ? value : value - 36; } - - const int value = index + 9 * rotation; - return value < 36 ? value : value - 36; + return index; } // OFFSET: 0x00E26050 @@ -30,19 +33,13 @@ void CSession::AssignShortcut(unsigned char type, std::uint32_t id, int level, i const int rowStart = this->RotateShortcut(9 * this->m_hotkeyPage, bank); const int destination = this->RotateShortcut(slot, bank); CMode* modeEvents = g_modeMgr.GetGameMode(); - std::list& cooldowns = this->m_requestTimers; + std::list& cooldowns = g_session.m_requestTimers; if (id == 0) { if (type != 0) { - bool erased = false; - for (ShortcutCooldownRecord& record : cooldowns) { const auto value = std::find_if(record.main.begin(), record.main.end(), [&](const CooldownState& state) { return state.slot == slot; }); if (value != record.main.end()) { record.main.erase(value); - erased = true; - } - - if (erased) { break; } } @@ -56,12 +53,11 @@ void CSession::AssignShortcut(unsigned char type, std::uint32_t id, int level, i return; } - for (int offset = 0; offset < 9; ++offset) { + for (int index = rowStart; index < rowStart + 9; ++index) { if (bank != 0 && bank != 1) { continue; } - const int index = rowStart + offset; const NormalItemSlot previous = (bank == 0 ? this->m_shortcutSlots : this->m_secondaryShortcutSlots)[index]; bool duplicate = previous.itemId == id && previous.unknown_0005 == level && previous.unknown_0000 == type;