r5sdk/r5dev/engine/server/datablock_sender.h
Kawe Mazidjatari 74da5c7c20 Engine: cleanup data block sender/receiver and add types
* Move member vars to correct place, to match it with the engine.
* Added out-of-band network message ID's for the R5 engine.

Also implemented 'ServerDataBlockSender::SendDataBlock()' and 'ClientDataBlockReceiver::AcknowledgeTransmission()'. NOTE that these are currently not tested, and also not in use! The code uses the version stored in the vftable which is what the engine itself provides. These have been implemented for reference only. If they need to be used, they need to be thoroughly tested first!
2024-04-05 18:06:36 +02:00

59 lines
1.9 KiB
C++

//===========================================================================//
//
// Purpose: server side data block sender
//
//===========================================================================//
#ifndef DATABLOCK_SENDER_H
#define DATABLOCK_SENDER_H
#include "engine/shared/datablock.h"
class CClient;
class ServerDataBlockSender : public NetDataBlockSender
{
public:
virtual void SendDataBlock(const short transferId, const int transferSize, const short transferNr,
const short blockNr, const uint8_t* const blockData, const int blockSize) override;
virtual float GetResendRate() const override;
virtual const char* GetReceiverName() const override;
void WriteDataBlock(const uint8_t* const sourceData, const int dataSize, const bool isMultiplayer, const char* const debugName);
};
struct ServerDataBlock
{
char blockBuffer[295312]; // this might be wrong !!!
void* userData;
char gapC0008[56];
ServerDataBlockSender sender;
};
struct ServerDataBlockHeader_s
{
bool isCompressed;
};
inline void* (*ServerDataBlockSender__SendDataBlock)(ServerDataBlockSender* thisptr,
const short transferId, const int transferSize, const short transferNr,
const short blockNr, const uint8_t* const blockData, const int blockSize);
///////////////////////////////////////////////////////////////////////////////
class VServerDataBlockSender : public IDetour
{
virtual void GetAdr(void) const
{
LogFunAdr("ServerDataBlockSender::SendDataBlock", ServerDataBlockSender__SendDataBlock);
}
virtual void GetFun(void) const
{
g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 55 48 8D AC 24 ?? ?? ?? ?? 48 81 EC ?? ?? ?? ?? 48 8B 99 ?? ?? ?? ??").GetPtr(ServerDataBlockSender__SendDataBlock);
}
virtual void GetVar(void) const { }
virtual void GetCon(void) const { }
virtual void Detour(const bool bAttach) const { }
};
///////////////////////////////////////////////////////////////////////////////
#endif // DATABLOCK_SENDER_H