From b7e0d1b382a54a883560f64ec4ac1dfda9f01ac4 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sat, 31 Oct 2026 10:54:35 +0000 Subject: [PATCH] Decompile 3 functions in Source/Client/Session.cpp, Source/Client/Session.h Batch #7617 by Yommy: 0 byte-identical, 3 confirmed by peer review. - fn_23371 CSession::GetFogParameters: logic confirmed by peer review - fn_23479 CSession::GetMapViewParameters: logic confirmed by peer review - fn_23510 CSession::InitWeaponHitWaveNames: logic confirmed by peer review Peer-reviewed-by: ragnarok-clanker, eAthena, secret Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Client/Session.cpp | 62 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/Source/Client/Session.cpp b/Source/Client/Session.cpp index 3576a6d2..04510c36 100644 --- a/Source/Client/Session.cpp +++ b/Source/Client/Session.cpp @@ -2505,10 +2505,72 @@ void CSession::ClearAchievements() { } // OFFSET: 0x00DDC9D0 +// FUNCTION: fn_23371 +const std::vector* CSession::GetFogParameters(const char* rswName, int* found) { + *found = 0; + // GLOBAL: gl_24841 + static std::vector s_defaultParameters(4); + + std::string name = rswName; + const std::size_t position = name.rfind("@"); + if (position != std::string::npos && position >= 4) { + name.erase(position - 4, 3); + } + + const char* key = name.c_str(); + auto it = std::lower_bound(this->m_fogParameters.begin(), this->m_fogParameters.end(), key, + [](const std::pair>& entry, const char* value) { + return std::strcmp(entry.first.c_str(), value) < 0; + }); + if (it != this->m_fogParameters.end() && std::strcmp(it->first.c_str(), name.c_str()) == 0) { + *found = 1; + return &it->second; + } + + return &s_defaultParameters; +} // OFFSET: 0x00DE3410 +// FUNCTION: fn_23479 +const std::vector* CSession::GetMapViewParameters(const char* rswName, int* found) { + std::vector>>& parameters = + reinterpret_cast>>&>(this->unknown_523C); + *found = 0; + // GLOBAL: gl_24993 + static std::vector s_defaultParameters(9); + + std::string name = rswName; + const std::size_t position = name.rfind("@"); + if (position != std::string::npos && position >= 4) { + name.erase(position - 4, 3); + } + + const char* key = name.c_str(); + auto it = std::lower_bound(parameters.begin(), parameters.end(), key, + [](const std::pair>& entry, const char* value) { + return std::strcmp(entry.first.c_str(), value) < 0; + }); + if (it != parameters.end() && std::strcmp(it->first.c_str(), name.c_str()) == 0) { + *found = 1; + return &it->second; + } + + return &s_defaultParameters; +} // OFFSET: 0x00DF8670 +// FUNCTION: fn_23510 +void CSession::InitWeaponHitWaveNames() { + std::vector& weaponWaves = reinterpret_cast&>(this->unknown_525C[0x18]); + weaponWaves.clear(); + weaponWaves.resize(105, "_hit_mace.wav"); + for (int weapon = 0; weapon < 105; ++weapon) { + const char* name = nullptr; + if (this->m_hotkeyScript->Call("ReqWeaponHitWaveName", "d>s", weapon, &name) && std::strcmp(name, "") != 0) { + weaponWaves[weapon] = name; + } + } +} // OFFSET: 0x00DF8C40 // FUNCTION: fn_23513