typedef HRESULT( __stdcall* EndScene_t )( LPDIRECT3DDEVICE9 );
EndScene_t m_EndScene;
HRESULT __stdcall hkEndScene( LPDIRECT3DDEVICE9 pDevice )
{
return m_EndScene( pDevice );
}
void *DetourFunction( BYTE *src, const BYTE *dst, const int len )
{
BYTE *jmp = ( BYTE* )malloc( len + 5 );
DWORD dwback;
VirtualProtect( src, len, PAGE_READWRITE, &dwback );
memcpy( jmp, src, len );
jmp += len;
jmp[ 0 ] = 0xE9;
*( DWORD* )( jmp + 1 ) = ( DWORD )( src + len - jmp ) - 5;
src[ 0 ] = 0xE9;
*( DWORD* )( src + 1 ) = ( DWORD )( dst - src ) - 5;
VirtualProtect( src, len, dwback, &dwback );
return ( jmp - len );
}
m_EndScene = ( EndScene_t )DetourFunction( ( PBYTE )m_vTable[ VTABLE_EndScene ], ( PBYTE )Hooks::hkEndScene, 5 );
struct D3DTLVERTEX
{
float fX;
float fY;
float fZ;
float fRHW;
D3DCOLOR Color;
float fU;
float fV;
};
enum gr_orientation
{
horizontal,
vertical
};
struct DXUT_SCREEN_VERTEX
{
float x, y, z, h;
D3DCOLOR color;
float tu, tv;
DWORD FVF;
};
void PrintText(ID3DXFont* g_pFont, int x, int y, DWORD dwColor, DWORD Flags, char *Text )
{
RECT rct;
rct.left = x - 1;
rct.right = x + 1;
rct.top = y - 1 ;
rct.bottom = y + 1;
if(!Text) { return; }
va_list va_alist;
char logbuf[256] = {0};
va_start (va_alist, Text);
_vsnprintf (logbuf+strlen(logbuf), sizeof(logbuf) - strlen(logbuf), Text, va_alist);
va_end (va_alist);
RECT FontRect = { x, y, x, y };
g_pFont->DrawTextA(NULL, logbuf, -1, &rct, DT_NOCLIP | Flags, dwColor);
}
void FillRGB(int x, int y, int w, int h, DWORD Color)
{
if(!D3DHook::GetDevice())
return;
D3DRECT dRect = {x, y, x + w, y + h};
pDevice->Clear(-1, &dRect, D3DCLEAR_TARGET, Color, 0, 0);
}
void GradientRect( float x, float y, float width, float height, DWORD startCol, DWORD endCol, gr_orientation orientation )
{
if( !pDevice )
return;
static struct D3DVERTEX {float x, y, z, rhw; DWORD color;} vertices[4] = {{0,0,0,1.0f,0},{0,0,0,1.0f,0},{0,0,0,1.0f,0},{0,0,0,1.0f,0}};
vertices[0].x = x;
vertices[0].y = y;
vertices[0].color = startCol;
vertices[1].x = x+width;
vertices[1].y = y;
vertices[1].color = orientation == horizontal ? endCol : startCol;
vertices[2].x = x;
vertices[2].y = y+height;
vertices[2].color = orientation == horizontal ? startCol : endCol;
vertices[3].x = x+width;
vertices[3].y = y+height;
vertices[3].color = endCol;
pDevice ->SetRenderState( D3DRS_ALPHABLENDENABLE, true );
pDevice ->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
pDevice ->SetFVF( D3DFVF_XYZRHW|D3DFVF_DIFFUSE );
pDevice ->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP,2,vertices,sizeof(vertices[0]));
}
void DrawNonFilledRectangle( float x, float y, float w, float h, DWORD dwColor )
{
if( !pDevice )
return;
DXUT_SCREEN_VERTEX vertices[6] =
{
x + w, y, 0.0f, 1.0f, dwColor, 0.0f, 0.0f,
x + w, y + h, 0.0f, 1.0f, dwColor, 0.0f, 0.0f,
x, y + h, 0.0f, 1.0f, dwColor, 0.0f, 0.0f,
x, y + h, 0.0f, 1.0f, dwColor, 0.0f, 0.0f,
x, y, 0.0f, 1.0f, dwColor, 0.0f, 0.0f,
x + w, y, 0.0f, 1.0f, dwColor, 0.0f, 0.0f,
};
pDevice ->DrawPrimitiveUP( D3DPT_LINESTRIP, 5, vertices, sizeof(DXUT_SCREEN_VERTEX) );
}
void cD3D::DrawBorder( float x, float y, float w, float h, DWORD color1, DWORD color2 )
{
if( !pDevice )
return;
DXUT_SCREEN_VERTEX vertices[6] =
{
x + w, y, 0.0f, 1.0f, color2, 0,0,
x + w, y + h, 0.0f, 1.0f, color2, 0,0,
x, y + h, 0.0f, 1.0f, color2, 0,0,
x, y + h, 0.0f, 1.0f, color1, 0,0,
x, y, 0.0f, 1.0f, color1, 0,0,
x + w, y, 0.0f, 1.0f, color1, 0,0,
};
pDevice->DrawPrimitiveUP( D3DPT_LINESTRIP, 5, vertices, sizeof(DXUT_SCREEN_VERTEX) );
}
[19:39:47] Found d3d9.dll at 0x73030000 [19:39:47] Found Offset at 0x73043939 [19:39:47] Found VTable[ 000 ]: 0x73036E99 - (QueryInterface) [19:39:47] Found VTable[ 001 ]: 0x730367F2 - (AddRef) [19:39:47] Found VTable[ 002 ]: 0x730367C9 - (Release) [19:39:47] Found VTable[ 003 ]: 0x7304CD54 - (TestCooperativeLevel) [19:39:47] Found VTable[ 004 ]: 0x730EBCFD - (GetAvaibleTextureMem) [19:39:47] Found VTable[ 005 ]: 0x7312971F - (EvictManagedResources) [19:39:47] Found VTable[ 006 ]: 0x7303BB76 - (GetDirect3D) [19:39:47] Found VTable[ 007 ]: 0x73036F78 - (GetDeviceCaps) [19:39:47] Found VTable[ 008 ]: 0x73067DFB - (GetDisplayMode) [19:39:47] Found VTable[ 009 ]: 0x7306B972 - (GetCreationParameters) [19:39:47] Found VTable[ 010 ]: 0x730EB1C4 - (SetCursorProperties) [19:39:47] Found VTable[ 011 ]: 0x730EB69D - (SetCursorPosition) [19:39:47] Found VTable[ 012 ]: 0x73067D10 - (ShowCursor) [19:39:47] Found VTable[ 013 ]: 0x7306CD50 - (CreateAdditionalSwapChain) [19:39:47] Found VTable[ 014 ]: 0x7304B46C - (GetSwapChain) [19:39:47] Found VTable[ 015 ]: 0x7308711E - (GetNumberOfSwapChains) [19:39:47] Found VTable[ 016 ]: 0x73088DDA - (Reset) [19:39:47] Found VTable[ 017 ]: 0x730710C3 - (Present) [19:39:47] Found VTable[ 018 ]: 0x73092A9F - (GetBackBuffer) [19:39:47] Found VTable[ 019 ]: 0x73068945 - (GetRasterStatus) [19:39:47] Found VTable[ 020 ]: 0x730EB789 - (SetDialogBoxMode) [19:39:47] Found VTable[ 021 ]: 0x730EBA0F - (SetGammaRamp) [19:39:47] Found VTable[ 022 ]: 0x730EBB4D - (GetGammaRamp) [19:39:47] Found VTable[ 023 ]: 0x7305476B - (CreateTexture) [19:39:47] Found VTable[ 024 ]: 0x730EC0B8 - (CreateVolumeTexture) [19:39:47] Found VTable[ 025 ]: 0x7307E93F - (CreateCubeTexture) [19:39:47] Found VTable[ 026 ]: 0x7304D40D - (CreateVertexBuffer) [19:39:47] Found VTable[ 027 ]: 0x7305ED61 - (CreateIndexBuffer) [19:39:47] Found VTable[ 028 ]: 0x730923B8 - (CreateRenderTarget) [19:39:47] Found VTable[ 029 ]: 0x730EC3D8 - (CreateDepthStencilSurface) [19:39:47] Found VTable[ 030 ]: 0x730ED72C - (UpdateSurface) [19:39:47] Found VTable[ 031 ]: 0x73066611 - (UpdateTexture) [19:39:47] Found VTable[ 032 ]: 0x73084331 - (GetRenderTargetData) [19:39:47] Found VTable[ 033 ]: 0x730EC687 - (GetFronBufferData) [19:39:47] Found VTable[ 034 ]: 0x73070430 - (StrechRect) [19:39:47] Found VTable[ 035 ]: 0x7306A5D3 - (ColorFill) [19:39:47] Found VTable[ 036 ]: 0x73084F4F - (CreateOffscreenPlainSurface) [19:39:47] Found VTable[ 037 ]: 0x73070EE9 - (SetRenderTarget) [19:39:47] Found VTable[ 038 ]: 0x730711D2 - (GetRenderTarget) [19:39:47] Found VTable[ 039 ]: 0x73076E97 - (SetDepthStencilSurface) [19:39:47] Found VTable[ 040 ]: 0x73076D10 - (GetDepthStencilSurface) [19:39:47] Found VTable[ 041 ]: 0x7304D8BC - (BeginScene) [19:39:47] Found VTable[ 042 ]: 0x7304CE09 - (EndScene) [19:39:47] Found VTable[ 043 ]: 0x7303F244 - (Clear) [19:39:47] Found VTable[ 044 ]: 0x7303E9D6 - (SetTransforM) [19:39:47] Found VTable[ 045 ]: 0x731307A2 - (GetTransform) [19:39:47] Found VTable[ 046 ]: 0x7312986F - (MultiplyTransform) [19:39:47] Found VTable[ 047 ]: 0x73129987 - (SetViewport) [19:39:47] Found VTable[ 048 ]: 0x730757A0 - (GetViewport) [19:39:47] Found VTable[ 049 ]: 0x73129C94 - (SetMaterial) [19:39:47] Found VTable[ 050 ]: 0x7313111B - (GetMaterial) [19:39:47] Found VTable[ 051 ]: 0x73065700 - (SetLight) [19:39:47] Found VTable[ 052 ]: 0x731311CA - (GetLight) [19:39:47] Found VTable[ 053 ]: 0x73065803 - (LightEnable) [19:39:47] Found VTable[ 054 ]: 0x73131313 - (GetLightEnable) [19:39:47] Found VTable[ 055 ]: 0x7312B054 - (SetClipPlane) [19:39:47] Found VTable[ 056 ]: 0x73130E27 - (GetClipPlane) [19:39:47] Found VTable[ 057 ]: 0x73072ED1 - (SetRenderState) [19:39:47] Found VTable[ 058 ]: 0x73130365 - (GetRenderState) [19:39:47] Found VTable[ 059 ]: 0x7307F1FC - (CreateStateBlock) [19:39:47] Found VTable[ 060 ]: 0x73071467 - (BeginStateBlock) [19:39:47] Found VTable[ 061 ]: 0x730730E3 - (EndStateBlock) [19:39:47] Found VTable[ 062 ]: 0x73130936 - (SetClipStatus) [19:39:47] Found VTable[ 063 ]: 0x731309E0 - (GetClipStatus) [19:39:47] Found VTable[ 064 ]: 0x7312A368 - (GetTexture) [19:39:47] Found VTable[ 065 ]: 0x7306B175 - (SetTexture) [19:39:47] Found VTable[ 066 ]: 0x7313054C - (GetTextureStageState) [19:39:47] Found VTable[ 067 ]: 0x7306B2E3 - (SetTextureStageState) [19:39:47] Found VTable[ 068 ]: 0x731306CA - (GetSamplerState) [19:39:47] Found VTable[ 069 ]: 0x7306B21E - (SetSamplerState) [19:39:47] Found VTable[ 070 ]: 0x7307CBB3 - (ValidateDevice) [19:39:47] Found VTable[ 071 ]: 0x7312AC57 - (SetPaletteEntries) [19:39:47] Found VTable[ 072 ]: 0x7312AF91 - (GetPaletteEntries) [19:39:47] Found VTable[ 073 ]: 0x7312AA5A - (SetCurrentTexturePalette) [19:39:47] Found VTable[ 074 ]: 0x7312ABB6 - (GetCurrentTexturePalette) [19:39:47] Found VTable[ 075 ]: 0x73129AB1 - (SetScissorRect) [19:39:47] Found VTable[ 076 ]: 0x73129BD8 - (GetScissorRect) [19:39:47] Found VTable[ 077 ]: 0x73130EEE - (SetSoftwareVertexProcessing) [19:39:47] Found VTable[ 078 ]: 0x73130348 - (GetSoftwareVertexProcessing) [19:39:47] Found VTable[ 079 ]: 0x73075B0E - (SetNPatchMode) [19:39:47] Found VTable[ 080 ]: 0x73075789 - (GetNPatchMode) [19:39:47] Found VTable[ 081 ]: 0x73053660 - (DrawPrimitive) [19:39:47] Found VTable[ 082 ]: 0x73057651 - (DrawIndexPrimitive) [19:39:47] Found VTable[ 083 ]: 0x73075473 - (DrawPrimitiveUP) [19:39:47] Found VTable[ 084 ]: 0x7312C4C6 - (DrawIndexPrimitiveUP) [19:39:47] Found VTable[ 085 ]: 0x73131FAC - (ProcessVertices) [19:39:47] Found VTable[ 086 ]: 0x7305F522 - (CreateVertexDeclaration) [19:39:47] Found VTable[ 087 ]: 0x7305F446 - (SetVertexDeclaration) [19:39:47] Found VTable[ 088 ]: 0x73127765 - (GetVertexDeclaration) [19:39:47] Found VTable[ 089 ]: 0x7312B56A - (SetFVF) [19:39:47] Found VTable[ 090 ]: 0x7312B6A0 - (GetFVF) [19:39:47] Found VTable[ 091 ]: 0x7309129F - (CreateVertexShader) [19:39:47] Found VTable[ 092 ]: 0x73072BAE - (SetVertexShader) [19:39:47] Found VTable[ 093 ]: 0x7313435C - (GetVertexShader) [19:39:47] Found VTable[ 094 ]: 0x7307EE48 - (SetVertexShaderConstantF) [19:39:47] Found VTable[ 095 ]: 0x73128DD6 - (GetVertexShaderConstantF) [19:39:47] Found VTable[ 096 ]: 0x73127834 - (SetVertexShaderConstantI) [19:39:47] Found VTable[ 097 ]: 0x73128FC3 - (GetVertexShaderConstantI) [19:39:47] Found VTable[ 098 ]: 0x731279A6 - (SetVertexShaderConstantB) [19:39:47] Found VTable[ 099 ]: 0x731291B3 - (GetVertexShaderConstantB) [19:39:47] Found VTable[ 100 ]: 0x73075CD1 - (SetStreamSource) [19:39:47] Found VTable[ 101 ]: 0x7312B1AA - (GetStreamSource) [19:39:47] Found VTable[ 102 ]: 0x7312B2A1 - (SetStreamSourceFreq) [19:39:47] Found VTable[ 103 ]: 0x7312B3E1 - (GetStreamSourceFreq) [19:39:47] Found VTable[ 104 ]: 0x73075DC2 - (SetIndices) [19:39:47] Found VTable[ 105 ]: 0x7312B49C - (GetIndices) [19:39:47] Found VTable[ 106 ]: 0x7308B177 - (CreatePixelShader) [19:39:47] Found VTable[ 107 ]: 0x73072C7A - (SetPixelShader) [19:39:47] Found VTable[ 108 ]: 0x73134751 - (GetPixelShader) [19:39:47] Found VTable[ 109 ]: 0x7307EFC3 - (SetPixelShaderConstantF) [19:39:47] Found VTable[ 110 ]: 0x7313481A - (GetPixelShaderConstantF) [19:39:47] Found VTable[ 111 ]: 0x73127C44 - (SetPixelShaderConstantI) [19:39:47] Found VTable[ 112 ]: 0x7313495C - (GetPixelShaderConstantI) [19:39:47] Found VTable[ 113 ]: 0x73127DB6 - (SetPixelShaderConstantB) [19:39:47] Found VTable[ 114 ]: 0x73134AAC - (GetPixelShaderConstantB) [19:39:47] Found VTable[ 115 ]: 0x7312BF76 - (DrawRectPatch) [19:39:47] Found VTable[ 116 ]: 0x7312C21F - (DrawTriPatch) [19:39:47] Found VTable[ 117 ]: 0x73127F28 - (DeletePatch) [19:39:47] Found VTable[ 118 ]: 0x7304E426 - (CreateQuery)

