rodecomp/Source/Network/ClientKeepalive.cpp
ragnarok-clanker d76e1f18f2 Decompile fn_22268 (CLoginMode::SendKeepalive)
Batch #16032 by Yommy: 1 byte-identical, 0 confirmed by peer review.

- fn_22268 CLoginMode::SendKeepalive: byte-identical

Merged automatically: every function is byte-identical to the original.
2026-11-10 13:07:11 +00:00

34 lines
944 B
C++

#include "Client/Mode/CLoginMode.h"
#include "Client/Session.h"
#include "Network/Connection/Connection.h"
#include "Network/Packets/PacketLengths.h"
#include "Network/Packets/PacketId.h"
#include <timeapi.h>
namespace {
#pragma pack(push, 1)
struct KeepalivePacket {
/* 0000 */ std::int16_t id;
/* 0002 */ std::uint32_t accountId;
};
#pragma pack(pop)
static_assert(sizeof(KeepalivePacket) == 6);
}
// OFFSET: 0x00D8D960
// FUNCTION: fn_22268
void CLoginMode::SendKeepalive() {
if (this->cursorType != 7 && this->cursorType != 8 && this->cursorType != 11 && this->cursorType != 19) {
return;
}
if (timeGetTime() > this->nextKeepaliveTime) {
this->nextKeepaliveTime = timeGetTime() + 12000;
KeepalivePacket packet;
packet.id = ID_PING;
packet.accountId = g_session.m_aid;
GetRagConnection().Send(reinterpret_cast<const PacketLengths&>(GetRagConnection()).FixedLength(packet.id), &packet);
}
}