2
0
mirror of https://github.com/rehlds/rehlds.git synced 2025-03-13 05:50:20 +03:00

Add GetDispatch hook

This commit is contained in:
tmp64 2023-08-19 20:15:43 +07:00
parent f955b07b69
commit 32348af364
5 changed files with 21 additions and 0 deletions

View File

@ -677,6 +677,11 @@ qboolean EXT_FUNC Voice_SetClientListening(int iReceiver, int iSender, qboolean
}
DISPATCHFUNCTION GetDispatch(char *pname)
{
return g_RehldsHookchains.m_GetDispatch.callChain(GetDispatch_Internal, pname);
}
DISPATCHFUNCTION GetDispatch_Internal(char* pname)
{
int i;
DISPATCHFUNCTION pDispatch;

View File

@ -115,6 +115,7 @@ NOBODY void GameSetBackground(qboolean bNewSetting);
qboolean Voice_GetClientListening(int iReceiver, int iSender);
qboolean Voice_SetClientListening(int iReceiver, int iSender, qboolean bListen);
DISPATCHFUNCTION GetDispatch(char *pname);
DISPATCHFUNCTION GetDispatch_Internal(char* pname);
const char *FindAddressInTable(extensiondll_t *pDll, uint32 function);
uint32 FindNameInTable(extensiondll_t *pDll, const char *pName);
NOBODY const char *ConvertNameToLocalPlatform(const char *pchInName);

View File

@ -259,6 +259,10 @@ typedef IVoidHookChainRegistry<const char *> IRehldsHookRegistry_SV_ClientPrintf
typedef IHookChain<bool, edict_t*, edict_t*> IRehldsHook_SV_AllowPhysent;
typedef IHookChainRegistry<bool, edict_t*, edict_t*> IRehldsHookRegistry_SV_AllowPhysent;
//GetDispatch hook
typedef IHookChain<DISPATCHFUNCTION, char*> IRehldsHook_GetDispatch;
typedef IHookChainRegistry<DISPATCHFUNCTION, char*> IRehldsHookRegistry_GetDispatch;
class IRehldsHookchains {
public:
virtual ~IRehldsHookchains() { }
@ -318,6 +322,7 @@ public:
virtual IRehldsHookRegistry_SV_AddResource* SV_AddResource() = 0;
virtual IRehldsHookRegistry_SV_ClientPrintf* SV_ClientPrintf() = 0;
virtual IRehldsHookRegistry_SV_AllowPhysent* SV_AllowPhysent() = 0;
virtual IRehldsHookRegistry_GetDispatch* GetDispatch() = 0;
};
struct RehldsFuncs_t {

View File

@ -883,6 +883,10 @@ IRehldsHookRegistry_SV_AllowPhysent* CRehldsHookchains::SV_AllowPhysent() {
return &m_SV_AllowPhysent;
}
EXT_FUNC IRehldsHookRegistry_GetDispatch* CRehldsHookchains::GetDispatch() {
return &m_GetDispatch;
}
int EXT_FUNC CRehldsApi::GetMajorVersion()
{
return REHLDS_API_VERSION_MAJOR;

View File

@ -254,6 +254,10 @@ typedef IVoidHookChainRegistryImpl<const char*> CRehldsHookRegistry_SV_ClientPri
typedef IHookChainImpl<bool, edict_t*, edict_t*> CRehldsHook_SV_AllowPhysent;
typedef IHookChainRegistryImpl<bool, edict_t*, edict_t*> CRehldsHookRegistry_SV_AllowPhysent;
//GetDispatch hook
typedef IHookChainImpl<DISPATCHFUNCTION, char*> CRehldsHook_GetDispatch;
typedef IHookChainRegistryImpl<DISPATCHFUNCTION, char*> CRehldsHookRegistry_GetDispatch;
class CRehldsHookchains : public IRehldsHookchains {
public:
CRehldsHookRegistry_Steam_NotifyClientConnect m_Steam_NotifyClientConnect;
@ -311,6 +315,7 @@ public:
CRehldsHookRegistry_SV_AddResource m_SV_AddResource;
CRehldsHookRegistry_SV_ClientPrintf m_SV_ClientPrintf;
CRehldsHookRegistry_SV_AllowPhysent m_SV_AllowPhysent;
CRehldsHookRegistry_GetDispatch m_GetDispatch;
public:
EXT_FUNC virtual IRehldsHookRegistry_Steam_NotifyClientConnect* Steam_NotifyClientConnect();
@ -368,6 +373,7 @@ public:
EXT_FUNC virtual IRehldsHookRegistry_SV_AddResource* SV_AddResource();
EXT_FUNC virtual IRehldsHookRegistry_SV_ClientPrintf* SV_ClientPrintf();
EXT_FUNC virtual IRehldsHookRegistry_SV_AllowPhysent* SV_AllowPhysent();
EXT_FUNC virtual IRehldsHookRegistry_GetDispatch* GetDispatch();
};
extern CRehldsHookchains g_RehldsHookchains;