Decompile fn_03697 (CLoadPartyInfoAsyncWork::Execute)
Batch #10536 by cremane: 0 byte-identical, 1 confirmed by peer review. - fn_03697 CLoadPartyInfoAsyncWork::Execute: logic confirmed by peer review Peer-reviewed-by: ragnarok-clanker, dori, StrawberrysherbetIX Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
parent
a927755fae
commit
f15059a9ba
1 changed files with 48 additions and 6 deletions
|
|
@ -2,6 +2,7 @@
|
|||
#include "Contents/Party/LoadPartyInfoAsyncWork.h"
|
||||
#include "Network/Http/CURLPostHander.h"
|
||||
#include "Network/TextEncoding.h"
|
||||
#include "Utility/Cipher/XorBytes.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <windows.h>
|
||||
|
|
@ -15,6 +16,35 @@ namespace {
|
|||
std::string message = text;
|
||||
return AsyncDiagnostic(&success, &message, sourceFile, &line);
|
||||
}
|
||||
|
||||
template <std::size_t Length, std::uint64_t Key>
|
||||
class EncryptedName {
|
||||
public:
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
const char* Text() {
|
||||
if (this->m_encrypted) {
|
||||
utility::XorBytes(this->m_text, Length, Key);
|
||||
this->m_encrypted = false;
|
||||
}
|
||||
|
||||
return reinterpret_cast<const char*>(this->m_text);
|
||||
}
|
||||
|
||||
private:
|
||||
/* 0000 */ std::uint8_t m_text[Length];
|
||||
bool m_encrypted;
|
||||
};
|
||||
}
|
||||
|
||||
// OFFSET: 0x005D0470
|
||||
|
|
@ -59,15 +89,27 @@ bool CLoadPartyInfoAsyncWork::Execute() {
|
|||
const std::string world = ToUtf8(this->m_world);
|
||||
_snprintf_s(query, sizeof(query), _TRUNCATE, "%lu", static_cast<unsigned long>(this->m_queryAccountId));
|
||||
CCURLPostHander handler(this->m_url);
|
||||
handler.AddField("AID", account, 4);
|
||||
handler.AddField("GID", character, 4);
|
||||
handler.AddField("AuthToken", this->m_token, 4);
|
||||
handler.AddField("WorldName", world, 4);
|
||||
handler.AddField("QueryAID", query, 4);
|
||||
const std::uint8_t aidSource[] = {0x14, 0xB4, 0xF1, 0xDB};
|
||||
thread_local EncryptedName<sizeof(aidSource), 0x3375B1C7DBB5FD55ULL> aidName(aidSource);
|
||||
handler.AddField(aidName.Text(), account, 4);
|
||||
const std::uint8_t gidSource[] = {0x58, 0x78, 0x89, 0xE7};
|
||||
thread_local EncryptedName<sizeof(gidSource), 0x1D6D75EDE7CD311FULL> gidName(gidSource);
|
||||
handler.AddField(gidName.Text(), character, 4);
|
||||
const std::uint8_t tokenSource[] = {0xE0, 0x48, 0xEB, 0xBF, 0x37, 0xE0, 0x4C, 0x3C, 0xCF, 0x3D};
|
||||
thread_local EncryptedName<sizeof(tokenSource), 0x59278F63D79F3DA1ULL> tokenName(tokenSource);
|
||||
handler.AddField(tokenName.Text(), this->m_token, 4);
|
||||
const std::uint8_t worldSource[] = {0xE0, 0x68, 0x25, 0xA1, 0x4F, 0xA9, 0x4A, 0xEC, 0xD2, 0x07};
|
||||
thread_local EncryptedName<sizeof(worldSource), 0x812BE72BCD5707B7ULL> worldName(worldSource);
|
||||
handler.AddField(worldName.Text(), world, 4);
|
||||
const std::uint8_t querySource[] = {0x58, 0xDC, 0x22, 0x2D, 0xA0, 0x1C, 0x3C, 0x97, 0x09};
|
||||
thread_local EncryptedName<sizeof(querySource), 0xD3755DD95F47A909ULL> queryName(querySource);
|
||||
handler.AddField(queryName.Text(), query, 4);
|
||||
|
||||
if (handler.Perform() == 0) {
|
||||
this->m_response = FromUtf8(handler.Response());
|
||||
AsyncDiagnostic diagnostic = Diagnostic(true, "success", 97);
|
||||
const std::uint8_t source[] = {0x1E, 0x96, 0x26, 0xC0, 0x88, 0xB2, 0xA4, 0x31};
|
||||
thread_local EncryptedName<sizeof(source), 0x31D7C1EDA345E36DULL> text(source);
|
||||
AsyncDiagnostic diagnostic = Diagnostic(true, text.Text(), 97);
|
||||
this->m_diagnostic.MoveFrom(diagnostic);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue