mirror of
https://github.com/rehlds/rehlds.git
synced 2025-01-06 03:55:32 +03:00
ReHLDS API: Added some functions
This commit is contained in:
parent
adf214c433
commit
ee4dbe6481
@ -715,6 +715,7 @@ void SV_CreateResourceList(void);
|
|||||||
void SV_ClearCaches(void);
|
void SV_ClearCaches(void);
|
||||||
void SV_PropagateCustomizations(void);
|
void SV_PropagateCustomizations(void);
|
||||||
void SV_WriteVoiceCodec(sizebuf_t *pBuf);
|
void SV_WriteVoiceCodec(sizebuf_t *pBuf);
|
||||||
|
void SV_WriteVoiceCodec_internal(sizebuf_t *pBuf);
|
||||||
void SV_CreateBaseline(void);
|
void SV_CreateBaseline(void);
|
||||||
void SV_BroadcastCommand(char *fmt, ...);
|
void SV_BroadcastCommand(char *fmt, ...);
|
||||||
void SV_BuildReconnect(sizebuf_t *msg);
|
void SV_BuildReconnect(sizebuf_t *msg);
|
||||||
|
@ -5124,8 +5124,13 @@ void SV_PropagateCustomizations(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* <a9cdb> ../engine/sv_main.c:6850 */
|
|
||||||
void SV_WriteVoiceCodec(sizebuf_t *pBuf)
|
void SV_WriteVoiceCodec(sizebuf_t *pBuf)
|
||||||
|
{
|
||||||
|
g_RehldsHookchains.m_SV_WriteVoiceCodec.callChain(SV_WriteVoiceCodec_internal, pBuf);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* <a9cdb> ../engine/sv_main.c:6850 */
|
||||||
|
void EXT_FUNC SV_WriteVoiceCodec_internal(sizebuf_t *pBuf)
|
||||||
{
|
{
|
||||||
MSG_WriteByte(pBuf, svc_voiceinit);
|
MSG_WriteByte(pBuf, svc_voiceinit);
|
||||||
MSG_WriteString(pBuf, "");
|
MSG_WriteString(pBuf, "");
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include "model.h"
|
#include "model.h"
|
||||||
|
|
||||||
#define REHLDS_API_VERSION_MAJOR 2
|
#define REHLDS_API_VERSION_MAJOR 2
|
||||||
#define REHLDS_API_VERSION_MINOR 2
|
#define REHLDS_API_VERSION_MINOR 3
|
||||||
|
|
||||||
//Steam_NotifyClientConnect hook
|
//Steam_NotifyClientConnect hook
|
||||||
typedef IHookChain<qboolean, IGameClient*, const void*, unsigned int> IRehldsHook_Steam_NotifyClientConnect;
|
typedef IHookChain<qboolean, IGameClient*, const void*, unsigned int> IRehldsHook_Steam_NotifyClientConnect;
|
||||||
@ -153,6 +153,10 @@ typedef IVoidHookChainRegistry<IGameClient*, bool, const char*> IRehldsHookRegis
|
|||||||
typedef IVoidHookChain<int> IRehldsHook_SV_ActivateServer;
|
typedef IVoidHookChain<int> IRehldsHook_SV_ActivateServer;
|
||||||
typedef IVoidHookChainRegistry<int> IRehldsHookRegistry_SV_ActivateServer;
|
typedef IVoidHookChainRegistry<int> IRehldsHookRegistry_SV_ActivateServer;
|
||||||
|
|
||||||
|
//SV_WriteVoiceCodec hook
|
||||||
|
typedef IVoidHookChain<sizebuf_t *> IRehldsHook_SV_WriteVoiceCodec;
|
||||||
|
typedef IVoidHookChainRegistry<sizebuf_t *> IRehldsHookRegistry_SV_WriteVoiceCodec;
|
||||||
|
|
||||||
class IRehldsHookchains {
|
class IRehldsHookchains {
|
||||||
public:
|
public:
|
||||||
virtual ~IRehldsHookchains() { }
|
virtual ~IRehldsHookchains() { }
|
||||||
@ -186,6 +190,7 @@ public:
|
|||||||
virtual IRehldsHookRegistry_SV_CheckConsistencyResponse* SV_CheckConsistencyResponse() = 0;
|
virtual IRehldsHookRegistry_SV_CheckConsistencyResponse* SV_CheckConsistencyResponse() = 0;
|
||||||
virtual IRehldsHookRegistry_SV_DropClient* SV_DropClient() = 0;
|
virtual IRehldsHookRegistry_SV_DropClient* SV_DropClient() = 0;
|
||||||
virtual IRehldsHookRegistry_SV_ActivateServer* SV_ActivateServer() = 0;
|
virtual IRehldsHookRegistry_SV_ActivateServer* SV_ActivateServer() = 0;
|
||||||
|
virtual IRehldsHookRegistry_SV_WriteVoiceCodec* SV_WriteVoiceCodec() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RehldsFuncs_t {
|
struct RehldsFuncs_t {
|
||||||
@ -222,6 +227,12 @@ struct RehldsFuncs_t {
|
|||||||
cvar_t*(*GetCvarVars)();
|
cvar_t*(*GetCvarVars)();
|
||||||
int (*SV_GetChallenge)(const netadr_t& adr);
|
int (*SV_GetChallenge)(const netadr_t& adr);
|
||||||
void (*SV_AddResource)(resourcetype_t type, const char *name, int size, unsigned char flags, int index);
|
void (*SV_AddResource)(resourcetype_t type, const char *name, int size, unsigned char flags, int index);
|
||||||
|
int(*MSG_ReadShort)(void);
|
||||||
|
int(*MSG_ReadBuf)(int iSize, void *pbuf);
|
||||||
|
void(*MSG_WriteBuf)(sizebuf_t *sb, int iSize, void *buf);
|
||||||
|
void(*MSG_WriteByte)(sizebuf_t *sb, int c);
|
||||||
|
void(*MSG_WriteShort)(sizebuf_t *sb, int c);
|
||||||
|
void(*MSG_WriteString)(sizebuf_t *sb, const char *s);
|
||||||
};
|
};
|
||||||
|
|
||||||
class IRehldsApi {
|
class IRehldsApi {
|
||||||
|
@ -67,6 +67,9 @@ public:
|
|||||||
virtual bool IsConnected() = 0;
|
virtual bool IsConnected() = 0;
|
||||||
virtual void SetConnected(bool connected) = 0;
|
virtual void SetConnected(bool connected) = 0;
|
||||||
|
|
||||||
|
virtual uint32 GetVoiceStreams(int id) = 0;
|
||||||
|
virtual double GetLastVoiceTime() = 0;
|
||||||
|
virtual bool GetLoopback() = 0;
|
||||||
|
|
||||||
// this must be the last virtual function in class
|
// this must be the last virtual function in class
|
||||||
#ifdef REHLDS_SELF
|
#ifdef REHLDS_SELF
|
||||||
@ -117,4 +120,6 @@ public:
|
|||||||
virtual int GetConsistencyNum() = 0;
|
virtual int GetConsistencyNum() = 0;
|
||||||
virtual int GetResourcesNum() = 0;
|
virtual int GetResourcesNum() = 0;
|
||||||
virtual int GetDecalNameNum() = 0;
|
virtual int GetDecalNameNum() = 0;
|
||||||
|
|
||||||
|
virtual double GetTime() = 0;
|
||||||
};
|
};
|
||||||
|
@ -73,6 +73,30 @@ void EXT_FUNC MSG_WriteBits_api(uint32 data, int numbits) {
|
|||||||
MSG_WriteBits(data, numbits);
|
MSG_WriteBits(data, numbits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int EXT_FUNC MSG_ReadShort_api() {
|
||||||
|
return MSG_ReadShort();
|
||||||
|
}
|
||||||
|
|
||||||
|
int EXT_FUNC MSG_ReadBuf_api(int iSize, void *pbuf) {
|
||||||
|
return MSG_ReadBuf(iSize, pbuf);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EXT_FUNC MSG_WriteBuf_api(sizebuf_t *sb, int iSize, void *buf) {
|
||||||
|
MSG_WriteBuf(sb, iSize, buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EXT_FUNC MSG_WriteByte_api(sizebuf_t *sb, int c) {
|
||||||
|
MSG_WriteByte(sb, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EXT_FUNC MSG_WriteShort_api(sizebuf_t *sb, int c) {
|
||||||
|
MSG_WriteShort(sb, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EXT_FUNC MSG_WriteString_api(sizebuf_t *sb, const char *s) {
|
||||||
|
MSG_WriteString(sb, s);
|
||||||
|
}
|
||||||
|
|
||||||
void EXT_FUNC MSG_WriteBitVec3Coord_api(const vec3_t fa) {
|
void EXT_FUNC MSG_WriteBitVec3Coord_api(const vec3_t fa) {
|
||||||
MSG_WriteBitVec3Coord(fa);
|
MSG_WriteBitVec3Coord(fa);
|
||||||
}
|
}
|
||||||
@ -122,7 +146,13 @@ RehldsFuncs_t g_RehldsApiFuncs =
|
|||||||
&SZ_GetSpace,
|
&SZ_GetSpace,
|
||||||
&GetCvarVars_api,
|
&GetCvarVars_api,
|
||||||
&SV_GetChallenge,
|
&SV_GetChallenge,
|
||||||
&SV_AddResource
|
&SV_AddResource,
|
||||||
|
&MSG_ReadShort_api,
|
||||||
|
&MSG_ReadBuf_api,
|
||||||
|
&MSG_WriteBuf_api,
|
||||||
|
&MSG_WriteByte_api,
|
||||||
|
&MSG_WriteShort_api,
|
||||||
|
&MSG_WriteString_api
|
||||||
};
|
};
|
||||||
|
|
||||||
sizebuf_t* EXT_FUNC GetNetMessage_api()
|
sizebuf_t* EXT_FUNC GetNetMessage_api()
|
||||||
@ -272,6 +302,10 @@ IRehldsHookRegistry_SV_ActivateServer* CRehldsHookchains::SV_ActivateServer() {
|
|||||||
return &m_SV_ActivateServer;
|
return &m_SV_ActivateServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IRehldsHookRegistry_SV_WriteVoiceCodec* CRehldsHookchains::SV_WriteVoiceCodec() {
|
||||||
|
return &m_SV_WriteVoiceCodec;
|
||||||
|
}
|
||||||
|
|
||||||
int EXT_FUNC CRehldsApi::GetMajorVersion()
|
int EXT_FUNC CRehldsApi::GetMajorVersion()
|
||||||
{
|
{
|
||||||
return REHLDS_API_VERSION_MAJOR;
|
return REHLDS_API_VERSION_MAJOR;
|
||||||
|
@ -147,6 +147,10 @@ typedef IVoidHookChainRegistryImpl<IGameClient*, bool, const char*> CRehldsHookR
|
|||||||
typedef IVoidHookChainImpl<int> CRehldsHook_SV_ActivateServer;
|
typedef IVoidHookChainImpl<int> CRehldsHook_SV_ActivateServer;
|
||||||
typedef IVoidHookChainRegistryImpl<int> CRehldsHookRegistry_SV_ActivateServer;
|
typedef IVoidHookChainRegistryImpl<int> CRehldsHookRegistry_SV_ActivateServer;
|
||||||
|
|
||||||
|
//SV_WriteVoiceCodec hook
|
||||||
|
typedef IVoidHookChainImpl<sizebuf_t *> CRehldsHook_SV_WriteVoiceCodec;
|
||||||
|
typedef IVoidHookChainRegistryImpl<sizebuf_t *> CRehldsHookRegistry_SV_WriteVoiceCodec;
|
||||||
|
|
||||||
class CRehldsHookchains : public IRehldsHookchains {
|
class CRehldsHookchains : public IRehldsHookchains {
|
||||||
public:
|
public:
|
||||||
CRehldsHookRegistry_Steam_NotifyClientConnect m_Steam_NotifyClientConnect;
|
CRehldsHookRegistry_Steam_NotifyClientConnect m_Steam_NotifyClientConnect;
|
||||||
@ -178,6 +182,7 @@ public:
|
|||||||
CRehldsHookRegistry_SV_CheckConsistencyResponse m_SV_CheckConsistencyResponse;
|
CRehldsHookRegistry_SV_CheckConsistencyResponse m_SV_CheckConsistencyResponse;
|
||||||
CRehldsHookRegistry_SV_DropClient m_SV_DropClient;
|
CRehldsHookRegistry_SV_DropClient m_SV_DropClient;
|
||||||
CRehldsHookRegistry_SV_ActivateServer m_SV_ActivateServer;
|
CRehldsHookRegistry_SV_ActivateServer m_SV_ActivateServer;
|
||||||
|
CRehldsHookRegistry_SV_WriteVoiceCodec m_SV_WriteVoiceCodec;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual IRehldsHookRegistry_Steam_NotifyClientConnect* Steam_NotifyClientConnect();
|
virtual IRehldsHookRegistry_Steam_NotifyClientConnect* Steam_NotifyClientConnect();
|
||||||
@ -209,6 +214,7 @@ public:
|
|||||||
virtual IRehldsHookRegistry_SV_CheckConsistencyResponse* SV_CheckConsistencyResponse();
|
virtual IRehldsHookRegistry_SV_CheckConsistencyResponse* SV_CheckConsistencyResponse();
|
||||||
virtual IRehldsHookRegistry_SV_DropClient* SV_DropClient();
|
virtual IRehldsHookRegistry_SV_DropClient* SV_DropClient();
|
||||||
virtual IRehldsHookRegistry_SV_ActivateServer* SV_ActivateServer();
|
virtual IRehldsHookRegistry_SV_ActivateServer* SV_ActivateServer();
|
||||||
|
virtual IRehldsHookRegistry_SV_WriteVoiceCodec* SV_WriteVoiceCodec();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern CRehldsHookchains g_RehldsHookchains;
|
extern CRehldsHookchains g_RehldsHookchains;
|
||||||
|
@ -63,13 +63,25 @@ void EXT_FUNC CGameClient::SetSpawned(bool spawned)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool EXT_FUNC CGameClient::IsConnected() {
|
bool EXT_FUNC CGameClient::IsConnected() {
|
||||||
return m_pClient->connected != 0;;
|
return m_pClient->connected != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EXT_FUNC CGameClient::SetConnected(bool connected) {
|
void EXT_FUNC CGameClient::SetConnected(bool connected) {
|
||||||
m_pClient->connected = connected ? 1 : 0;
|
m_pClient->connected = connected ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32 EXT_FUNC CGameClient::GetVoiceStreams(int id) {
|
||||||
|
return m_pClient->m_VoiceStreams[id >> 5];
|
||||||
|
}
|
||||||
|
|
||||||
|
double EXT_FUNC CGameClient::GetLastVoiceTime() {
|
||||||
|
return m_pClient->m_lastvoicetime;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EXT_FUNC CGameClient::GetLoopback() {
|
||||||
|
return m_pClient->m_bLoopback != 0;
|
||||||
|
}
|
||||||
|
|
||||||
INetChan* EXT_FUNC CGameClient::GetNetChan()
|
INetChan* EXT_FUNC CGameClient::GetNetChan()
|
||||||
{
|
{
|
||||||
return &m_NetChan;
|
return &m_NetChan;
|
||||||
@ -207,6 +219,10 @@ int EXT_FUNC CRehldsServerData::GetDecalNameNum() {
|
|||||||
return sv_decalnamecount;
|
return sv_decalnamecount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double EXT_FUNC CRehldsServerData::GetTime() {
|
||||||
|
return g_psv.time;
|
||||||
|
}
|
||||||
|
|
||||||
void Rehlds_Interfaces_FreeClients()
|
void Rehlds_Interfaces_FreeClients()
|
||||||
{
|
{
|
||||||
if (g_GameClients == NULL)
|
if (g_GameClients == NULL)
|
||||||
|
@ -76,6 +76,9 @@ public:
|
|||||||
virtual bool IsConnected();
|
virtual bool IsConnected();
|
||||||
virtual void SetConnected(bool connected);
|
virtual void SetConnected(bool connected);
|
||||||
|
|
||||||
|
virtual uint32 GetVoiceStreams(int id);
|
||||||
|
virtual double GetLastVoiceTime();
|
||||||
|
virtual bool GetLoopback();
|
||||||
|
|
||||||
virtual client_t* GetClient();
|
virtual client_t* GetClient();
|
||||||
};
|
};
|
||||||
@ -103,6 +106,8 @@ public:
|
|||||||
virtual int GetConsistencyNum();
|
virtual int GetConsistencyNum();
|
||||||
virtual int GetResourcesNum();
|
virtual int GetResourcesNum();
|
||||||
virtual int GetDecalNameNum();
|
virtual int GetDecalNameNum();
|
||||||
|
|
||||||
|
virtual double GetTime();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern CGameClient** g_GameClients;
|
extern CGameClient** g_GameClients;
|
||||||
|
Loading…
Reference in New Issue
Block a user