mirror of
https://github.com/rehlds/rehlds.git
synced 2024-12-27 23:25:45 +03:00
ReHLDS API: Extending api
This commit is contained in:
parent
9f7be106ed
commit
084bd023d2
@ -1,3 +1,3 @@
|
||||
majorVersion=3
|
||||
minorVersion=6
|
||||
minorVersion=7
|
||||
maintenanceVersion=0
|
||||
|
@ -608,7 +608,8 @@ void SV_CheckCmdTimes(void);
|
||||
void SV_CheckForRcon(void);
|
||||
qboolean SV_IsSimulating(void);
|
||||
void SV_CheckMapDifferences(void);
|
||||
void SV_Frame(void);
|
||||
void SV_Frame();
|
||||
void SV_Frame_Internal();
|
||||
void SV_Drop_f(void);
|
||||
void SV_RegisterDelta(char *name, char *loadfile);
|
||||
void SV_InitDeltas(void);
|
||||
|
@ -6447,7 +6447,7 @@ USERID_t *SV_StringToUserID(const char *str)
|
||||
return &id;
|
||||
}
|
||||
|
||||
void SV_SerializeSteamid(USERID_t* id, USERID_t* serialized)
|
||||
void EXT_FUNC SV_SerializeSteamid(USERID_t* id, USERID_t* serialized)
|
||||
{
|
||||
*serialized = *id;
|
||||
}
|
||||
@ -7680,7 +7680,12 @@ void SV_CheckMapDifferences(void)
|
||||
}
|
||||
}
|
||||
|
||||
void SV_Frame(void)
|
||||
void SV_Frame()
|
||||
{
|
||||
g_RehldsHookchains.m_SV_Frame.callChain(SV_Frame_Internal);
|
||||
}
|
||||
|
||||
void EXT_FUNC SV_Frame_Internal()
|
||||
{
|
||||
if (!g_psv.active)
|
||||
return;
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include "pr_dlls.h"
|
||||
|
||||
#define REHLDS_API_VERSION_MAJOR 3
|
||||
#define REHLDS_API_VERSION_MINOR 6
|
||||
#define REHLDS_API_VERSION_MINOR 7
|
||||
|
||||
//Steam_NotifyClientConnect hook
|
||||
typedef IHookChain<qboolean, IGameClient*, const void*, unsigned int> IRehldsHook_Steam_NotifyClientConnect;
|
||||
@ -199,6 +199,10 @@ typedef IHookChainRegistry<edict_t *, const char *> IRehldsHookRegistry_CreateFa
|
||||
typedef IHookChain<bool, netadr_t &, const uint8_t *, int> IRehldsHook_SV_CheckConnectionLessRateLimits;
|
||||
typedef IHookChainRegistry<bool, netadr_t &, const uint8_t *, int> IRehldsHookRegistry_SV_CheckConnectionLessRateLimits;
|
||||
|
||||
//SV_Frame hook
|
||||
typedef IVoidHookChain<> IRehldsHook_SV_Frame;
|
||||
typedef IVoidHookChainRegistry<> IRehldsHookRegistry_SV_Frame;
|
||||
|
||||
class IRehldsHookchains {
|
||||
public:
|
||||
virtual ~IRehldsHookchains() { }
|
||||
@ -243,6 +247,7 @@ public:
|
||||
virtual IRehldsHookRegistry_SV_EmitSound2* SV_EmitSound2() = 0;
|
||||
virtual IRehldsHookRegistry_CreateFakeClient* CreateFakeClient() = 0;
|
||||
virtual IRehldsHookRegistry_SV_CheckConnectionLessRateLimits* SV_CheckConnectionLessRateLimits() = 0;
|
||||
virtual IRehldsHookRegistry_SV_Frame* SV_Frame() = 0;
|
||||
};
|
||||
|
||||
struct RehldsFuncs_t {
|
||||
@ -350,6 +355,9 @@ struct RehldsFuncs_t {
|
||||
void(*SZ_Write)(sizebuf_t *buf, const void *data, int length);
|
||||
void(*SZ_Print)(sizebuf_t *buf, const char *data);
|
||||
void(*SZ_Clear)(sizebuf_t *buf);
|
||||
void(*MSG_BeginReading)();
|
||||
double(*GetHostFrameTime)();
|
||||
struct cmd_function_s *(*GetFirstCmdFunctionHandle)();
|
||||
};
|
||||
|
||||
class IRehldsApi {
|
||||
|
@ -130,4 +130,5 @@ public:
|
||||
virtual void SetName(const char* name) = 0;
|
||||
virtual class ISteamGameServer *GetSteamGameServer() = 0;
|
||||
virtual struct netadr_s *GetNetFrom() = 0;
|
||||
virtual double GetOldTime() = 0;
|
||||
};
|
||||
|
@ -56,7 +56,7 @@ int* EXT_FUNC GetAllowCheats_api() {
|
||||
}
|
||||
|
||||
bool EXT_FUNC GSBSecure_api() {
|
||||
return Steam_GSBSecure() != 0;
|
||||
return Steam_GSBSecure() != FALSE;
|
||||
}
|
||||
|
||||
int EXT_FUNC GetBuildNumber_api() {
|
||||
@ -67,6 +67,14 @@ double EXT_FUNC GetRealTime_api() {
|
||||
return realtime;
|
||||
}
|
||||
|
||||
double EXT_FUNC GetHostFrameTime_api() {
|
||||
return host_frametime;
|
||||
}
|
||||
|
||||
cmd_function_t* EXT_FUNC GetFirstCmdFunctionHandle_api() {
|
||||
return Cmd_GetFirstCmd();
|
||||
}
|
||||
|
||||
int* EXT_FUNC GetMsgBadRead_api() {
|
||||
return &msg_badread;
|
||||
}
|
||||
@ -312,6 +320,10 @@ void EXT_FUNC SZ_Clear_api(sizebuf_t *buf) {
|
||||
SZ_Clear(buf);
|
||||
}
|
||||
|
||||
void EXT_FUNC MSG_BeginReading_api() {
|
||||
MSG_BeginReading();
|
||||
}
|
||||
|
||||
cvar_t* EXT_FUNC GetCvarVars_api() {
|
||||
return cvar_vars;
|
||||
}
|
||||
@ -545,6 +557,9 @@ RehldsFuncs_t g_RehldsApiFuncs =
|
||||
&SZ_Write_api,
|
||||
&SZ_Print_api,
|
||||
&SZ_Clear_api,
|
||||
&MSG_BeginReading_api,
|
||||
&GetHostFrameTime_api,
|
||||
&GetFirstCmdFunctionHandle_api
|
||||
};
|
||||
|
||||
bool EXT_FUNC SV_EmitSound2_internal(edict_t *entity, IGameClient *pReceiver, int channel, const char *sample, float volume, float attenuation, int flags, int pitch, int emitFlags, const float *pOrigin)
|
||||
@ -808,6 +823,10 @@ IRehldsHookRegistry_SV_CheckConnectionLessRateLimits* CRehldsHookchains::SV_Chec
|
||||
return &m_SV_CheckConnectionLessRateLimits;
|
||||
}
|
||||
|
||||
IRehldsHookRegistry_SV_Frame* CRehldsHookchains::SV_Frame() {
|
||||
return &m_SV_Frame;
|
||||
}
|
||||
|
||||
int EXT_FUNC CRehldsApi::GetMajorVersion()
|
||||
{
|
||||
return REHLDS_API_VERSION_MAJOR;
|
||||
|
@ -194,6 +194,10 @@ typedef IHookChainRegistryImpl<edict_t *, const char *> CRehldsHookRegistry_Crea
|
||||
typedef IHookChainImpl<bool, netadr_t &, const uint8_t *, int> CRehldsHook_SV_CheckConnectionLessRateLimits;
|
||||
typedef IHookChainRegistryImpl<bool, netadr_t &, const uint8_t *, int> CRehldsHookRegistry_SV_CheckConnectionLessRateLimits;
|
||||
|
||||
//SV_Frame hook
|
||||
typedef IVoidHookChainImpl<> CRehldsHook_SV_Frame;
|
||||
typedef IVoidHookChainRegistryImpl<> CRehldsHookRegistry_SV_Frame;
|
||||
|
||||
class CRehldsHookchains : public IRehldsHookchains {
|
||||
public:
|
||||
CRehldsHookRegistry_Steam_NotifyClientConnect m_Steam_NotifyClientConnect;
|
||||
@ -236,6 +240,7 @@ public:
|
||||
CRehldsHookRegistry_SV_EmitSound2 m_SV_EmitSound2;
|
||||
CRehldsHookRegistry_CreateFakeClient m_CreateFakeClient;
|
||||
CRehldsHookRegistry_SV_CheckConnectionLessRateLimits m_SV_CheckConnectionLessRateLimits;
|
||||
CRehldsHookRegistry_SV_Frame m_SV_Frame;
|
||||
|
||||
public:
|
||||
EXT_FUNC virtual IRehldsHookRegistry_Steam_NotifyClientConnect* Steam_NotifyClientConnect();
|
||||
@ -278,6 +283,7 @@ public:
|
||||
EXT_FUNC virtual IRehldsHookRegistry_SV_EmitSound2* SV_EmitSound2();
|
||||
EXT_FUNC virtual IRehldsHookRegistry_CreateFakeClient* CreateFakeClient();
|
||||
EXT_FUNC virtual IRehldsHookRegistry_SV_CheckConnectionLessRateLimits* SV_CheckConnectionLessRateLimits();
|
||||
EXT_FUNC virtual IRehldsHookRegistry_SV_Frame* SV_Frame();
|
||||
};
|
||||
|
||||
extern CRehldsHookchains g_RehldsHookchains;
|
||||
|
@ -248,6 +248,10 @@ double EXT_FUNC CRehldsServerData::GetTime() {
|
||||
return g_psv.time;
|
||||
}
|
||||
|
||||
double EXT_FUNC CRehldsServerData::GetOldTime() {
|
||||
return g_psv.oldtime;
|
||||
}
|
||||
|
||||
void EXT_FUNC CRehldsServerData::SetResourcesNum(int num) {
|
||||
g_psv.num_resources = num;
|
||||
}
|
||||
@ -260,7 +264,7 @@ struct resource_s *EXT_FUNC CRehldsServerData::GetResource(int index) {
|
||||
#endif // REHLDS_FIXES
|
||||
}
|
||||
|
||||
void Rehlds_Interfaces_FreeClients()
|
||||
void Rehlds_Interfaces_FreeClients()
|
||||
{
|
||||
if (g_GameClients == NULL)
|
||||
return;
|
||||
@ -274,7 +278,7 @@ void Rehlds_Interfaces_FreeClients()
|
||||
g_GameClients = NULL;
|
||||
}
|
||||
|
||||
void Rehlds_Interfaces_InitClients()
|
||||
void Rehlds_Interfaces_InitClients()
|
||||
{
|
||||
Rehlds_Interfaces_FreeClients();
|
||||
|
||||
|
@ -145,6 +145,7 @@ public:
|
||||
virtual void SetName(const char* name);
|
||||
virtual ISteamGameServer *GetSteamGameServer();
|
||||
virtual netadr_t *GetNetFrom();
|
||||
virtual double GetOldTime();
|
||||
};
|
||||
|
||||
extern CGameClient** g_GameClients;
|
||||
|
Loading…
Reference in New Issue
Block a user