Decompile fn_24201 (CSession::BuildShopReplayRecords)

Batch #18480 by eAthena: 0 byte-identical, 1 confirmed by peer review.

- fn_24201 CSession::BuildShopReplayRecords: logic confirmed by peer review

Peer-reviewed-by: ragnarok-clanker, cremane, bibinir
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-12 14:51:43 +00:00
commit 0585e8cc85
2 changed files with 19 additions and 3 deletions

View file

@ -174,7 +174,15 @@ Replay::Replay() : cipherIndex(0), cipherBase(0), cipherKey(0), recordingState(0
this->speed = 1.0f;
std::memset(&this->header, 0, sizeof(this->header));
std::memset(&this->header.options, 1, sizeof(this->header.options));
this->ResetFile();
const ReplayOptions savedOptions = this->header.options;
std::memset(&this->header, 0, sizeof(this->header));
this->header.options = savedOptions;
this->header.signature = 0x52414705;
this->header.closingSignature = 0x52414705;
this->records = 0;
this->fileMode = -1;
this->file = nullptr;
this->fileOffset = 0;
this->previousTick = timeGetTime();
this->playbackState = 0;
this->recordingState = 0;
@ -1285,7 +1293,8 @@ std::vector<unsigned char> CSession::BuildShopReplayRecords() {
value.padding_0000 = 0;
value.shopId = it->second;
std::memset(value.name, 0, sizeof(value.name));
std::memcpy(value.name, it->first.c_str(), (std::min)(it->first.size(), sizeof(value.name)));
const std::size_t length = it->first.size();
std::memcpy(value.name, it->first.c_str(), length > sizeof(value.name) ? sizeof(value.name) : length);
AppendRecord(records, MakeReplayRecord(7502, &value, sizeof(value)));
}
for (auto shop = this->m_shops.begin(); shop != this->m_shops.end(); ++shop) {

View file

@ -20,8 +20,15 @@ struct ReplayCachedPacket {
/* 0000 */ bool enabled;
/* 0004 */ std::vector<unsigned char> bytes;
ReplayCachedPacket() = default;
// INLINED
ReplayCachedPacket() {
this->enabled = false;
}
ReplayCachedPacket(const ReplayCachedPacket& other);
// INLINED
~ReplayCachedPacket() {
this->bytes.clear();
}
};
#pragma pack(push, 1)