From bdd3e3238229ded480a7399f893b23fcebc039b6 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Wed, 11 Nov 2026 11:25:22 +0000 Subject: [PATCH] Decompile 3 functions in Source/Client/Mode/LoginMode.cpp, Source/Client/Mode/GameModeHandlers.cpp Batch #16872 by eAthena: 0 byte-identical, 3 confirmed by peer review. - fn_22272 CLoginMode::GetMaxCharacterSlot: logic confirmed by peer review - fn_21798 CGameMode::PlayBgm: logic confirmed by peer review - fn_22037 CGameMode::ReceiveGradeEnchantResult: logic confirmed by peer review Peer-reviewed-by: ragnarok-clanker, Yommy, br4yan Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Client/Mode/GameModeHandlers.cpp | 29 +++++++++++++++---------- Source/Client/Mode/LoginMode.cpp | 3 ++- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/Source/Client/Mode/GameModeHandlers.cpp b/Source/Client/Mode/GameModeHandlers.cpp index a47c9ddcb..c130f4f78 100644 --- a/Source/Client/Mode/GameModeHandlers.cpp +++ b/Source/Client/Mode/GameModeHandlers.cpp @@ -851,19 +851,25 @@ void CGameMode::PlayBgm(unsigned char type, std::string name) { g_soundMgr->StopStreams(); switch (type) { - case 0: - g_soundMgr->PlayStream(FormatOwnedString("bgm\\%s.mp3", name.c_str()).c_str(), 0, false); + case 0: { + CSoundMgr* soundMgr = g_soundMgr; + soundMgr->PlayStream(FormatOwnedString("bgm\\%s.mp3", name.c_str()).c_str(), 0, false); g_soundMgr->secondaryEnabled = 0; break; - case 1: - g_soundMgr->PlayStream(FormatOwnedString("bgm\\%s.mp3", name.c_str()).c_str(), 1, false); + } + case 1: { + CSoundMgr* soundMgr = g_soundMgr; + soundMgr->PlayStream(FormatOwnedString("bgm\\%s.mp3", name.c_str()).c_str(), 1, false); g_soundMgr->secondaryEnabled = 1; break; - case 2: - g_soundMgr->SetDefaultName(g_session.GetBgmFileName(std::string(this->mapName).c_str())); + } + case 2: { + CSoundMgr* soundMgr = g_soundMgr; + soundMgr->SetDefaultName(g_session.GetBgmFileName(std::string(this->mapName).c_str())); g_soundMgr->secondaryEnabled = 0; break; } + } } // OFFSET: 0x00D3D0F0 @@ -2151,12 +2157,13 @@ void CGameMode::ReceiveServiceRequest(unsigned char type, int value) { // FUNCTION: fn_22037 void CGameMode::ReceiveGradeEnchantResult(const unsigned char* packet) { ITEM_INFO item = LookupClientItemByIdentity(g_session.m_inventoryItems, *reinterpret_cast(packet + 2)); - if (item.identity[1]) { + if (item.identity[1] > 0) { const int result = *reinterpret_cast(packet + 6); - if (result == ENCHANTGRADE_UPGRADE_SUCCESS || result == ENCHANTGRADE_UPGRADE_DOWNGRADE) { - if (result == ENCHANTGRADE_UPGRADE_SUCCESS) { - item.refiningLevel = 0; - } + if (result == ENCHANTGRADE_UPGRADE_SUCCESS) { + item.refiningLevel = 0; + item.grade = *reinterpret_cast(packet + 4); + g_session.UpdateInventoryItem(item, 1); + } else if (result == ENCHANTGRADE_UPGRADE_DOWNGRADE) { item.grade = *reinterpret_cast(packet + 4); g_session.UpdateInventoryItem(item, 1); } diff --git a/Source/Client/Mode/LoginMode.cpp b/Source/Client/Mode/LoginMode.cpp index 8a0a0cc55..ab55a737d 100644 --- a/Source/Client/Mode/LoginMode.cpp +++ b/Source/Client/Mode/LoginMode.cpp @@ -626,7 +626,8 @@ int CLoginMode::GetMaxCharacterSlot() { break; } - maxSlot = std::max(static_cast(this->characters[i].slot), maxSlot); + const int slot = this->characters[i].slot; + maxSlot = maxSlot < slot ? slot : maxSlot; } return maxSlot;