mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2025-01-03 16:13:22 +08:00
Update INetworkMessages, INetworkMessageInternal & CNetMessage
After 8/8/2024 CS2 update
This commit is contained in:
parent
fda9cb0325
commit
1a19a2cca1
@ -71,13 +71,10 @@ public:
|
||||
virtual bool UnserializeMessageInternal( bf_read &pBuf, CNetMessage *pData ) = 0;
|
||||
virtual bool SerializeMessageInternal( bf_write &pBuf, const CNetMessage *pData ) = 0;
|
||||
|
||||
// Returns nullptr if failed to unserialize, reason is written to err_reason
|
||||
virtual CNetMessage *UnserializeFromStream(bf_read &pBuf, CUtlString &err_reason) = 0;
|
||||
virtual bool SerializeAbstract(bf_write &pBuf, INetworkMessageInternal *pNetMessage, const CNetMessage *pData) = 0;
|
||||
|
||||
// Returns true if the buffer is fully read, false if there's still data left
|
||||
virtual bool UnserializeAbstract(bf_read &pBuf, INetworkMessageInternal *pNetMessage, CNetMessage *pData) = 0;
|
||||
virtual bool UnserializeAbstract(bf_read &pBuf, INetworkMessageInternal **pNetMessage, CNetMessage **pData) = 0;
|
||||
|
||||
virtual CNetMessage *AllocateNetMessageAbstract(INetworkMessageInternal *pNetMessage) = 0;
|
||||
virtual CNetMessage *AllocateAndCopyConstructNetMessageAbstract(INetworkMessageInternal *pNetMessage, const CNetMessage *pFrom) = 0;
|
||||
|
||||
virtual void DeallocateNetMessageAbstract(INetworkMessageInternal *pNetMessage, CNetMessage *pData) = 0;
|
||||
|
@ -66,8 +66,6 @@ public:
|
||||
virtual void SwitchMode( NetworkValidationMode_t nMode ) = 0;
|
||||
|
||||
virtual CNetMessage *AllocateMessage() = 0;
|
||||
virtual void DeallocateMessage( CNetMessage *pMsg ) = 0;
|
||||
virtual CNetMessage *AllocateAndCopyConstructNetMessage( const CNetMessage *pOther ) = 0;
|
||||
|
||||
// Calls to INetworkMessages::SerializeMessageInternal
|
||||
virtual bool Serialize( bf_write &pBuf, const CNetMessage *pData ) = 0;
|
||||
|
@ -13,18 +13,18 @@ class CNetMessagePB;
|
||||
class CNetMessage
|
||||
{
|
||||
public:
|
||||
// Disabled as per CNetMessagePB note
|
||||
CNetMessage() = delete;
|
||||
CNetMessage( const CNetMessage & ) = delete;
|
||||
|
||||
virtual ~CNetMessage() {}
|
||||
|
||||
// Returns the underlying proto object
|
||||
virtual void *AsProto() const = 0;
|
||||
virtual void *AsProto2() const = 0;
|
||||
|
||||
virtual INetworkMessageInternal *GetNetMessage() const
|
||||
{
|
||||
// This shouldn't ever be called and the game provided vtable should be called instead!
|
||||
Assert(0);
|
||||
return nullptr;
|
||||
}
|
||||
virtual INetworkMessageInternal *GetNetMessage() const = 0;
|
||||
virtual CNetMessage *CopyConstruct( const CNetMessage *other ) const = 0;
|
||||
|
||||
// Helper function to cast up the abstract message to a concrete CNetMessagePB<T> type.
|
||||
// Doesn't do any validity checks itself!
|
||||
@ -39,6 +39,9 @@ public:
|
||||
{
|
||||
return static_cast<CNetMessagePB<T> *>(this);
|
||||
}
|
||||
|
||||
private:
|
||||
char unk001[32];
|
||||
};
|
||||
|
||||
// AMNOTE: This is a stub class over real CNetMessagePB!
|
||||
@ -55,10 +58,10 @@ public:
|
||||
template<typename PROTO_TYPE>
|
||||
class CNetMessagePB : public CNetMessage, public PROTO_TYPE
|
||||
{
|
||||
private:
|
||||
public:
|
||||
// Prevent manual construction of this object as per the comment above
|
||||
CNetMessagePB() { };
|
||||
CNetMessagePB( const CNetMessagePB & ) { };
|
||||
CNetMessagePB() = delete;
|
||||
CNetMessagePB( const CNetMessagePB & ) = delete;
|
||||
};
|
||||
|
||||
#endif // NETMESSAGE_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user