#include "d3d9.h" #include "d3dx9.h" #include <stdio.h> #include <windows.h> #pragma comment(lib, "d3d9.lib") #pragma comment(lib, "D3DX9.LIB")
struct _Object
{
byte pad0[0x4];
float x;
float y;
float z;
};
struct CPlayer
{
__int32 Get;
_Object*Object;
byte ClientID;
__int8 Team;
char Name[12];
__int16 check;
__int8 Alive;
__int8 check2;
__int32 PlayerSlotTeam;
__int32 Tester;
bool Has_C4;
__int32 State;
__int32 Rank;
__int32 Tester2;
__int32 CheckAgain1;
__int8 iHealth;
__int8 iHealth2;
};
bool WorldToScreen(LPDIRECT3DDEVICE9 pDev, CPlayer* pPlayer, D3DXVECTOR3* Pos)
{
D3DXVECTOR3 vWorld(pPlayer->Object->x ,pPlayer->Object->y, pPlayer->Object->z);
D3DVIEWPORT9 viewPort = {0};
D3DXMATRIX projection, view, world;
pDev->GetTransform(D3DTS_VIEW, &view);
pDev->GetTransform(D3DTS_PROJECTION, &projection);
pDev->GetTransform(D3DTS_WORLD, &world);
pDev->GetViewport(&viewPort);
D3DXVec3Project(Pos, &vWorld, &viewPort, &projection, &view, &world);
if(Pos->z < 1)
{
return true;
}
return false;
}
void ESP(LPDIRECT3DDEVICE9 pDevice)
{
DWORD CShellBase = (DWORD)GetModuleHandleA("CShell.dll");
unsigned long Base = *(DWORD*)(CShellBase + 0x30FB7C);
char *szFormat = new char[ 256 ];
if(Base != 0)
{
for(int i = 0; i < 16; i++)
{
DWORD dwStruct = (Base + (i * 0x1C0) + 0xEA6C);
if(dwStruct=!0)
{
CPlayer *pPlayer = (CPlayer*)dwStruct;
if((pPlayer) && (strlen(pPlayer->Name) > 2) && (pPlayer->iHealth > 0)) //check if player is alive and valid
{
D3DXVECTOR3 Position;
if(WorldToScreen(pDevice, pPlayer, &Position))
{
sprintf(szFormat,"%s",pPlayer->Name);
sprintf(szFormat,"%s",pPlayer->iHealth);
}
}
}
}
}
}
LPD3DXMESH pSphereMesh = NULL;
LPD3DXMESH pBoxMesh = NULL;
D3DXMATRIX ObjWorldMatrices;
D3DXMATRIX SavedMatrices;
LPDIRECT3DTEXTURE9 tRed = NULL;
LPDIRECT3DTEXTURE9 tBlue = NULL;
const BYTE bRed[] = {0x42, 0x4D, 0x3A, 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, 0x18, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00};
const BYTE bBlue[] = {0x42, 0x4D, 0x3A, 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, 0x18, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00};
D3DXCreateSphere( pDevice, 155.0f, 8, 7, &pSphereMesh, 0);
D3DXCreateBox( pDevice,100,322,100, &pBoxMesh, 0);
D3DXCreateTextureFromFileInMemory(pDevice, (LPCVOID)&bRed , sizeof(bRed) , &tRed );
D3DXCreateTextureFromFileInMemory(pDevice, (LPCVOID)&bBlue , sizeof(bBlue) , &tBlue );
D3DXVECTOR3 GetMidPoint(D3DXVECTOR3 V1,D3DXVECTOR3 V2)
{
D3DXVECTOR3 Mid;
Mid.x = (V1.x+V2.x)/2;
Mid.y = (V1.y+V2.y)/2;
Mid.z = (V1.z+V2.z)/2;
return Mid;
}
void DrawSphere(D3DXVECTOR3 Pos)
{
pDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE );
pDevice->SetRenderState( D3DRS_ZFUNC, D3DCMP_NEVER );
pDevice->GetTransform(D3DTS_WORLD, &SavedMatrices );
D3DXMatrixTranslation(&ObjWorldMatrices, Pos.x, Pos.y, Pos.z);
pDevice->SetTransform(D3DTS_WORLD, &ObjWorldMatrices);
pDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_WIREFRAME);
pDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
pDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
pDevice->SetRenderState( D3DRS_FOGENABLE, false );
pSphereMesh->DrawSubset(0);
pDevice->SetTransform(D3DTS_WORLD, &SavedMatrices );
}
void Draw3DBox(D3DXVECTOR3 Pos)
{
pDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE );
pDevice->SetRenderState( D3DRS_ZFUNC, D3DCMP_NEVER );
pDevice->GetTransform(D3DTS_WORLD, &SavedMatrices );
D3DXMatrixTranslation(&ObjWorldMatrices, Pos.x, Pos.y, Pos.z);
pDevice->SetTransform(D3DTS_WORLD, &ObjWorldMatrices);
pDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_WIREFRAME);
pDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
pDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
pDevice->SetRenderState( D3DRS_FOGENABLE, false );
pBoxMesh->DrawSubset(0);
pDevice->SetTransform(D3DTS_WORLD, &SavedMatrices );
}
HRESULT APIENTRY hkCreateDevice(BYTE * Self, UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS *pPresentationParameters, IDirect3DDevice9 **ppReturnedDeviceInterface)
{
HRESULT hRet = oCreateDevice(Self, Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, ppReturnedDeviceInterface);
if( SUCCEEDED(hRet) )
{
Log->add("Hooked Direct3D9 device: 0x%x", *ppReturnedDeviceInterface);
mco = 1;
OnInitialize(*ppReturnedDeviceInterface);
d3ddev = *ppReturnedDeviceInterface;
}
return hRet;
}
hMod = LoadLibrary("d3d9.dll");
oCreateDevice = (tCreateDevice)Hook->HookWS(bCall_CD,bCall_CD_N ,aCall_CD,aCall_CD_N ,(BYTE*)((DWORD)hMod+offset_CD),(BYTE*)hkCreateDevice);
if(!oCreateDevice) return false;
*(DWORD*)((DWORD)oCreateDevice + 8) = ((DWORD)hMod+0x180EAE);
1>------ Erstellen gestartet: Projekt: ByD3D, Konfiguration: Debug Win32 ------ 1> Main.cpp 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(420): error C2065: 'pDevice': nichtdeklarierter Bezeichner 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(420): error C4430: Fehlender Typspezifizierer - int wird angenommen. Hinweis: "default-int" wird von C++ nicht unterstützt. 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(420): error C2365: "D3DXCreateSphere": Erneute Definition; vorherige Definition war "Funktion". 1> c:\program files (x86)\microsoft directx sdk (june 2010)\include\d3dx9shape.h(117): Siehe Deklaration von 'D3DXCreateSphere' 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(420): error C2078: Zu viele Initialisierungen 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(421): error C2065: 'pDevice': nichtdeklarierter Bezeichner 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(421): error C4430: Fehlender Typspezifizierer - int wird angenommen. Hinweis: "default-int" wird von C++ nicht unterstützt. 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(421): error C2365: "D3DXCreateBox": Erneute Definition; vorherige Definition war "Funktion". 1> c:\program files (x86)\microsoft directx sdk (june 2010)\include\d3dx9shape.h(63): Siehe Deklaration von 'D3DXCreateBox' 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(421): error C2078: Zu viele Initialisierungen 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(422): error C2065: 'pDevice': nichtdeklarierter Bezeichner 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(422): error C4430: Fehlender Typspezifizierer - int wird angenommen. Hinweis: "default-int" wird von C++ nicht unterstützt. 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(422): error C2365: "D3DXCreateTextureFromFileInMemory": Erneute Definition; vorherige Definition war "Funktion". 1> c:\program files (x86)\microsoft directx sdk (june 2010)\include\d3dx9tex.h(1450): Siehe Deklaration von 'D3DXCreateTextureFromFileInMemory' 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(422): error C2078: Zu viele Initialisierungen 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(422): error C2440: 'Initialisierung': 'LPDIRECT3DTEXTURE9 *' kann nicht in 'int' konvertiert werden 1> Es gibt keinen Kontext, in dem diese Konvertierung möglich ist 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(423): error C2065: 'pDevice': nichtdeklarierter Bezeichner 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(423): error C4430: Fehlender Typspezifizierer - int wird angenommen. Hinweis: "default-int" wird von C++ nicht unterstützt. 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(423): error C2365: "D3DXCreateTextureFromFileInMemory": Erneute Definition; vorherige Definition war "Funktion". 1> c:\program files (x86)\microsoft directx sdk (june 2010)\include\d3dx9tex.h(1450): Siehe Deklaration von 'D3DXCreateTextureFromFileInMemory' 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(423): error C2078: Zu viele Initialisierungen 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(423): error C2440: 'Initialisierung': 'LPDIRECT3DTEXTURE9 *' kann nicht in 'int' konvertiert werden 1> Es gibt keinen Kontext, in dem diese Konvertierung möglich ist 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(436): error C2065: 'pDevice': nichtdeklarierter Bezeichner 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(436): error C2227: Links von "->SetRenderState" muss sich ein Zeiger auf Klassen-/Struktur-/Union-/generischen Typ befinden. 1> Typ ist ''unknown-type'' 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(437): error C2065: 'pDevice': nichtdeklarierter Bezeichner 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(437): error C2227: Links von "->SetRenderState" muss sich ein Zeiger auf Klassen-/Struktur-/Union-/generischen Typ befinden. 1> Typ ist ''unknown-type'' 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(438): error C2065: 'pDevice': nichtdeklarierter Bezeichner 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(438): error C2227: Links von "->GetTransform" muss sich ein Zeiger auf Klassen-/Struktur-/Union-/generischen Typ befinden. 1> Typ ist ''unknown-type'' 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(441): error C2065: 'pDevice': nichtdeklarierter Bezeichner 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(441): error C2227: Links von "->SetTransform" muss sich ein Zeiger auf Klassen-/Struktur-/Union-/generischen Typ befinden. 1> Typ ist ''unknown-type'' 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(442): error C2065: 'pDevice': nichtdeklarierter Bezeichner 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(442): error C2227: Links von "->SetRenderState" muss sich ein Zeiger auf Klassen-/Struktur-/Union-/generischen Typ befinden. 1> Typ ist ''unknown-type'' 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(443): error C2065: 'pDevice': nichtdeklarierter Bezeichner 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(443): error C2227: Links von "->SetRenderState" muss sich ein Zeiger auf Klassen-/Struktur-/Union-/generischen Typ befinden. 1> Typ ist ''unknown-type'' 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(444): error C2065: 'pDevice': nichtdeklarierter Bezeichner 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(444): error C2227: Links von "->SetRenderState" muss sich ein Zeiger auf Klassen-/Struktur-/Union-/generischen Typ befinden. 1> Typ ist ''unknown-type'' 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(445): error C2065: 'pDevice': nichtdeklarierter Bezeichner 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(445): error C2227: Links von "->SetRenderState" muss sich ein Zeiger auf Klassen-/Struktur-/Union-/generischen Typ befinden. 1> Typ ist ''unknown-type'' 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(448): error C2065: 'pDevice': nichtdeklarierter Bezeichner 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(448): error C2227: Links von "->SetTransform" muss sich ein Zeiger auf Klassen-/Struktur-/Union-/generischen Typ befinden. 1> Typ ist ''unknown-type'' 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(452): error C2065: 'pDevice': nichtdeklarierter Bezeichner 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(452): error C2227: Links von "->SetRenderState" muss sich ein Zeiger auf Klassen-/Struktur-/Union-/generischen Typ befinden. 1> Typ ist ''unknown-type'' 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(453): error C2065: 'pDevice': nichtdeklarierter Bezeichner 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(453): error C2227: Links von "->SetRenderState" muss sich ein Zeiger auf Klassen-/Struktur-/Union-/generischen Typ befinden. 1> Typ ist ''unknown-type'' 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(454): error C2065: 'pDevice': nichtdeklarierter Bezeichner 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(454): error C2227: Links von "->GetTransform" muss sich ein Zeiger auf Klassen-/Struktur-/Union-/generischen Typ befinden. 1> Typ ist ''unknown-type'' 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(457): error C2065: 'pDevice': nichtdeklarierter Bezeichner 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(457): error C2227: Links von "->SetTransform" muss sich ein Zeiger auf Klassen-/Struktur-/Union-/generischen Typ befinden. 1> Typ ist ''unknown-type'' 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(458): error C2065: 'pDevice': nichtdeklarierter Bezeichner 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(458): error C2227: Links von "->SetRenderState" muss sich ein Zeiger auf Klassen-/Struktur-/Union-/generischen Typ befinden. 1> Typ ist ''unknown-type'' 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(459): error C2065: 'pDevice': nichtdeklarierter Bezeichner 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(459): error C2227: Links von "->SetRenderState" muss sich ein Zeiger auf Klassen-/Struktur-/Union-/generischen Typ befinden. 1> Typ ist ''unknown-type'' 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(460): error C2065: 'pDevice': nichtdeklarierter Bezeichner 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(460): error C2227: Links von "->SetRenderState" muss sich ein Zeiger auf Klassen-/Struktur-/Union-/generischen Typ befinden. 1> Typ ist ''unknown-type'' 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(461): error C2065: 'pDevice': nichtdeklarierter Bezeichner 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(461): error C2227: Links von "->SetRenderState" muss sich ein Zeiger auf Klassen-/Struktur-/Union-/generischen Typ befinden. 1> Typ ist ''unknown-type'' 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(464): error C2065: 'pDevice': nichtdeklarierter Bezeichner 1>c:\users\CF\desktop\d3dcrossfire\topbase v1.1\main.cpp(464): error C2227: Links von "->SetTransform" muss sich ein Zeiger auf Klassen-/Struktur-/Union-/generischen Typ befinden. 1> Typ ist ''unknown-type'' ========== Erstellen: 0 erfolgreich, Fehler bei 1, 0 aktuell, 0 übersprungen ==========
D3DXCreateSphere( pDevice, 155.0f, 8, 7, &pSphereMesh, 0); D3DXCreateBox( pDevice,100,322,100, &pBoxMesh, 0); D3DXCreateTextureFromFileInMemory(pDevice, (LPCVOID)&bRed , sizeof(bRed) , &tRed ); D3DXCreateTextureFromFileInMemory(pDevice, (LPCVOID)&bBlue , sizeof(bBlue) , &tBlue );