
DWORD dw_PresentStart = 0x004FB0BF; //8b 51 44 6a 00 6a 00 6a 00 50 ff d2 b8 ?? ?? ?? ??
DWORD dw_PresentReturn = ( dw_PresentStart + 0x03 );
void WINAPI startMainRender( LPDIRECT3DDEVICE9 pDevice )
{
pDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE );
//Your d3d stuffs...
pDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_TRUE );
}
__declspec( naked ) HRESULT WINAPI hk_PresentEngine( void )
{
__asm
{
mov edx, [ ecx + 0x44 ]
pushad
push eax
call startMainRender
popad
jmp dw_PresentReturn
}
}
DWORD WINAPI dwWriteHook( void *lpParameter )
{
while( memcmp( ( void * ) dw_PresentStart, ( void * ) "\x8B\x51\x44", 3 ) )
Sleep( 500 );
DWORD dw_ProperAddress = NULL;
for( int i = 0; !dw_ProperAddress; i++ )
if( !memcmp( ( void * ) ( dw_PresentStart + i ), ( void * ) "\xC3\xCC", 2 ) )
dw_ProperAddress = ( dw_PresentStart + i + 0x01 );
*( BYTE * ) ( dw_ProperAddress + 0x00 ) = 0xE9;
*( DWORD * ) ( dw_ProperAddress + 0x01 ) = ( ( DWORD ) hk_PresentEngine - dw_ProperAddress ) - 5;
*( BYTE * ) ( dw_PresentStart + 0x00 ) = 0xEB;
*( BYTE * ) ( dw_PresentStart + 0x01 ) = 0x37;
*( BYTE * ) ( dw_PresentStart + 0x02 ) = 0x90;
return 0;
}

std::int16_t GetCurrentWeaponID()
{
std::int16_t iCurrentID = 0;
__asm
{
mov edx, g_pLTClientShell
mov ecx, [edx + 0x78]
mov eax, [ecx]
mov edx, [eax + 0x84]
call edx
mov edx, [eax]
mov ecx, eax
mov eax, [edx + 0x78]
call eax
mov iCurrentID, ax
}
return iCurrentID;
}
MOV EAX,DWORD PTR DS:[ECX+2D0] RETN
MOV EAX,DWORD PTR DS:[ECX+3C] RETN