Help in D3D coding.

Technical Discussions not Related Directly to MHS. For Example, Coding, Hex Editing, General Hacking, Etc.

Moderators: g3nuin3, SpeedWing, WhiteHat

Help in D3D coding.

Postby jkfoong » Fri Sep 25, 2009 2:27 pm

I've changed my code.
Code: Select all
//Made by jkfoong

#include <windows.h>
#include "main.h"
#include "d3d8.h"
#include <d3dx8.h>
#include "texto.h"
#include <stdio.h>

unsigned int mStride = NULL;

bool FullBrilho = false;
bool SEMFOG = false;
  bool Wireframe = false;
    bool AsusWallhack = false;
       bool xray = false;
             bool wallhack = false;
      


#define CHAMS (( mStride == 44) || (mStride == 40))


const D3DCOLOR CorAmarelo = D3DCOLOR_ARGB(255, 255, 255, 0);

const BYTE byteVermelho[60] = 

    0x42, 0x4D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 
    0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 
    0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x12, 0x0B, 0x00, 0x00, 0x12, 0x0B, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0xFF, 0x00, 0x00, 0x00 
};

const BYTE byteAzul[60] = 
{
    0x42, 0x4D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 
    0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 
    0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x12, 0x0B, 0x00, 0x00, 0x12, 0x0B, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0xFF, 0x00, 0x00, 0x00, 0x00, 0x00
}; 

LPDIRECT3DTEXTURE8 TexturaAzul;
LPDIRECT3DTEXTURE8 TexturaVermelho;


HRESULT CD3DManager::Initialize()
{


   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 hkIDirect3DDevice8::QueryInterface(REFIID riid, void** ppvObj)
{
   return m_pD3Ddev->QueryInterface(riid, ppvObj);
}

ULONG APIENTRY hkIDirect3DDevice8::AddRef(void)
{
   m_refCount++;
   return m_pD3Ddev->AddRef();
}

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

   return m_pD3Ddev->Release();
}

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

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

HRESULT APIENTRY hkIDirect3DDevice8::ResourceManagerDiscardBytes(DWORD Bytes)
{
   return m_pD3Ddev->ResourceManagerDiscardBytes(Bytes);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetDirect3D(IDirect3D8** ppD3D8)
{
   HRESULT hRet = m_pD3Ddev->GetDirect3D(ppD3D8);
   if( SUCCEEDED(hRet) )
      *ppD3D8 = m_pD3Dint;
   return hRet;
}

HRESULT APIENTRY hkIDirect3DDevice8::GetDeviceCaps(D3DCAPS8* pCaps)
{
   return m_pD3Ddev->GetDeviceCaps(pCaps);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetDisplayMode(D3DDISPLAYMODE* pMode)
{
   return m_pD3Ddev->GetDisplayMode(pMode);
}

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

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

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

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

HRESULT APIENTRY hkIDirect3DDevice8::CreateAdditionalSwapChain(D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DSwapChain8** pSwapChain)
{
   return m_pD3Ddev->CreateAdditionalSwapChain(pPresentationParameters, pSwapChain);
}

HRESULT APIENTRY hkIDirect3DDevice8::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 hkIDirect3DDevice8::Present(CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion)
{

GravaTexto(m_pD3Ddev,"D3D Hook by jkfoong","Arial",1,1,10,10,CorAmarelo);
return m_pD3Ddev->Present(pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetBackBuffer(UINT BackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface8** ppBackBuffer)
{
   return m_pD3Ddev->GetBackBuffer(BackBuffer, Type, ppBackBuffer);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetRasterStatus(D3DRASTER_STATUS* pRasterStatus)
{
   return m_pD3Ddev->GetRasterStatus(pRasterStatus);
}

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

void APIENTRY hkIDirect3DDevice8::GetGammaRamp(D3DGAMMARAMP* pRamp)
{
   m_pD3Ddev->GetGammaRamp(pRamp);
}

HRESULT APIENTRY hkIDirect3DDevice8::CreateTexture(UINT Width,UINT Height,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DTexture8** ppTexture)
{
   HRESULT hRet = m_pD3Ddev->CreateTexture(Width, Height, Levels, Usage, Format, Pool, ppTexture);

#ifdef D3DHOOK_TEXTURES
   if(hRet == D3D_OK) { *ppTexture = new hkIDirect3DTexture8(ppTexture, this, Width, Height, Format); }
#endif

   return hRet;
}

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

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

HRESULT APIENTRY hkIDirect3DDevice8::CreateVertexBuffer(UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IDirect3DVertexBuffer8** ppVertexBuffer)
{
   return m_pD3Ddev->CreateVertexBuffer(Length, Usage, FVF, Pool, ppVertexBuffer);
}

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

HRESULT APIENTRY hkIDirect3DDevice8::CreateRenderTarget(UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,BOOL Lockable,IDirect3DSurface8** ppSurface)
{
   return m_pD3Ddev->CreateRenderTarget(Width, Height, Format, MultiSample, Lockable, ppSurface);
}

HRESULT APIENTRY hkIDirect3DDevice8::CreateDepthStencilSurface(UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,IDirect3DSurface8** ppSurface)
{
   return m_pD3Ddev->CreateDepthStencilSurface(Width, Height, Format, MultiSample, ppSurface);
}

HRESULT APIENTRY hkIDirect3DDevice8::CreateImageSurface(UINT Width,UINT Height,D3DFORMAT Format,IDirect3DSurface8** ppSurface)
{
   return m_pD3Ddev->CreateImageSurface(Width, Height, Format, ppSurface);
}

HRESULT APIENTRY hkIDirect3DDevice8::CopyRects(IDirect3DSurface8* pSourceSurface,CONST RECT* pSourceRectsArray,UINT cRects,IDirect3DSurface8* pDestinationSurface,CONST POINT* pDestPointsArray)
{
   return m_pD3Ddev->CopyRects(pSourceSurface, pSourceRectsArray, cRects, pDestinationSurface, pDestPointsArray);
}

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

HRESULT APIENTRY hkIDirect3DDevice8::GetFrontBuffer(IDirect3DSurface8* pDestSurface)
{
   return m_pD3Ddev->GetFrontBuffer(pDestSurface);
}

HRESULT APIENTRY hkIDirect3DDevice8::SetRenderTarget(IDirect3DSurface8* pRenderTarget,IDirect3DSurface8* pNewZStencil)
{
   return m_pD3Ddev->SetRenderTarget(pRenderTarget, pNewZStencil);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetRenderTarget(IDirect3DSurface8** ppRenderTarget)
{
   return m_pD3Ddev->GetRenderTarget(ppRenderTarget);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetDepthStencilSurface(IDirect3DSurface8** ppZStencilSurface)
{
   return m_pD3Ddev->GetDepthStencilSurface(ppZStencilSurface);
}

HRESULT APIENTRY hkIDirect3DDevice8::BeginScene(void)
{
   
   //criar por baseada em textura de imagem
   D3DXCreateTextureFromFileInMemory(m_pD3Ddev, (LPCVOID)&byteAzul,   60, &TexturaAzul);
   D3DXCreateTextureFromFileInMemory(m_pD3Ddev, (LPCVOID)&byteVermelho,    60, &TexturaVermelho);

   return m_pD3Ddev->BeginScene();
}

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

HRESULT APIENTRY hkIDirect3DDevice8::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 hkIDirect3DDevice8::SetTransform(D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix)
{
   return m_pD3Ddev->SetTransform(State, pMatrix);
}

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

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

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

HRESULT APIENTRY hkIDirect3DDevice8::GetViewport( D3DVIEWPORT8* pViewport)
{
   return m_pD3Ddev->GetViewport(pViewport);
}

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

HRESULT APIENTRY hkIDirect3DDevice8::GetMaterial( D3DMATERIAL8* pMaterial)
{
   return m_pD3Ddev->GetMaterial(pMaterial);
}

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

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

HRESULT APIENTRY hkIDirect3DDevice8::LightEnable( DWORD Index,BOOL Enable)
{
   return m_pD3Ddev->LightEnable(Index,Enable);
}

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

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

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

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

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

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

HRESULT APIENTRY hkIDirect3DDevice8::EndStateBlock( DWORD* pToken)
{
   return m_pD3Ddev->EndStateBlock(pToken);
}

HRESULT APIENTRY hkIDirect3DDevice8::ApplyStateBlock( DWORD Token)
{
   return m_pD3Ddev->ApplyStateBlock(Token);
}

HRESULT APIENTRY hkIDirect3DDevice8::CaptureStateBlock( DWORD Token)
{
   return m_pD3Ddev->CaptureStateBlock(Token);
}

HRESULT APIENTRY hkIDirect3DDevice8::DeleteStateBlock( DWORD Token)
{
   return m_pD3Ddev->DeleteStateBlock(Token);
}

HRESULT APIENTRY hkIDirect3DDevice8::CreateStateBlock( D3DSTATEBLOCKTYPE Type,DWORD* pToken)
{
   return m_pD3Ddev->CreateStateBlock(Type,pToken);
}

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

HRESULT APIENTRY hkIDirect3DDevice8::GetClipStatus( D3DCLIPSTATUS8* pClipStatus)
{
   return m_pD3Ddev->GetClipStatus(pClipStatus);
}

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

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

   return m_pD3Ddev->SetTexture(Stage,pTexture);
}

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

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

HRESULT APIENTRY hkIDirect3DDevice8::ValidateDevice( DWORD* pNumPasses)
{
   return m_pD3Ddev->ValidateDevice(pNumPasses);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetInfo( DWORD DevInfoID,void* pDevInfoStruct,DWORD DevInfoStructSize)
{
   return m_pD3Ddev->GetInfo(DevInfoID,pDevInfoStruct,DevInfoStructSize);
}

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

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

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

HRESULT APIENTRY hkIDirect3DDevice8::GetCurrentTexturePalette(UINT *PaletteNumber)
{
   return m_pD3Ddev->GetCurrentTexturePalette(PaletteNumber);
}

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

HRESULT APIENTRY hkIDirect3DDevice8::DrawIndexedPrimitive(D3DPRIMITIVETYPE PrimitiveType,UINT minIndex,UINT NumVertices,UINT startIndex,UINT primCount)
{
DWORD dwOldZEnable = D3DZB_TRUE;
   //funcao chams, os playes estao em valor mstride = 44
   if(CHAMS){
       m_pD3Ddev->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable);//desativa o Z do buffer (wallhack)
      m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);// desativa a funcao que liga nos modelos
      m_pD3Ddev->SetRenderState(D3DRS_ZFUNC,D3DCMP_NEVER);//player modelos off
      m_pD3Ddev->SetTexture(0, TexturaAzul); // modelo de cor 1
      m_pD3Ddev->DrawIndexedPrimitive(PrimitiveType, minIndex, NumVertices, startIndex, primCount);
      m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);//ativa o Z do buffer (wallhack)
        m_pD3Ddev->SetRenderState(D3DRS_ZFUNC,D3DCMP_LESSEQUAL);//player modelos on
      m_pD3Ddev->SetTexture(0, TexturaVermelho);// modelo de cor 2
}
//em dip
if(GetAsyncKeyState(VK_NUMPAD0)&1){FullBrilho =!FullBrilho ;}

if(FullBrilho){
m_pD3Ddev->SetRenderState(D3DRS_LIGHTING, false); //d3d lighting off
m_pD3Ddev->SetRenderState(D3DRS_AMBIENT,D3DCOLOR_ARGB(255,255,255,255)); // use all colors to glow up the lighting ingame
}

if(GetAsyncKeyState(VK_NUMPAD2)&1){SEMFOG =!SEMFOG;}
if(SEMFOG){
m_pD3Ddev->SetRenderState(D3DRS_FOGENABLE, false); // Disable the Fog
}

if(GetAsyncKeyState(VK_NUMPAD3)&1){Wireframe =!Wireframe;}
if(Wireframe){
   if(( mStride == 44) || (mStride == 40))
m_pD3Ddev->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);
}   

if(GetAsyncKeyState(VK_NUMPAD5)&1){xray =!xray;}
if(xray){
m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE); 
}

if(GetAsyncKeyState(VK_NUMPAD7)&1){wallhack =!wallhack;}
if(wallhack){
if(( mStride == 44) || (mStride == 40))
m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
        }
        else
        {
m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
    }

if(GetAsyncKeyState(VK_NUMPAD4)&1){AsusWallhack =!AsusWallhack;}
if(AsusWallhack){
   m_pD3Ddev->SetRenderState( D3DRS_SRCBLEND, 3 );
    m_pD3Ddev->SetRenderState( D3DRS_DESTBLEND, 4 );
m_pD3Ddev->SetRenderState( D3DRS_ALPHABLENDENABLE, true );
}

return m_pD3Ddev->DrawIndexedPrimitive(PrimitiveType, minIndex, NumVertices, startIndex, primCount);
}

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

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

HRESULT APIENTRY hkIDirect3DDevice8::ProcessVertices(UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,IDirect3DVertexBuffer8* pDestBuffer,DWORD Flags)
{
   return m_pD3Ddev->ProcessVertices(SrcStartIndex, DestIndex, VertexCount, pDestBuffer, Flags);
}

HRESULT APIENTRY hkIDirect3DDevice8::CreateVertexShader(CONST DWORD* pDeclaration,CONST DWORD* pFunction,DWORD* pHandle,DWORD Usage)
{
   return m_pD3Ddev->CreateVertexShader(pDeclaration, pFunction, pHandle, Usage);
}

HRESULT APIENTRY hkIDirect3DDevice8::SetVertexShader(DWORD Handle)
{
   return m_pD3Ddev->SetVertexShader(Handle);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetVertexShader(DWORD* pHandle)
{
   return m_pD3Ddev->GetVertexShader(pHandle);
}

HRESULT APIENTRY hkIDirect3DDevice8::DeleteVertexShader(DWORD Handle)
{
   return m_pD3Ddev->DeleteVertexShader(Handle);
}

HRESULT APIENTRY hkIDirect3DDevice8::SetVertexShaderConstant(DWORD Register,CONST void* pConstantData,DWORD ConstantCount)
{
   return m_pD3Ddev->SetVertexShaderConstant(Register, pConstantData, ConstantCount);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetVertexShaderConstant(DWORD Register,void* pConstantData,DWORD ConstantCount)
{
   return m_pD3Ddev->GetVertexShaderConstant(Register, pConstantData, ConstantCount);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetVertexShaderDeclaration(DWORD Handle,void* pData,DWORD* pSizeOfData)
{
   return m_pD3Ddev->GetVertexShaderDeclaration(Handle, pData, pSizeOfData);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetVertexShaderFunction(DWORD Handle,void* pData,DWORD* pSizeOfData)
{
   return m_pD3Ddev->GetVertexShaderFunction(Handle, pData, pSizeOfData);
}

HRESULT APIENTRY hkIDirect3DDevice8::SetStreamSource(UINT StreamNumber,IDirect3DVertexBuffer8* pStreamData,UINT Stride)
{
   if(StreamNumber==0) mStride=Stride; 

   return m_pD3Ddev->SetStreamSource(StreamNumber, pStreamData, Stride);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetStreamSource(UINT StreamNumber,IDirect3DVertexBuffer8** ppStreamData,UINT* pStride)
{
   return m_pD3Ddev->GetStreamSource(StreamNumber, ppStreamData, pStride);
}

HRESULT APIENTRY hkIDirect3DDevice8::SetIndices(IDirect3DIndexBuffer8* pIndexData,UINT BaseVertexIndex)
{
   return m_pD3Ddev->SetIndices(pIndexData, BaseVertexIndex);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetIndices(IDirect3DIndexBuffer8** ppIndexData,UINT* pBaseVertexIndex)
{
   return m_pD3Ddev->GetIndices(ppIndexData, pBaseVertexIndex);
}

HRESULT APIENTRY hkIDirect3DDevice8::CreatePixelShader(CONST DWORD* pFunction,DWORD* pHandle)
{
   return m_pD3Ddev->CreatePixelShader(pFunction, pHandle);
}

HRESULT APIENTRY hkIDirect3DDevice8::SetPixelShader(DWORD Handle)
{
   return m_pD3Ddev->SetPixelShader(Handle);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetPixelShader(DWORD* pHandle)
{
   return m_pD3Ddev->GetPixelShader(pHandle);
}

HRESULT APIENTRY hkIDirect3DDevice8::DeletePixelShader(DWORD Handle)
{
   return m_pD3Ddev->DeletePixelShader(Handle);
}

HRESULT APIENTRY hkIDirect3DDevice8::SetPixelShaderConstant(DWORD Register,CONST void* pConstantData,DWORD ConstantCount)
{
   return m_pD3Ddev->SetPixelShaderConstant(Register, pConstantData, ConstantCount);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetPixelShaderConstant(DWORD Register,void* pConstantData,DWORD ConstantCount)
{
   return m_pD3Ddev->GetPixelShaderConstant(Register, pConstantData, ConstantCount);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetPixelShaderFunction(DWORD Handle,void* pData,DWORD* pSizeOfData)
{
   return m_pD3Ddev->GetPixelShaderFunction(Handle, pData, pSizeOfData);
}

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

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

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


Now it's detected.
Last edited by jkfoong on Thu Oct 01, 2009 8:11 am, edited 2 times in total.
I love Malaysia!
我爱马来西亚!
我愛馬來西亞!
J'adore la Malaisie!
Amo Malesia!
マレーシア大好き!
사랑 말레이시아!

Image
User avatar
jkfoong
NULL
 
Posts: 150
Joined: Mon Mar 31, 2008 3:56 pm
Location: Facing the computer

Postby CoMPMStR » Sat Sep 26, 2009 9:26 am

I think you need to word the if statement differently, such as...

Code: Select all
if (m_Stride == 40 && m_Stride == 44 && m_Stride == 32 && m_Stride == 36)


...or maybe even...

Code: Select all
if (m_Stride == 40 || m_Stride == 44 || m_Stride == 32 || m_Stride == 36)


That is the only thing that doesn't look right to me.
Image

______________________________________________________
My Utilities:
CT <-> LSSAVE Converter
LSS Visual Dialog Designer
.NET Trainer Helper Library

~Whether you think you can or you think you can't, you're right.

L. Spiro wrote:In my left hand is a red pill. If you take it I will show you the truth. I lost my right hand in the war, so I’m afraid you’re stuck with the red pill.
User avatar
CoMPMStR
(P)ot (I)n (M)y (P)ipe
 
Posts: 451
Joined: Thu Mar 06, 2008 7:50 am
Location: Best Place

Postby L. Spiro » Sat Sep 26, 2009 11:23 am

It must be the latter.


L. Spiro
Our songs remind you of songs you’ve never heard.
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Postby jkfoong » Sat Sep 26, 2009 3:27 pm

Post 1.. ^
Last edited by jkfoong on Thu Oct 01, 2009 8:05 am, edited 1 time in total.
I love Malaysia!
我爱马来西亚!
我愛馬來西亞!
J'adore la Malaisie!
Amo Malesia!
マレーシア大好き!
사랑 말레이시아!

Image
User avatar
jkfoong
NULL
 
Posts: 150
Joined: Mon Mar 31, 2008 3:56 pm
Location: Facing the computer

Postby L. Spiro » Sat Sep 26, 2009 5:06 pm

Link to the proper version of the DirectX SDK.


L. Spiro
Our songs remind you of songs you’ve never heard.
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Postby jkfoong » Sat Sep 26, 2009 6:28 pm

Post 1 ^
Last edited by jkfoong on Thu Oct 01, 2009 8:05 am, edited 1 time in total.
I love Malaysia!
我爱马来西亚!
我愛馬來西亞!
J'adore la Malaisie!
Amo Malesia!
マレーシア大好き!
사랑 말레이시아!

Image
User avatar
jkfoong
NULL
 
Posts: 150
Joined: Mon Mar 31, 2008 3:56 pm
Location: Facing the computer

Postby CoMPMStR » Sat Sep 26, 2009 6:54 pm

lol I'd tell the person who said you NEED a menu to get fucked, but that's just me. Sure a menu is nice but as long as the hotkeys work, and everyone know's what they're for, why do you NEED a menu?

Anyway enough of that, the code in DrawIndexedPrimitives looks the same as the first one you posted. I don't see where you toggle the menu, and the m_stride if statement looks like it hasn't been touched, is it working now or something? :?
Image

______________________________________________________
My Utilities:
CT <-> LSSAVE Converter
LSS Visual Dialog Designer
.NET Trainer Helper Library

~Whether you think you can or you think you can't, you're right.

L. Spiro wrote:In my left hand is a red pill. If you take it I will show you the truth. I lost my right hand in the war, so I’m afraid you’re stuck with the red pill.
User avatar
CoMPMStR
(P)ot (I)n (M)y (P)ipe
 
Posts: 451
Joined: Thu Mar 06, 2008 7:50 am
Location: Best Place

Postby jkfoong » Sat Sep 26, 2009 7:12 pm

Haha i thought you tell me to change the STS.
Do you have msn? And yes I'm working on it.
I love Malaysia!
我爱马来西亚!
我愛馬來西亞!
J'adore la Malaisie!
Amo Malesia!
マレーシア大好き!
사랑 말레이시아!

Image
User avatar
jkfoong
NULL
 
Posts: 150
Joined: Mon Mar 31, 2008 3:56 pm
Location: Facing the computer

Postby troublesh00ter » Sat Sep 26, 2009 7:25 pm

Code: Select all
if (m_stride == 40 && 44 && 32 && 36) //On the players model.


How does this make sense? This will only check if m_stride is equal to 40, and it will do the following checks:
Code: Select all
if( 44 )
if( 32 )
etc.


So that's not the same as
Code: Select all
if (m_stride == 40 && m_stride == 44 && m_stride == 32 && m_stride == 36)


But even this if doesn't make sense... m_stride is a number, so it will never be 40 AND 44 AND 32 AND 36, you should check if it is 40 OR 44 OR 32 OR 36.

You shouldn't blindly take what people tell you. Think about what you're trying to achieve with the if statement, then I'm sure you would've figured out that it is wrong.

I'm not sure what the person telling you that you need a menu is thinking... but you definitely do not need a menu for the chams to work.

I'm not trying to be offensive here, but do you think you are confident enough in C++ to do a project like this? You might make it in the end by copy/pasting but will you really understand what's going on? Sometimes it is better to take a step back and work your way up.

Once again, don't take it the wrong way.
troublesh00ter
Sir Hacks-A-Lot
 
Posts: 30
Joined: Mon Jun 01, 2009 2:54 pm
Location: The Netherlands

Postby L. Spiro » Sat Sep 26, 2009 7:31 pm

There are still 3 big problems.

Code: Select all
   if (wallhack) //If wallhack bool is called.
    {
    if (m_stride == 40 && 44 && 32 && 36) //On the players model.


Code: Select all
if (Chams)            //if cham bool is called
    {
        if (m_Stride == 40 && 44 && 32 && 36)            //on the player models


Code: Select all
{
   if (m_Stride == 40 && m_Stride == 44 && m_Stride == 32 && m_Stride == 36)



#1: You only replaced one occurrence of that mistake.
#2: You replaced it with another mistake.

If m_Stride is 40, then m_Stride is probably NOT 44.
So how could m_Stride == 40 && m_Stride == 44 ever evaluate to true?

I told you before to use the latter of CoMPMStR’s suggestions.


L. Spiro
Our songs remind you of songs you’ve never heard.
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Postby CoMPMStR » Sat Sep 26, 2009 7:47 pm

Yup yup, I only posted the first to show what a boolean expression should look like. Maybe I should've clearified to use the latter expression... :oops:

I don't use MSN. You can either take troublesh00ter's suggestion and take a step back to understand what you're doing, or keep posting the errors you get here and get it the copy&paste way. :lol:

Trust me, it never hurts to come back to a project later with more knowledge.
Image

______________________________________________________
My Utilities:
CT <-> LSSAVE Converter
LSS Visual Dialog Designer
.NET Trainer Helper Library

~Whether you think you can or you think you can't, you're right.

L. Spiro wrote:In my left hand is a red pill. If you take it I will show you the truth. I lost my right hand in the war, so I’m afraid you’re stuck with the red pill.
User avatar
CoMPMStR
(P)ot (I)n (M)y (P)ipe
 
Posts: 451
Joined: Thu Mar 06, 2008 7:50 am
Location: Best Place

Postby jkfoong » Sat Sep 26, 2009 7:52 pm

Ok thanks. Now what i've change is

Code: Select all
if (wallhack) //If wallhack bool is called.
    {
    if (m_Stride == 40 ) //On the players model.


and

Code: Select all
if (Chams)            //if cham bool is called
    {
        if (m_Stride == 40 )   //on the player models


and

Code: Select all
      if( StreamNumber == 0 ){m_Stride = Stride;}


Still can't . What I still left, please teach me, and don't so mad.
Sorry I didn't mean to make you guys mad..
I love Malaysia!
我爱马来西亚!
我愛馬來西亞!
J'adore la Malaisie!
Amo Malesia!
マレーシア大好き!
사랑 말레이시아!

Image
User avatar
jkfoong
NULL
 
Posts: 150
Joined: Mon Mar 31, 2008 3:56 pm
Location: Facing the computer

Postby L. Spiro » Sun Sep 27, 2009 7:32 am

But that is not what you want.

Why don’t you say what you want to do?

“If m_Stride is 40, or if m_Stride is 44, or if m_Stride is 32, or if m_Stride is 36.”
Code: Select all
if ( m_Stride == 40 || m_Stride == 44 || m_Stride == 32 || m_Stride == 36 ) {
}



L. Spiro
Our songs remind you of songs you’ve never heard.
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Postby jkfoong » Sun Sep 27, 2009 10:36 am

Changed the DIP, still doesn't works.

Code: Select all
if (Chams)
{
if ( m_Stride == 40 || m_Stride == 44 || m_Stride == 32 || m_Stride == 36 ) {
}


Code: Select all
if (wallhack)
{
if ( m_Stride == 40 || m_Stride == 44 || m_Stride == 32 || m_Stride == 36 ) {
}
I love Malaysia!
我爱马来西亚!
我愛馬來西亞!
J'adore la Malaisie!
Amo Malesia!
マレーシア大好き!
사랑 말레이시아!

Image
User avatar
jkfoong
NULL
 
Posts: 150
Joined: Mon Mar 31, 2008 3:56 pm
Location: Facing the computer

Postby troublesh00ter » Sun Sep 27, 2009 12:28 pm

I'm going to state again then I think you should become more confident in C++ before trying to create something like this. At this point it is just copy/pasting what people tell you until at some point it may work.

But if you wish to continue, I will post a part of your code that has a mistake and I want you to try and find it:

Code: Select all
#include "d3dbase.h"

#define D3DHOOK_TEXTURES //comment this to disable texture hooking

bool m_stride;
bool Chams;
bool wallhack;
int CH_cheats = 1;
int CH_back = 2; // 40%
char *opt_Back[] = { "Off","20%","40%","60%","80%","Solid" };
char *opt_OffOn[] = { "Off","On" };
char *opt_Grp[] = { "+","-" };
char sFPS[20]="xxx Fps";

D3DMenu   *pMenu=NULL;
troublesh00ter
Sir Hacks-A-Lot
 
Posts: 30
Joined: Mon Jun 01, 2009 2:54 pm
Location: The Netherlands

Next

Return to Technical Unrelated

Who is online

Users browsing this forum: No registered users and 0 guests

cron