rodecomp/Source/Network/Connection/Connection.h
ragnarok-clanker 38bd0ddc2b Decompile fn_20390 (CConnection::Close)
Batch #14389 by Yommy: 0 byte-identical, 1 confirmed by peer review.

- fn_20390 CConnection::Close: logic confirmed by peer review

Peer-reviewed-by: secret, aDw, codeplay
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
2026-11-07 08:10:13 +00:00

76 lines
1.8 KiB
C++

#ifndef RAGNAROK_SOURCE_NETWORK_CONNECTION_CONNECTION_H
#define RAGNAROK_SOURCE_NETWORK_CONNECTION_CONNECTION_H
#include "Network/Connection/PacketQueue.h"
#include <winsock2.h>
class PacketLengths;
struct ConnectionEndpoint {
/* 0000 */ char address[16];
/* 0010 */ int port;
/* 0014 */ char overrideAddress[129];
};
class CConnection {
public:
CConnection();
virtual ~CConnection();
virtual bool Connect(const ConnectionEndpoint& endpoint);
__declspec(noinline) void Close();
bool Receive();
bool Flush();
bool Update();
void UpdateStatus();
int Status() const;
void Send(int bytes, const void* data);
int Read(void* output, int bytes, unsigned char exact);
bool ReadPacket(void* output, unsigned short* bytes, const PacketLengths& lengths);
void Prepend(int bytes, const void* data);
void ResetDeferred();
void ResetQueue();
void SetBlock(unsigned char value);
// INLINED
SOCKET NativeSocket() const {
return this->m_socket;
}
// INLINED
CPacketQueue& Input() {
return this->m_input;
}
// INLINED
unsigned& SendDeadline() {
return this->m_sendDeadline;
}
protected:
/* 0004 */ SOCKET m_socket;
/* 0008 */ sockaddr_in m_address;
/* 0018 */ unsigned char m_deferred;
/* 001C */ unsigned m_sendDeadline;
/* 0020 */ int m_status;
/* 0024 */ CPacketQueue m_output;
/* 003C */ CPacketQueue m_input;
/* 0054 */ CPacketQueue m_pending;
};
class CRagConnection : public CConnection {
public:
CRagConnection();
~CRagConnection() override;
short GetPacketType(const char* packet);
private:
/* 006C */ unsigned char unknown_006C;
};
CRagConnection& GetRagConnection();
#if defined(_WIN32) && !defined(_WIN64)
static_assert(sizeof(CConnection) == 0x6C);
static_assert(sizeof(CRagConnection) == 0x70);
#endif
#endif