rodecomp/Source/Contents/Emblems/EmblemDataUploadAsyncWork.cpp
ragnarok-clanker e168b4e4a6 Restore translation-unit ownership and publish verified source corrections
Owner-authorized source migration: 31 helper-only translation units were merged into their callers or existing inline headers; both build manifests updated. Includes the preserved source payload, Lua configuration matching wowdecomp, and exact malloca expansion without diagnostic pragmas.

449 native units compiled locally and 449 staged units compiled by the pinned server toolchain. No previously byte-matched function regressed. Compiler mapping diagnostics remain recorded as needs_cleanup, not accepted or peer-confirmed. Existing independent review records are preserved. README.md is intentionally unchanged.
2026-10-25 15:42:21 +00:00

94 lines
3.1 KiB
C++

#include "Contents/Emblems/EmblemDataMgr.h"
#include "Contents/Emblems/EmblemDataUploadAsyncWork.h"
#include "Network/Http/CURLPostHander.h"
#include "Network/TextEncoding.h"
#include <cctype>
#include <cstdio>
#include <windows.h>
#include <timeapi.h>
namespace {
constexpr char sourceFile[] = "C:\\repositories\\RagnarokClient\\RagnarokClient\\Contents\\Emblem\\CEmblemDataUploadAsyncWork.cpp";
// INLINED
AsyncDiagnostic Diagnostic(bool success, const char* text, std::uint32_t line) {
std::string message = text;
return AsyncDiagnostic(&success, &message, sourceFile, &line);
}
}
// OFFSET: 0x005EBF50
// FUNCTION: fn_03978
CEmblemDataUploadAsyncWork::CEmblemDataUploadAsyncWork()
: NAsyncWork("Emblem_Upload"), m_accountId(0), m_guildId(0), m_diagnostic(Diagnostic(false, "unknwon", 27)), m_owner(nullptr), m_context(nullptr) {
}
// INLINED
CEmblemDataUploadAsyncWork::~CEmblemDataUploadAsyncWork() = default;
// OFFSET: 0x005EC6F0
// FUNCTION: fn_03981
void CEmblemDataUploadAsyncWork::Reset() {
}
// OFFSET: 0x005EC450
// FUNCTION: fn_03980
void CEmblemDataUploadAsyncWork::Bind(
std::string url, std::uint32_t accountId, std::string token, std::string accountName, std::uint32_t guildId, std::string path, CEmblemDataMgr& owner,
EmblemUploadContext& context
) {
this->m_group = timeGetTime();
this->m_key = 0;
this->m_url = url;
this->m_accountId = accountId;
this->m_token = token;
this->m_accountName = accountName;
this->m_guildId = guildId;
this->m_path = path;
AsyncDiagnostic diagnostic = Diagnostic(false, "unknwon", 54);
this->m_diagnostic.MoveFrom(diagnostic);
this->m_owner = &owner;
this->m_context = &context;
}
// OFFSET: 0x005EC7C0
// FUNCTION: fn_03983
bool CEmblemDataUploadAsyncWork::Execute() {
char account[64] = {}, guild[64] = {};
_snprintf_s(account, sizeof(account), _TRUNCATE, "%d", static_cast<std::int32_t>(this->m_accountId));
_snprintf_s(guild, sizeof(guild), _TRUNCATE, "%d", static_cast<std::int32_t>(this->m_guildId));
std::string name = ToUtf8(this->m_accountName);
std::string path = ToUtf8(this->m_path);
std::string extension = this->m_path.substr(this->m_path.size() - 3, this->m_path.size());
for (char& value : extension) {
value = static_cast<char>(std::toupper(static_cast<unsigned char>(value)));
}
extension = ToUtf8(extension);
CCURLPostHander handler(this->m_url);
handler.AddField("AID", account, 4);
handler.AddField("AuthToken", this->m_token, 4);
handler.AddField("WorldName", name, 4);
handler.AddField("GDID", guild, 4);
handler.AddField("ImgType", extension, 4);
handler.AddField("Img", path, 10);
if (handler.Perform() == 0) {
this->m_response = FromUtf8(handler.Response());
AsyncDiagnostic diagnostic = Diagnostic(true, "good", 100);
this->m_diagnostic.MoveFrom(diagnostic);
} else {
AsyncDiagnostic diagnostic = Diagnostic(false, "fail", 109);
this->m_diagnostic.MoveFrom(diagnostic);
}
return false;
}
// OFFSET: 0x005EC700
// FUNCTION: fn_03982
void CEmblemDataUploadAsyncWork::Complete() {
this->m_owner->CompleteUpload(this->m_diagnostic, this->m_response, this->m_guildId, *this->m_context);
}