Batch #14681 by ragnarok-clanker: forced by an admin (6 lower score(s), 70 changed function(s)); checked with 555 compiled unit(s), including every includer of Source/Client/Mode/CLoginMode.h, Source/Client/Session.h, Source/Contents/Actors/GameActor.h, Source/Contents/Actors/GrannyGameActor.h, Source/Contents/Actors/Pc.h, Source/Contents/Actors/RenderObject.h, Source/Contents/EffectResourceSwitcher.h, Source/Contents/Effects/CartCannon.h, Source/Contents/Effects/EZ2STREffectEx.h, Source/Contents/Effects/EffectActor.h, Source/Contents/Effects/MonsterSkillEffects.h, Source/Contents/Effects/RagEffect.h, Source/Contents/Effects/RectUpEffect.h, Source/Contents/Ground/GroundGeometry.h, Source/Network/Connection/Connection.h, Source/Resource/Audio/WaveResource.h, Source/Resource/Bitmap/BitmapResource.h, Source/Resource/EZeffectResource.h, Source/Resource/EmblemResource.h, Source/Resource/GifResource.h, Source/Resource/ImfResource.h, Source/Resource/Models/AnimatedModelResource.h, Source/Resource/Models/GrannyModelResource.h, Source/Resource/Models/ModelResource.h, Source/Resource/PaletteResource.h, Source/Resource/RmaResource.h, Source/Resource/Sprites/ActionResource.h, Source/Resource/Sprites/SpriteResource.h, Source/Resource/World/GroundResource.h, Source/Resource/World/TerrainResource.h, Source/Resource/World/WorldResource.h, Source/UI/Buttons/UIBmpRadioBtn.h, Source/UI/Buttons/UITextButton.h, Source/UI/Item/UIItemPurchaseWnd.h, Source/UI/Item/UIItemSellWnd.h, Source/UI/Item/UIItemSellWnd2.h, Source/UI/Item/UIItemStoreWnd.h, Source/UI/Item/UIItemWnd.h, Source/UI/Item/UIParaItemShopWnd.h, Source/UI/Items/UIItemRepairWnd.h, Source/UI/Items/UIMakeTargetListWnd.h, Source/UI/Items/UIMakeTargetProcessWnd.h, Source/UI/Items/UIWeaponRefineWnd.h, Source/UI/Rodex/UIRodexInboxWnd.h, Source/UI/Shop/UIMerchantItemShopWnd.h, Source/UI/Shop/UIMerchantMirrorItemWnd.h, Source/UI/Shop/UIMerchantShopMakeWnd.h, Source/UI/StylingShop/UIStylingShopWnd.h, Source/UI/UIChangeMaterialWnd.h, Source/UI/UIIngredientInfoWnd.h, Source/UI/UIItemReformWnd.h, Source/UI/UILapineScrollBar.h, Source/UI/Window/UIHotKeyWnd.h, Source/UI/Window/UINewSelectCharWnd.h.
79 lines
1.9 KiB
C++
79 lines
1.9 KiB
C++
#ifndef RAGNAROK_SOURCE_NETWORK_CONNECTION_CONNECTION_H
|
|
#define RAGNAROK_SOURCE_NETWORK_CONNECTION_CONNECTION_H
|
|
|
|
#include "Network/Connection/PacketQueue.h"
|
|
|
|
#include <cstddef>
|
|
#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(offsetof(ConnectionEndpoint, port) == 0x10);
|
|
static_assert(offsetof(ConnectionEndpoint, overrideAddress) == 0x14);
|
|
static_assert(sizeof(CConnection) == 0x6C);
|
|
static_assert(sizeof(CRagConnection) == 0x70);
|
|
#endif
|
|
|
|
#endif
|