2022-05-20 20:14:39 +02:00
|
|
|
|
//===== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ======//
|
|
|
|
|
//
|
|
|
|
|
// Purpose:
|
|
|
|
|
//
|
|
|
|
|
// $NoKeywords: $
|
|
|
|
|
//===========================================================================//
|
|
|
|
|
|
|
|
|
|
#ifndef NETWORKSTRINGTABLE_H
|
|
|
|
|
#define NETWORKSTRINGTABLE_H
|
2023-04-09 11:06:55 +02:00
|
|
|
|
#include "tier0/fasttimer.h"
|
2023-02-18 00:24:02 +01:00
|
|
|
|
#include "tier1/utlvector.h"
|
|
|
|
|
#include "tier1/bitbuf.h"
|
|
|
|
|
#include "client/client.h"
|
2022-05-20 20:14:39 +02:00
|
|
|
|
|
|
|
|
|
typedef int TABLEID;
|
|
|
|
|
|
|
|
|
|
class INetworkStringTable
|
|
|
|
|
{
|
|
|
|
|
INetworkStringTable* m_pVTable;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class CNetworkStringTable : public INetworkStringTable
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
TABLEID GetTableId(void) const;
|
|
|
|
|
int GetMaxStrings(void) const;
|
|
|
|
|
const char* GetTableName(void) const;
|
|
|
|
|
int GetEntryBits(void) const;
|
|
|
|
|
void SetTick(int tick_count);
|
|
|
|
|
bool Lock(bool bLock);
|
|
|
|
|
|
2023-02-18 00:24:02 +01:00
|
|
|
|
private:
|
2022-05-20 20:14:39 +02:00
|
|
|
|
TABLEID m_id;
|
|
|
|
|
bool m_bLocked; // Might be wrong!
|
|
|
|
|
char* m_pszTableName;
|
|
|
|
|
int m_nMaxEntries;
|
|
|
|
|
int m_nEntryBits;
|
|
|
|
|
int m_nTickCount;
|
|
|
|
|
int m_nLastChangedTick;
|
|
|
|
|
uint32_t m_nFlags;
|
|
|
|
|
// !TODO
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class CNetworkStringTableContainer : public INetworkStringTable
|
|
|
|
|
{
|
|
|
|
|
public:
|
2023-02-18 00:24:02 +01:00
|
|
|
|
static void WriteUpdateMessage(CNetworkStringTableContainer* thisp, CClient* client, unsigned int tick_ack, bf_write* msg);
|
|
|
|
|
|
|
|
|
|
private:
|
2022-09-09 19:47:31 +02:00
|
|
|
|
bool m_bAllowCreation; // create guard
|
2022-05-20 20:14:39 +02:00
|
|
|
|
int m_nTickCount; // current tick
|
|
|
|
|
bool m_bLocked; // currently locked?
|
|
|
|
|
bool m_bEnableRollback; // enables rollback feature
|
2023-02-18 00:24:02 +01:00
|
|
|
|
CUtlVector < CNetworkStringTable* > m_Tables; // the string tables
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
inline CMemory p_CNetworkStringTableContainer__WriteUpdateMessage;
|
|
|
|
|
inline auto v_CNetworkStringTableContainer__WriteUpdateMessage =
|
|
|
|
|
p_CNetworkStringTableContainer__WriteUpdateMessage.RCast<void (*)(CNetworkStringTableContainer* thisp, CClient* client, unsigned int tick_ack, bf_write* msg)>();
|
|
|
|
|
|
|
|
|
|
class VNetworkStringTableContainer : public IDetour
|
|
|
|
|
{
|
|
|
|
|
virtual void GetAdr(void) const
|
|
|
|
|
{
|
|
|
|
|
LogFunAdr("CNetworkStringTableContainer::WriteUpdateMessage", p_CNetworkStringTableContainer__WriteUpdateMessage.GetPtr());
|
|
|
|
|
}
|
|
|
|
|
virtual void GetFun(void) const
|
|
|
|
|
{
|
|
|
|
|
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
|
|
|
|
|
p_CNetworkStringTableContainer__WriteUpdateMessage = g_GameDll.FindPatternSIMD("48 89 74 24 ?? 55 57 41 54 41 55 41 56 48 8D AC 24 ?? ?? ?? ?? B8 ?? ?? ?? ??");
|
|
|
|
|
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
|
|
|
|
|
p_CNetworkStringTableContainer__WriteUpdateMessage = g_GameDll.FindPatternSIMD("48 89 74 24 ?? 48 89 7C 24 ?? 55 41 54 41 55 41 56 41 57 48 8D AC 24 ?? ?? ?? ?? B8 ?? ?? ?? ?? E8 ?? ?? ?? ?? 48 2B E0 45 33 ED");
|
|
|
|
|
#endif
|
|
|
|
|
v_CNetworkStringTableContainer__WriteUpdateMessage =
|
|
|
|
|
p_CNetworkStringTableContainer__WriteUpdateMessage.RCast<void (*)(CNetworkStringTableContainer*, CClient*, unsigned int, bf_write*)>();
|
|
|
|
|
}
|
|
|
|
|
virtual void GetVar(void) const { }
|
|
|
|
|
virtual void GetCon(void) const { }
|
|
|
|
|
virtual void Attach(void) const;
|
|
|
|
|
virtual void Detach(void) const;
|
2022-05-20 20:14:39 +02:00
|
|
|
|
};
|
2023-02-18 00:24:02 +01:00
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2022-05-20 20:14:39 +02:00
|
|
|
|
|
|
|
|
|
#endif // NETWORKSTRINGTABLE_H
|