HRESULT WINAPI hkDrawIndexedPrimitive(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT StartIndex, UINT PrimCount)
{
LPDIRECT3DVERTEXBUFFER9 StreamBuffer;
UINT OffsetInBytes, m_Stride;
if (pDevice->GetStreamSource(0,&StreamBuffer,&OffsetInBytes,&m_Stride) == D3D_OK)StreamBuffer->Release();
if(cMenu.hack[1])
{
if(modelRec_CT || modelRec_T)
{
pDevice->SetRenderState( D3DRS_FOGENABLE, false);
pDevice->SetRenderState( D3DRS_ZENABLE,false );
pDrawIndexedPrimitive(pDevice, Type, BaseVertexIndex, MinVertexIndex, NumVertices, StartIndex, PrimCount);
pDevice->SetRenderState( D3DRS_FOGENABLE, false);
pDevice->SetRenderState( D3DRS_ZENABLE, true );
}
}
return pDrawIndexedPrimitive(pDevice, Type, BaseVertexIndex, MinVertexIndex, NumVertices, StartIndex, PrimCount);
}
while( GetModuleHandleA("d3d9.dll") == NULL )
Sleep(100);
cDebug.print("Found modules!", debug_green);
DWORD dwD3D9, adr, *vTable;
dwD3D9 = (DWORD)GetModuleHandleA("d3d9.dll");
adr = cDebug.FindPattern(dwD3D9, 0x128000, (PBYTE)"\xC7\x06\x00\x00\x00\x00\x89\x86\x00\x00\x00\x00\x89\x86", "xx????xx????xx");
if(adr)
{
memcpy(&vTable,(void *)(adr+2),4);
pReset = (oReset) DetourFunction((PBYTE)vTable[16] , (PBYTE)hkReset);
pEndScene = (oEndScene) DetourFunction((PBYTE)vTable[42] , (PBYTE)hkEndScene);
pDrawIndexedPrimitive = (oDrawIndexedPrimitive_t) DetourFunction((PBYTE)vTable[82] , (PBYTE)hkDrawIndexedPrimitive );
cDebug.print("Successfully Hooked!", debug_green);