Go Back   UnKnoWnCheaTs - Multiplayer Game Hacks and Cheats > Anti-Cheat Software & Programming > Direct3D

- Sponsored Advertisement -
http://www.myfpscheats.com/

Welcome to the UnKnoWnCheaTs - Multiplayer Game Hacks and Cheats.
You have to register before you can post and see and access any of the advanced forum features, please click the register link to proceed to the registration form. To start viewing threads or posts, select a forum that you want to visit from the selection below.
Direct3D
hacking programming reversing
You are Unregistered, please register to gain Full access.    
Reply
 
Thread Tools

GetAsyncKeyState Multible Times [Menuless Hack]
Old 07-18-2010, 06:16 AM   #1
n00bie

DeadLinez's Avatar

Join Date: Jan 2010
Posts: 7
Reputation: 76
Rep Power: 26
DeadLinez is about to stop their Leeching
GetAsyncKeyState Multible Times [Menuless Hack]

i am making my v1 for my halo hack and atm i have a crosshair, and i can never get more then 1 getasynckeystate if statement in there, or else my output frame, gets 101 errors.Heres My Code:

Before: (No Errors) (the diffrence between the two codes is the dip)
Code:
/*    Direct3D9 Device */

#include <windows.h>
#include "main.h"
#include "d3d9.h"



#define D3DHOOK_TEXTURES //comment this to disable texture hooking


//**********************************************************************
bool xhair = false;
bool xwire = false;
//**********************************************************************
D3DCOLOR dWhite        = D3DCOLOR_ARGB( 255, 255, 255, 255 );//white
//**********************************************************************








HRESULT CD3DManager::Initialize()
{
    /*
    initialize Resources such as textures 
    (managed and unmanaged [D3DPOOL]), 
    vertex buffers, and other D3D rendering resources
    ...
    m_pD3Ddev->CreateTexture(..., ..., &m_pD3Dtexture);
    */
    return S_OK;
}

HRESULT CD3DManager::PreReset()
{
    /*
    release all UNMANAGED [D3DPOOL_DEFAULT] 
    textures, vertex buffers, and other 
    volitile resources
    ...
    _SAFE_RELEASE(m_pD3Dtexture);
    */
    return S_OK;
}

HRESULT CD3DManager::PostReset()
{
    /*
    re-initialize all UNMANAGED [D3DPOOL_DEFAULT]
    textures, vertex buffers, and other volitile 
    resources
    ...
    m_pD3Ddev->CreateTexture(..., ..., &m_pD3Dtexture);
    */
    return S_OK;
}

HRESULT CD3DManager::Release()
{
    /*
    Release all textures, vertex buffers, and 
    other resources
    ...
    _SAFE_RELEASE(m_pD3Dtexture);
    */
    return S_OK;
}

//-----------------------------------------------------------------------------

HRESULT APIENTRY hkIDirect3DDevice9::QueryInterface(REFIID riid, LPVOID *ppvObj) 
{
    return m_pD3Ddev->QueryInterface(riid, ppvObj);
}

ULONG APIENTRY hkIDirect3DDevice9::AddRef() 
{
    m_refCount++;
    return m_pD3Ddev->AddRef();
}
D3DVIEWPORT9 Viewport;
HRESULT APIENTRY hkIDirect3DDevice9::BeginScene() 
{
    m_pD3Ddev->GetViewport(&Viewport);
    return m_pD3Ddev->BeginScene();
}

HRESULT APIENTRY hkIDirect3DDevice9::BeginStateBlock() 
{
    return m_pD3Ddev->BeginStateBlock();
}

HRESULT APIENTRY hkIDirect3DDevice9::Clear(DWORD Count, CONST D3DRECT *pRects, DWORD Flags, D3DCOLOR Color, float Z, DWORD Stencil) 
{
    return m_pD3Ddev->Clear(Count, pRects, Flags, Color, Z, Stencil);
}

HRESULT APIENTRY hkIDirect3DDevice9::ColorFill(IDirect3DSurface9* pSurface,CONST RECT* pRect, D3DCOLOR color) 
{    
    return m_pD3Ddev->ColorFill(pSurface,pRect,color);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateAdditionalSwapChain(D3DPRESENT_PARAMETERS *pPresentationParameters, IDirect3DSwapChain9 **ppSwapChain) 
{
    return m_pD3Ddev->CreateAdditionalSwapChain(pPresentationParameters, ppSwapChain);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateCubeTexture(UINT EdgeLength,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DCubeTexture9** ppCubeTexture,HANDLE* pSharedHandle) 
{
    return m_pD3Ddev->CreateCubeTexture(EdgeLength, Levels, Usage, Format, Pool, ppCubeTexture,pSharedHandle);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateDepthStencilSurface(UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Discard,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) 
{
    return m_pD3Ddev->CreateDepthStencilSurface(Width, Height, Format, MultiSample, MultisampleQuality,Discard,ppSurface, pSharedHandle);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateIndexBuffer(UINT Length,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DIndexBuffer9** ppIndexBuffer,HANDLE* pSharedHandle) 
{
    return m_pD3Ddev->CreateIndexBuffer(Length, Usage, Format, Pool, ppIndexBuffer,pSharedHandle);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateOffscreenPlainSurface(UINT Width,UINT Height,D3DFORMAT Format,D3DPOOL Pool,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) 
{
    return m_pD3Ddev->CreateOffscreenPlainSurface(Width,Height,Format,Pool,ppSurface,pSharedHandle);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreatePixelShader(CONST DWORD* pFunction,IDirect3DPixelShader9** ppShader) 
{
    return m_pD3Ddev->CreatePixelShader(pFunction, ppShader);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateQuery(D3DQUERYTYPE Type,IDirect3DQuery9** ppQuery) 
{
    return m_pD3Ddev->CreateQuery(Type,ppQuery);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateRenderTarget(UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Lockable,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) 
{
    return m_pD3Ddev->CreateRenderTarget(Width, Height, Format, MultiSample,MultisampleQuality, Lockable, ppSurface,pSharedHandle);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateStateBlock(D3DSTATEBLOCKTYPE Type,IDirect3DStateBlock9** ppSB) 
{
    return m_pD3Ddev->CreateStateBlock(Type, ppSB);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateTexture(UINT Width,UINT Height,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DTexture9** ppTexture,HANDLE* pSharedHandle) 
{
    HRESULT ret = m_pD3Ddev->CreateTexture(Width, Height, Levels, Usage, Format, Pool, ppTexture, pSharedHandle);

#ifdef D3DHOOK_TEXTURES
    if(ret == D3D_OK) { new hkIDirect3DTexture9(ppTexture, this, Width, Height, Format); }
#endif

    return ret;
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateVertexBuffer(UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IDirect3DVertexBuffer9** ppVertexBuffer,HANDLE* pSharedHandle) 
{
    return m_pD3Ddev->CreateVertexBuffer(Length, Usage, FVF, Pool, ppVertexBuffer,pSharedHandle);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateVertexDeclaration(CONST D3DVERTEXELEMENT9* pVertexElements,IDirect3DVertexDeclaration9** ppDecl) 
{
    return m_pD3Ddev->CreateVertexDeclaration(pVertexElements,ppDecl);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateVertexShader(CONST DWORD* pFunction,IDirect3DVertexShader9** ppShader) 
{
    return m_pD3Ddev->CreateVertexShader(pFunction, ppShader);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateVolumeTexture(UINT Width,UINT Height,UINT Depth,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DVolumeTexture9** ppVolumeTexture,HANDLE* pSharedHandle) 
{
    return m_pD3Ddev->CreateVolumeTexture(Width, Height, Depth, Levels, Usage, Format, Pool, ppVolumeTexture,pSharedHandle);
}

HRESULT APIENTRY hkIDirect3DDevice9::DeletePatch(UINT Handle) 
{
    return m_pD3Ddev->DeletePatch(Handle);
}

HRESULT APIENTRY hkIDirect3DDevice9::DrawIndexedPrimitive(D3DPRIMITIVETYPE Type,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount)
{       
    if ((GetAsyncKeyState(VK_NUMPAD2)&1) == 1)        
        xhair = !xhair;  
        if(xhair)
        {
            D3DRECT rec2 = {(Viewport.Width/2)-8, (Viewport.Height/2),(Viewport.Width/2)+8, (Viewport.Height/2)+ 1};
            D3DRECT rec3 = {(Viewport.Width/2),(Viewport.Height/2)-8, (Viewport.Width/2)+1,(Viewport.Height/2)+8};
            m_pD3Ddev->Clear(1, &rec2, D3DCLEAR_TARGET,dWhite, 0,  0);
            m_pD3Ddev->Clear(1, &rec3, D3DCLEAR_TARGET,dWhite, 0,  0);

}
    return m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::DrawIndexedPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType, UINT MinIndex, UINT NumVertices, UINT PrimitiveCount, CONST void *pIndexData, D3DFORMAT IndexDataFormat, CONST void *pVertexStreamZeroData, UINT VertexStreamZeroStride) 
{    
    return m_pD3Ddev->DrawIndexedPrimitiveUP(PrimitiveType, MinIndex, NumVertices, PrimitiveCount, pIndexData, IndexDataFormat, pVertexStreamZeroData, VertexStreamZeroStride);
}

HRESULT APIENTRY hkIDirect3DDevice9::DrawPrimitive(D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount) 
{
    return m_pD3Ddev->DrawPrimitive(PrimitiveType, StartVertex, PrimitiveCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::DrawPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, CONST void *pVertexStreamZeroData, UINT VertexStreamZeroStride) 
{
    return m_pD3Ddev->DrawPrimitiveUP(PrimitiveType, PrimitiveCount, pVertexStreamZeroData, VertexStreamZeroStride);
}

HRESULT APIENTRY hkIDirect3DDevice9::DrawRectPatch(UINT Handle, CONST float *pNumSegs, CONST D3DRECTPATCH_INFO *pRectPatchInfo) 
{
    return m_pD3Ddev->DrawRectPatch(Handle, pNumSegs, pRectPatchInfo);
}

HRESULT APIENTRY hkIDirect3DDevice9::DrawTriPatch(UINT Handle, CONST float *pNumSegs, CONST D3DTRIPATCH_INFO *pTriPatchInfo)
{
    return m_pD3Ddev->DrawTriPatch(Handle, pNumSegs, pTriPatchInfo);
}

HRESULT APIENTRY hkIDirect3DDevice9::EndScene()
{
    return m_pD3Ddev->EndScene();
}

HRESULT APIENTRY hkIDirect3DDevice9::EndStateBlock(IDirect3DStateBlock9** ppSB) 
{
    return m_pD3Ddev->EndStateBlock(ppSB);
}

HRESULT APIENTRY hkIDirect3DDevice9::EvictManagedResources() 
{
    return m_pD3Ddev->EvictManagedResources();
}

UINT APIENTRY hkIDirect3DDevice9::GetAvailableTextureMem() 
{
    return m_pD3Ddev->GetAvailableTextureMem();
}

HRESULT APIENTRY hkIDirect3DDevice9::GetBackBuffer(UINT iSwapChain,UINT iBackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface9** ppBackBuffer) 
{
    return m_pD3Ddev->GetBackBuffer(iSwapChain,iBackBuffer, Type, ppBackBuffer);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetClipPlane(DWORD Index, float *pPlane) 
{
    return m_pD3Ddev->GetClipPlane(Index, pPlane);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetClipStatus(D3DCLIPSTATUS9 *pClipStatus) 
{
    return m_pD3Ddev->GetClipStatus(pClipStatus);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetCreationParameters(D3DDEVICE_CREATION_PARAMETERS *pParameters) 
{
    return m_pD3Ddev->GetCreationParameters(pParameters);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetCurrentTexturePalette(UINT *pPaletteNumber)
{
    return m_pD3Ddev->GetCurrentTexturePalette(pPaletteNumber);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetDepthStencilSurface(IDirect3DSurface9 **ppZStencilSurface) 
{
    return m_pD3Ddev->GetDepthStencilSurface(ppZStencilSurface);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetDeviceCaps(D3DCAPS9 *pCaps) 
{
    return m_pD3Ddev->GetDeviceCaps(pCaps);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetDirect3D(IDirect3D9 **ppD3D9) 
{
    HRESULT hRet = m_pD3Ddev->GetDirect3D(ppD3D9);
    if( SUCCEEDED(hRet) )
        *ppD3D9 = m_pD3Dint;
    return hRet;
}

HRESULT APIENTRY hkIDirect3DDevice9::GetDisplayMode(UINT iSwapChain,D3DDISPLAYMODE* pMode) 
{
    return m_pD3Ddev->GetDisplayMode(iSwapChain,pMode);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetFrontBufferData(UINT iSwapChain,IDirect3DSurface9* pDestSurface) 
{
    return m_pD3Ddev->GetFrontBufferData(iSwapChain,pDestSurface);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetFVF(DWORD* pFVF) 
{
    return m_pD3Ddev->GetFVF(pFVF);
}

void APIENTRY hkIDirect3DDevice9::GetGammaRamp(UINT iSwapChain,D3DGAMMARAMP* pRamp) 
{
    m_pD3Ddev->GetGammaRamp(iSwapChain,pRamp);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetIndices(IDirect3DIndexBuffer9** ppIndexData) 
{
    return m_pD3Ddev->GetIndices(ppIndexData);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetLight(DWORD Index, D3DLIGHT9 *pLight) 
{
    return m_pD3Ddev->GetLight(Index, pLight);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetLightEnable(DWORD Index, BOOL *pEnable) 
{
    return m_pD3Ddev->GetLightEnable(Index, pEnable);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetMaterial(D3DMATERIAL9 *pMaterial) 
{
    return m_pD3Ddev->GetMaterial(pMaterial);
}

float APIENTRY hkIDirect3DDevice9::GetNPatchMode() 
{
    return m_pD3Ddev->GetNPatchMode();
}

unsigned int APIENTRY hkIDirect3DDevice9::GetNumberOfSwapChains() 
{
    return m_pD3Ddev->GetNumberOfSwapChains();
}

HRESULT APIENTRY hkIDirect3DDevice9::GetPaletteEntries(UINT PaletteNumber, PALETTEENTRY *pEntries)
{
    return m_pD3Ddev->GetPaletteEntries(PaletteNumber, pEntries);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetPixelShader(IDirect3DPixelShader9** ppShader) 
{
    return m_pD3Ddev->GetPixelShader(ppShader);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetPixelShaderConstantB(UINT StartRegister,BOOL* pConstantData,UINT BoolCount) 
{
    return m_pD3Ddev->GetPixelShaderConstantB(StartRegister,pConstantData,BoolCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetPixelShaderConstantF(UINT StartRegister,float* pConstantData,UINT Vector4fCount) 
{
    return m_pD3Ddev->GetPixelShaderConstantF(StartRegister,pConstantData,Vector4fCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetPixelShaderConstantI(UINT StartRegister,int* pConstantData,UINT Vector4iCount)
{
    return m_pD3Ddev->GetPixelShaderConstantI(StartRegister,pConstantData,Vector4iCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetRasterStatus(UINT iSwapChain,D3DRASTER_STATUS* pRasterStatus) 
{
    return m_pD3Ddev->GetRasterStatus(iSwapChain,pRasterStatus);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetRenderState(D3DRENDERSTATETYPE State, DWORD *pValue) 
{
    return m_pD3Ddev->GetRenderState(State, pValue);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetRenderTarget(DWORD RenderTargetIndex,IDirect3DSurface9** ppRenderTarget) 
{
    return m_pD3Ddev->GetRenderTarget(RenderTargetIndex,ppRenderTarget);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetRenderTargetData(IDirect3DSurface9* pRenderTarget,IDirect3DSurface9* pDestSurface) 
{
    return m_pD3Ddev->GetRenderTargetData(pRenderTarget,pDestSurface);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetSamplerState(DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD* pValue) 
{
    return m_pD3Ddev->GetSamplerState(Sampler,Type,pValue);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetScissorRect(RECT* pRect) 
{
    return m_pD3Ddev->GetScissorRect(pRect);
}

BOOL APIENTRY hkIDirect3DDevice9::GetSoftwareVertexProcessing() 
{
    return m_pD3Ddev->GetSoftwareVertexProcessing();
}

HRESULT APIENTRY hkIDirect3DDevice9::GetStreamSource(UINT StreamNumber,IDirect3DVertexBuffer9** ppStreamData,UINT* OffsetInBytes,UINT* pStride) 
{
    return m_pD3Ddev->GetStreamSource(StreamNumber, ppStreamData,OffsetInBytes, pStride);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetStreamSourceFreq(UINT StreamNumber,UINT* Divider) 
{
    return m_pD3Ddev->GetStreamSourceFreq(StreamNumber,Divider);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetSwapChain(UINT iSwapChain,IDirect3DSwapChain9** pSwapChain)
{
    return m_pD3Ddev->GetSwapChain(iSwapChain,pSwapChain);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetTexture(DWORD Stage, IDirect3DBaseTexture9 **ppTexture) 
{
    return m_pD3Ddev->GetTexture(Stage, ppTexture);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD *pValue) 
{
    return m_pD3Ddev->GetTextureStageState(Stage, Type, pValue);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetTransform(D3DTRANSFORMSTATETYPE State, D3DMATRIX *pMatrix) 
{
    return m_pD3Ddev->GetTransform(State, pMatrix);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetVertexDeclaration(IDirect3DVertexDeclaration9** ppDecl) 
{
    return m_pD3Ddev->GetVertexDeclaration(ppDecl);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetVertexShader(IDirect3DVertexShader9** ppShader) 
{
    return m_pD3Ddev->GetVertexShader(ppShader);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetVertexShaderConstantB(UINT StartRegister,BOOL* pConstantData,UINT BoolCount)
{
    return m_pD3Ddev->GetVertexShaderConstantB(StartRegister,pConstantData,BoolCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetVertexShaderConstantF(UINT StartRegister,float* pConstantData,UINT Vector4fCount) 
{
    return m_pD3Ddev->GetVertexShaderConstantF(StartRegister,pConstantData,Vector4fCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetVertexShaderConstantI(UINT StartRegister,int* pConstantData,UINT Vector4iCount)
{
    return m_pD3Ddev->GetVertexShaderConstantI(StartRegister,pConstantData,Vector4iCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetViewport(D3DVIEWPORT9 *pViewport) 
{
    return m_pD3Ddev->GetViewport(pViewport);
}

HRESULT APIENTRY hkIDirect3DDevice9::LightEnable(DWORD LightIndex, BOOL bEnable) 
{
    return m_pD3Ddev->LightEnable(LightIndex, bEnable);
}

HRESULT APIENTRY hkIDirect3DDevice9::MultiplyTransform(D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX *pMatrix) 
{
    return m_pD3Ddev->MultiplyTransform(State, pMatrix);
}

HRESULT APIENTRY hkIDirect3DDevice9::Present(CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion) 
{    
    return m_pD3Ddev->Present(pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
}

HRESULT APIENTRY hkIDirect3DDevice9::ProcessVertices(UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,IDirect3DVertexBuffer9* pDestBuffer,IDirect3DVertexDeclaration9* pVertexDecl,DWORD Flags) 
{
    return m_pD3Ddev->ProcessVertices(SrcStartIndex, DestIndex, VertexCount, pDestBuffer,pVertexDecl, Flags);
}

ULONG APIENTRY hkIDirect3DDevice9::Release() 
{
    if( --m_refCount == 0 )
        m_pManager->Release();

    return m_pD3Ddev->Release();
}

HRESULT APIENTRY hkIDirect3DDevice9::Reset(D3DPRESENT_PARAMETERS *pPresentationParameters) 
{
    m_pManager->PreReset();

    HRESULT hRet = m_pD3Ddev->Reset(pPresentationParameters);

    if( SUCCEEDED(hRet) )
    {
        m_PresentParam = *pPresentationParameters;
        m_pManager->PostReset();
    }

    return hRet;
}

HRESULT APIENTRY hkIDirect3DDevice9::SetClipPlane(DWORD Index, CONST float *pPlane) 
{
    return m_pD3Ddev->SetClipPlane(Index, pPlane);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetClipStatus(CONST D3DCLIPSTATUS9 *pClipStatus) 
{
    return m_pD3Ddev->SetClipStatus(pClipStatus);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetCurrentTexturePalette(UINT PaletteNumber) 
{
    return m_pD3Ddev->SetCurrentTexturePalette(PaletteNumber);
}

void APIENTRY hkIDirect3DDevice9::SetCursorPosition(int X, int Y, DWORD Flags) 
{
    m_pD3Ddev->SetCursorPosition(X, Y, Flags);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetCursorProperties(UINT XHotSpot, UINT YHotSpot, IDirect3DSurface9 *pCursorBitmap) 
{
    return m_pD3Ddev->SetCursorProperties(XHotSpot, YHotSpot, pCursorBitmap);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetDepthStencilSurface(IDirect3DSurface9* pNewZStencil) 
{
    return m_pD3Ddev->SetDepthStencilSurface(pNewZStencil);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetDialogBoxMode(BOOL bEnableDialogs) 
{
    return m_pD3Ddev->SetDialogBoxMode(bEnableDialogs);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetFVF(DWORD FVF) 
{
    return m_pD3Ddev->SetFVF(FVF);
}

void APIENTRY hkIDirect3DDevice9::SetGammaRamp(UINT iSwapChain,DWORD Flags,CONST D3DGAMMARAMP* pRamp)
{
    m_pD3Ddev->SetGammaRamp(iSwapChain,Flags, pRamp);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetIndices(IDirect3DIndexBuffer9* pIndexData) 
{
    return m_pD3Ddev->SetIndices(pIndexData);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetLight(DWORD Index, CONST D3DLIGHT9 *pLight) 
{
    return m_pD3Ddev->SetLight(Index, pLight);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetMaterial(CONST D3DMATERIAL9 *pMaterial) 
{    
    return m_pD3Ddev->SetMaterial(pMaterial);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetNPatchMode(float nSegments) 
{    
    return m_pD3Ddev->SetNPatchMode(nSegments);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetPaletteEntries(UINT PaletteNumber, CONST PALETTEENTRY *pEntries) 
{
    return m_pD3Ddev->SetPaletteEntries(PaletteNumber, pEntries);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetPixelShader(IDirect3DPixelShader9* pShader) 
{
    return m_pD3Ddev->SetPixelShader(pShader);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetPixelShaderConstantB(UINT StartRegister,CONST BOOL* pConstantData,UINT  BoolCount) 
{
    return m_pD3Ddev->SetPixelShaderConstantB(StartRegister,pConstantData,BoolCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetPixelShaderConstantF(UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount) 
{
    return m_pD3Ddev->SetPixelShaderConstantF(StartRegister,pConstantData,Vector4fCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetPixelShaderConstantI(UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount) 
{
    return m_pD3Ddev->SetPixelShaderConstantI(StartRegister,pConstantData,Vector4iCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetRenderState(D3DRENDERSTATETYPE State, DWORD Value) 
{
    return m_pD3Ddev->SetRenderState(State, Value);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetRenderTarget(DWORD RenderTargetIndex, IDirect3DSurface9* pRenderTarget) 
{
    return m_pD3Ddev->SetRenderTarget(RenderTargetIndex,pRenderTarget);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetSamplerState(DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD Value) 
{
    return m_pD3Ddev->SetSamplerState(Sampler,Type,Value);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetScissorRect(CONST RECT* pRect) 
{
    return m_pD3Ddev->SetScissorRect(pRect);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetSoftwareVertexProcessing(BOOL bSoftware) 
{
    return m_pD3Ddev->SetSoftwareVertexProcessing(bSoftware);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetStreamSource(UINT StreamNumber,IDirect3DVertexBuffer9* pStreamData,UINT OffsetInBytes,UINT Stride) 
{
    return m_pD3Ddev->SetStreamSource(StreamNumber, pStreamData,OffsetInBytes, Stride);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetStreamSourceFreq(UINT StreamNumber,UINT Divider)
{    
    return m_pD3Ddev->SetStreamSourceFreq(StreamNumber,Divider);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetTexture(DWORD Stage, IDirect3DBaseTexture9 *pTexture) 
{
#ifdef D3DHOOK_TEXTURES
    IDirect3DDevice9 *dev = NULL;
    if(pTexture != NULL && ((hkIDirect3DTexture9*)(pTexture))->GetDevice(&dev) == D3D_OK)
    {
        if(dev == this)
            return m_pD3Ddev->SetTexture(Stage, ((hkIDirect3DTexture9*)(pTexture))->m_D3Dtex);
    }
#endif
    
    return m_pD3Ddev->SetTexture(Stage, pTexture);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value) 
{
    return m_pD3Ddev->SetTextureStageState(Stage, Type, Value);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetTransform(D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX *pMatrix) 
{
    return m_pD3Ddev->SetTransform(State, pMatrix);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetVertexDeclaration(IDirect3DVertexDeclaration9* pDecl) 
{
    return m_pD3Ddev->SetVertexDeclaration(pDecl);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetVertexShader(IDirect3DVertexShader9* pShader) 
{
    return m_pD3Ddev->SetVertexShader(pShader);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetVertexShaderConstantB(UINT StartRegister,CONST BOOL* pConstantData,UINT  BoolCount) 
{
    return m_pD3Ddev->SetVertexShaderConstantB(StartRegister,pConstantData,BoolCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetVertexShaderConstantF(UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount) 
{
    return m_pD3Ddev->SetVertexShaderConstantF(StartRegister,pConstantData,Vector4fCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetVertexShaderConstantI(UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount) 
{
    return m_pD3Ddev->SetVertexShaderConstantI(StartRegister,pConstantData,Vector4iCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetViewport(CONST D3DVIEWPORT9 *pViewport) 
{
    return m_pD3Ddev->SetViewport(pViewport);
}

BOOL APIENTRY hkIDirect3DDevice9::ShowCursor(BOOL bShow) 
{
    return m_pD3Ddev->ShowCursor(bShow);
}

HRESULT APIENTRY hkIDirect3DDevice9::StretchRect(IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestSurface,CONST RECT* pDestRect,D3DTEXTUREFILTERTYPE Filter) 
{
    return m_pD3Ddev->StretchRect(pSourceSurface,pSourceRect,pDestSurface,pDestRect,Filter);
}

HRESULT APIENTRY hkIDirect3DDevice9::TestCooperativeLevel() 
{
    return m_pD3Ddev->TestCooperativeLevel();
}

HRESULT APIENTRY hkIDirect3DDevice9::UpdateSurface(IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestinationSurface,CONST POINT* pDestPoint) 
{
    return m_pD3Ddev->UpdateSurface(pSourceSurface,pSourceRect,pDestinationSurface,pDestPoint);
}

HRESULT APIENTRY hkIDirect3DDevice9::UpdateTexture(IDirect3DBaseTexture9 *pSourceTexture, IDirect3DBaseTexture9 *pDestinationTexture) 
{
    return m_pD3Ddev->UpdateTexture(pSourceTexture, pDestinationTexture);
}

HRESULT APIENTRY hkIDirect3DDevice9::ValidateDevice(DWORD *pNumPasses) 
{
    return m_pD3Ddev->ValidateDevice(pNumPasses);
}
After: (ERRORS!)
Code:
/*    Direct3D9 Device */

#include <windows.h>
#include "main.h"
#include "d3d9.h"



#define D3DHOOK_TEXTURES //comment this to disable texture hooking


//**********************************************************************
bool xhair = false;
bool xwire = false;
//**********************************************************************
D3DCOLOR dWhite        = D3DCOLOR_ARGB( 255, 255, 255, 255 );//white
//**********************************************************************








HRESULT CD3DManager::Initialize()
{
    /*
    initialize Resources such as textures 
    (managed and unmanaged [D3DPOOL]), 
    vertex buffers, and other D3D rendering resources
    ...
    m_pD3Ddev->CreateTexture(..., ..., &m_pD3Dtexture);
    */
    return S_OK;
}

HRESULT CD3DManager::PreReset()
{
    /*
    release all UNMANAGED [D3DPOOL_DEFAULT] 
    textures, vertex buffers, and other 
    volitile resources
    ...
    _SAFE_RELEASE(m_pD3Dtexture);
    */
    return S_OK;
}

HRESULT CD3DManager::PostReset()
{
    /*
    re-initialize all UNMANAGED [D3DPOOL_DEFAULT]
    textures, vertex buffers, and other volitile 
    resources
    ...
    m_pD3Ddev->CreateTexture(..., ..., &m_pD3Dtexture);
    */
    return S_OK;
}

HRESULT CD3DManager::Release()
{
    /*
    Release all textures, vertex buffers, and 
    other resources
    ...
    _SAFE_RELEASE(m_pD3Dtexture);
    */
    return S_OK;
}

//-----------------------------------------------------------------------------

HRESULT APIENTRY hkIDirect3DDevice9::QueryInterface(REFIID riid, LPVOID *ppvObj) 
{
    return m_pD3Ddev->QueryInterface(riid, ppvObj);
}

ULONG APIENTRY hkIDirect3DDevice9::AddRef() 
{
    m_refCount++;
    return m_pD3Ddev->AddRef();
}
D3DVIEWPORT9 Viewport;
HRESULT APIENTRY hkIDirect3DDevice9::BeginScene() 
{
    m_pD3Ddev->GetViewport(&Viewport);
    return m_pD3Ddev->BeginScene();
}

HRESULT APIENTRY hkIDirect3DDevice9::BeginStateBlock() 
{
    return m_pD3Ddev->BeginStateBlock();
}

HRESULT APIENTRY hkIDirect3DDevice9::Clear(DWORD Count, CONST D3DRECT *pRects, DWORD Flags, D3DCOLOR Color, float Z, DWORD Stencil) 
{
    return m_pD3Ddev->Clear(Count, pRects, Flags, Color, Z, Stencil);
}

HRESULT APIENTRY hkIDirect3DDevice9::ColorFill(IDirect3DSurface9* pSurface,CONST RECT* pRect, D3DCOLOR color) 
{    
    return m_pD3Ddev->ColorFill(pSurface,pRect,color);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateAdditionalSwapChain(D3DPRESENT_PARAMETERS *pPresentationParameters, IDirect3DSwapChain9 **ppSwapChain) 
{
    return m_pD3Ddev->CreateAdditionalSwapChain(pPresentationParameters, ppSwapChain);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateCubeTexture(UINT EdgeLength,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DCubeTexture9** ppCubeTexture,HANDLE* pSharedHandle) 
{
    return m_pD3Ddev->CreateCubeTexture(EdgeLength, Levels, Usage, Format, Pool, ppCubeTexture,pSharedHandle);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateDepthStencilSurface(UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Discard,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) 
{
    return m_pD3Ddev->CreateDepthStencilSurface(Width, Height, Format, MultiSample, MultisampleQuality,Discard,ppSurface, pSharedHandle);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateIndexBuffer(UINT Length,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DIndexBuffer9** ppIndexBuffer,HANDLE* pSharedHandle) 
{
    return m_pD3Ddev->CreateIndexBuffer(Length, Usage, Format, Pool, ppIndexBuffer,pSharedHandle);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateOffscreenPlainSurface(UINT Width,UINT Height,D3DFORMAT Format,D3DPOOL Pool,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) 
{
    return m_pD3Ddev->CreateOffscreenPlainSurface(Width,Height,Format,Pool,ppSurface,pSharedHandle);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreatePixelShader(CONST DWORD* pFunction,IDirect3DPixelShader9** ppShader) 
{
    return m_pD3Ddev->CreatePixelShader(pFunction, ppShader);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateQuery(D3DQUERYTYPE Type,IDirect3DQuery9** ppQuery) 
{
    return m_pD3Ddev->CreateQuery(Type,ppQuery);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateRenderTarget(UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Lockable,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) 
{
    return m_pD3Ddev->CreateRenderTarget(Width, Height, Format, MultiSample,MultisampleQuality, Lockable, ppSurface,pSharedHandle);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateStateBlock(D3DSTATEBLOCKTYPE Type,IDirect3DStateBlock9** ppSB) 
{
    return m_pD3Ddev->CreateStateBlock(Type, ppSB);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateTexture(UINT Width,UINT Height,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DTexture9** ppTexture,HANDLE* pSharedHandle) 
{
    HRESULT ret = m_pD3Ddev->CreateTexture(Width, Height, Levels, Usage, Format, Pool, ppTexture, pSharedHandle);

#ifdef D3DHOOK_TEXTURES
    if(ret == D3D_OK) { new hkIDirect3DTexture9(ppTexture, this, Width, Height, Format); }
#endif

    return ret;
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateVertexBuffer(UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IDirect3DVertexBuffer9** ppVertexBuffer,HANDLE* pSharedHandle) 
{
    return m_pD3Ddev->CreateVertexBuffer(Length, Usage, FVF, Pool, ppVertexBuffer,pSharedHandle);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateVertexDeclaration(CONST D3DVERTEXELEMENT9* pVertexElements,IDirect3DVertexDeclaration9** ppDecl) 
{
    return m_pD3Ddev->CreateVertexDeclaration(pVertexElements,ppDecl);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateVertexShader(CONST DWORD* pFunction,IDirect3DVertexShader9** ppShader) 
{
    return m_pD3Ddev->CreateVertexShader(pFunction, ppShader);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateVolumeTexture(UINT Width,UINT Height,UINT Depth,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DVolumeTexture9** ppVolumeTexture,HANDLE* pSharedHandle) 
{
    return m_pD3Ddev->CreateVolumeTexture(Width, Height, Depth, Levels, Usage, Format, Pool, ppVolumeTexture,pSharedHandle);
}

HRESULT APIENTRY hkIDirect3DDevice9::DeletePatch(UINT Handle) 
{
    return m_pD3Ddev->DeletePatch(Handle);
}

HRESULT APIENTRY hkIDirect3DDevice9::DrawIndexedPrimitive(D3DPRIMITIVETYPE Type,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount)
{       
    if ((GetAsyncKeyState(VK_NUMPAD2)&1) == 1)        
        xhair = !xhair;  
        if(xhair)
        {
            D3DRECT rec2 = {(Viewport.Width/2)-8, (Viewport.Height/2),(Viewport.Width/2)+8, (Viewport.Height/2)+ 1};
            D3DRECT rec3 = {(Viewport.Width/2),(Viewport.Height/2)-8, (Viewport.Width/2)+1,(Viewport.Height/2)+8};
            m_pD3Ddev->Clear(1, &rec2, D3DCLEAR_TARGET,dWhite, 0,  0);
            m_pD3Ddev->Clear(1, &rec3, D3DCLEAR_TARGET,dWhite, 0,  0);

    if ((GetAsyncKeyState(VK_NUMPAD3)&1) == 1)        
        xwire = !xwire;   
        if(xwire)
        {
            //my code here. 

}
    return m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::DrawIndexedPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType, UINT MinIndex, UINT NumVertices, UINT PrimitiveCount, CONST void *pIndexData, D3DFORMAT IndexDataFormat, CONST void *pVertexStreamZeroData, UINT VertexStreamZeroStride) 
{    
    return m_pD3Ddev->DrawIndexedPrimitiveUP(PrimitiveType, MinIndex, NumVertices, PrimitiveCount, pIndexData, IndexDataFormat, pVertexStreamZeroData, VertexStreamZeroStride);
}

HRESULT APIENTRY hkIDirect3DDevice9::DrawPrimitive(D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount) 
{
    return m_pD3Ddev->DrawPrimitive(PrimitiveType, StartVertex, PrimitiveCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::DrawPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, CONST void *pVertexStreamZeroData, UINT VertexStreamZeroStride) 
{
    return m_pD3Ddev->DrawPrimitiveUP(PrimitiveType, PrimitiveCount, pVertexStreamZeroData, VertexStreamZeroStride);
}

HRESULT APIENTRY hkIDirect3DDevice9::DrawRectPatch(UINT Handle, CONST float *pNumSegs, CONST D3DRECTPATCH_INFO *pRectPatchInfo) 
{
    return m_pD3Ddev->DrawRectPatch(Handle, pNumSegs, pRectPatchInfo);
}

HRESULT APIENTRY hkIDirect3DDevice9::DrawTriPatch(UINT Handle, CONST float *pNumSegs, CONST D3DTRIPATCH_INFO *pTriPatchInfo)
{
    return m_pD3Ddev->DrawTriPatch(Handle, pNumSegs, pTriPatchInfo);
}

HRESULT APIENTRY hkIDirect3DDevice9::EndScene()
{
    return m_pD3Ddev->EndScene();
}

HRESULT APIENTRY hkIDirect3DDevice9::EndStateBlock(IDirect3DStateBlock9** ppSB) 
{
    return m_pD3Ddev->EndStateBlock(ppSB);
}

HRESULT APIENTRY hkIDirect3DDevice9::EvictManagedResources() 
{
    return m_pD3Ddev->EvictManagedResources();
}

UINT APIENTRY hkIDirect3DDevice9::GetAvailableTextureMem() 
{
    return m_pD3Ddev->GetAvailableTextureMem();
}

HRESULT APIENTRY hkIDirect3DDevice9::GetBackBuffer(UINT iSwapChain,UINT iBackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface9** ppBackBuffer) 
{
    return m_pD3Ddev->GetBackBuffer(iSwapChain,iBackBuffer, Type, ppBackBuffer);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetClipPlane(DWORD Index, float *pPlane) 
{
    return m_pD3Ddev->GetClipPlane(Index, pPlane);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetClipStatus(D3DCLIPSTATUS9 *pClipStatus) 
{
    return m_pD3Ddev->GetClipStatus(pClipStatus);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetCreationParameters(D3DDEVICE_CREATION_PARAMETERS *pParameters) 
{
    return m_pD3Ddev->GetCreationParameters(pParameters);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetCurrentTexturePalette(UINT *pPaletteNumber)
{
    return m_pD3Ddev->GetCurrentTexturePalette(pPaletteNumber);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetDepthStencilSurface(IDirect3DSurface9 **ppZStencilSurface) 
{
    return m_pD3Ddev->GetDepthStencilSurface(ppZStencilSurface);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetDeviceCaps(D3DCAPS9 *pCaps) 
{
    return m_pD3Ddev->GetDeviceCaps(pCaps);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetDirect3D(IDirect3D9 **ppD3D9) 
{
    HRESULT hRet = m_pD3Ddev->GetDirect3D(ppD3D9);
    if( SUCCEEDED(hRet) )
        *ppD3D9 = m_pD3Dint;
    return hRet;
}

HRESULT APIENTRY hkIDirect3DDevice9::GetDisplayMode(UINT iSwapChain,D3DDISPLAYMODE* pMode) 
{
    return m_pD3Ddev->GetDisplayMode(iSwapChain,pMode);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetFrontBufferData(UINT iSwapChain,IDirect3DSurface9* pDestSurface) 
{
    return m_pD3Ddev->GetFrontBufferData(iSwapChain,pDestSurface);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetFVF(DWORD* pFVF) 
{
    return m_pD3Ddev->GetFVF(pFVF);
}

void APIENTRY hkIDirect3DDevice9::GetGammaRamp(UINT iSwapChain,D3DGAMMARAMP* pRamp) 
{
    m_pD3Ddev->GetGammaRamp(iSwapChain,pRamp);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetIndices(IDirect3DIndexBuffer9** ppIndexData) 
{
    return m_pD3Ddev->GetIndices(ppIndexData);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetLight(DWORD Index, D3DLIGHT9 *pLight) 
{
    return m_pD3Ddev->GetLight(Index, pLight);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetLightEnable(DWORD Index, BOOL *pEnable) 
{
    return m_pD3Ddev->GetLightEnable(Index, pEnable);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetMaterial(D3DMATERIAL9 *pMaterial) 
{
    return m_pD3Ddev->GetMaterial(pMaterial);
}

float APIENTRY hkIDirect3DDevice9::GetNPatchMode() 
{
    return m_pD3Ddev->GetNPatchMode();
}

unsigned int APIENTRY hkIDirect3DDevice9::GetNumberOfSwapChains() 
{
    return m_pD3Ddev->GetNumberOfSwapChains();
}

HRESULT APIENTRY hkIDirect3DDevice9::GetPaletteEntries(UINT PaletteNumber, PALETTEENTRY *pEntries)
{
    return m_pD3Ddev->GetPaletteEntries(PaletteNumber, pEntries);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetPixelShader(IDirect3DPixelShader9** ppShader) 
{
    return m_pD3Ddev->GetPixelShader(ppShader);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetPixelShaderConstantB(UINT StartRegister,BOOL* pConstantData,UINT BoolCount) 
{
    return m_pD3Ddev->GetPixelShaderConstantB(StartRegister,pConstantData,BoolCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetPixelShaderConstantF(UINT StartRegister,float* pConstantData,UINT Vector4fCount) 
{
    return m_pD3Ddev->GetPixelShaderConstantF(StartRegister,pConstantData,Vector4fCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetPixelShaderConstantI(UINT StartRegister,int* pConstantData,UINT Vector4iCount)
{
    return m_pD3Ddev->GetPixelShaderConstantI(StartRegister,pConstantData,Vector4iCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetRasterStatus(UINT iSwapChain,D3DRASTER_STATUS* pRasterStatus) 
{
    return m_pD3Ddev->GetRasterStatus(iSwapChain,pRasterStatus);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetRenderState(D3DRENDERSTATETYPE State, DWORD *pValue) 
{
    return m_pD3Ddev->GetRenderState(State, pValue);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetRenderTarget(DWORD RenderTargetIndex,IDirect3DSurface9** ppRenderTarget) 
{
    return m_pD3Ddev->GetRenderTarget(RenderTargetIndex,ppRenderTarget);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetRenderTargetData(IDirect3DSurface9* pRenderTarget,IDirect3DSurface9* pDestSurface) 
{
    return m_pD3Ddev->GetRenderTargetData(pRenderTarget,pDestSurface);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetSamplerState(DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD* pValue) 
{
    return m_pD3Ddev->GetSamplerState(Sampler,Type,pValue);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetScissorRect(RECT* pRect) 
{
    return m_pD3Ddev->GetScissorRect(pRect);
}

BOOL APIENTRY hkIDirect3DDevice9::GetSoftwareVertexProcessing() 
{
    return m_pD3Ddev->GetSoftwareVertexProcessing();
}

HRESULT APIENTRY hkIDirect3DDevice9::GetStreamSource(UINT StreamNumber,IDirect3DVertexBuffer9** ppStreamData,UINT* OffsetInBytes,UINT* pStride) 
{
    return m_pD3Ddev->GetStreamSource(StreamNumber, ppStreamData,OffsetInBytes, pStride);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetStreamSourceFreq(UINT StreamNumber,UINT* Divider) 
{
    return m_pD3Ddev->GetStreamSourceFreq(StreamNumber,Divider);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetSwapChain(UINT iSwapChain,IDirect3DSwapChain9** pSwapChain)
{
    return m_pD3Ddev->GetSwapChain(iSwapChain,pSwapChain);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetTexture(DWORD Stage, IDirect3DBaseTexture9 **ppTexture) 
{
    return m_pD3Ddev->GetTexture(Stage, ppTexture);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD *pValue) 
{
    return m_pD3Ddev->GetTextureStageState(Stage, Type, pValue);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetTransform(D3DTRANSFORMSTATETYPE State, D3DMATRIX *pMatrix) 
{
    return m_pD3Ddev->GetTransform(State, pMatrix);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetVertexDeclaration(IDirect3DVertexDeclaration9** ppDecl) 
{
    return m_pD3Ddev->GetVertexDeclaration(ppDecl);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetVertexShader(IDirect3DVertexShader9** ppShader) 
{
    return m_pD3Ddev->GetVertexShader(ppShader);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetVertexShaderConstantB(UINT StartRegister,BOOL* pConstantData,UINT BoolCount)
{
    return m_pD3Ddev->GetVertexShaderConstantB(StartRegister,pConstantData,BoolCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetVertexShaderConstantF(UINT StartRegister,float* pConstantData,UINT Vector4fCount) 
{
    return m_pD3Ddev->GetVertexShaderConstantF(StartRegister,pConstantData,Vector4fCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetVertexShaderConstantI(UINT StartRegister,int* pConstantData,UINT Vector4iCount)
{
    return m_pD3Ddev->GetVertexShaderConstantI(StartRegister,pConstantData,Vector4iCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetViewport(D3DVIEWPORT9 *pViewport) 
{
    return m_pD3Ddev->GetViewport(pViewport);
}

HRESULT APIENTRY hkIDirect3DDevice9::LightEnable(DWORD LightIndex, BOOL bEnable) 
{
    return m_pD3Ddev->LightEnable(LightIndex, bEnable);
}

HRESULT APIENTRY hkIDirect3DDevice9::MultiplyTransform(D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX *pMatrix) 
{
    return m_pD3Ddev->MultiplyTransform(State, pMatrix);
}

HRESULT APIENTRY hkIDirect3DDevice9::Present(CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion) 
{    
    return m_pD3Ddev->Present(pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
}

HRESULT APIENTRY hkIDirect3DDevice9::ProcessVertices(UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,IDirect3DVertexBuffer9* pDestBuffer,IDirect3DVertexDeclaration9* pVertexDecl,DWORD Flags) 
{
    return m_pD3Ddev->ProcessVertices(SrcStartIndex, DestIndex, VertexCount, pDestBuffer,pVertexDecl, Flags);
}

ULONG APIENTRY hkIDirect3DDevice9::Release() 
{
    if( --m_refCount == 0 )
        m_pManager->Release();

    return m_pD3Ddev->Release();
}

HRESULT APIENTRY hkIDirect3DDevice9::Reset(D3DPRESENT_PARAMETERS *pPresentationParameters) 
{
    m_pManager->PreReset();

    HRESULT hRet = m_pD3Ddev->Reset(pPresentationParameters);

    if( SUCCEEDED(hRet) )
    {
        m_PresentParam = *pPresentationParameters;
        m_pManager->PostReset();
    }

    return hRet;
}

HRESULT APIENTRY hkIDirect3DDevice9::SetClipPlane(DWORD Index, CONST float *pPlane) 
{
    return m_pD3Ddev->SetClipPlane(Index, pPlane);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetClipStatus(CONST D3DCLIPSTATUS9 *pClipStatus) 
{
    return m_pD3Ddev->SetClipStatus(pClipStatus);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetCurrentTexturePalette(UINT PaletteNumber) 
{
    return m_pD3Ddev->SetCurrentTexturePalette(PaletteNumber);
}

void APIENTRY hkIDirect3DDevice9::SetCursorPosition(int X, int Y, DWORD Flags) 
{
    m_pD3Ddev->SetCursorPosition(X, Y, Flags);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetCursorProperties(UINT XHotSpot, UINT YHotSpot, IDirect3DSurface9 *pCursorBitmap) 
{
    return m_pD3Ddev->SetCursorProperties(XHotSpot, YHotSpot, pCursorBitmap);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetDepthStencilSurface(IDirect3DSurface9* pNewZStencil) 
{
    return m_pD3Ddev->SetDepthStencilSurface(pNewZStencil);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetDialogBoxMode(BOOL bEnableDialogs) 
{
    return m_pD3Ddev->SetDialogBoxMode(bEnableDialogs);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetFVF(DWORD FVF) 
{
    return m_pD3Ddev->SetFVF(FVF);
}

void APIENTRY hkIDirect3DDevice9::SetGammaRamp(UINT iSwapChain,DWORD Flags,CONST D3DGAMMARAMP* pRamp)
{
    m_pD3Ddev->SetGammaRamp(iSwapChain,Flags, pRamp);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetIndices(IDirect3DIndexBuffer9* pIndexData) 
{
    return m_pD3Ddev->SetIndices(pIndexData);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetLight(DWORD Index, CONST D3DLIGHT9 *pLight) 
{
    return m_pD3Ddev->SetLight(Index, pLight);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetMaterial(CONST D3DMATERIAL9 *pMaterial) 
{    
    return m_pD3Ddev->SetMaterial(pMaterial);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetNPatchMode(float nSegments) 
{    
    return m_pD3Ddev->SetNPatchMode(nSegments);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetPaletteEntries(UINT PaletteNumber, CONST PALETTEENTRY *pEntries) 
{
    return m_pD3Ddev->SetPaletteEntries(PaletteNumber, pEntries);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetPixelShader(IDirect3DPixelShader9* pShader) 
{
    return m_pD3Ddev->SetPixelShader(pShader);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetPixelShaderConstantB(UINT StartRegister,CONST BOOL* pConstantData,UINT  BoolCount) 
{
    return m_pD3Ddev->SetPixelShaderConstantB(StartRegister,pConstantData,BoolCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetPixelShaderConstantF(UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount) 
{
    return m_pD3Ddev->SetPixelShaderConstantF(StartRegister,pConstantData,Vector4fCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetPixelShaderConstantI(UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount) 
{
    return m_pD3Ddev->SetPixelShaderConstantI(StartRegister,pConstantData,Vector4iCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetRenderState(D3DRENDERSTATETYPE State, DWORD Value) 
{
    return m_pD3Ddev->SetRenderState(State, Value);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetRenderTarget(DWORD RenderTargetIndex, IDirect3DSurface9* pRenderTarget) 
{
    return m_pD3Ddev->SetRenderTarget(RenderTargetIndex,pRenderTarget);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetSamplerState(DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD Value) 
{
    return m_pD3Ddev->SetSamplerState(Sampler,Type,Value);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetScissorRect(CONST RECT* pRect) 
{
    return m_pD3Ddev->SetScissorRect(pRect);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetSoftwareVertexProcessing(BOOL bSoftware) 
{
    return m_pD3Ddev->SetSoftwareVertexProcessing(bSoftware);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetStreamSource(UINT StreamNumber,IDirect3DVertexBuffer9* pStreamData,UINT OffsetInBytes,UINT Stride) 
{
    return m_pD3Ddev->SetStreamSource(StreamNumber, pStreamData,OffsetInBytes, Stride);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetStreamSourceFreq(UINT StreamNumber,UINT Divider)
{    
    return m_pD3Ddev->SetStreamSourceFreq(StreamNumber,Divider);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetTexture(DWORD Stage, IDirect3DBaseTexture9 *pTexture) 
{
#ifdef D3DHOOK_TEXTURES
    IDirect3DDevice9 *dev = NULL;
    if(pTexture != NULL && ((hkIDirect3DTexture9*)(pTexture))->GetDevice(&dev) == D3D_OK)
    {
        if(dev == this)
            return m_pD3Ddev->SetTexture(Stage, ((hkIDirect3DTexture9*)(pTexture))->m_D3Dtex);
    }
#endif
    
    return m_pD3Ddev->SetTexture(Stage, pTexture);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value) 
{
    return m_pD3Ddev->SetTextureStageState(Stage, Type, Value);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetTransform(D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX *pMatrix) 
{
    return m_pD3Ddev->SetTransform(State, pMatrix);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetVertexDeclaration(IDirect3DVertexDeclaration9* pDecl) 
{
    return m_pD3Ddev->SetVertexDeclaration(pDecl);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetVertexShader(IDirect3DVertexShader9* pShader) 
{
    return m_pD3Ddev->SetVertexShader(pShader);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetVertexShaderConstantB(UINT StartRegister,CONST BOOL* pConstantData,UINT  BoolCount) 
{
    return m_pD3Ddev->SetVertexShaderConstantB(StartRegister,pConstantData,BoolCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetVertexShaderConstantF(UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount) 
{
    return m_pD3Ddev->SetVertexShaderConstantF(StartRegister,pConstantData,Vector4fCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetVertexShaderConstantI(UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount) 
{
    return m_pD3Ddev->SetVertexShaderConstantI(StartRegister,pConstantData,Vector4iCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetViewport(CONST D3DVIEWPORT9 *pViewport) 
{
    return m_pD3Ddev->SetViewport(pViewport);
}

BOOL APIENTRY hkIDirect3DDevice9::ShowCursor(BOOL bShow) 
{
    return m_pD3Ddev->ShowCursor(bShow);
}

HRESULT APIENTRY hkIDirect3DDevice9::StretchRect(IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestSurface,CONST RECT* pDestRect,D3DTEXTUREFILTERTYPE Filter) 
{
    return m_pD3Ddev->StretchRect(pSourceSurface,pSourceRect,pDestSurface,pDestRect,Filter);
}

HRESULT APIENTRY hkIDirect3DDevice9::TestCooperativeLevel() 
{
    return m_pD3Ddev->TestCooperativeLevel();
}

HRESULT APIENTRY hkIDirect3DDevice9::UpdateSurface(IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestinationSurface,CONST POINT* pDestPoint) 
{
    return m_pD3Ddev->UpdateSurface(pSourceSurface,pSourceRect,pDestinationSurface,pDestPoint);
}

HRESULT APIENTRY hkIDirect3DDevice9::UpdateTexture(IDirect3DBaseTexture9 *pSourceTexture, IDirect3DBaseTexture9 *pDestinationTexture) 
{
    return m_pD3Ddev->UpdateTexture(pSourceTexture, pDestinationTexture);
}

HRESULT APIENTRY hkIDirect3DDevice9::ValidateDevice(DWORD *pNumPasses) 
{
    return m_pD3Ddev->ValidateDevice(pNumPasses);
}/*    Direct3D9 Device */

#include <windows.h>
#include "main.h"
#include "d3d9.h"



#define D3DHOOK_TEXTURES //comment this to disable texture hooking


//**********************************************************************
bool xhair = false;
bool xwire = false;
//**********************************************************************
D3DCOLOR dWhite        = D3DCOLOR_ARGB( 255, 255, 255, 255 );//white
//**********************************************************************








HRESULT CD3DManager::Initialize()
{
    /*
    initialize Resources such as textures 
    (managed and unmanaged [D3DPOOL]), 
    vertex buffers, and other D3D rendering resources
    ...
    m_pD3Ddev->CreateTexture(..., ..., &m_pD3Dtexture);
    */
    return S_OK;
}

HRESULT CD3DManager::PreReset()
{
    /*
    release all UNMANAGED [D3DPOOL_DEFAULT] 
    textures, vertex buffers, and other 
    volitile resources
    ...
    _SAFE_RELEASE(m_pD3Dtexture);
    */
    return S_OK;
}

HRESULT CD3DManager::PostReset()
{
    /*
    re-initialize all UNMANAGED [D3DPOOL_DEFAULT]
    textures, vertex buffers, and other volitile 
    resources
    ...
    m_pD3Ddev->CreateTexture(..., ..., &m_pD3Dtexture);
    */
    return S_OK;
}

HRESULT CD3DManager::Release()
{
    /*
    Release all textures, vertex buffers, and 
    other resources
    ...
    _SAFE_RELEASE(m_pD3Dtexture);
    */
    return S_OK;
}

//-----------------------------------------------------------------------------

HRESULT APIENTRY hkIDirect3DDevice9::QueryInterface(REFIID riid, LPVOID *ppvObj) 
{
    return m_pD3Ddev->QueryInterface(riid, ppvObj);
}

ULONG APIENTRY hkIDirect3DDevice9::AddRef() 
{
    m_refCount++;
    return m_pD3Ddev->AddRef();
}
D3DVIEWPORT9 Viewport;
HRESULT APIENTRY hkIDirect3DDevice9::BeginScene() 
{
    m_pD3Ddev->GetViewport(&Viewport);
    return m_pD3Ddev->BeginScene();
}

HRESULT APIENTRY hkIDirect3DDevice9::BeginStateBlock() 
{
    return m_pD3Ddev->BeginStateBlock();
}

HRESULT APIENTRY hkIDirect3DDevice9::Clear(DWORD Count, CONST D3DRECT *pRects, DWORD Flags, D3DCOLOR Color, float Z, DWORD Stencil) 
{
    return m_pD3Ddev->Clear(Count, pRects, Flags, Color, Z, Stencil);
}

HRESULT APIENTRY hkIDirect3DDevice9::ColorFill(IDirect3DSurface9* pSurface,CONST RECT* pRect, D3DCOLOR color) 
{    
    return m_pD3Ddev->ColorFill(pSurface,pRect,color);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateAdditionalSwapChain(D3DPRESENT_PARAMETERS *pPresentationParameters, IDirect3DSwapChain9 **ppSwapChain) 
{
    return m_pD3Ddev->CreateAdditionalSwapChain(pPresentationParameters, ppSwapChain);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateCubeTexture(UINT EdgeLength,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DCubeTexture9** ppCubeTexture,HANDLE* pSharedHandle) 
{
    return m_pD3Ddev->CreateCubeTexture(EdgeLength, Levels, Usage, Format, Pool, ppCubeTexture,pSharedHandle);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateDepthStencilSurface(UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Discard,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) 
{
    return m_pD3Ddev->CreateDepthStencilSurface(Width, Height, Format, MultiSample, MultisampleQuality,Discard,ppSurface, pSharedHandle);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateIndexBuffer(UINT Length,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DIndexBuffer9** ppIndexBuffer,HANDLE* pSharedHandle) 
{
    return m_pD3Ddev->CreateIndexBuffer(Length, Usage, Format, Pool, ppIndexBuffer,pSharedHandle);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateOffscreenPlainSurface(UINT Width,UINT Height,D3DFORMAT Format,D3DPOOL Pool,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) 
{
    return m_pD3Ddev->CreateOffscreenPlainSurface(Width,Height,Format,Pool,ppSurface,pSharedHandle);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreatePixelShader(CONST DWORD* pFunction,IDirect3DPixelShader9** ppShader) 
{
    return m_pD3Ddev->CreatePixelShader(pFunction, ppShader);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateQuery(D3DQUERYTYPE Type,IDirect3DQuery9** ppQuery) 
{
    return m_pD3Ddev->CreateQuery(Type,ppQuery);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateRenderTarget(UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Lockable,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) 
{
    return m_pD3Ddev->CreateRenderTarget(Width, Height, Format, MultiSample,MultisampleQuality, Lockable, ppSurface,pSharedHandle);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateStateBlock(D3DSTATEBLOCKTYPE Type,IDirect3DStateBlock9** ppSB) 
{
    return m_pD3Ddev->CreateStateBlock(Type, ppSB);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateTexture(UINT Width,UINT Height,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DTexture9** ppTexture,HANDLE* pSharedHandle) 
{
    HRESULT ret = m_pD3Ddev->CreateTexture(Width, Height, Levels, Usage, Format, Pool, ppTexture, pSharedHandle);

#ifdef D3DHOOK_TEXTURES
    if(ret == D3D_OK) { new hkIDirect3DTexture9(ppTexture, this, Width, Height, Format); }
#endif

    return ret;
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateVertexBuffer(UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IDirect3DVertexBuffer9** ppVertexBuffer,HANDLE* pSharedHandle) 
{
    return m_pD3Ddev->CreateVertexBuffer(Length, Usage, FVF, Pool, ppVertexBuffer,pSharedHandle);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateVertexDeclaration(CONST D3DVERTEXELEMENT9* pVertexElements,IDirect3DVertexDeclaration9** ppDecl) 
{
    return m_pD3Ddev->CreateVertexDeclaration(pVertexElements,ppDecl);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateVertexShader(CONST DWORD* pFunction,IDirect3DVertexShader9** ppShader) 
{
    return m_pD3Ddev->CreateVertexShader(pFunction, ppShader);
}

HRESULT APIENTRY hkIDirect3DDevice9::CreateVolumeTexture(UINT Width,UINT Height,UINT Depth,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DVolumeTexture9** ppVolumeTexture,HANDLE* pSharedHandle) 
{
    return m_pD3Ddev->CreateVolumeTexture(Width, Height, Depth, Levels, Usage, Format, Pool, ppVolumeTexture,pSharedHandle);
}

HRESULT APIENTRY hkIDirect3DDevice9::DeletePatch(UINT Handle) 
{
    return m_pD3Ddev->DeletePatch(Handle);
}

HRESULT APIENTRY hkIDirect3DDevice9::DrawIndexedPrimitive(D3DPRIMITIVETYPE Type,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount)
{       
    if ((GetAsyncKeyState(VK_NUMPAD2)&1) == 1)        
        xhair = !xhair;  
        if(xhair)
        {
            D3DRECT rec2 = {(Viewport.Width/2)-8, (Viewport.Height/2),(Viewport.Width/2)+8, (Viewport.Height/2)+ 1};
            D3DRECT rec3 = {(Viewport.Width/2),(Viewport.Height/2)-8, (Viewport.Width/2)+1,(Viewport.Height/2)+8};
            m_pD3Ddev->Clear(1, &rec2, D3DCLEAR_TARGET,dWhite, 0,  0);
            m_pD3Ddev->Clear(1, &rec3, D3DCLEAR_TARGET,dWhite, 0,  0);

    if ((GetAsyncKeyState(VK_NUMPAD3)&1) == 1)        
        xwire = !xwire;   
        if(xwire)
        {
            //my code here. 

}
    return m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::DrawIndexedPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType, UINT MinIndex, UINT NumVertices, UINT PrimitiveCount, CONST void *pIndexData, D3DFORMAT IndexDataFormat, CONST void *pVertexStreamZeroData, UINT VertexStreamZeroStride) 
{    
    return m_pD3Ddev->DrawIndexedPrimitiveUP(PrimitiveType, MinIndex, NumVertices, PrimitiveCount, pIndexData, IndexDataFormat, pVertexStreamZeroData, VertexStreamZeroStride);
}

HRESULT APIENTRY hkIDirect3DDevice9::DrawPrimitive(D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount) 
{
    return m_pD3Ddev->DrawPrimitive(PrimitiveType, StartVertex, PrimitiveCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::DrawPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, CONST void *pVertexStreamZeroData, UINT VertexStreamZeroStride) 
{
    return m_pD3Ddev->DrawPrimitiveUP(PrimitiveType, PrimitiveCount, pVertexStreamZeroData, VertexStreamZeroStride);
}

HRESULT APIENTRY hkIDirect3DDevice9::DrawRectPatch(UINT Handle, CONST float *pNumSegs, CONST D3DRECTPATCH_INFO *pRectPatchInfo) 
{
    return m_pD3Ddev->DrawRectPatch(Handle, pNumSegs, pRectPatchInfo);
}

HRESULT APIENTRY hkIDirect3DDevice9::DrawTriPatch(UINT Handle, CONST float *pNumSegs, CONST D3DTRIPATCH_INFO *pTriPatchInfo)
{
    return m_pD3Ddev->DrawTriPatch(Handle, pNumSegs, pTriPatchInfo);
}

HRESULT APIENTRY hkIDirect3DDevice9::EndScene()
{
    return m_pD3Ddev->EndScene();
}

HRESULT APIENTRY hkIDirect3DDevice9::EndStateBlock(IDirect3DStateBlock9** ppSB) 
{
    return m_pD3Ddev->EndStateBlock(ppSB);
}

HRESULT APIENTRY hkIDirect3DDevice9::EvictManagedResources() 
{
    return m_pD3Ddev->EvictManagedResources();
}

UINT APIENTRY hkIDirect3DDevice9::GetAvailableTextureMem() 
{
    return m_pD3Ddev->GetAvailableTextureMem();
}

HRESULT APIENTRY hkIDirect3DDevice9::GetBackBuffer(UINT iSwapChain,UINT iBackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface9** ppBackBuffer) 
{
    return m_pD3Ddev->GetBackBuffer(iSwapChain,iBackBuffer, Type, ppBackBuffer);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetClipPlane(DWORD Index, float *pPlane) 
{
    return m_pD3Ddev->GetClipPlane(Index, pPlane);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetClipStatus(D3DCLIPSTATUS9 *pClipStatus) 
{
    return m_pD3Ddev->GetClipStatus(pClipStatus);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetCreationParameters(D3DDEVICE_CREATION_PARAMETERS *pParameters) 
{
    return m_pD3Ddev->GetCreationParameters(pParameters);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetCurrentTexturePalette(UINT *pPaletteNumber)
{
    return m_pD3Ddev->GetCurrentTexturePalette(pPaletteNumber);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetDepthStencilSurface(IDirect3DSurface9 **ppZStencilSurface) 
{
    return m_pD3Ddev->GetDepthStencilSurface(ppZStencilSurface);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetDeviceCaps(D3DCAPS9 *pCaps) 
{
    return m_pD3Ddev->GetDeviceCaps(pCaps);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetDirect3D(IDirect3D9 **ppD3D9) 
{
    HRESULT hRet = m_pD3Ddev->GetDirect3D(ppD3D9);
    if( SUCCEEDED(hRet) )
        *ppD3D9 = m_pD3Dint;
    return hRet;
}

HRESULT APIENTRY hkIDirect3DDevice9::GetDisplayMode(UINT iSwapChain,D3DDISPLAYMODE* pMode) 
{
    return m_pD3Ddev->GetDisplayMode(iSwapChain,pMode);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetFrontBufferData(UINT iSwapChain,IDirect3DSurface9* pDestSurface) 
{
    return m_pD3Ddev->GetFrontBufferData(iSwapChain,pDestSurface);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetFVF(DWORD* pFVF) 
{
    return m_pD3Ddev->GetFVF(pFVF);
}

void APIENTRY hkIDirect3DDevice9::GetGammaRamp(UINT iSwapChain,D3DGAMMARAMP* pRamp) 
{
    m_pD3Ddev->GetGammaRamp(iSwapChain,pRamp);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetIndices(IDirect3DIndexBuffer9** ppIndexData) 
{
    return m_pD3Ddev->GetIndices(ppIndexData);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetLight(DWORD Index, D3DLIGHT9 *pLight) 
{
    return m_pD3Ddev->GetLight(Index, pLight);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetLightEnable(DWORD Index, BOOL *pEnable) 
{
    return m_pD3Ddev->GetLightEnable(Index, pEnable);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetMaterial(D3DMATERIAL9 *pMaterial) 
{
    return m_pD3Ddev->GetMaterial(pMaterial);
}

float APIENTRY hkIDirect3DDevice9::GetNPatchMode() 
{
    return m_pD3Ddev->GetNPatchMode();
}

unsigned int APIENTRY hkIDirect3DDevice9::GetNumberOfSwapChains() 
{
    return m_pD3Ddev->GetNumberOfSwapChains();
}

HRESULT APIENTRY hkIDirect3DDevice9::GetPaletteEntries(UINT PaletteNumber, PALETTEENTRY *pEntries)
{
    return m_pD3Ddev->GetPaletteEntries(PaletteNumber, pEntries);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetPixelShader(IDirect3DPixelShader9** ppShader) 
{
    return m_pD3Ddev->GetPixelShader(ppShader);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetPixelShaderConstantB(UINT StartRegister,BOOL* pConstantData,UINT BoolCount) 
{
    return m_pD3Ddev->GetPixelShaderConstantB(StartRegister,pConstantData,BoolCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetPixelShaderConstantF(UINT StartRegister,float* pConstantData,UINT Vector4fCount) 
{
    return m_pD3Ddev->GetPixelShaderConstantF(StartRegister,pConstantData,Vector4fCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetPixelShaderConstantI(UINT StartRegister,int* pConstantData,UINT Vector4iCount)
{
    return m_pD3Ddev->GetPixelShaderConstantI(StartRegister,pConstantData,Vector4iCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetRasterStatus(UINT iSwapChain,D3DRASTER_STATUS* pRasterStatus) 
{
    return m_pD3Ddev->GetRasterStatus(iSwapChain,pRasterStatus);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetRenderState(D3DRENDERSTATETYPE State, DWORD *pValue) 
{
    return m_pD3Ddev->GetRenderState(State, pValue);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetRenderTarget(DWORD RenderTargetIndex,IDirect3DSurface9** ppRenderTarget) 
{
    return m_pD3Ddev->GetRenderTarget(RenderTargetIndex,ppRenderTarget);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetRenderTargetData(IDirect3DSurface9* pRenderTarget,IDirect3DSurface9* pDestSurface) 
{
    return m_pD3Ddev->GetRenderTargetData(pRenderTarget,pDestSurface);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetSamplerState(DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD* pValue) 
{
    return m_pD3Ddev->GetSamplerState(Sampler,Type,pValue);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetScissorRect(RECT* pRect) 
{
    return m_pD3Ddev->GetScissorRect(pRect);
}

BOOL APIENTRY hkIDirect3DDevice9::GetSoftwareVertexProcessing() 
{
    return m_pD3Ddev->GetSoftwareVertexProcessing();
}

HRESULT APIENTRY hkIDirect3DDevice9::GetStreamSource(UINT StreamNumber,IDirect3DVertexBuffer9** ppStreamData,UINT* OffsetInBytes,UINT* pStride) 
{
    return m_pD3Ddev->GetStreamSource(StreamNumber, ppStreamData,OffsetInBytes, pStride);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetStreamSourceFreq(UINT StreamNumber,UINT* Divider) 
{
    return m_pD3Ddev->GetStreamSourceFreq(StreamNumber,Divider);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetSwapChain(UINT iSwapChain,IDirect3DSwapChain9** pSwapChain)
{
    return m_pD3Ddev->GetSwapChain(iSwapChain,pSwapChain);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetTexture(DWORD Stage, IDirect3DBaseTexture9 **ppTexture) 
{
    return m_pD3Ddev->GetTexture(Stage, ppTexture);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD *pValue) 
{
    return m_pD3Ddev->GetTextureStageState(Stage, Type, pValue);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetTransform(D3DTRANSFORMSTATETYPE State, D3DMATRIX *pMatrix) 
{
    return m_pD3Ddev->GetTransform(State, pMatrix);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetVertexDeclaration(IDirect3DVertexDeclaration9** ppDecl) 
{
    return m_pD3Ddev->GetVertexDeclaration(ppDecl);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetVertexShader(IDirect3DVertexShader9** ppShader) 
{
    return m_pD3Ddev->GetVertexShader(ppShader);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetVertexShaderConstantB(UINT StartRegister,BOOL* pConstantData,UINT BoolCount)
{
    return m_pD3Ddev->GetVertexShaderConstantB(StartRegister,pConstantData,BoolCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetVertexShaderConstantF(UINT StartRegister,float* pConstantData,UINT Vector4fCount) 
{
    return m_pD3Ddev->GetVertexShaderConstantF(StartRegister,pConstantData,Vector4fCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetVertexShaderConstantI(UINT StartRegister,int* pConstantData,UINT Vector4iCount)
{
    return m_pD3Ddev->GetVertexShaderConstantI(StartRegister,pConstantData,Vector4iCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::GetViewport(D3DVIEWPORT9 *pViewport) 
{
    return m_pD3Ddev->GetViewport(pViewport);
}

HRESULT APIENTRY hkIDirect3DDevice9::LightEnable(DWORD LightIndex, BOOL bEnable) 
{
    return m_pD3Ddev->LightEnable(LightIndex, bEnable);
}

HRESULT APIENTRY hkIDirect3DDevice9::MultiplyTransform(D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX *pMatrix) 
{
    return m_pD3Ddev->MultiplyTransform(State, pMatrix);
}

HRESULT APIENTRY hkIDirect3DDevice9::Present(CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion) 
{    
    return m_pD3Ddev->Present(pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
}

HRESULT APIENTRY hkIDirect3DDevice9::ProcessVertices(UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,IDirect3DVertexBuffer9* pDestBuffer,IDirect3DVertexDeclaration9* pVertexDecl,DWORD Flags) 
{
    return m_pD3Ddev->ProcessVertices(SrcStartIndex, DestIndex, VertexCount, pDestBuffer,pVertexDecl, Flags);
}

ULONG APIENTRY hkIDirect3DDevice9::Release() 
{
    if( --m_refCount == 0 )
        m_pManager->Release();

    return m_pD3Ddev->Release();
}

HRESULT APIENTRY hkIDirect3DDevice9::Reset(D3DPRESENT_PARAMETERS *pPresentationParameters) 
{
    m_pManager->PreReset();

    HRESULT hRet = m_pD3Ddev->Reset(pPresentationParameters);

    if( SUCCEEDED(hRet) )
    {
        m_PresentParam = *pPresentationParameters;
        m_pManager->PostReset();
    }

    return hRet;
}

HRESULT APIENTRY hkIDirect3DDevice9::SetClipPlane(DWORD Index, CONST float *pPlane) 
{
    return m_pD3Ddev->SetClipPlane(Index, pPlane);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetClipStatus(CONST D3DCLIPSTATUS9 *pClipStatus) 
{
    return m_pD3Ddev->SetClipStatus(pClipStatus);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetCurrentTexturePalette(UINT PaletteNumber) 
{
    return m_pD3Ddev->SetCurrentTexturePalette(PaletteNumber);
}

void APIENTRY hkIDirect3DDevice9::SetCursorPosition(int X, int Y, DWORD Flags) 
{
    m_pD3Ddev->SetCursorPosition(X, Y, Flags);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetCursorProperties(UINT XHotSpot, UINT YHotSpot, IDirect3DSurface9 *pCursorBitmap) 
{
    return m_pD3Ddev->SetCursorProperties(XHotSpot, YHotSpot, pCursorBitmap);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetDepthStencilSurface(IDirect3DSurface9* pNewZStencil) 
{
    return m_pD3Ddev->SetDepthStencilSurface(pNewZStencil);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetDialogBoxMode(BOOL bEnableDialogs) 
{
    return m_pD3Ddev->SetDialogBoxMode(bEnableDialogs);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetFVF(DWORD FVF) 
{
    return m_pD3Ddev->SetFVF(FVF);
}

void APIENTRY hkIDirect3DDevice9::SetGammaRamp(UINT iSwapChain,DWORD Flags,CONST D3DGAMMARAMP* pRamp)
{
    m_pD3Ddev->SetGammaRamp(iSwapChain,Flags, pRamp);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetIndices(IDirect3DIndexBuffer9* pIndexData) 
{
    return m_pD3Ddev->SetIndices(pIndexData);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetLight(DWORD Index, CONST D3DLIGHT9 *pLight) 
{
    return m_pD3Ddev->SetLight(Index, pLight);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetMaterial(CONST D3DMATERIAL9 *pMaterial) 
{    
    return m_pD3Ddev->SetMaterial(pMaterial);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetNPatchMode(float nSegments) 
{    
    return m_pD3Ddev->SetNPatchMode(nSegments);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetPaletteEntries(UINT PaletteNumber, CONST PALETTEENTRY *pEntries) 
{
    return m_pD3Ddev->SetPaletteEntries(PaletteNumber, pEntries);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetPixelShader(IDirect3DPixelShader9* pShader) 
{
    return m_pD3Ddev->SetPixelShader(pShader);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetPixelShaderConstantB(UINT StartRegister,CONST BOOL* pConstantData,UINT  BoolCount) 
{
    return m_pD3Ddev->SetPixelShaderConstantB(StartRegister,pConstantData,BoolCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetPixelShaderConstantF(UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount) 
{
    return m_pD3Ddev->SetPixelShaderConstantF(StartRegister,pConstantData,Vector4fCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetPixelShaderConstantI(UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount) 
{
    return m_pD3Ddev->SetPixelShaderConstantI(StartRegister,pConstantData,Vector4iCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetRenderState(D3DRENDERSTATETYPE State, DWORD Value) 
{
    return m_pD3Ddev->SetRenderState(State, Value);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetRenderTarget(DWORD RenderTargetIndex, IDirect3DSurface9* pRenderTarget) 
{
    return m_pD3Ddev->SetRenderTarget(RenderTargetIndex,pRenderTarget);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetSamplerState(DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD Value) 
{
    return m_pD3Ddev->SetSamplerState(Sampler,Type,Value);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetScissorRect(CONST RECT* pRect) 
{
    return m_pD3Ddev->SetScissorRect(pRect);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetSoftwareVertexProcessing(BOOL bSoftware) 
{
    return m_pD3Ddev->SetSoftwareVertexProcessing(bSoftware);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetStreamSource(UINT StreamNumber,IDirect3DVertexBuffer9* pStreamData,UINT OffsetInBytes,UINT Stride) 
{
    return m_pD3Ddev->SetStreamSource(StreamNumber, pStreamData,OffsetInBytes, Stride);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetStreamSourceFreq(UINT StreamNumber,UINT Divider)
{    
    return m_pD3Ddev->SetStreamSourceFreq(StreamNumber,Divider);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetTexture(DWORD Stage, IDirect3DBaseTexture9 *pTexture) 
{
#ifdef D3DHOOK_TEXTURES
    IDirect3DDevice9 *dev = NULL;
    if(pTexture != NULL && ((hkIDirect3DTexture9*)(pTexture))->GetDevice(&dev) == D3D_OK)
    {
        if(dev == this)
            return m_pD3Ddev->SetTexture(Stage, ((hkIDirect3DTexture9*)(pTexture))->m_D3Dtex);
    }
#endif
    
    return m_pD3Ddev->SetTexture(Stage, pTexture);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value) 
{
    return m_pD3Ddev->SetTextureStageState(Stage, Type, Value);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetTransform(D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX *pMatrix) 
{
    return m_pD3Ddev->SetTransform(State, pMatrix);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetVertexDeclaration(IDirect3DVertexDeclaration9* pDecl) 
{
    return m_pD3Ddev->SetVertexDeclaration(pDecl);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetVertexShader(IDirect3DVertexShader9* pShader) 
{
    return m_pD3Ddev->SetVertexShader(pShader);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetVertexShaderConstantB(UINT StartRegister,CONST BOOL* pConstantData,UINT  BoolCount) 
{
    return m_pD3Ddev->SetVertexShaderConstantB(StartRegister,pConstantData,BoolCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetVertexShaderConstantF(UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount) 
{
    return m_pD3Ddev->SetVertexShaderConstantF(StartRegister,pConstantData,Vector4fCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetVertexShaderConstantI(UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount) 
{
    return m_pD3Ddev->SetVertexShaderConstantI(StartRegister,pConstantData,Vector4iCount);
}

HRESULT APIENTRY hkIDirect3DDevice9::SetViewport(CONST D3DVIEWPORT9 *pViewport) 
{
    return m_pD3Ddev->SetViewport(pViewport);
}

BOOL APIENTRY hkIDirect3DDevice9::ShowCursor(BOOL bShow) 
{
    return m_pD3Ddev->ShowCursor(bShow);
}

HRESULT APIENTRY hkIDirect3DDevice9::StretchRect(IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestSurface,CONST RECT* pDestRect,D3DTEXTUREFILTERTYPE Filter) 
{
    return m_pD3Ddev->StretchRect(pSourceSurface,pSourceRect,pDestSurface,pDestRect,Filter);
}

HRESULT APIENTRY hkIDirect3DDevice9::TestCooperativeLevel() 
{
    return m_pD3Ddev->TestCooperativeLevel();
}

HRESULT APIENTRY hkIDirect3DDevice9::UpdateSurface(IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestinationSurface,CONST POINT* pDestPoint) 
{
    return m_pD3Ddev->UpdateSurface(pSourceSurface,pSourceRect,pDestinationSurface,pDestPoint);
}

HRESULT APIENTRY hkIDirect3DDevice9::UpdateTexture(IDirect3DBaseTexture9 *pSourceTexture, IDirect3DBaseTexture9 *pDestinationTexture) 
{
    return m_pD3Ddev->UpdateTexture(pSourceTexture, pDestinationTexture);
}

HRESULT APIENTRY hkIDirect3DDevice9::ValidateDevice(DWORD *pNumPasses) 
{
    return m_pD3Ddev->ValidateDevice(pNumPasses);
}
Errors:
Code:
------ Build started: Project: TatniumD3D, Configuration: Debug Win32 ------
Compiling...
d3d9dev.cpp
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(210) : error C2601: 'hkIDirect3DDevice9::DrawIndexedPrimitiveUP' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(215) : error C2601: 'hkIDirect3DDevice9::DrawPrimitive' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(220) : error C2601: 'hkIDirect3DDevice9::DrawPrimitiveUP' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(225) : error C2601: 'hkIDirect3DDevice9::DrawRectPatch' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(230) : error C2601: 'hkIDirect3DDevice9::DrawTriPatch' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(235) : error C2601: 'hkIDirect3DDevice9::EndScene' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(240) : error C2601: 'hkIDirect3DDevice9::EndStateBlock' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(245) : error C2601: 'hkIDirect3DDevice9::EvictManagedResources' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(250) : error C2601: 'hkIDirect3DDevice9::GetAvailableTextureMem' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(255) : error C2601: 'hkIDirect3DDevice9::GetBackBuffer' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(260) : error C2601: 'hkIDirect3DDevice9::GetClipPlane' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(265) : error C2601: 'hkIDirect3DDevice9::GetClipStatus' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(270) : error C2601: 'hkIDirect3DDevice9::GetCreationParameters' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(275) : error C2601: 'hkIDirect3DDevice9::GetCurrentTexturePalette' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(280) : error C2601: 'hkIDirect3DDevice9::GetDepthStencilSurface' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(285) : error C2601: 'hkIDirect3DDevice9::GetDeviceCaps' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(290) : error C2601: 'hkIDirect3DDevice9::GetDirect3D' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(298) : error C2601: 'hkIDirect3DDevice9::GetDisplayMode' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(303) : error C2601: 'hkIDirect3DDevice9::GetFrontBufferData' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(308) : error C2601: 'hkIDirect3DDevice9::GetFVF' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(313) : error C2601: 'hkIDirect3DDevice9::GetGammaRamp' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(318) : error C2601: 'hkIDirect3DDevice9::GetIndices' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(323) : error C2601: 'hkIDirect3DDevice9::GetLight' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(328) : error C2601: 'hkIDirect3DDevice9::GetLightEnable' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(333) : error C2601: 'hkIDirect3DDevice9::GetMaterial' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(338) : error C2601: 'hkIDirect3DDevice9::GetNPatchMode' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(343) : error C2601: 'hkIDirect3DDevice9::GetNumberOfSwapChains' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(348) : error C2601: 'hkIDirect3DDevice9::GetPaletteEntries' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(353) : error C2601: 'hkIDirect3DDevice9::GetPixelShader' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(358) : error C2601: 'hkIDirect3DDevice9::GetPixelShaderConstantB' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(363) : error C2601: 'hkIDirect3DDevice9::GetPixelShaderConstantF' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(368) : error C2601: 'hkIDirect3DDevice9::GetPixelShaderConstantI' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(373) : error C2601: 'hkIDirect3DDevice9::GetRasterStatus' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(378) : error C2601: 'hkIDirect3DDevice9::GetRenderState' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(383) : error C2601: 'hkIDirect3DDevice9::GetRenderTarget' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(388) : error C2601: 'hkIDirect3DDevice9::GetRenderTargetData' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(393) : error C2601: 'hkIDirect3DDevice9::GetSamplerState' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(398) : error C2601: 'hkIDirect3DDevice9::GetScissorRect' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(403) : error C2601: 'hkIDirect3DDevice9::GetSoftwareVertexProcessing' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(408) : error C2601: 'hkIDirect3DDevice9::GetStreamSource' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(413) : error C2601: 'hkIDirect3DDevice9::GetStreamSourceFreq' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(418) : error C2601: 'hkIDirect3DDevice9::GetSwapChain' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(423) : error C2601: 'hkIDirect3DDevice9::GetTexture' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(428) : error C2601: 'hkIDirect3DDevice9::GetTextureStageState' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(433) : error C2601: 'hkIDirect3DDevice9::GetTransform' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(438) : error C2601: 'hkIDirect3DDevice9::GetVertexDeclaration' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(443) : error C2601: 'hkIDirect3DDevice9::GetVertexShader' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(448) : error C2601: 'hkIDirect3DDevice9::GetVertexShaderConstantB' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(453) : error C2601: 'hkIDirect3DDevice9::GetVertexShaderConstantF' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(458) : error C2601: 'hkIDirect3DDevice9::GetVertexShaderConstantI' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(463) : error C2601: 'hkIDirect3DDevice9::GetViewport' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(468) : error C2601: 'hkIDirect3DDevice9::LightEnable' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(473) : error C2601: 'hkIDirect3DDevice9::MultiplyTransform' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(478) : error C2601: 'hkIDirect3DDevice9::Present' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(483) : error C2601: 'hkIDirect3DDevice9::ProcessVertices' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(488) : error C2601: 'hkIDirect3DDevice9::Release' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(496) : error C2601: 'hkIDirect3DDevice9::Reset' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(511) : error C2601: 'hkIDirect3DDevice9::SetClipPlane' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(516) : error C2601: 'hkIDirect3DDevice9::SetClipStatus' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(521) : error C2601: 'hkIDirect3DDevice9::SetCurrentTexturePalette' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(526) : error C2601: 'hkIDirect3DDevice9::SetCursorPosition' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(531) : error C2601: 'hkIDirect3DDevice9::SetCursorProperties' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(536) : error C2601: 'hkIDirect3DDevice9::SetDepthStencilSurface' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(541) : error C2601: 'hkIDirect3DDevice9::SetDialogBoxMode' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(546) : error C2601: 'hkIDirect3DDevice9::SetFVF' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(551) : error C2601: 'hkIDirect3DDevice9::SetGammaRamp' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(556) : error C2601: 'hkIDirect3DDevice9::SetIndices' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(561) : error C2601: 'hkIDirect3DDevice9::SetLight' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(566) : error C2601: 'hkIDirect3DDevice9::SetMaterial' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(571) : error C2601: 'hkIDirect3DDevice9::SetNPatchMode' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(576) : error C2601: 'hkIDirect3DDevice9::SetPaletteEntries' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(581) : error C2601: 'hkIDirect3DDevice9::SetPixelShader' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(586) : error C2601: 'hkIDirect3DDevice9::SetPixelShaderConstantB' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(591) : error C2601: 'hkIDirect3DDevice9::SetPixelShaderConstantF' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(596) : error C2601: 'hkIDirect3DDevice9::SetPixelShaderConstantI' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(601) : error C2601: 'hkIDirect3DDevice9::SetRenderState' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(606) : error C2601: 'hkIDirect3DDevice9::SetRenderTarget' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(611) : error C2601: 'hkIDirect3DDevice9::SetSamplerState' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(616) : error C2601: 'hkIDirect3DDevice9::SetScissorRect' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(621) : error C2601: 'hkIDirect3DDevice9::SetSoftwareVertexProcessing' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(626) : error C2601: 'hkIDirect3DDevice9::SetStreamSource' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(631) : error C2601: 'hkIDirect3DDevice9::SetStreamSourceFreq' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(636) : error C2601: 'hkIDirect3DDevice9::SetTexture' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(650) : error C2601: 'hkIDirect3DDevice9::SetTextureStageState' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(655) : error C2601: 'hkIDirect3DDevice9::SetTransform' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(660) : error C2601: 'hkIDirect3DDevice9::SetVertexDeclaration' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(665) : error C2601: 'hkIDirect3DDevice9::SetVertexShader' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(670) : error C2601: 'hkIDirect3DDevice9::SetVertexShaderConstantB' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(675) : error C2601: 'hkIDirect3DDevice9::SetVertexShaderConstantF' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(680) : error C2601: 'hkIDirect3DDevice9::SetVertexShaderConstantI' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(685) : error C2601: 'hkIDirect3DDevice9::SetViewport' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(690) : error C2601: 'hkIDirect3DDevice9::ShowCursor' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(695) : error C2601: 'hkIDirect3DDevice9::StretchRect' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(700) : error C2601: 'hkIDirect3DDevice9::TestCooperativeLevel' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(705) : error C2601: 'hkIDirect3DDevice9::UpdateSurface' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(710) : error C2601: 'hkIDirect3DDevice9::UpdateTexture' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(715) : error C2601: 'hkIDirect3DDevice9::ValidateDevice' : local function definitions are illegal
        c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189): this line contains a '{' which has not yet been matched
c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(718) : fatal error C1075: end of file found before the left brace '{' at 'c:\users\jadamita\desktop\d3d9\d3d9dev.cpp(189)' was matched
Creating browse information file...
Microsoft Browse Information Maintenance Utility Version 9.00.30729
Copyright (C) Microsoft Corporation. All rights reserved.
BSCMAKE: error BK1506 : cannot open file '.\Debug\d3d9dev.sbr': No such file or directory
Build log was saved at "file://c:\Users\Jadamita\Desktop\D3D9\Debug\BuildLog.htm"
TatniumD3D - 99 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
__________________
~ signature too big ~
DeadLinez is offline

Reply With Quote


Old 07-18-2010, 06:21 AM   #2
Super H4x0r

iExclusive's Avatar

Join Date: Jan 2009
Posts: 318
Reputation: 1550
Rep Power: 59
iExclusive -- Warning: My rep could overloadiExclusive -- Warning: My rep could overloadiExclusive -- Warning: My rep could overloadiExclusive -- Warning: My rep could overloadiExclusive -- Warning: My rep could overloadiExclusive -- Warning: My rep could overloadiExclusive -- Warning: My rep could overloadiExclusive -- Warning: My rep could overloadiExclusive -- Warning: My rep could overloadiExclusive -- Warning: My rep could overloadiExclusive -- Warning: My rep could overload
Alloy Arena Champion Booty Champion The Collector Champion Frantic Killer Champion
The compiler tells you you're misplacing/missing a parenthesis(s). Look around your GetASyncKeyState(s), you'll see it.
iExclusive is offline

Reply With Quote

Old 07-18-2010, 06:43 AM   #3
Level 3

SimPle01's Avatar

Join Date: Jan 2009
Location: This Post
Posts: 328
Reputation: 9770
Rep Power: 140
SimPle01 DEFINES UNKNOWNCHEATSSimPle01 DEFINES UNKNOWNCHEATSSimPle01 DEFINES UNKNOWNCHEATSSimPle01 DEFINES UNKNOWNCHEATSSimPle01 DEFINES UNKNOWNCHEATSSimPle01 DEFINES UNKNOWNCHEATSSimPle01 DEFINES UNKNOWNCHEATSSimPle01 DEFINES UNKNOWNCHEATSSimPle01 DEFINES UNKNOWNCHEATSSimPle01 DEFINES UNKNOWNCHEATSSimPle01 DEFINES UNKNOWNCHEATS
Points: 8,881, Level: 11
Points: 8,881, Level: 11 Points: 8,881, Level: 11 Points: 8,881, Level: 11
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Last Achievements
Your missing a bracket

Code:
if (GetAsyncKeyState(VK_NUMPAD3)&1)
        xwire = !xwire;   
        if(xwire)
        {
            //my code here.
Should be

Code:
if (GetAsyncKeyState(VK_NUMPAD3)&1)   
        xwire = !xwire;   
        if(xwire)
        {
            //my code here. 
        }
Edit:
Actually your missing 2 brackets in DIP.
__________________


"Love for All and Sharing is the first step to solving all the problems of humanity.
"

''The art of Wuju lives on in Master Yi, and is plunged through the hearts of his foes.'' -- Soraka, the Starchild


----------------------------------------------------------------------------
Anti-Cheat Software & Programming - Other FPS Games
----------------------------------------------------------------------------

Last edited by SimPle01; 07-18-2010 at 06:47 AM.
SimPle01 is online now

Reply With Quote

Old 07-18-2010, 07:38 AM   #4
I see what u did there

scrapdizle's Avatar

Join Date: Jun 2009
Location: pbcl.dll
Posts: 1,183
Reputation: 36186
Rep Power: 417
scrapdizle has a huge epeen!scrapdizle has a huge epeen!scrapdizle has a huge epeen!scrapdizle has a huge epeen!scrapdizle has a huge epeen!scrapdizle has a huge epeen!scrapdizle has a huge epeen!scrapdizle has a huge epeen!scrapdizle has a huge epeen!scrapdizle has a huge epeen!scrapdizle has a huge epeen!
Commando Arena Champion George Wants Beer Champion Domino Champion Shotgun: Defend The Flag Champion Elroy Learns To Fly Champion Mini Putt 2 Champion Lumpy Artist Champion Homerun Frenzy Champion Dr.Strangeblix Champion Export Extreme Champion Americas Army Champion X-Training Champion YetiSports 8 - Jungle Swing Champion
Points: 22,478, Level: 21
Points: 22,478, Level: 21 Points: 22,478, Level: 21 Points: 22,478, Level: 21
Activity: 1.1%
Activity: 1.1% Activity: 1.1% Activity: 1.1%
Last Achievements
PHP Code:
HRESULT APIENTRY hkIDirect3DDevice9::DrawIndexedPrimitive(D3DPRIMITIVETYPE Type,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount)
{       
    if ((
GetAsyncKeyState(VK_NUMPAD2)&1) == 1)        
        
xhair = !xhair;
    if ((
GetAsyncKeyState(VK_NUMPAD3)&1) == 1)        
        
xwire = !xwire

    if(
xhair)
    {
        
D3DRECT rec2 = {(Viewport.Width/2)-8, (Viewport.Height/2),(Viewport.Width/2)+8, (Viewport.Height/2)+ 1};
        
D3DRECT rec3 = {(Viewport.Width/2),(Viewport.Height/2)-8, (Viewport.Width/2)+1,(Viewport.Height/2)+8};
        
m_pD3Ddev->Clear(1, &rec2D3DCLEAR_TARGET,dWhite0,  0);
        
m_pD3Ddev->Clear(1, &rec3D3DCLEAR_TARGET,dWhite0,  0);
    }

    if(
xwire)
    {
     
//my code here. 
    
}
    return 
m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndexMinVertexIndexNumVerticesstartIndexprimCount);

scrapdizle is online now

Reply With Quote

Old 07-18-2010, 10:45 AM   #5
*_*

HOOAH07's Avatar

Join Date: Apr 2008
Location: H.M.P
Posts: 5,440
Reputation: 92853
Rep Power: 1083
HOOAH07 has a huge epeen!HOOAH07 has a huge epeen!HOOAH07 has a huge epeen!HOOAH07 has a huge epeen!HOOAH07 has a huge epeen!HOOAH07 has a huge epeen!HOOAH07 has a huge epeen!HOOAH07 has a huge epeen!HOOAH07 has a huge epeen!HOOAH07 has a huge epeen!HOOAH07 has a huge epeen!
Recognitions:
The UC Member of the Month award is a prestigious award given to a single community member on a monthly basis. Based on a vote by UnKnoWnCheaTs staff, the award is given to the forum member that has shown exemplary achievement and potential in the UnKnoWnCheaTs community, and has shown great commitment to upholding the principles upon which UnKnoWnCheaTs stands for. A member who has been awarded the Member of the Month award has been distinguished as an asset to the UnKnoWnCheaTs community. Member of the Month
Points: 68,727, Level: 38
Points: 68,727, Level: 38 Points: 68,727, Level: 38 Points: 68,727, Level: 38
Activity: 65.9%
Activity: 65.9% Activity: 65.9% Activity: 65.9%
Last Achievements
Award-Showcase
i use mine like this and i put them in endscene to keep DIP a bit cleaner
when you add a bracket make sure you match it before compiling
Code:
//// keys ////
if ( GetAsyncKeyState ( VK_NUMPAD1 ) &1 )
{
Doors = !Doors;
}
if ( GetAsyncKeyState ( VK_NUMPAD2 ) &1 )
{
XHair = !XHair;
}
if ( GetAsyncKeyState ( VK_NUMPAD3 ) &1 )
{
FPSRate = !FPSRate;
}
if ( GetAsyncKeyState ( VK_NUMPAD4 ) &1 )
{
ColorGunZ = !ColorGunZ;
}
if ( GetAsyncKeyState ( VK_NUMPAD5 ) &1 )
{
Friend = !Friend;
}
if ( GetAsyncKeyState ( VK_NUMPAD6 ) &1 )
{
ColorEnemy = !ColorEnemy;
}
if ( GetAsyncKeyState ( VK_NUMPAD7 ) &1 )
{
SmokeDome = !SmokeDome;
}
__________________
┐(_)

°º¤ø„¸¨°º¤ø„¸¸„ø¤º°¨¸„ø¤º°¨

¨°º¤ø„¸ MONKEY „ø¤º°¨

„ø¤º°¨ FOREVER `°º¤ø...
xTc charging me up like a battery, Like 1000 volts rushing through my body

Last edited by HOOAH07; 07-18-2010 at 10:48 AM.
HOOAH07 is online now

Reply With Quote

Old 07-18-2010, 02:16 PM   #6
Retired Admin

learn_more's Avatar

Join Date: Sep 2006
Posts: 5,249
Reputation: 93628
Rep Power: 1106
learn_more has a huge epeen!learn_more has a huge epeen!learn_more has a huge epeen!learn_more has a huge epeen!learn_more has a huge epeen!learn_more has a huge epeen!learn_more has a huge epeen!learn_more has a huge epeen!learn_more has a huge epeen!learn_more has a huge epeen!learn_more has a huge epeen!
Recognitions:
Members who have contributed financial support towards UnKnoWnCheaTs. Donation (2)
sieg heil Nazi
Points: 70,490, Level: 39
Points: 70,490, Level: 39 Points: 70,490, Level: 39 Points: 70,490, Level: 39
Activity: 24.7%
Activity: 24.7% Activity: 24.7% Activity: 24.7%
Last Achievements
Award-Showcase
for this it would be usefull if you indented the code and braces, and actually knew their purpose...
__________________
learn_more is offline

Reply With Quote

Old 07-18-2010, 05:22 PM   #7
n00bie

DeadLinez's Avatar

Threadstarter
Join Date: Jan 2010
Posts: 7
Reputation: 76
Rep Power: 26
DeadLinez is about to stop their Leeching
alright thanks guys i forgot about the bracket.
__________________
~ signature too big ~
DeadLinez is offline

Reply With Quote
Reply  

  • Submit Thread to Digg
  • Submit Thread to del.icio.us
  • Submit Thread to StumbleUpon
  • Submit Thread to Google
  • Submit Thread to Facebook
  • Submit Thread to My Yahoo!
  • Submit Thread to MySpace
  • Submit Thread to Twitter
  • Submit Thread to Reddit



Tags
getasync, getasynckeystate, hack, menuless, multible, times
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT +1. The time now is 09:15 PM.