mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2025-01-14 07:38:00 +03:00
Refactoring implementation hookchain
Added align stack for some functions Update major version API
This commit is contained in:
parent
6115723666
commit
51313e9b2b
@ -103,7 +103,7 @@ int CBaseAnimating::LookupSequence(const char *label)
|
||||
|
||||
LINK_HOOK_CLASS_VOID_CHAIN2(CBaseAnimating, ResetSequenceInfo)
|
||||
|
||||
void CBaseAnimating::__API_HOOK(ResetSequenceInfo)()
|
||||
void EXT_ALIGN CBaseAnimating::__API_HOOK(ResetSequenceInfo)()
|
||||
{
|
||||
void *pmodel = GET_MODEL_PTR(ENT(pev));
|
||||
|
||||
|
@ -1541,7 +1541,7 @@ void CBasePlayer::PackDeadPlayerItems()
|
||||
|
||||
LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, GiveDefaultItems);
|
||||
|
||||
void CBasePlayer::__API_HOOK(GiveDefaultItems)()
|
||||
void EXT_ALIGN CBasePlayer::__API_HOOK(GiveDefaultItems)()
|
||||
{
|
||||
RemoveAllItems(FALSE);
|
||||
m_bHasPrimary = false;
|
||||
@ -1638,6 +1638,7 @@ void CBasePlayer::RemoveAllItems(BOOL removeSuit)
|
||||
|
||||
UpdateClientData();
|
||||
|
||||
// send Selected Weapon Message to our client
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgCurWeapon, NULL, pev);
|
||||
WRITE_BYTE(0);
|
||||
WRITE_BYTE(0);
|
||||
@ -3602,7 +3603,7 @@ void CBasePlayer::PlayerDeathThink()
|
||||
|
||||
LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, RoundRespawn);
|
||||
|
||||
void CBasePlayer::__API_VHOOK(RoundRespawn)()
|
||||
void EXT_ALIGN CBasePlayer::__API_VHOOK(RoundRespawn)()
|
||||
{
|
||||
m_canSwitchObserverModes = true;
|
||||
|
||||
@ -3948,7 +3949,7 @@ void CBasePlayer::HostageUsed()
|
||||
|
||||
LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, Jump);
|
||||
|
||||
void CBasePlayer::__API_VHOOK(Jump)()
|
||||
void EXT_ALIGN CBasePlayer::__API_VHOOK(Jump)()
|
||||
{
|
||||
if (pev->flags & FL_WATERJUMP)
|
||||
return;
|
||||
@ -4020,7 +4021,7 @@ NOXREF void FixPlayerCrouchStuck(edict_t *pPlayer)
|
||||
|
||||
LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, Duck);
|
||||
|
||||
void CBasePlayer::__API_VHOOK(Duck)()
|
||||
void EXT_ALIGN CBasePlayer::__API_VHOOK(Duck)()
|
||||
{
|
||||
if (pev->button & IN_DUCK)
|
||||
SetAnimation(PLAYER_WALK);
|
||||
@ -4161,7 +4162,7 @@ bool CBasePlayer::CanPlayerBuy(bool display)
|
||||
|
||||
LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, PreThink);
|
||||
|
||||
void CBasePlayer::__API_VHOOK(PreThink)()
|
||||
void EXT_ALIGN CBasePlayer::__API_VHOOK(PreThink)()
|
||||
{
|
||||
// These buttons have changed this frame
|
||||
int buttonsChanged = (m_afButtonLast ^ pev->button);
|
||||
@ -4737,7 +4738,7 @@ void CBasePlayer::UpdatePlayerSound()
|
||||
|
||||
LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, PostThink);
|
||||
|
||||
void CBasePlayer::__API_VHOOK(PostThink)()
|
||||
void EXT_ALIGN CBasePlayer::__API_VHOOK(PostThink)()
|
||||
{
|
||||
// intermission or finale
|
||||
if (g_fGameOver)
|
||||
@ -5084,7 +5085,7 @@ void CBasePlayer::SetScoreAttrib(CBasePlayer *dest)
|
||||
|
||||
LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, Spawn);
|
||||
|
||||
void CBasePlayer::__API_VHOOK(Spawn)()
|
||||
void EXT_ALIGN CBasePlayer::__API_VHOOK(Spawn)()
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -5427,7 +5428,7 @@ void CBasePlayer::__API_VHOOK(Spawn)()
|
||||
|
||||
LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, Precache);
|
||||
|
||||
void CBasePlayer::__API_VHOOK(Precache)()
|
||||
void EXT_ALIGN CBasePlayer::__API_VHOOK(Precache)()
|
||||
{
|
||||
#ifndef REGAMEDLL_FIXES
|
||||
// in the event that the player JUST spawned, and the level node graph
|
||||
@ -5950,7 +5951,7 @@ void CBasePlayer::ForceClientDllUpdate()
|
||||
|
||||
LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, ImpulseCommands);
|
||||
|
||||
void CBasePlayer::__API_VHOOK(ImpulseCommands)()
|
||||
void EXT_ALIGN CBasePlayer::__API_VHOOK(ImpulseCommands)()
|
||||
{
|
||||
TraceResult tr;
|
||||
|
||||
@ -6622,7 +6623,7 @@ LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, UpdateClientData);
|
||||
// Also called at start of demo recording and playback by
|
||||
// ForceClientDllUpdate to ensure the demo gets messages
|
||||
// reflecting all of the HUD state info.
|
||||
void CBasePlayer::__API_VHOOK(UpdateClientData)()
|
||||
void EXT_ALIGN CBasePlayer::__API_VHOOK(UpdateClientData)()
|
||||
{
|
||||
if (m_fInitHUD)
|
||||
{
|
||||
@ -6992,7 +6993,7 @@ void CBasePlayer::EnableControl(BOOL fControl)
|
||||
|
||||
LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, ResetMaxSpeed);
|
||||
|
||||
void CBasePlayer::__API_VHOOK(ResetMaxSpeed)()
|
||||
void EXT_ALIGN CBasePlayer::__API_VHOOK(ResetMaxSpeed)()
|
||||
{
|
||||
float speed;
|
||||
|
||||
|
@ -1782,7 +1782,7 @@ void CWeaponBox::__MAKE_VHOOK(Touch)(CBaseEntity *pOther)
|
||||
if (playerGrenades < maxGrenades && grenadeName != NULL)
|
||||
{
|
||||
bEmitSound = true;
|
||||
pPlayer->GiveNamedItem(grenadeName);
|
||||
pPlayer->GiveNamedItemEx(grenadeName);
|
||||
|
||||
// unlink this weapon from the box
|
||||
pItem = m_rgpPlayerItems[i]->m_pNext;
|
||||
|
@ -71,6 +71,9 @@
|
||||
#define FL_KILLME (1<<30) // This entity is marked for death -- This allows the engine to kill ents at the appropriate time
|
||||
#define FL_DORMANT (1<<31) // Entity is dormant, no updates to client
|
||||
|
||||
// SV_EmitSound2 flags
|
||||
#define SND_EMIT2_NOPAS (1<<0) // never to do check PAS
|
||||
#define SND_EMIT2_INVOKER (1<<1) // do not send to the client invoker
|
||||
|
||||
// Engine edict->spawnflags
|
||||
#define SF_NOTINDEATHMATCH 0x0800 // Do not spawn when deathmatch and loading entities from a file
|
||||
|
@ -37,6 +37,16 @@ public:
|
||||
virtual t_ret callOriginal(t_args... args) = 0;
|
||||
};
|
||||
|
||||
template<typename t_ret, typename t_class, typename ...t_args>
|
||||
class IHookChainClass {
|
||||
protected:
|
||||
virtual ~IHookChainClass() {}
|
||||
|
||||
public:
|
||||
virtual t_ret callNext(t_class *, t_args... args) = 0;
|
||||
virtual t_ret callOriginal(t_class *, t_args... args) = 0;
|
||||
};
|
||||
|
||||
template<typename ...t_args>
|
||||
class IVoidHookChain
|
||||
{
|
||||
@ -48,6 +58,17 @@ public:
|
||||
virtual void callOriginal(t_args... args) = 0;
|
||||
};
|
||||
|
||||
template<typename t_class, typename ...t_args>
|
||||
class IVoidHookChainClass
|
||||
{
|
||||
protected:
|
||||
virtual ~IVoidHookChainClass() {}
|
||||
|
||||
public:
|
||||
virtual void callNext(t_class *, t_args... args) = 0;
|
||||
virtual void callOriginal(t_class *, t_args... args) = 0;
|
||||
};
|
||||
|
||||
// Hook chain registry(for hooks [un]registration)
|
||||
template<typename t_ret, typename ...t_args>
|
||||
class IHookChainRegistry {
|
||||
|
@ -200,3 +200,4 @@
|
||||
#define C_DLLEXPORT extern "C" DLLEXPORT
|
||||
|
||||
#define EXT_FUNC /*FORCE_STACK_ALIGN*/
|
||||
#define EXT_ALIGN FORCE_STACK_ALIGN
|
||||
|
@ -33,132 +33,132 @@
|
||||
#include "player.h"
|
||||
#include "gamerules.h"
|
||||
|
||||
#define REGAMEDLL_API_VERSION_MAJOR 2
|
||||
#define REGAMEDLL_API_VERSION_MAJOR 3
|
||||
#define REGAMEDLL_API_VERSION_MINOR 1
|
||||
|
||||
// CBasePlayer::Spawn hook
|
||||
typedef IVoidHookChain<> IReGameHook_CBasePlayer_Spawn;
|
||||
typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_Spawn;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBasePlayer_Spawn;
|
||||
|
||||
// CBasePlayer::Precache hook
|
||||
typedef IVoidHookChain<> IReGameHook_CBasePlayer_Precache;
|
||||
typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_Precache;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBasePlayer_Precache;
|
||||
|
||||
// CBasePlayer::ObjectCaps hook
|
||||
typedef IHookChain<int> IReGameHook_CBasePlayer_ObjectCaps;
|
||||
typedef IHookChainClass<int, class CBasePlayer> IReGameHook_CBasePlayer_ObjectCaps;
|
||||
typedef IHookChainRegistryClass<int, class CBasePlayer> IReGameHookRegistry_CBasePlayer_ObjectCaps;
|
||||
|
||||
// CBasePlayer::Classify hook
|
||||
typedef IHookChain<int> IReGameHook_CBasePlayer_Classify;
|
||||
typedef IHookChainClass<int, class CBasePlayer> IReGameHook_CBasePlayer_Classify;
|
||||
typedef IHookChainRegistryClass<int, class CBasePlayer> IReGameHookRegistry_CBasePlayer_Classify;
|
||||
|
||||
// CBasePlayer::TraceAttack hook
|
||||
typedef IVoidHookChain<struct entvars_s *, float, Vector &, struct TraceResult *, int> IReGameHook_CBasePlayer_TraceAttack;
|
||||
typedef IVoidHookChainClass<class CBasePlayer, struct entvars_s *, float, Vector &, struct TraceResult *, int> IReGameHook_CBasePlayer_TraceAttack;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, struct entvars_s *, float, Vector &, struct TraceResult *, int> IReGameHookRegistry_CBasePlayer_TraceAttack;
|
||||
|
||||
// CBasePlayer::TakeDamage hook
|
||||
typedef IHookChain<int, struct entvars_s *, struct entvars_s *, float&, int> IReGameHook_CBasePlayer_TakeDamage;
|
||||
typedef IHookChainClass<int, class CBasePlayer, struct entvars_s *, struct entvars_s *, float&, int> IReGameHook_CBasePlayer_TakeDamage;
|
||||
typedef IHookChainRegistryClass<int, class CBasePlayer, struct entvars_s *, struct entvars_s *, float&, int> IReGameHookRegistry_CBasePlayer_TakeDamage;
|
||||
|
||||
// CBasePlayer::TakeHealth hook
|
||||
typedef IHookChain<int, float, int> IReGameHook_CBasePlayer_TakeHealth;
|
||||
typedef IHookChainClass<int, class CBasePlayer, float, int> IReGameHook_CBasePlayer_TakeHealth;
|
||||
typedef IHookChainRegistryClass<int, class CBasePlayer, float, int> IReGameHookRegistry_CBasePlayer_TakeHealth;
|
||||
|
||||
// CBasePlayer::Killed hook
|
||||
typedef IVoidHookChain<struct entvars_s *, int> IReGameHook_CBasePlayer_Killed;
|
||||
typedef IVoidHookChainClass<class CBasePlayer, struct entvars_s *, int> IReGameHook_CBasePlayer_Killed;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, struct entvars_s *, int> IReGameHookRegistry_CBasePlayer_Killed;
|
||||
|
||||
// CBasePlayer::AddPoints hook
|
||||
typedef IVoidHookChain<int, BOOL> IReGameHook_CBasePlayer_AddPoints;
|
||||
typedef IVoidHookChainClass<class CBasePlayer, int, BOOL> IReGameHook_CBasePlayer_AddPoints;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, int, BOOL> IReGameHookRegistry_CBasePlayer_AddPoints;
|
||||
|
||||
// CBasePlayer::AddPointsToTeam hook
|
||||
typedef IVoidHookChain<int, BOOL> IReGameHook_CBasePlayer_AddPointsToTeam;
|
||||
typedef IVoidHookChainClass<class CBasePlayer, int, BOOL> IReGameHook_CBasePlayer_AddPointsToTeam;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, int, BOOL> IReGameHookRegistry_CBasePlayer_AddPointsToTeam;
|
||||
|
||||
// CBasePlayer::AddPlayerItem hook
|
||||
typedef IHookChain<BOOL, class CBasePlayerItem *> IReGameHook_CBasePlayer_AddPlayerItem;
|
||||
typedef IHookChainClass<BOOL, class CBasePlayer, class CBasePlayerItem *> IReGameHook_CBasePlayer_AddPlayerItem;
|
||||
typedef IHookChainRegistryClass<BOOL, class CBasePlayer, class CBasePlayerItem *> IReGameHookRegistry_CBasePlayer_AddPlayerItem;
|
||||
|
||||
// CBasePlayer::RemovePlayerItem hook
|
||||
typedef IHookChain<BOOL, class CBasePlayerItem *> IReGameHook_CBasePlayer_RemovePlayerItem;
|
||||
typedef IHookChainClass<BOOL, class CBasePlayer, class CBasePlayerItem *> IReGameHook_CBasePlayer_RemovePlayerItem;
|
||||
typedef IHookChainRegistryClass<BOOL, class CBasePlayer, class CBasePlayerItem *> IReGameHookRegistry_CBasePlayer_RemovePlayerItem;
|
||||
|
||||
// CBasePlayer::GiveAmmo hook
|
||||
typedef IHookChain<int, int , char *, int> IReGameHook_CBasePlayer_GiveAmmo;
|
||||
typedef IHookChainClass<int, class CBasePlayer, int , char *, int> IReGameHook_CBasePlayer_GiveAmmo;
|
||||
typedef IHookChainRegistryClass<int, class CBasePlayer, int , char *, int> IReGameHookRegistry_CBasePlayer_GiveAmmo;
|
||||
|
||||
// CBasePlayer::ResetMaxSpeed hook
|
||||
typedef IVoidHookChain<> IReGameHook_CBasePlayer_ResetMaxSpeed;
|
||||
typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_ResetMaxSpeed;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBasePlayer_ResetMaxSpeed;
|
||||
|
||||
// CBasePlayer::Jump hook
|
||||
typedef IVoidHookChain<> IReGameHook_CBasePlayer_Jump;
|
||||
typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_Jump;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBasePlayer_Jump;
|
||||
|
||||
// CBasePlayer::Duck hook
|
||||
typedef IVoidHookChain<> IReGameHook_CBasePlayer_Duck;
|
||||
typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_Duck;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBasePlayer_Duck;
|
||||
|
||||
// CBasePlayer::PreThink hook
|
||||
typedef IVoidHookChain<> IReGameHook_CBasePlayer_PreThink;
|
||||
typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_PreThink;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBasePlayer_PreThink;
|
||||
|
||||
// CBasePlayer::PostThink hook
|
||||
typedef IVoidHookChain<> IReGameHook_CBasePlayer_PostThink;
|
||||
typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_PostThink;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBasePlayer_PostThink;
|
||||
|
||||
// CBasePlayer::UpdateClientData hook
|
||||
typedef IVoidHookChain<> IReGameHook_CBasePlayer_UpdateClientData;
|
||||
typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_UpdateClientData;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBasePlayer_UpdateClientData;
|
||||
|
||||
// CBasePlayer::ImpulseCommands hook
|
||||
typedef IVoidHookChain<> IReGameHook_CBasePlayer_ImpulseCommands;
|
||||
typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_ImpulseCommands;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBasePlayer_ImpulseCommands;
|
||||
|
||||
// CBasePlayer::RoundRespawn hook
|
||||
typedef IVoidHookChain<> IReGameHook_CBasePlayer_RoundRespawn;
|
||||
typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_RoundRespawn;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBasePlayer_RoundRespawn;
|
||||
|
||||
// CBasePlayer::Blind hook
|
||||
typedef IVoidHookChain<float, float, float, int> IReGameHook_CBasePlayer_Blind;
|
||||
typedef IVoidHookChainClass<class CBasePlayer, float, float, float, int> IReGameHook_CBasePlayer_Blind;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, float, float, float, int> IReGameHookRegistry_CBasePlayer_Blind;
|
||||
|
||||
|
||||
// CBasePlayer::Observer_IsValidTarget hook
|
||||
typedef IHookChain<class CBasePlayer *, int, bool> IReGameHook_CBasePlayer_Observer_IsValidTarget;
|
||||
typedef IHookChainClass<class CBasePlayer *, class CBasePlayer, int, bool> IReGameHook_CBasePlayer_Observer_IsValidTarget;
|
||||
typedef IHookChainRegistryClass<class CBasePlayer *, class CBasePlayer, int, bool> IReGameHookRegistry_CBasePlayer_Observer_IsValidTarget;
|
||||
|
||||
// CBasePlayer::SetAnimation hook
|
||||
typedef IVoidHookChain<PLAYER_ANIM> IReGameHook_CBasePlayer_SetAnimation;
|
||||
typedef IVoidHookChainClass<class CBasePlayer, PLAYER_ANIM> IReGameHook_CBasePlayer_SetAnimation;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, PLAYER_ANIM> IReGameHookRegistry_CBasePlayer_SetAnimation;
|
||||
|
||||
// CBasePlayer::GiveDefaultItems hook
|
||||
typedef IVoidHookChain<> IReGameHook_CBasePlayer_GiveDefaultItems;
|
||||
typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_GiveDefaultItems;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBasePlayer_GiveDefaultItems;
|
||||
|
||||
// CBasePlayer::GiveNamedItem hook
|
||||
typedef IVoidHookChain<const char *> IReGameHook_CBasePlayer_GiveNamedItem;
|
||||
typedef IVoidHookChainClass<class CBasePlayer, const char *> IReGameHook_CBasePlayer_GiveNamedItem;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, const char *> IReGameHookRegistry_CBasePlayer_GiveNamedItem;
|
||||
|
||||
// CBasePlayer::AddAccount hook
|
||||
typedef IVoidHookChain<int, RewardType, bool> IReGameHook_CBasePlayer_AddAccount;
|
||||
typedef IVoidHookChainClass<class CBasePlayer, int, RewardType, bool> IReGameHook_CBasePlayer_AddAccount;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, int, RewardType, bool> IReGameHookRegistry_CBasePlayer_AddAccount;
|
||||
|
||||
// CBasePlayer::GiveShield hook
|
||||
typedef IVoidHookChain<bool> IReGameHook_CBasePlayer_GiveShield;
|
||||
typedef IVoidHookChainClass<class CBasePlayer, bool> IReGameHook_CBasePlayer_GiveShield;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, bool> IReGameHookRegistry_CBasePlayer_GiveShield;
|
||||
|
||||
// CBasePlayer:SetClientUserInfoModel hook
|
||||
typedef IVoidHookChain<char *, char *> IReGameHook_CBasePlayer_SetClientUserInfoModel;
|
||||
typedef IVoidHookChainClass<class CBasePlayer, char *, char *> IReGameHook_CBasePlayer_SetClientUserInfoModel;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, char *, char *> IReGameHookRegistry_CBasePlayer_SetClientUserInfoModel;
|
||||
|
||||
// CBasePlayer:SetClientUserInfoName hook
|
||||
typedef IVoidHookChain<char *, char *> IReGameHook_CBasePlayer_SetClientUserInfoName;
|
||||
typedef IVoidHookChainClass<class CBasePlayer, char *, char *> IReGameHook_CBasePlayer_SetClientUserInfoName;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, char *, char *> IReGameHookRegistry_CBasePlayer_SetClientUserInfoName;
|
||||
|
||||
// CBaseAnimating::ResetSequenceInfo hook
|
||||
typedef IVoidHookChain<> IReGameHook_CBaseAnimating_ResetSequenceInfo;
|
||||
typedef IVoidHookChainClass<class CBaseAnimating> IReGameHook_CBaseAnimating_ResetSequenceInfo;
|
||||
typedef IVoidHookChainRegistryClass<class CBaseAnimating> IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo;
|
||||
|
||||
|
||||
@ -339,6 +339,7 @@ public:
|
||||
virtual IReGameHookRegistry_CBasePlayer_AddAccount* CBasePlayer_AddAccount() = 0;
|
||||
virtual IReGameHookRegistry_CBasePlayer_GiveShield* CBasePlayer_GiveShield() = 0;
|
||||
virtual IReGameHookRegistry_CBasePlayer_SetClientUserInfoModel* CBasePlayer_SetClientUserInfoModel() = 0;
|
||||
virtual IReGameHookRegistry_CBasePlayer_SetClientUserInfoName* CBasePlayer_SetClientUserInfoName() = 0;
|
||||
virtual IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo* CBaseAnimating_ResetSequenceInfo() = 0;
|
||||
|
||||
virtual IReGameHookRegistry_GetForceCamera* GetForceCamera() = 0;
|
||||
@ -377,9 +378,6 @@ public:
|
||||
virtual IReGameHookRegistry_CSGameRules_ChangeLevel* CSGameRules_ChangeLevel() = 0;
|
||||
virtual IReGameHookRegistry_CSGameRules_GoToIntermission* CSGameRules_GoToIntermission() = 0;
|
||||
virtual IReGameHookRegistry_CSGameRules_BalanceTeams* CSGameRules_BalanceTeams() = 0;
|
||||
|
||||
// later sort them on the positions and change the major version
|
||||
virtual IReGameHookRegistry_CBasePlayer_SetClientUserInfoName* CBasePlayer_SetClientUserInfoName() = 0;
|
||||
};
|
||||
|
||||
struct ReGameFuncs_t {
|
||||
|
@ -49,10 +49,12 @@ class CCSMonster: public CCSToggle {};
|
||||
class CCSWeaponBox: public CCSEntity {};
|
||||
class CCSArmoury: public CCSEntity {};
|
||||
|
||||
#pragma warning(disable:4351) // new behavior: elements of array 'CCSPlayer::m_szModel' will be default initialized
|
||||
class CCSPlayer: public CCSMonster {
|
||||
public:
|
||||
CCSPlayer() : m_szModel() {}
|
||||
CCSPlayer()
|
||||
{
|
||||
m_szModel[0] = '\0';
|
||||
}
|
||||
|
||||
virtual bool IsConnected() const;
|
||||
virtual void SetAnimation(PLAYER_ANIM playerAnim);
|
||||
|
@ -185,6 +185,10 @@ typedef IVoidHookChainRegistry<> IRehldsHookRegistry_SV_Spawn_f;
|
||||
typedef IHookChain<int, enum sv_delta_s, IGameClient *, struct packet_entities_s *, struct sizebuf_s *> IRehldsHook_SV_CreatePacketEntities;
|
||||
typedef IHookChainRegistry<int, enum sv_delta_s, IGameClient *, struct packet_entities_s *, struct sizebuf_s *> IRehldsHookRegistry_SV_CreatePacketEntities;
|
||||
|
||||
//SV_EmitSound2 hook
|
||||
typedef IHookChain<bool, edict_t *, IGameClient *, int, const char*, float, float, int, int, int, const float*> IRehldsHook_SV_EmitSound2;
|
||||
typedef IHookChainRegistry<bool, edict_t *, IGameClient *, int, const char*, float, float, int, int, int, const float*> IRehldsHookRegistry_SV_EmitSound2;
|
||||
|
||||
class IRehldsHookchains {
|
||||
public:
|
||||
virtual ~IRehldsHookchains() { }
|
||||
@ -226,6 +230,7 @@ public:
|
||||
virtual IRehldsHookRegistry_SV_EstablishTimeBase* SV_EstablishTimeBase() = 0;
|
||||
virtual IRehldsHookRegistry_SV_Spawn_f* SV_Spawn_f() = 0;
|
||||
virtual IRehldsHookRegistry_SV_CreatePacketEntities* SV_CreatePacketEntities() = 0;
|
||||
virtual IRehldsHookRegistry_SV_EmitSound2* SV_EmitSound2() = 0;
|
||||
};
|
||||
|
||||
struct RehldsFuncs_t {
|
||||
@ -273,6 +278,8 @@ struct RehldsFuncs_t {
|
||||
qboolean(*SV_FileInConsistencyList)(const char *filename, struct consistency_s **ppconsist);
|
||||
qboolean(*Steam_NotifyClientConnect)(IGameClient *cl, const void *pvSteam2Key, unsigned int ucbSteam2Key);
|
||||
void(*Steam_NotifyClientDisconnect)(IGameClient* cl);
|
||||
void(*SV_StartSound)(int recipients, edict_t *entity, int channel, const char *sample, int volume, float attenuation, int flags, int pitch);
|
||||
bool(*SV_EmitSound2)(edict_t *entity, IGameClient *receiver, int channel, const char *sample, float volume, float attenuation, int flags, int pitch, int emitFlags, const float *pOrigin);
|
||||
};
|
||||
|
||||
class IRehldsApi {
|
||||
|
@ -37,6 +37,16 @@ public:
|
||||
virtual t_ret callOriginal(t_args... args) = 0;
|
||||
};
|
||||
|
||||
template<typename t_ret, typename t_class, typename ...t_args>
|
||||
class IHookChainClass {
|
||||
protected:
|
||||
virtual ~IHookChainClass() {}
|
||||
|
||||
public:
|
||||
virtual t_ret callNext(t_class *, t_args... args) = 0;
|
||||
virtual t_ret callOriginal(t_class *, t_args... args) = 0;
|
||||
};
|
||||
|
||||
template<typename ...t_args>
|
||||
class IVoidHookChain
|
||||
{
|
||||
@ -48,6 +58,17 @@ public:
|
||||
virtual void callOriginal(t_args... args) = 0;
|
||||
};
|
||||
|
||||
template<typename t_class, typename ...t_args>
|
||||
class IVoidHookChainClass
|
||||
{
|
||||
protected:
|
||||
virtual ~IVoidHookChainClass() {}
|
||||
|
||||
public:
|
||||
virtual void callNext(t_class *, t_args... args) = 0;
|
||||
virtual void callOriginal(t_class *, t_args... args) = 0;
|
||||
};
|
||||
|
||||
// Hook chain registry(for hooks [un]registration)
|
||||
template<typename t_ret, typename ...t_args>
|
||||
class IHookChainRegistry {
|
||||
|
@ -200,3 +200,4 @@
|
||||
#define C_DLLEXPORT extern "C" DLLEXPORT
|
||||
|
||||
#define EXT_FUNC /*FORCE_STACK_ALIGN*/
|
||||
#define EXT_ALIGN FORCE_STACK_ALIGN
|
||||
|
@ -33,132 +33,132 @@
|
||||
#include "player.h"
|
||||
#include "gamerules.h"
|
||||
|
||||
#define REGAMEDLL_API_VERSION_MAJOR 2
|
||||
#define REGAMEDLL_API_VERSION_MAJOR 3
|
||||
#define REGAMEDLL_API_VERSION_MINOR 1
|
||||
|
||||
// CBasePlayer::Spawn hook
|
||||
typedef IVoidHookChain<> IReGameHook_CBasePlayer_Spawn;
|
||||
typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_Spawn;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBasePlayer_Spawn;
|
||||
|
||||
// CBasePlayer::Precache hook
|
||||
typedef IVoidHookChain<> IReGameHook_CBasePlayer_Precache;
|
||||
typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_Precache;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBasePlayer_Precache;
|
||||
|
||||
// CBasePlayer::ObjectCaps hook
|
||||
typedef IHookChain<int> IReGameHook_CBasePlayer_ObjectCaps;
|
||||
typedef IHookChainClass<int, class CBasePlayer> IReGameHook_CBasePlayer_ObjectCaps;
|
||||
typedef IHookChainRegistryClass<int, class CBasePlayer> IReGameHookRegistry_CBasePlayer_ObjectCaps;
|
||||
|
||||
// CBasePlayer::Classify hook
|
||||
typedef IHookChain<int> IReGameHook_CBasePlayer_Classify;
|
||||
typedef IHookChainClass<int, class CBasePlayer> IReGameHook_CBasePlayer_Classify;
|
||||
typedef IHookChainRegistryClass<int, class CBasePlayer> IReGameHookRegistry_CBasePlayer_Classify;
|
||||
|
||||
// CBasePlayer::TraceAttack hook
|
||||
typedef IVoidHookChain<struct entvars_s *, float, Vector &, struct TraceResult *, int> IReGameHook_CBasePlayer_TraceAttack;
|
||||
typedef IVoidHookChainClass<class CBasePlayer, struct entvars_s *, float, Vector &, struct TraceResult *, int> IReGameHook_CBasePlayer_TraceAttack;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, struct entvars_s *, float, Vector &, struct TraceResult *, int> IReGameHookRegistry_CBasePlayer_TraceAttack;
|
||||
|
||||
// CBasePlayer::TakeDamage hook
|
||||
typedef IHookChain<int, struct entvars_s *, struct entvars_s *, float&, int> IReGameHook_CBasePlayer_TakeDamage;
|
||||
typedef IHookChainClass<int, class CBasePlayer, struct entvars_s *, struct entvars_s *, float&, int> IReGameHook_CBasePlayer_TakeDamage;
|
||||
typedef IHookChainRegistryClass<int, class CBasePlayer, struct entvars_s *, struct entvars_s *, float&, int> IReGameHookRegistry_CBasePlayer_TakeDamage;
|
||||
|
||||
// CBasePlayer::TakeHealth hook
|
||||
typedef IHookChain<int, float, int> IReGameHook_CBasePlayer_TakeHealth;
|
||||
typedef IHookChainClass<int, class CBasePlayer, float, int> IReGameHook_CBasePlayer_TakeHealth;
|
||||
typedef IHookChainRegistryClass<int, class CBasePlayer, float, int> IReGameHookRegistry_CBasePlayer_TakeHealth;
|
||||
|
||||
// CBasePlayer::Killed hook
|
||||
typedef IVoidHookChain<struct entvars_s *, int> IReGameHook_CBasePlayer_Killed;
|
||||
typedef IVoidHookChainClass<class CBasePlayer, struct entvars_s *, int> IReGameHook_CBasePlayer_Killed;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, struct entvars_s *, int> IReGameHookRegistry_CBasePlayer_Killed;
|
||||
|
||||
// CBasePlayer::AddPoints hook
|
||||
typedef IVoidHookChain<int, BOOL> IReGameHook_CBasePlayer_AddPoints;
|
||||
typedef IVoidHookChainClass<class CBasePlayer, int, BOOL> IReGameHook_CBasePlayer_AddPoints;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, int, BOOL> IReGameHookRegistry_CBasePlayer_AddPoints;
|
||||
|
||||
// CBasePlayer::AddPointsToTeam hook
|
||||
typedef IVoidHookChain<int, BOOL> IReGameHook_CBasePlayer_AddPointsToTeam;
|
||||
typedef IVoidHookChainClass<class CBasePlayer, int, BOOL> IReGameHook_CBasePlayer_AddPointsToTeam;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, int, BOOL> IReGameHookRegistry_CBasePlayer_AddPointsToTeam;
|
||||
|
||||
// CBasePlayer::AddPlayerItem hook
|
||||
typedef IHookChain<BOOL, class CBasePlayerItem *> IReGameHook_CBasePlayer_AddPlayerItem;
|
||||
typedef IHookChainClass<BOOL, class CBasePlayer, class CBasePlayerItem *> IReGameHook_CBasePlayer_AddPlayerItem;
|
||||
typedef IHookChainRegistryClass<BOOL, class CBasePlayer, class CBasePlayerItem *> IReGameHookRegistry_CBasePlayer_AddPlayerItem;
|
||||
|
||||
// CBasePlayer::RemovePlayerItem hook
|
||||
typedef IHookChain<BOOL, class CBasePlayerItem *> IReGameHook_CBasePlayer_RemovePlayerItem;
|
||||
typedef IHookChainClass<BOOL, class CBasePlayer, class CBasePlayerItem *> IReGameHook_CBasePlayer_RemovePlayerItem;
|
||||
typedef IHookChainRegistryClass<BOOL, class CBasePlayer, class CBasePlayerItem *> IReGameHookRegistry_CBasePlayer_RemovePlayerItem;
|
||||
|
||||
// CBasePlayer::GiveAmmo hook
|
||||
typedef IHookChain<int, int , char *, int> IReGameHook_CBasePlayer_GiveAmmo;
|
||||
typedef IHookChainClass<int, class CBasePlayer, int , char *, int> IReGameHook_CBasePlayer_GiveAmmo;
|
||||
typedef IHookChainRegistryClass<int, class CBasePlayer, int , char *, int> IReGameHookRegistry_CBasePlayer_GiveAmmo;
|
||||
|
||||
// CBasePlayer::ResetMaxSpeed hook
|
||||
typedef IVoidHookChain<> IReGameHook_CBasePlayer_ResetMaxSpeed;
|
||||
typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_ResetMaxSpeed;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBasePlayer_ResetMaxSpeed;
|
||||
|
||||
// CBasePlayer::Jump hook
|
||||
typedef IVoidHookChain<> IReGameHook_CBasePlayer_Jump;
|
||||
typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_Jump;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBasePlayer_Jump;
|
||||
|
||||
// CBasePlayer::Duck hook
|
||||
typedef IVoidHookChain<> IReGameHook_CBasePlayer_Duck;
|
||||
typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_Duck;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBasePlayer_Duck;
|
||||
|
||||
// CBasePlayer::PreThink hook
|
||||
typedef IVoidHookChain<> IReGameHook_CBasePlayer_PreThink;
|
||||
typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_PreThink;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBasePlayer_PreThink;
|
||||
|
||||
// CBasePlayer::PostThink hook
|
||||
typedef IVoidHookChain<> IReGameHook_CBasePlayer_PostThink;
|
||||
typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_PostThink;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBasePlayer_PostThink;
|
||||
|
||||
// CBasePlayer::UpdateClientData hook
|
||||
typedef IVoidHookChain<> IReGameHook_CBasePlayer_UpdateClientData;
|
||||
typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_UpdateClientData;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBasePlayer_UpdateClientData;
|
||||
|
||||
// CBasePlayer::ImpulseCommands hook
|
||||
typedef IVoidHookChain<> IReGameHook_CBasePlayer_ImpulseCommands;
|
||||
typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_ImpulseCommands;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBasePlayer_ImpulseCommands;
|
||||
|
||||
// CBasePlayer::RoundRespawn hook
|
||||
typedef IVoidHookChain<> IReGameHook_CBasePlayer_RoundRespawn;
|
||||
typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_RoundRespawn;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBasePlayer_RoundRespawn;
|
||||
|
||||
// CBasePlayer::Blind hook
|
||||
typedef IVoidHookChain<float, float, float, int> IReGameHook_CBasePlayer_Blind;
|
||||
typedef IVoidHookChainClass<class CBasePlayer, float, float, float, int> IReGameHook_CBasePlayer_Blind;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, float, float, float, int> IReGameHookRegistry_CBasePlayer_Blind;
|
||||
|
||||
|
||||
// CBasePlayer::Observer_IsValidTarget hook
|
||||
typedef IHookChain<class CBasePlayer *, int, bool> IReGameHook_CBasePlayer_Observer_IsValidTarget;
|
||||
typedef IHookChainClass<class CBasePlayer *, class CBasePlayer, int, bool> IReGameHook_CBasePlayer_Observer_IsValidTarget;
|
||||
typedef IHookChainRegistryClass<class CBasePlayer *, class CBasePlayer, int, bool> IReGameHookRegistry_CBasePlayer_Observer_IsValidTarget;
|
||||
|
||||
// CBasePlayer::SetAnimation hook
|
||||
typedef IVoidHookChain<PLAYER_ANIM> IReGameHook_CBasePlayer_SetAnimation;
|
||||
typedef IVoidHookChainClass<class CBasePlayer, PLAYER_ANIM> IReGameHook_CBasePlayer_SetAnimation;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, PLAYER_ANIM> IReGameHookRegistry_CBasePlayer_SetAnimation;
|
||||
|
||||
// CBasePlayer::GiveDefaultItems hook
|
||||
typedef IVoidHookChain<> IReGameHook_CBasePlayer_GiveDefaultItems;
|
||||
typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_GiveDefaultItems;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBasePlayer_GiveDefaultItems;
|
||||
|
||||
// CBasePlayer::GiveNamedItem hook
|
||||
typedef IVoidHookChain<const char *> IReGameHook_CBasePlayer_GiveNamedItem;
|
||||
typedef IVoidHookChainClass<class CBasePlayer, const char *> IReGameHook_CBasePlayer_GiveNamedItem;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, const char *> IReGameHookRegistry_CBasePlayer_GiveNamedItem;
|
||||
|
||||
// CBasePlayer::AddAccount hook
|
||||
typedef IVoidHookChain<int, RewardType, bool> IReGameHook_CBasePlayer_AddAccount;
|
||||
typedef IVoidHookChainClass<class CBasePlayer, int, RewardType, bool> IReGameHook_CBasePlayer_AddAccount;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, int, RewardType, bool> IReGameHookRegistry_CBasePlayer_AddAccount;
|
||||
|
||||
// CBasePlayer::GiveShield hook
|
||||
typedef IVoidHookChain<bool> IReGameHook_CBasePlayer_GiveShield;
|
||||
typedef IVoidHookChainClass<class CBasePlayer, bool> IReGameHook_CBasePlayer_GiveShield;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, bool> IReGameHookRegistry_CBasePlayer_GiveShield;
|
||||
|
||||
// CBasePlayer:SetClientUserInfoModel hook
|
||||
typedef IVoidHookChain<char *, char *> IReGameHook_CBasePlayer_SetClientUserInfoModel;
|
||||
typedef IVoidHookChainClass<class CBasePlayer, char *, char *> IReGameHook_CBasePlayer_SetClientUserInfoModel;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, char *, char *> IReGameHookRegistry_CBasePlayer_SetClientUserInfoModel;
|
||||
|
||||
// CBasePlayer:SetClientUserInfoName hook
|
||||
typedef IVoidHookChain<char *, char *> IReGameHook_CBasePlayer_SetClientUserInfoName;
|
||||
typedef IVoidHookChainClass<class CBasePlayer, char *, char *> IReGameHook_CBasePlayer_SetClientUserInfoName;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, char *, char *> IReGameHookRegistry_CBasePlayer_SetClientUserInfoName;
|
||||
|
||||
// CBaseAnimating::ResetSequenceInfo hook
|
||||
typedef IVoidHookChain<> IReGameHook_CBaseAnimating_ResetSequenceInfo;
|
||||
typedef IVoidHookChainClass<class CBaseAnimating> IReGameHook_CBaseAnimating_ResetSequenceInfo;
|
||||
typedef IVoidHookChainRegistryClass<class CBaseAnimating> IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo;
|
||||
|
||||
|
||||
@ -339,6 +339,7 @@ public:
|
||||
virtual IReGameHookRegistry_CBasePlayer_AddAccount* CBasePlayer_AddAccount() = 0;
|
||||
virtual IReGameHookRegistry_CBasePlayer_GiveShield* CBasePlayer_GiveShield() = 0;
|
||||
virtual IReGameHookRegistry_CBasePlayer_SetClientUserInfoModel* CBasePlayer_SetClientUserInfoModel() = 0;
|
||||
virtual IReGameHookRegistry_CBasePlayer_SetClientUserInfoName* CBasePlayer_SetClientUserInfoName() = 0;
|
||||
virtual IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo* CBaseAnimating_ResetSequenceInfo() = 0;
|
||||
|
||||
virtual IReGameHookRegistry_GetForceCamera* GetForceCamera() = 0;
|
||||
@ -377,9 +378,6 @@ public:
|
||||
virtual IReGameHookRegistry_CSGameRules_ChangeLevel* CSGameRules_ChangeLevel() = 0;
|
||||
virtual IReGameHookRegistry_CSGameRules_GoToIntermission* CSGameRules_GoToIntermission() = 0;
|
||||
virtual IReGameHookRegistry_CSGameRules_BalanceTeams* CSGameRules_BalanceTeams() = 0;
|
||||
|
||||
// later sort them on the positions and change the major version
|
||||
virtual IReGameHookRegistry_CBasePlayer_SetClientUserInfoName* CBasePlayer_SetClientUserInfoName() = 0;
|
||||
};
|
||||
|
||||
struct ReGameFuncs_t {
|
||||
|
@ -49,10 +49,12 @@ class CCSMonster: public CCSToggle {};
|
||||
class CCSWeaponBox: public CCSEntity {};
|
||||
class CCSArmoury: public CCSEntity {};
|
||||
|
||||
#pragma warning(disable:4351) // new behavior: elements of array 'CCSPlayer::m_szModel' will be default initialized
|
||||
class CCSPlayer: public CCSMonster {
|
||||
public:
|
||||
CCSPlayer() : m_szModel() {}
|
||||
CCSPlayer()
|
||||
{
|
||||
m_szModel[0] = '\0';
|
||||
}
|
||||
|
||||
virtual bool IsConnected() const;
|
||||
virtual void SetAnimation(PLAYER_ANIM playerAnim);
|
||||
|
@ -68,12 +68,12 @@ private:
|
||||
|
||||
// Implementation for chains in modules
|
||||
template<typename t_ret, typename t_class, typename ...t_args>
|
||||
class IHookChainClassImpl : public IHookChain<t_ret, t_args...> {
|
||||
class IHookChainClassImpl : public IHookChainClass<t_ret, t_class, t_args...> {
|
||||
public:
|
||||
typedef t_ret(*hookfunc_t)(IHookChain<t_ret, t_args...>*, t_class *, t_args...);
|
||||
typedef t_ret(*hookfunc_t)(IHookChainClass<t_ret, t_class, t_args...>*, t_class *, t_args...);
|
||||
typedef t_ret(t_class::*origfunc_t)(t_args...);
|
||||
|
||||
IHookChainClassImpl(void** hooks, origfunc_t orig, t_class *object) : m_Hooks(hooks), m_OriginalFunc(orig), m_Object(object)
|
||||
IHookChainClassImpl(void** hooks, origfunc_t orig) : m_Hooks(hooks), m_OriginalFunc(orig)
|
||||
{
|
||||
if (orig == NULL)
|
||||
regamedll_syserror("Non-void HookChain without original function.");
|
||||
@ -81,25 +81,24 @@ public:
|
||||
|
||||
virtual ~IHookChainClassImpl() {}
|
||||
|
||||
virtual t_ret callNext(t_args... args) {
|
||||
virtual t_ret callNext(t_class *object, t_args... args) {
|
||||
hookfunc_t nexthook = (hookfunc_t)m_Hooks[0];
|
||||
|
||||
if (nexthook)
|
||||
{
|
||||
IHookChainClassImpl nextChain(m_Hooks + 1, m_OriginalFunc, m_Object);
|
||||
return nexthook(&nextChain, m_Object, args...);
|
||||
IHookChainClassImpl nextChain(m_Hooks + 1, m_OriginalFunc);
|
||||
return nexthook(&nextChain, object, args...);
|
||||
}
|
||||
|
||||
return (m_Object->*m_OriginalFunc)(args...);
|
||||
return (object->*m_OriginalFunc)(args...);
|
||||
}
|
||||
|
||||
virtual t_ret callOriginal(t_args... args) {
|
||||
return (m_Object->*m_OriginalFunc)(args...);
|
||||
virtual t_ret callOriginal(t_class *object, t_args... args) {
|
||||
return (object->*m_OriginalFunc)(args...);
|
||||
}
|
||||
|
||||
private:
|
||||
void** m_Hooks;
|
||||
t_class *m_Object;
|
||||
origfunc_t m_OriginalFunc;
|
||||
};
|
||||
|
||||
@ -211,30 +210,30 @@ private:
|
||||
|
||||
// Implementation for void chains in modules
|
||||
template<typename t_class, typename ...t_args>
|
||||
class IVoidHookChainClassImpl : public IVoidHookChain<t_args...> {
|
||||
class IVoidHookChainClassImpl : public IVoidHookChainClass<t_class, t_args...> {
|
||||
public:
|
||||
typedef void(*hookfunc_t)(IVoidHookChain<t_args...>*, t_class *, t_args...);
|
||||
typedef void(*hookfunc_t)(IVoidHookChainClass<t_class, t_args...>*, t_class *, t_args...);
|
||||
typedef void(t_class::*origfunc_t)(t_args...);
|
||||
|
||||
IVoidHookChainClassImpl(void** hooks, origfunc_t orig, t_class *object) : m_Hooks(hooks), m_OriginalFunc(orig), m_Object(object) {}
|
||||
IVoidHookChainClassImpl(void** hooks, origfunc_t orig) : m_Hooks(hooks), m_OriginalFunc(orig) {}
|
||||
virtual ~IVoidHookChainClassImpl() {}
|
||||
|
||||
virtual void callNext(t_args... args) {
|
||||
virtual void callNext(t_class *object, t_args... args) {
|
||||
hookfunc_t nexthook = (hookfunc_t)m_Hooks[0];
|
||||
|
||||
if (nexthook)
|
||||
{
|
||||
IVoidHookChainClassImpl nextChain(m_Hooks + 1, m_OriginalFunc, m_Object);
|
||||
nexthook(&nextChain, m_Object, args...);
|
||||
IVoidHookChainClassImpl nextChain(m_Hooks + 1, m_OriginalFunc);
|
||||
nexthook(&nextChain, object, args...);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_OriginalFunc && m_Object)
|
||||
(m_Object->*m_OriginalFunc)(args...);
|
||||
if (m_OriginalFunc && object)
|
||||
(object->*m_OriginalFunc)(args...);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void callOriginal(t_args... args) {
|
||||
virtual void callOriginal(t_class *object, t_args... args) {
|
||||
(m_Object->*m_OriginalFunc)(args...);
|
||||
}
|
||||
|
||||
@ -287,8 +286,8 @@ public:
|
||||
virtual ~IHookChainRegistryClassImpl() { }
|
||||
|
||||
t_ret callChain(origfunc_t origFunc, t_class *object, t_args... args) {
|
||||
IHookChainClassImpl<t_ret, t_class, t_args...> chain(m_Hooks, origFunc, object);
|
||||
return chain.callNext(args...);
|
||||
IHookChainClassImpl<t_ret, t_class, t_args...> chain(m_Hooks, origFunc);
|
||||
return chain.callNext(object, args...);
|
||||
}
|
||||
|
||||
virtual void registerHook(hookfunc_t hook) {
|
||||
@ -373,8 +372,8 @@ public:
|
||||
virtual ~IVoidHookChainRegistryClassImpl() { }
|
||||
|
||||
void callChain(origfunc_t origFunc, t_class *object, t_args... args) {
|
||||
IVoidHookChainClassImpl<t_class, t_args...> chain(m_Hooks, origFunc, object);
|
||||
chain.callNext(args...);
|
||||
IVoidHookChainClassImpl<t_class, t_args...> chain(m_Hooks, origFunc);
|
||||
chain.callNext(object, args...);
|
||||
}
|
||||
|
||||
virtual void registerHook(hookfunc_t hook) {
|
||||
|
@ -44,7 +44,7 @@
|
||||
g_ReGameHookchains.m_##className##_##functionName.callChain(&className::functionName##_, this, __VA_ARGS__);\
|
||||
}
|
||||
#define LINK_HOOK_CLASS_VOID_CHAIN2(className, functionName)\
|
||||
void className::functionName() {\
|
||||
void EXT_ALIGN className::functionName() {\
|
||||
g_ReGameHookchains.m_##className##_##functionName.callChain(&className::functionName##_, this);\
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user