mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Originally, we store the search results in a CMemory instance which we then assign to the actual function pointer. CMemory is just a pointer class; we can assign the results directly to the actual function pointer. This commit reduces a lot of code verbosity, and also reduced roughly 2KiB worth of static pointers in the resulting executable. This commit also officially deprecates the support for any GameDLL's below S3 (Season 3), since it makes more sense to port the assets from earlier/later games back to the version this SDK supports.
76 lines
2.3 KiB
C++
76 lines
2.3 KiB
C++
//===== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ======//
|
||
//
|
||
// Purpose:
|
||
//
|
||
// $NoKeywords: $
|
||
//===========================================================================//
|
||
|
||
#ifndef NETWORKSTRINGTABLE_H
|
||
#define NETWORKSTRINGTABLE_H
|
||
#include "tier0/fasttimer.h"
|
||
#include "tier1/utlvector.h"
|
||
#include "tier1/bitbuf.h"
|
||
#include "client/client.h"
|
||
|
||
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);
|
||
|
||
private:
|
||
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:
|
||
static void WriteUpdateMessage(CNetworkStringTableContainer* thisp, CClient* client, unsigned int tick_ack, bf_write* msg);
|
||
|
||
private:
|
||
bool m_bAllowCreation; // create guard
|
||
int m_nTickCount; // current tick
|
||
bool m_bLocked; // currently locked?
|
||
bool m_bEnableRollback; // enables rollback feature
|
||
CUtlVector < CNetworkStringTable* > m_Tables; // the string tables
|
||
};
|
||
|
||
inline void (*CNetworkStringTableContainer__WriteUpdateMessage)(CNetworkStringTableContainer* thisp, CClient* client, unsigned int tick_ack, bf_write* msg);
|
||
|
||
class VNetworkStringTableContainer : public IDetour
|
||
{
|
||
virtual void GetAdr(void) const
|
||
{
|
||
LogFunAdr("CNetworkStringTableContainer::WriteUpdateMessage", CNetworkStringTableContainer__WriteUpdateMessage);
|
||
}
|
||
virtual void GetFun(void) const
|
||
{
|
||
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")
|
||
.GetPtr(CNetworkStringTableContainer__WriteUpdateMessage);
|
||
}
|
||
virtual void GetVar(void) const { }
|
||
virtual void GetCon(void) const { }
|
||
virtual void Detour(const bool bAttach) const;
|
||
};
|
||
///////////////////////////////////////////////////////////////////////////////
|
||
|
||
#endif // NETWORKSTRINGTABLE_H
|