From 97f0af3a93bf92a11088fb1fba5dcc5d386e7cd4 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Thu, 5 Nov 2026 13:23:28 +0000 Subject: [PATCH] Decompile fn_03976 (CEmblemDataMgr::CompleteUpload) Batch #12322 by cremane: 0 byte-identical, 1 confirmed by peer review. - fn_03976 CEmblemDataMgr::CompleteUpload: logic confirmed by peer review Peer-reviewed-by: Yommy, Tanke Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Contents/Emblems/EmblemUpload.cpp | 43 ++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/Source/Contents/Emblems/EmblemUpload.cpp b/Source/Contents/Emblems/EmblemUpload.cpp index 017e9579..19247ebe 100644 --- a/Source/Contents/Emblems/EmblemUpload.cpp +++ b/Source/Contents/Emblems/EmblemUpload.cpp @@ -4,6 +4,7 @@ #include "Network/Packets/PacketLengths.h" #include "UI/Window/UIWindowMgr.h" #include "Utility/Async/AsyncDiagnostic.h" +#include "Utility/Cipher/XorBytes.h" #include #include @@ -17,6 +18,44 @@ namespace { }; #pragma pack(pop) static_assert(sizeof(EmblemVersionPacket) == 10); + + template + class EncryptedName { + public: + // INLINED + explicit EncryptedName(const std::uint8_t (&source)[Length]) : m_encrypted(true) { + for (std::uint64_t index = 0; index < Length; ++index) { + this->m_text[index] = source[index]; + } + } + + ~EncryptedName() { + for (std::uint64_t index = 0; index < Length; ++index) { + this->m_text[index] = 0; + } + } + + // INLINED + const char* Text() { + if (this->m_encrypted) { + utility::XorBytes(this->m_text, Length, Key); + this->m_encrypted = false; + } + + return reinterpret_cast(this->m_text); + } + + private: + /* 0000 */ std::uint8_t m_text[Length]; + bool m_encrypted; + }; + + // INLINED + template + const char* DecryptName(const std::uint8_t (&source)[Length]) { + thread_local EncryptedName name(source); + return name.Text(); + } } // OFFSET: 0x005EBAD0 @@ -34,9 +73,9 @@ void CEmblemDataMgr::CompleteUpload(AsyncDiagnostic diagnostic, std::string resp return; } - switch (root["Type"].asInt()) { + switch (root[DecryptName<0xC52FB5FBB94FF917ULL>({0x43, 0x80, 0x3F, 0xDC, 0xFB})].asInt()) { case 1: { - EmblemVersionPacket packet{0x0B46, guildId, root["version"].asInt()}; + EmblemVersionPacket packet{0x0B46, guildId, root[DecryptName<0x812BE72BCD5707B7ULL>({0xC1, 0x62, 0x25, 0xBE, 0x42, 0x88, 0x45, 0x81})].asInt()}; GetRagConnection().Send(g_packetLengths.FixedLength(packet.id), &packet); break; }