diff --git a/gradle.properties b/gradle.properties index 1a2d6e1..2743145 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ majorVersion=3 -minorVersion=6 +minorVersion=7 maintenanceVersion=0 diff --git a/rehlds/engine/server.h b/rehlds/engine/server.h index 9110369..b94f7c4 100644 --- a/rehlds/engine/server.h +++ b/rehlds/engine/server.h @@ -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); diff --git a/rehlds/engine/sv_main.cpp b/rehlds/engine/sv_main.cpp index 2748905..b6ca889 100644 --- a/rehlds/engine/sv_main.cpp +++ b/rehlds/engine/sv_main.cpp @@ -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; diff --git a/rehlds/public/rehlds/rehlds_api.h b/rehlds/public/rehlds/rehlds_api.h index 964ccde..0a73b4f 100644 --- a/rehlds/public/rehlds/rehlds_api.h +++ b/rehlds/public/rehlds/rehlds_api.h @@ -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 IRehldsHook_Steam_NotifyClientConnect; @@ -199,6 +199,10 @@ typedef IHookChainRegistry IRehldsHookRegistry_CreateFa typedef IHookChain IRehldsHook_SV_CheckConnectionLessRateLimits; typedef IHookChainRegistry 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 { diff --git a/rehlds/public/rehlds/rehlds_interfaces.h b/rehlds/public/rehlds/rehlds_interfaces.h index d2db710..8e12e33 100644 --- a/rehlds/public/rehlds/rehlds_interfaces.h +++ b/rehlds/public/rehlds/rehlds_interfaces.h @@ -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; }; diff --git a/rehlds/rehlds/rehlds_api_impl.cpp b/rehlds/rehlds/rehlds_api_impl.cpp index 95076f2..f4ade26 100644 --- a/rehlds/rehlds/rehlds_api_impl.cpp +++ b/rehlds/rehlds/rehlds_api_impl.cpp @@ -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; diff --git a/rehlds/rehlds/rehlds_api_impl.h b/rehlds/rehlds/rehlds_api_impl.h index 296ce4b..689556b 100644 --- a/rehlds/rehlds/rehlds_api_impl.h +++ b/rehlds/rehlds/rehlds_api_impl.h @@ -194,6 +194,10 @@ typedef IHookChainRegistryImpl CRehldsHookRegistry_Crea typedef IHookChainImpl CRehldsHook_SV_CheckConnectionLessRateLimits; typedef IHookChainRegistryImpl 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; diff --git a/rehlds/rehlds/rehlds_interfaces_impl.cpp b/rehlds/rehlds/rehlds_interfaces_impl.cpp index 8d02a03..a1103a8 100644 --- a/rehlds/rehlds/rehlds_interfaces_impl.cpp +++ b/rehlds/rehlds/rehlds_interfaces_impl.cpp @@ -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(); diff --git a/rehlds/rehlds/rehlds_interfaces_impl.h b/rehlds/rehlds/rehlds_interfaces_impl.h index 9164a02..431ca99 100644 --- a/rehlds/rehlds/rehlds_interfaces_impl.h +++ b/rehlds/rehlds/rehlds_interfaces_impl.h @@ -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;