Don't judge me, I'm high.
Code:
char isVisible(Entity_t* ret, int* entityNum) //54E6D0
{
int *v4; // eax@1
char result; // al@2
v4 = &dword_9FC748[344 * *(_DWORD *)(entityNum+ 352)]; //Get the ClientInfo address for the entity passsed.
if ( !*entityNum|| *((_BYTE *)entityNum+ 56) & 0x40 ) //Compare perk. if(SelectedClient->Perk & 0x40) return;
result = 0;
else
result = sub_474000(ret, entityNum, (int)&unk_2807823) != 0; //Else, execute a trace using cEntity, EntityClientNum and the traceflag, here it's 0x2807823
return result; //Then returns 1 if the Entity is visible.
}
Yea....I found this. Bite me.
naked functions format
Code:
__declspec(naked) void hookname()
{
__asm
{
do origional code
save stack
}
do hacks here
__asm
{
restore stack
jmp [returnaddress];
}
}
required function
Code:
void JumpTo( BYTE* pAddress, DWORD dwJumpTo, DWORD dwLen ) {
DWORD dwOldProtect, dwBkup, dwRelAddr;
VirtualProtect ( pAddress, dwLen, PAGE_EXECUTE_READWRITE, &dwOldProtect );
dwRelAddr = ( DWORD ) ( dwJumpTo - ( DWORD ) pAddress ) - 5;
*pAddress = 0xE9;
* ( ( DWORD * ) ( pAddress + 0x1 ) ) = dwRelAddr;
for ( DWORD x = 0x5; x < dwLen; x++ ) * ( pAddress + x ) = 0x90;
VirtualProtect ( pAddress, dwLen, dwOldProtect, &dwBkup );
return;
}
common functions
Code:
DWORD writepacket_rtn = 0x00420AB5, writepacket_OFFS = 0x00420AB5, hooksize_wpkt = 0x5;
__declspec(naked) void writepacket_hook()
{
__asm
{
mov eax,0x1058
pushad
pushfd
}
//Call code here
__asm
{
popfd
popad
jmp writepacket_rtn
}
}
DWORD obituary_rtn = 0x58D1D8, obituary_OFFS = 0x58D1D0, hooksize_obt = 0x8, version = 0x7E1218;
__declspec(naked) void obituary_hook()
{
__asm
{
sub esp,0x74
cmp eax,0xF0
fld ds:[version]
pushad
pushfd
}
//Call code here
__asm
{
popfd
popad
jmp obituary_rtn
}
}
In some thread:
Code:
JumpTo((PBYTE)obituary_OFFS, (DWORD)obituary_hook, hooksize_obt);