Updated TF2 Extension to fix critical hits.

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%402119
This commit is contained in:
Matt Woodrow 2008-05-01 07:29:46 +00:00
parent f226e6d70b
commit 8df36003a8
3 changed files with 28 additions and 5 deletions

View File

@ -318,9 +318,19 @@ void CriticalHitManager::EnableCriticalDetour()
{
if (!detoured)
{
DoGatePatch((unsigned char *)critical_address, &critical_callback);
DoGatePatch((unsigned char *)melee_address, &melee_callback);
DoGatePatch((unsigned char *)knife_address, &knife_callback);
if (normalcreated)
{
DoGatePatch((unsigned char *)critical_address, &critical_callback);
}
if (meleecreated)
{
DoGatePatch((unsigned char *)melee_address, &melee_callback);
}
if (knifecreated)
{
DoGatePatch((unsigned char *)knife_address, &knife_callback);
}
detoured = true;
}
}

View File

@ -51,6 +51,10 @@ public:
knife_callback = NULL;
forward = NULL;
normalcreated = false;
meleecreated = false;
knifecreated = false;
}
~CriticalHitManager()
@ -61,9 +65,14 @@ public:
void Init()
{
if (!CreateCriticalDetour() || !CreateCriticalMeleeDetour() || !CreateCriticalKnifeDetour())
normalcreated = CreateCriticalDetour();
meleecreated = CreateCriticalMeleeDetour();
knifecreated = CreateCriticalKnifeDetour();
if (!normalcreated && !meleecreated && !knifecreated)
{
enabled = false;
g_pSM->LogError(myself, "No critical hit forwards could be initialised - Disabled critical hit hooks");
return;
}
@ -98,6 +107,10 @@ private:
bool CreateCriticalKnifeDetour();
void DeleteCriticalDetour();
bool normalcreated;
bool meleecreated;
bool knifecreated;
/* These patch/unpatch the server.dll */
void EnableCriticalDetour();
void DisableCriticalDetour();

View File

@ -44,7 +44,7 @@
{
"library" "server"
"linux" "@_ZN8CTFKnife26CalcIsAttackCriticalHelperEv"
"windows" "\x33\xC0\x83\xB9\x20\x05\x00"
"windows" "\x33\xC0\x83\xB9\x74\x12\x00\x00\x01\x0F\x94\xC0\xC3"
}
}