HRESULT WINAPI DrawIndexedPrimitive_Detour(LPDIRECT3DDEVICE9 Device_Interface, D3DPRIMITIVETYPE Type, INT BaseIndex,
UINT MinIndex, UINT NumVertices, UINT StartIndex, UINT PrimitiveCount)
{
LPDIRECT3DVERTEXBUFFER9 Stream_Data;
LPDIRECT3DTEXTURE9 BTEX = NULL;
D3DSURFACE_DESC pDesc;
PDWORD IsInGame =
(PDWORD)0x0074E35C;
D3DVIEWPORT9 Vwp;
UINT Offset = 0;
UINT Stride = 0;
if(Device_Interface->GetStreamSource(0, &Stream_Data, &Offset, &Stride) == D3D_OK)
Stream_Data->Release();
Device_Interface->GetViewport( &Vwp );
if( NumVertices == 4 && PrimitiveCount == 2 && *IsInGame && Stride == 32 )
{
Device_Interface->GetTexture
( 0, (LPDIRECT3DBASETEXTURE9*)&BTEX );
if( BTEX )
{
BTEX->GetLevelDesc( 0, &pDesc );
BTEX->Release();
}
if( pDesc.Height == Vwp.Height && pDesc.Width == Vwp.Width )
return D3D_OK;
}
return DrawIndexedPrimitive_Pointer(Device_Interface, Type, BaseIndex, MinIndex, NumVertices, StartIndex, PrimitiveCount);