Decompile 2 functions in Source/Contents/Store/MCStoreInfoBackupAsyncWork.cpp

Batch #16438 by eAthena: 0 byte-identical, 2 confirmed by peer review.

- fn_04246 CMCStoreInfoBackupLoadAsyncWork::Execute: logic confirmed by peer review
- fn_04252 CMCStoreInfoBackupSaveAsyncWork::Execute: logic confirmed by peer review

Peer-reviewed-by: Yommy, kyoshi
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
ragnarok-clanker 2026-11-10 19:47:24 +00:00
commit f148d66fae

View file

@ -6,6 +6,7 @@
#include "Utility/Cipher/XorBytes.h"
#include "Utility/Text/FormatString.h"
#include <array>
#include <cstdio>
#include <windows.h>
#include <timeapi.h>
@ -31,6 +32,13 @@ namespace {
}
}
// INLINED
explicit EncryptedName(const std::array<std::uint8_t, Length>& source) : 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;
@ -57,6 +65,13 @@ namespace {
thread_local EncryptedName<Length, Key> name(source);
return name.Text();
}
// INLINED
template <std::uint64_t Key, std::size_t Length>
const char* DecryptName(const std::array<std::uint8_t, Length>& source) {
thread_local EncryptedName<Length, Key> name(source);
return name.Text();
}
}
// OFFSET: 0x00607B10
@ -105,20 +120,20 @@ bool CMCStoreInfoBackupLoadAsyncWork::Execute() {
StringFormat(type, sizeof(type), _TRUNCATE, "%d", this->m_type);
CCURLPostHander handler(this->m_url);
const std::uint8_t aid[] = {0xB4, 0x6C, 0x17, 0xE9};
const std::array<std::uint8_t, 4> aid = {0xB4, 0x6C, 0x17, 0xE9};
handler.AddField(DecryptName<0x2B8725D7E95325F5ULL>(aid), account, 4);
const std::uint8_t gid[] = {0x4A, 0x12, 0x2D, 0x83};
const std::array<std::uint8_t, 4> gid = {0x4A, 0x12, 0x2D, 0x83};
handler.AddField(DecryptName<0x899D11BB83695B0DULL>(gid), character, 4);
const std::uint8_t authToken[] = {0x2A, 0x7E, 0xD1, 0xAD, 0xD3, 0xB2, 0xC6, 0xD8, 0x05, 0x0B};
const std::array<std::uint8_t, 10> authToken = {0x2A, 0x7E, 0xD1, 0xAD, 0xD3, 0xB2, 0xC6, 0xD8, 0x05, 0x0B};
handler.AddField(DecryptName<0xBDADDD87C5A50B6BULL>(authToken), this->m_token, 4);
const std::uint8_t typeName[] = {0xE9, 0xE4, 0x4B, 0x82, 0x0D};
const std::array<std::uint8_t, 5> typeName = {0xE9, 0xE4, 0x4B, 0x82, 0x0D};
handler.AddField(DecryptName<0x7989830DE73B9DBDULL>(typeName), type, 4);
const std::uint8_t worldName[] = {0xDE, 0x52, 0x1F, 0x89, 0xC3, 0x4F, 0x46, 0x42, 0xEC, 0x3D};
const std::array<std::uint8_t, 10> worldName = {0xDE, 0x52, 0x1F, 0x89, 0xC3, 0x4F, 0x46, 0x42, 0xEC, 0x3D};
handler.AddField(DecryptName<0x2F2701A7E56D3D89ULL>(worldName), name, 4);
if (handler.Perform() == 0) {
this->m_response = handler.Response();
const std::uint8_t good[] = {0x42, 0xFE, 0x68, 0xC7, 0xE1};
const std::array<std::uint8_t, 5> good = {0x42, 0xFE, 0x68, 0xC7, 0xE1};
AsyncDiagnostic diagnostic = Diagnostic(true, DecryptName<0x6B3301E1A3079125ULL>(good), loadSource, 115);
this->m_diagnostic.MoveFrom(diagnostic);
}
@ -178,26 +193,26 @@ bool CMCStoreInfoBackupSaveAsyncWork::Execute() {
std::string name = ToUtf8(this->m_accountName);
CCURLPostHander handler(this->m_url);
const std::uint8_t aid[] = {0x48, 0xE0, 0x03, 0x5F};
const std::array<std::uint8_t, 4> aid = {0x48, 0xE0, 0x03, 0x5F};
handler.AddField(DecryptName<0xD3755DD95F47A909ULL>(aid), account, 4);
const std::uint8_t gid[] = {0x2A, 0xAA, 0x01, 0xA3};
const std::array<std::uint8_t, 4> gid = {0x2A, 0xAA, 0x01, 0xA3};
handler.AddField(DecryptName<0x31D7C1EDA345E36DULL>(gid), character, 4);
const std::uint8_t authToken[] = {0x2C, 0x16, 0x41, 0x45, 0xF1, 0x6C, 0xE4, 0xBC, 0x03, 0x63};
const std::array<std::uint8_t, 10> authToken = {0x2C, 0x16, 0x41, 0x45, 0xF1, 0x6C, 0xE4, 0xBC, 0x03, 0x63};
handler.AddField(DecryptName<0xD98F03A52D35636DULL>(authToken), this->m_token, 4);
const std::uint8_t worldName[] = {0x86, 0x76, 0xEF, 0xE3, 0x0F, 0xC5, 0x6E, 0x62, 0xB4, 0x19};
const std::array<std::uint8_t, 10> worldName = {0x86, 0x76, 0xEF, 0xE3, 0x0F, 0xC5, 0x6E, 0x62, 0xB4, 0x19};
handler.AddField(DecryptName<0x0F0F8B6B8F9D19D1ULL>(worldName), name, 4);
const std::uint8_t typeName[] = {0x01, 0x84, 0xC5, 0xBE, 0xC7};
const std::array<std::uint8_t, 5> typeName = {0x01, 0x84, 0xC5, 0xBE, 0xC7};
handler.AddField(DecryptName<0x3375B1C7DBB5FD55ULL>(typeName), type, 4);
const std::uint8_t dataName[] = {0x7B, 0x50, 0xB9, 0x86, 0xED};
const std::array<std::uint8_t, 5> dataName = {0x7B, 0x50, 0xB9, 0x86, 0xED};
handler.AddField(DecryptName<0x1D6D75EDE7CD311FULL>(dataName), this->m_data, 4);
if (handler.Perform() != 0) {
const std::uint8_t fail[] = {0xC7, 0x5C, 0xF6, 0xBB, 0x63};
const std::array<std::uint8_t, 5> fail = {0xC7, 0x5C, 0xF6, 0xBB, 0x63};
AsyncDiagnostic diagnostic = Diagnostic(false, DecryptName<0x59278F63D79F3DA1ULL>(fail), saveSource, 112);
this->m_diagnostic.MoveFrom(diagnostic);
this->m_response = handler.Response();
} else {
const std::uint8_t good[] = {0xD0, 0x68, 0x38, 0xA9, 0x2B};
const std::array<std::uint8_t, 5> good = {0xD0, 0x68, 0x38, 0xA9, 0x2B};
AsyncDiagnostic diagnostic = Diagnostic(true, DecryptName<0x812BE72BCD5707B7ULL>(good), saveSource, 122);
this->m_diagnostic.MoveFrom(diagnostic);
this->m_response = handler.Response();