2
0
mirror of https://github.com/rehlds/rehlds.git synced 2025-01-01 01:25:38 +03:00

Merge pull request #125 from s1lentq/master

ReHLDS API: Added SV_TransferConsistencyInfo, SV_FileInConsistencyList
This commit is contained in:
theAsmodai 2016-01-10 19:15:17 +03:00
commit 6886bde121
5 changed files with 25 additions and 2 deletions

View File

@ -247,7 +247,7 @@ void SV_ParseConsistencyResponse(client_t *pSenderClient)
}
/* <bf937> ../engine/sv_user.c:267 */
qboolean SV_FileInConsistencyList(const char *filename, consistency_t **ppconsist)
qboolean EXT_FUNC SV_FileInConsistencyList(const char *filename, consistency_t **ppconsist)
{
for (int i = 0; i < ARRAYSIZE(g_psv.consistency_list); i++)
{
@ -267,6 +267,11 @@ qboolean SV_FileInConsistencyList(const char *filename, consistency_t **ppconsis
/* <bf9a8> ../engine/sv_user.c:298 */
int SV_TransferConsistencyInfo(void)
{
return g_RehldsHookchains.m_SV_TransferConsistencyInfo.callChain(SV_TransferConsistencyInfo_internal);
}
int EXT_FUNC SV_TransferConsistencyInfo_internal(void)
{
consistency_t *pc;

View File

@ -120,6 +120,7 @@ extern qboolean nofind;
void SV_ParseConsistencyResponse(client_t *pSenderClient);
qboolean SV_FileInConsistencyList(const char *filename, consistency_t **ppconsist);
int SV_TransferConsistencyInfo(void);
int SV_TransferConsistencyInfo_internal(void);
void SV_SendConsistencyList(sizebuf_t *msg);
void SV_PreRunCmd(void);
void SV_CopyEdictToPhysent(physent_t *pe, int e, edict_t *check);

View File

@ -161,6 +161,10 @@ typedef IVoidHookChainRegistry<sizebuf_t *> IRehldsHookRegistry_SV_WriteVoiceCod
typedef IHookChain<uint64> IRehldsHook_Steam_GSGetSteamID;
typedef IHookChainRegistry<uint64> IRehldsHookRegistry_Steam_GSGetSteamID;
//SV_TransferConsistencyInfo hook
typedef IHookChain<int> IRehldsHook_SV_TransferConsistencyInfo;
typedef IHookChainRegistry<int> IRehldsHookRegistry_SV_TransferConsistencyInfo;
class IRehldsHookchains {
public:
virtual ~IRehldsHookchains() { }
@ -196,6 +200,7 @@ public:
virtual IRehldsHookRegistry_SV_ActivateServer* SV_ActivateServer() = 0;
virtual IRehldsHookRegistry_SV_WriteVoiceCodec* SV_WriteVoiceCodec() = 0;
virtual IRehldsHookRegistry_Steam_GSGetSteamID* Steam_GSGetSteamID() = 0;
virtual IRehldsHookRegistry_SV_TransferConsistencyInfo* SV_TransferConsistencyInfo() = 0;
};
struct RehldsFuncs_t {
@ -240,6 +245,7 @@ struct RehldsFuncs_t {
void(*MSG_WriteString)(sizebuf_t *sb, const char *s);
void*(*GetPluginApi)(const char *name);
void(*RegisterPluginApi)(const char *name, void *impl);
qboolean(*SV_FileInConsistencyList)(const char *filename, struct consistency_s **ppconsist);
};
class IRehldsApi {

View File

@ -191,7 +191,8 @@ RehldsFuncs_t g_RehldsApiFuncs =
&MSG_WriteShort_api,
&MSG_WriteString_api,
&Rehlds_GetPluginApi,
&Rehlds_RegisterPluginApi
&Rehlds_RegisterPluginApi,
&SV_FileInConsistencyList
};
sizebuf_t* EXT_FUNC GetNetMessage_api()
@ -349,6 +350,10 @@ CRehldsHookRegistry_Steam_GSGetSteamID* CRehldsHookchains::Steam_GSGetSteamID()
return &m_Steam_GSGetSteamID;
}
CRehldsHookRegistry_SV_TransferConsistencyInfo* CRehldsHookchains::SV_TransferConsistencyInfo() {
return &m_SV_TransferConsistencyInfo;
}
int EXT_FUNC CRehldsApi::GetMajorVersion()
{
return REHLDS_API_VERSION_MAJOR;

View File

@ -155,6 +155,10 @@ typedef IVoidHookChainRegistryImpl<sizebuf_t *> CRehldsHookRegistry_SV_WriteVoic
typedef IHookChainImpl<uint64> CRehldsHook_Steam_GSGetSteamID;
typedef IHookChainRegistryImpl<uint64> CRehldsHookRegistry_Steam_GSGetSteamID;
//SV_TransferConsistencyInfo hook
typedef IHookChainImpl<int> CRehldsHook_SV_TransferConsistencyInfo;
typedef IHookChainRegistryImpl<int> CRehldsHookRegistry_SV_TransferConsistencyInfo;
class CRehldsHookchains : public IRehldsHookchains {
public:
CRehldsHookRegistry_Steam_NotifyClientConnect m_Steam_NotifyClientConnect;
@ -188,6 +192,7 @@ public:
CRehldsHookRegistry_SV_ActivateServer m_SV_ActivateServer;
CRehldsHookRegistry_SV_WriteVoiceCodec m_SV_WriteVoiceCodec;
CRehldsHookRegistry_Steam_GSGetSteamID m_Steam_GSGetSteamID;
CRehldsHookRegistry_SV_TransferConsistencyInfo m_SV_TransferConsistencyInfo;
public:
virtual IRehldsHookRegistry_Steam_NotifyClientConnect* Steam_NotifyClientConnect();
@ -221,6 +226,7 @@ public:
virtual IRehldsHookRegistry_SV_ActivateServer* SV_ActivateServer();
virtual IRehldsHookRegistry_SV_WriteVoiceCodec* SV_WriteVoiceCodec();
virtual CRehldsHookRegistry_Steam_GSGetSteamID* Steam_GSGetSteamID();
virtual CRehldsHookRegistry_SV_TransferConsistencyInfo* SV_TransferConsistencyInfo();
};
extern CRehldsHookchains g_RehldsHookchains;