#include <Windows.h>
#include <d3d9.h>
#include "XOR.h"
#include "main.h"
DWORD retMyDIP;
// Full Credits to Crash
#define smPlayer (my_Stride == 44)
#define smHeads (my_Stride == 36)
#define smGuns (my_Stride == 32)
#define Hands (my_Stride == 40 /*&& nNumVertices == 18 && nPrimitiveCount == 11)*/)
void D3DDIP (LPDIRECT3DDEVICE9 pDevice)
{
IDirect3DVertexBuffer9* my_StreamData = NULL;
UINT my_OffsetInBytes,my_Stride;
pDevice->GetStreamSource(0,&my_StreamData,&my_OffsetInBytes,&my_Stride);
if(GetAsyncKeyState(VK_NUMPAD1)&1) //does not seem to activate
{
if(smPlayer || smHeads || smGuns || Hands)
{
pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);//WallHack
//MessageBox(NULL, NULL, NULL, NULL);
} else {
pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
}
}
pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
}
typedef HRESULT (WINAPI* oDIP)(LPDIRECT3DDEVICE9 pDevice,D3DPRIMITIVETYPE,int,UINT,UINT,UINT,UINT); oDIP pDIP;
HRESULT WINAPI DIP(LPDIRECT3DDEVICE9 pDevice,D3DPRIMITIVETYPE Type,int BaseVertexIndex,UINT MinIndex,UINT NumVertices,UINT StartIndex,UINT PrimCount)
{
return pDIP(pDevice, Type, BaseVertexIndex, MinIndex, NumVertices, StartIndex, PrimCount);
}
Credits to codeDemon for his post i guess ?
82
#include <Windows.h>
#include <d3d9.h>
#include "XOR.h"
#include "main.h"
DWORD retMy_DIP;
// Full Credits to Crash
#define smPlayer (my_Stride == 44)
#define smHeads (my_Stride == 36)
#define smGuns (my_Stride == 32)
#define Hands (my_Stride == 40)
void My_D3D (LPDIRECT3DDEVICE9 pDevice)
{
IDirect3DVertexBuffer9* my_StreamData = NULL;
UINT my_OffsetInBytes,my_Stride;
pDevice->GetStreamSource(0,&my_StreamData,&my_OffsetInBytes,&my_Stride);
if(GetAsyncKeyState(VK_NUMPAD1)&1) //does not seem to activate
{
if(smPlayer || smHeads || smGuns || Hands)
{
pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);//WallHack
//MessageBox(NULL, NULL, NULL, NULL);
} else {
pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
}
}
if(GetAsyncKeyState(VK_INSERT)%1)
{
TerminateProcess("Engine.exe",1); //jsut a test to see if it would work
}
}
__declspec(naked) HRESULT WINAPI My_DIP()
{
static LPDIRECT3DDEVICE9 pDevice;
__asm
{
MOV EDI,EDI
PUSH EBP
MOV EBP,ESP
MOV EAX,DWORD PTR SS:[EBP + 0x8]
MOV pDevice,EAX
}
My_D3D(pDevice);
__asm
{
JMP retMy_DIP
}
}
void Hook ()
{
DWORD hD3D = (DWORD)LoadLibrary(ed3d9);
DWORD *vtbl;
DWORD adr = FindPattern(hD3D, 0x128000, (PBYTE)"\xC7\x06\x00\x00\x00\x00\x89\x86\x00\x00\x00\x00\x89\x86", "xx????xx????xx");
if(adr)
{
memcpy(&vtbl,(void*)(adr + 2),4);
retMy_DIP = vtbl[147] + 0x5;
MakeJMP((PBYTE)vtbl[147],(DWORD)My_DIP,0x5);
}
}
extern "C"
{
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
CreateThread(0,0,(LPTHREAD_START_ROUTINE)Hook,0,0,0); //it does hook, tested with msg box
break;
}
return true;
}
}