rodecomp/Source/Contents/Schedule/CaptchaUploadSchedule.cpp
ragnarok-clanker 4813b73e91 Decompile 6 functions in Source/Contents/Schedule/CaptchaUploadSchedule.cpp, Source/Contents/Schedule/CaptchaUploadSchedule.h, ...
Batch #4629 by gordaoprogramas: 0 byte-identical, 6 confirmed by peer review.

- fn_04710 CCaptchaUploadSchedule::CCaptchaUploadSchedule: logic confirmed by peer review
- fn_04711 CSchedule::~CSchedule: logic confirmed by peer review
- fn_04714 CCaptchaUploadSchedule::Process: logic confirmed by peer review
- fn_04715 CEmotionPurchaseExpireSchedule::CEmotionPurchaseExpireSchedule: logic confirmed by peer review
- fn_04718 CEmotionPurchaseUseableTimeUISchedule::CEmotionPurchaseUseableTimeUISchedule: logic confirmed by peer review
- fn_04721 CEmotionSaleExpireSchedule::CEmotionSaleExpireSchedule: logic confirmed by peer review

Peer-reviewed-by: youko, Millenium, Qwenkler3.8, eAthena
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
Adds to the build: Source/Contents/Schedule/CaptchaUploadSchedule.cpp, Source/Contents/Schedule/EmotionSchedule.cpp
2026-10-30 04:15:57 +00:00

68 lines
1.9 KiB
C++

#include "Contents/Schedule/CaptchaUploadSchedule.h"
#include "Contents/ShowRankingScheduler.h"
#include "Network/Connection/Connection.h"
#include <cstdint>
#include <cstdlib>
#include <cstring>
struct CaptchaUploadHeader {
/* 0000 */ std::int16_t packetType;
/* 0002 */ std::int16_t length;
/* 0004 */ std::uint32_t sessionId;
};
// OFFSET: 0x006367B0
// FUNCTION: fn_04710
CCaptchaUploadSchedule::CCaptchaUploadSchedule(const std::uint64_t& timestamp, const std::uint32_t* sessionId, int size, const void* data)
: CSchedule(timestamp, 1000, 1, ++g_schedulerSerial, 0) {
this->size = size;
this->buffer = std::malloc(size);
memcpy_s(this->buffer, size, data, size);
memcpy_s(&this->sessionId, sizeof(this->sessionId), sessionId, sizeof(this->sessionId));
this->sent = 0;
}
CCaptchaUploadSchedule::~CCaptchaUploadSchedule() {
if (this->buffer) {
std::free(this->buffer);
this->buffer = nullptr;
}
}
// OFFSET: 0x00636920
// FUNCTION: fn_04711
CSchedule::~CSchedule() {
}
// OFFSET: 0x006369E0
// FUNCTION: fn_04714
void CCaptchaUploadSchedule::Process(const std::uint64_t& now) {
if (this->size != this->sent) {
int chunk = this->size - this->sent;
if (chunk > 0x400) {
chunk = 0x400;
}
CaptchaUploadHeader* header = new CaptchaUploadHeader;
header->packetType = 0xA54;
header->length = static_cast<std::int16_t>(chunk + 8);
memcpy_s(&header->sessionId, sizeof(header->sessionId), &this->sessionId, sizeof(this->sessionId));
char* packet = static_cast<char*>(std::malloc(header->length));
memcpy_s(packet, header->length, header, sizeof(*header));
memcpy_s(packet + sizeof(*header), header->length, static_cast<char*>(this->buffer) + this->sent, chunk);
GetRagConnection().Send(header->length, packet);
std::free(packet);
delete header;
this->sent += chunk;
if (this->size != this->sent) {
return;
}
}
this->active = false;
}