Fixed Crit hits sigs for Windows and cleaned up the code somewhat
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%402154
This commit is contained in:
parent
b90386276f
commit
f7613f80f1
@ -165,13 +165,11 @@ bool CriticalHitManager::CreateCriticalMeleeDetour()
|
||||
|
||||
//If TempDetour returns non-zero we want to load something into eax and return this value
|
||||
|
||||
//IA32_Test_Rm_Reg(jit, eax, eax, something);
|
||||
jit->write_ubyte(0x85);
|
||||
jit->write_ubyte(0xC0);
|
||||
//test eax, eax
|
||||
IA32_Test_Rm_Reg(jit, REG_EAX, REG_EAX, MOD_REG);
|
||||
|
||||
//JNZ critical_callback+50
|
||||
jit->write_ubyte(0x75);
|
||||
jit->write_ubyte(50-((jit->outptr+1)-jit->outbase));
|
||||
//jnz _skip
|
||||
jitoffs_t jmp = IA32_Jump_Cond_Imm8(jit, CC_NZ, 0);
|
||||
|
||||
int callbyte = -1;
|
||||
/* The callbyte should return the nth byte (starting from 1) in the backup bytes - Should be an 0xE8 (call) */
|
||||
@ -212,18 +210,15 @@ bool CriticalHitManager::CreateCriticalMeleeDetour()
|
||||
i += 4;
|
||||
}
|
||||
|
||||
|
||||
/* Return to the original function */
|
||||
call = IA32_Jump_Imm32(jit, 0);
|
||||
IA32_Write_Jump32_Abs(jit, call, (unsigned char *)melee_address + melee_restore.bytes);
|
||||
|
||||
wr.outbase = (jitcode_t)melee_callback+50;
|
||||
wr.outptr = wr.outbase;
|
||||
|
||||
//copy g_returnvalue into eax
|
||||
jit->write_ubyte(0xA1);
|
||||
jit->write_uint32((jit_uint32_t)&g_returnvalue);
|
||||
|
||||
//_skip:
|
||||
//mov eax, [g_returnvalue]
|
||||
//ret
|
||||
IA32_Send_Jump8_Here(jit, jmp);
|
||||
IA32_Mov_Eax_Mem(jit, (jit_int32_t)&g_returnvalue);
|
||||
IA32_Return(jit);
|
||||
|
||||
return true;
|
||||
@ -280,13 +275,11 @@ bool CriticalHitManager::CreateCriticalKnifeDetour()
|
||||
|
||||
//If TempDetour returns non-zero we want to load something into eax and return this value
|
||||
|
||||
//IA32_Test_Rm_Reg(jit, eax, eax, something);
|
||||
jit->write_ubyte(0x85);
|
||||
jit->write_ubyte(0xC0);
|
||||
//test eax, eax
|
||||
IA32_Test_Rm_Reg(jit, REG_EAX, REG_EAX, MOD_REG);
|
||||
|
||||
//JNZ critical_callback+50
|
||||
jit->write_ubyte(0x75);
|
||||
jit->write_ubyte(50-((jit->outptr+1)-jit->outbase));
|
||||
//jnz _skip
|
||||
jitoffs_t jmp = IA32_Jump_Cond_Imm8(jit, CC_NZ, 0);
|
||||
|
||||
/* Patch old bytes in */
|
||||
for (size_t i=0; i<knife_restore.bytes; i++)
|
||||
@ -298,13 +291,11 @@ bool CriticalHitManager::CreateCriticalKnifeDetour()
|
||||
call = IA32_Jump_Imm32(jit, 0);
|
||||
IA32_Write_Jump32_Abs(jit, call, (unsigned char *)knife_address + knife_restore.bytes);
|
||||
|
||||
wr.outbase = (jitcode_t)knife_callback+50;
|
||||
wr.outptr = wr.outbase;
|
||||
|
||||
//copy g_returnvalue into eax
|
||||
jit->write_ubyte(0xA1);
|
||||
jit->write_uint32((jit_uint32_t)&g_returnvalue);
|
||||
|
||||
//_skip:
|
||||
//mov eax, [g_returnvalue]
|
||||
//ret
|
||||
IA32_Send_Jump8_Here(jit, jmp);
|
||||
IA32_Mov_Eax_Mem(jit, (jit_int32_t)&g_returnvalue);
|
||||
IA32_Return(jit);
|
||||
|
||||
return true;
|
||||
|
@ -32,13 +32,13 @@
|
||||
{
|
||||
"library" "server"
|
||||
"linux" "@_ZN18CTFWeaponBaseMelee26CalcIsAttackCriticalHelperEv"
|
||||
"windows" "\x83\xEC\x08\x56\xE8\x2A\x2A\x2A\x2A\x8B\xF0\x85\xF6"
|
||||
"windows" "\x83\xEC\x08\x56\x57\x8B\xF1\xE8\x2A\x2A\x2A\x2A\x8B\xF8"
|
||||
}
|
||||
"CalcCriticalKnife"
|
||||
{
|
||||
"library" "server"
|
||||
"linux" "@_ZN8CTFKnife26CalcIsAttackCriticalHelperEv"
|
||||
"windows" "\x33\xC0\x83\xB9\x74\x12\x00\x00\x01\x0F\x94\xC0\xC3"
|
||||
"windows" "\x33\xC0\x83\xB9\xF4\x12\x00\x00\x01\x0F\x94\xC0\xC3"
|
||||
}
|
||||
|
||||
}
|
||||
@ -57,13 +57,13 @@
|
||||
"CalcCriticalMeleeBackup"
|
||||
{
|
||||
"linux" "7"
|
||||
"windows" "9"
|
||||
"windows" "7"
|
||||
}
|
||||
/* The byte number (starting from 1) of the call (0xE8) byte or -1 if none */
|
||||
"CalcCriticalMeleeCallByte"
|
||||
{
|
||||
"linux" "-1"
|
||||
"windows" "5"
|
||||
"windows" "-1"
|
||||
}
|
||||
"CalcCriticalKnifeBackup"
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user