Here's a external hack sourcecode & binary, includes Box ESP, Snaplines, Radar & No Recoil.
Run game in windowed or borderless windowed mode, and requires Aero..
Code:
return false;
}
D3DPRESENT_PARAMETERS pPresentationParameters;
ZeroMemory(&pPresentationParameters, sizeof(pPresentationParameters));
pPresentationParameters.Windowed = TRUE;
pPresentationParameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
pPresentationParameters.BackBufferFormat = D3DFMT_A8R8G8B8;
DWORD pQualityLevels = 0;
if(pD3D->CheckDeviceMultiSampleType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_A8R8G8B8, TRUE, D3DMULTISAMPLE_NONMASKABLE, &pQualityLevels) == D3D_OK)
{
pPresentationParameters.MultiSampleType = D3DMULTISAMPLE_NONMASKABLE;
pPresentationParameters.MultiSampleQuality = pQualityLevels - 1;
}
else
{
pPresentationParameters.MultiSampleType = D3DMULTISAMPLE_NONE;
}
if(pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &pPresentationParameters, &pD3DDevice) != D3D_OK)
{
return false;
}
return true;
}
void Render()
{
if(!pD3DDevice) {
return;
}
pD3DDevice->Clear(0, NULL, D3DCLEAR_TARGET, 0x00000000, 1.0f, 0);
if(pD3DDevice->BeginScene() != D3D_OK) {
return;
}
pD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
pD3DDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
pD3DDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
if(bInitialized == true)
{
bIsInGame = false;
ReadGame();
if(bIsInGame == true)
{
Esp();
Crosshair();
NoRecoil();
}
}
pD3DDevice->EndScene();
pD3DDevice->Present(NULL, NULL, NULL, NULL);
}
INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, INT)
{
MSG uMsg;
// generate random window, class & mutex name
int r = rand()%50 + rand()%32;
for(int i = 0; i < r; i++)
name[i] = rand()%26 + 97;
CreateMutexA(0, false, name);
if(GetLastError())
return 0;
WNDCLASSEXA wc = {sizeof(WNDCLASSEX), NULL, WindowProc, NULL, NULL, hInstance, LoadIcon(NULL, IDI_APPLICATION), LoadCursor(NULL, IDC_ARROW), NULL, NULL, name, LoadIcon(NULL, IDI_APPLICATION)};
RegisterClassExA(&wc);
// create window
HWND hWnd = CreateWindowExA(WS_EX_TOPMOST | WS_EX_COMPOSITED | WS_EX_TRANSPARENT | WS_EX_LAYERED, name, name, WS_POPUP, CW_USEDEFAULT, CW_USEDEFAULT, 800, 600, NULL, NULL, hInstance, NULL);
// magic
MARGINS pMarInset = {-1, -1, -1, -1};
if(DwmExtendFrameIntoClientArea(hWnd, &pMarInset) != S_OK) {
return 1;
}
if(!D3DStartup(hWnd)) {
return 1;
}
// done, let's pull the window up
ShowWindow(hWnd, SW_SHOWDEFAULT);
UpdateWindow(hWnd);
while(1)
{
if(PeekMessage(&uMsg, NULL, 0, 0, PM_REMOVE))
{
if(uMsg.message == WM_QUIT) {
break;
}
TranslateMessage(&uMsg);
DispatchMessage(&uMsg);
}
if(hwGame == NULL)
{
hwGame = FindWindow(L"IW5", NULL);
}
if(hwGame != NULL && dwPID == 0)
{
GetWindowThreadProcessId(hwGame, &dwPID);
}
if(hProcess == NULL && dwPID != 0)
{
hProcess = OpenProcess(PROCESS_VM_READ, FALSE, dwPID);
}
if(hProcess != NULL)
{
RECT rcClient;
GetClientRect(hwGame, &rcClient);
nResolution[0] = rcClient.right;
nResolution[1] = rcClient.bottom;
RECT rcWindow;
GetWindowRect(hwGame, &rcWindow);
nBorderPosition[0] = GetSystemMetrics(SM_CXBORDER);
nBorderPosition[1] = GetSystemMetrics(SM_CYCAPTION);
if(bInitialized == true)
{
if(nWindowPos[0] != rcWindow.left || nWindowPos[1] != rcWindow.top)
{
MoveWindow(hWnd, rcWindow.left,rcWindow.top, nResolution[0], nResolution[1], FALSE);
nWindowPos[0] = rcWindow.left;
nWindowPos[1] = rcWindow.top;
}
}
else
{
if(rcWindow.left == 0 && rcWindow.top == 0)
{
MoveWindow(hWnd, -1, -1, nResolution[0], nResolution[1],false);
}
MoveWindow(hWnd, rcWindow.left, rcWindow.top, nResolution[0], nResolution[1], false);
nWindowPos[0] = rcWindow.left;
nWindowPos[1] = rcWindow.top;
if(pD3DDevice) {
pD3DDevice->Release();
}
if(pD3D) {
pD3D->Release();
}
D3DStartup(hWnd);
}
bInitialized = true;
}
Render();
}
if(pD3DDevice) {
pD3DDevice->Release();
}
if(pD3D) {
pD3D->Release();
}
return 0;
}
Code:
//n! yo
char name[64] = {0};
#include <d3d9.h>
#include <d3dx9.h>
#include <dwmapi.h>
#include <stdio.h>
#include <math.h>
#pragma comment(lib, "d3d9.lib")
#pragma comment(lib, "d3dx9.lib")
#pragma comment(lib, "dwmapi.lib")
// settings
bool crosshair = true;
bool norecoil = true;
bool box_esp = true;
bool snapline = true;
/* Viewangles
005A956F - CC - int 3
005A9570 - 83 EC 10 - sub esp,10
005A9573 - 53 - push ebx
005A9574 - 55 - push ebp
005A9575 - 8B 6C 24 1C - mov ebp,[esp+1C]
005A9579 - 56 - push esi
005A957A - 57 - push edi
005A957B - 8B F0 - mov esi,eax
005A957D - E8 FE07F2FF - call 004C9D80
005A9582 - 84 C0 - test al,al
005A9584 - 74 09 - je 005A958F
005A9586 - 55 - push ebp
005A9587 - E8 F44FF7FF - call 0051E580
005A958C - 83 C4 04 - add esp,04
005A958F - D9 05 A8070601 - fld dword ptr [010607A8] ; viewangle pitch
005A9595 - 8B C5 - mov eax,ebp
005A9597 - D9 5C 24 14 - fstp dword ptr [esp+14]
005A959B - E8 D0EFFFFF - call 005A8570
005A95A0 - 6A 2C - push 2C
005A95A2 - 6A 00 - push 00
005A95A4 - 56 - push esi
005A95A5 - E8 762C1800 - call 0072C220
005A95AA - 55 - push ebp
83 C4 04 D9 05 A8 07 06 01 8B C5 D9
83 C4 04 D9 05 ?? ?? ?? ?? 8B C5 D9
*/
DWORD addrViewAngles = 0;
BYTE* sigViewAngles = (BYTE*)"\x83\xC4\x04\xD9\x05\xA8\x07\x06\x01\x8B\xC5\xD9";
char* maskViewAngles = "xxxxx????xxx";
/* Recoil values
004065A4 - 53 - push ebx
004065A5 - 52 - push edx
004065A6 - 56 - push esi
004065A7 - E8 14C21200 - call 005327C0
004065AC - 83 C4 0C - add esp,0C
004065AF - 84 C0 - test al,al
004065B1 - 75 0C - jne 004065BF
004065B3 - 89 1D 40269700 - mov [00972640],ebx
004065B9 - 89 1D 3C269700 - mov [0097263C],ebx
004065BF - A1 60719600 - mov eax,[00967160]
004065C4 - 8B 0D 64C38F00 - mov ecx,[008FC364]
004065CA - A3 44269700 - mov [00972644],eax
004065CF - 89 0D 402D9700 - mov [00972D40],ecx
004065D5 - 89 1D F4259700 - mov [009725F4],ebx
004065DB - 89 1D FC259700 - mov [009725FC],ebx
004065E1 - C7 05 EC259700 FFFFFFFF - mov [009725EC],FFFFFFFF
004065EB - E8 506A0200 - call 0042D040
004065F0 - D9EE - fldz
004065F2 - D9 15 A8309700 - fst dword ptr [009730A8]
004065F8 - 33 C0 - xor eax,eax
004065FA - D9 15 AC309700 - fst dword ptr [009730AC]
00406600 - 68 30030000 - push 00000330
00406605 - D9 15 B0309700 - fst dword ptr [009730B0]
0040660B - 53 - push ebx
0040660C - D9 15 9C309700 - fst dword ptr [0097309C]
00406612 - 68 442D9700 - push 00972D44
00406617 - D9 15 A0309700 - fst dword ptr [009730A0]
0040661D - A3 10F38F00 - mov [008FF310],eax
00406622 - D9 15 A4309700 - fst dword ptr [009730A4]
00406628 - A3 14F38F00 - mov [008FF314],eax
0040662D - D9 15 98309700 - fst dword ptr [00973098]
00406633 - A3 18F38F00 - mov [008FF318],eax
00406638 - D9 15 90309700 - fst dword ptr [00973090] ; Vector3
0040663E - A3 1CF38F00 - mov [008FF31C],eax
00406643 - D9 15 94309700 - fst dword ptr [00973094]
00406649 - A3 20F38F00 - mov [008FF320],eax
D9 EE D9 15 ?? ?? ?? 00 33 C0 D9 15
+4
-0x18
*/
DWORD addrRecoil = 0;
BYTE* sigRecoil = (BYTE*)"\xD9\xEE\xD9\x15\x00\x00\x00\x00\x33\xC0\xD9\x15";
char* maskRecoil = "xxxx???xxxxx";
/*
0059DD83 - 83 C4 0C - add esp,0C
0059DD86 - C3 - ret
0059DD87 - 83 3D 04C08F00 06 - cmp dword ptr [008FC004],06
0059DD8E - D9 15 C8BC9600 - fst dword ptr [0096BCC8]
0059DD94 - D9 05 20C08F00 - fld dword ptr [008FC020]
0059DD9A - 8B 15 A07A8F00 - mov edx,[008F7AA0]
0059DDA0 - A1 A47A8F00 - mov eax,[008F7AA4]
0059DDA5 - D9 15 CCBC9600 - fst dword ptr [0096BCCC]
0059DDAB - D9 05 24C08F00 - fld dword ptr [008FC024]
0059DDB1 - 8B 0D A87A8F00 - mov ecx,[008F7AA8]
0059DDB7 - D9 15 D0BC9600 - fst dword ptr [0096BCD0]
0059DDBD - 89 15 84719600 - mov [00967184],edx ; refdef
0059DDC3 - 8B 15 AC7A8F00 - mov edx,[008F7AAC]
0059DDC9 - D9 1D DCBC9600 - fstp dword ptr [0096BCDC]
0059DDCF - D9C9 - fxch st(1)
0059DDD1 - A3 88719600 - mov [00967188],eax
0059DDD6 - D9 1D D4BC9600 - fstp dword ptr [0096BCD4]
0059DDDC - 89 0D 8C719600 - mov [0096718C],ecx
0059DDE2 - 89 15 90719600 - mov [00967190],edx
0059DDE8 - D9 1D D8BC9600 - fstp dword ptr [0096BCD8]
0059DDEE - C6 05 A4BC9600 00 - mov byte ptr [0096BCA4],00
0059DDF5 - D9 05 58C18F00 - fld dword ptr [008FC158]
0059DDFB - D9 1D E0BC9600 - fstp dword ptr [0096BCE0]
0059DE01 - D9 05 5CC18F00 - fld dword ptr [008FC15C]
0059DE07 - D9 1D E4BC9600 - fstp dword ptr [0096BCE4]
0059DE0D - D9 05 60C18F00 - fld dword ptr [008FC160]
0059DE13 - D9 1D E8BC9600 - fstp dword ptr [0096BCE8]
0059DE19 - 75 6E - jne 0059DE89
0059DE1B - 8D 44 24 04 - lea eax,[esp+04]
0059DE1F - 50 - push eax
0059DE20 - 57 - push edi
0059DE21 - E8 0ABFF1FF - call 004B9D30
0059DE26 - D9 05 1CC08F00 - fld dword ptr [008FC01C]
D9 15 ?? ?? ?? 00 89 15 ?? ?? ?? 00 8B 15
*/
DWORD addrRefDef = 0;
BYTE* sigRefDef = (BYTE*)"\xD9\x15\x00\x00\x00\x00\x89\x15\x00\x00\x00\x00\x8B\x15";
char* maskRefDef = "xx???xxx???xxx";
/*
00591C14 - D9 9D 2C010000 - fstp dword ptr [ebp+0000012C]
00591C1A - D9 05 98319700 - fld dword ptr [00973198]
00591C20 - D9 5C 24 1C - fstp dword ptr [esp+1C]
00591C24 - 8B 74 24 58 - mov esi,[esp+58]
00591C28 - 83 C4 1C - add esp,1C
00591C2B - 68 90319700 - push 00973190
00591C30 - 68 00C08F00 - push 008FC000 ; cg_t
00591C35 - 56 - push esi
00591C36 - 88 55 02 - mov [ebp+02],dl
00591C39 - 89 2D 0CF38F00 - mov [008FF30C],ebp ; ptr to entity list
00591C3F - E8 BC8AECFF - call 0045A700
00591C44 - 68 00C08F00 - push 008FC000
00591C49 - 56 - push esi
00591C4A - E8 5184FBFF - call 0054A0A0
00591C4F - 83 C4 18 - add esp,18
00591C52 - 5F - pop edi
00591C53 - 5E - pop esi
00591C54 - 5D - pop ebp
00591C55 - 5B - pop ebx
00591C56 - 83 C4 24 - add esp,24
00591C59 - C3 - ret
00591C5A - CC - int 3
56 88 55 02 89 2D 0C F3 8F 00 E8 BC 8A EC FF 68
56 88 55 02 89 2D ?? ?? ?? ?? E8 ?? ?? ?? ?? 68
*/
DWORD pEntity = 0;
DWORD addrEntity = 0;
BYTE* sigEntity = (BYTE*)"\x56\x88\x55\x02\x89\x2D\x00\x00\x00\x00\xE8\x00\x00\x00\x00\x68";
char* maskEntity = "xxxxxx????x????x";
DWORD addrCGT = 0;
/*
0062406F - CC - int 3
00624070 - A1 40F38F00 - mov eax,[008FF340]
00624075 - 69 C0 60050000 - imul eax,eax,00000560
0062407B - 83 B8 48969F00 00 - cmp dword ptr [eax+009F9648],00 ; clientinfo
00624082 - 8D 80 00C08F00 - lea eax,[eax+008FC000]
00624088 - 74 14 - je 0062409E
0062408A - 8B 80 64D60F00 - mov eax,[eax+000FD664]
00624090 - 53 - push ebx
00624091 - 51 - push ecx
00624092 - 8B D8 - mov ebx,eax
00624094 - E8 F7FDFFFF - call 00623E90
00624099 - 83 C4 04 - add esp,04
0062409C - 5B - pop ebx
0062409D - C3 - ret
83 B8 48 96 9F 00 00 8D 80 00 C0 8F 00 74 14
83 B8 ?? ?? ?? ?? 00 8D 80 ?? ?? ?? ?? 74 14
*/
DWORD addrClientInfo = 0;
BYTE* sigClientInfo = (BYTE*)"\x83\xB8\x00\x00\x00\x00\x00\x8D\x80\x00\x00\x00\x00\x74\x14";
char* maskClientInfo = "xx????xxx????xx";
/*
iw5mp.exe+2AC7F - CC - int 3
iw5mp.exe+2AC80 - 83 EC 0C - sub esp,0C
iw5mp.exe+2AC83 - 80 3D A8228F00 00 - cmp byte ptr [iw5mp.exe+4F22A8],00 ; is in game
iw5mp.exe+2AC8A - 0F84 C1000000 - je iw5mp.exe+2AD51
iw5mp.exe+2AC90 - E8 3B820500 - call iw5mp.exe+82ED0
iw5mp.exe+2AC95 - 39 44 24 10 - cmp [esp+10],eax
iw5mp.exe+2AC99 - 0F85 B2000000 - jne iw5mp.exe+2AD51
iw5mp.exe+2AC9F - D9EE - fldz
iw5mp.exe+2ACA1 - 56 - push esi
iw5mp.exe+2ACA2 - D9 5C 24 08 - fstp dword ptr [esp+08]
iw5mp.exe+2ACA6 - C7 05 A0228F00 00000000 - mov [iw5mp.exe+4F22A0],00000000
iw5mp.exe+2ACB0 - C7 44 24 04 00000000 - mov [esp+04],00000000
iw5mp.exe+2ACB8 - C7 44 24 0C 9C719600 - mov [esp+0C],iw5mp.exe+56719C
iw5mp.exe+2ACC0 - 33 F6 - xor esi,esi
iw5mp.exe+2ACC2 - EB 0C - jmp iw5mp.exe+2ACD0
iw5mp.exe+2ACC4 - 8D A4 24 00000000 - lea esp,[esp+00000000]
iw5mp.exe+2ACCB - EB 03 - jmp iw5mp.exe+2ACD0
iw5mp.exe+2ACCD - 8D 49 00 - lea ecx,[ecx+00]
iw5mp.exe+2ACD0 - 8A 04 B5 A0128F00 - mov al,[esi*4+iw5mp.exe+4F12A0]
iw5mp.exe+2ACD7 - 3A 86 A00E8F00 - cmp al,[esi+iw5mp.exe+4F0EA0]
iw5mp.exe+2ACDD - 76 19 - jna iw5mp.exe+2ACF8
iw5mp.exe+2ACDF - 3C 02 - cmp al,02
iw5mp.exe+2ACE1 - 75 15 - jne iw5mp.exe+2ACF8
iw5mp.exe+2ACE3 - FF 44 24 04 - inc [esp+04]
iw5mp.exe+2ACE7 - 56 - push esi
iw5mp.exe+2ACE8 - E8 13BBFDFF - call iw5mp.exe+6800
iw5mp.exe+2ACED - D8 44 24 0C - fadd dword ptr [esp+0C]
iw5mp.exe+2ACF1 - 83 C4 04 - add esp,04
iw5mp.exe+2ACF4 - D9 5C 24 08 - fstp dword ptr [esp+08]
iw5mp.exe+2ACF8 - 46 - inc esi
iw5mp.exe+2ACF9 - 81 FE 00040000 - cmp esi,00000400
iw5mp.exe+2ACFF - 72 CF - jb iw5mp.exe+2ACD0
CC 83 EC 0C 80 3D ?? ?? ?? ?? 00 0F 84
*/
DWORD addrIsInGame = 0;
BYTE* sigIsInGame = (BYTE*)"\xCC\x83\xEC\x0C\x80\x3D\x00\x00\x00\x00\x00\x0F\x84";
char* maskIsInGame = "xxxxxx????xxx";
#define PLAYERMAX 18
#define ENTITIESMAX 2048
#define M_PI 3.1415f
#define FLAGS_CROUCHED 0x0004
#define FLAGS_PRONE 0x0008
#define FLAGS_FIRING 0x0200
#include "classes.h"
int nLocalNum, nLocalTeam;
Vector3 vViewAxis[3];
bool bIsInGame;
ClientInfo pClientInfo[PLAYERMAX];
CEntity pEntities[ENTITIESMAX];
int nWindowPos[2] = {0, 0};
IDirect3D9 *pD3D = NULL;
IDirect3DDevice9 *pD3DDevice = NULL;
HANDLE hProcess = NULL;
DWORD dwPID = 0;
HWND hwGame = NULL;
int nResolution[2], nBorderPosition[2];
bool bInitialized = false;
Vector3 vLocalPos;
float fFOV[2];
#include "functions.h"
Code:
//n! yo
void DrawLine(float x1, float y1, float x2, float y2, D3DCOLOR color)
{
static bool firstCall = true;
static IDirect3DPixelShader9* colorPixShader = NULL;
static IDirect3DVertexDeclaration9* vDecl = NULL;
if(firstCall)
{
unsigned char colorPixShaderFunc[] = { 0x1, 0x1, 0xFF, 0xFF, 0xFE, 0xFF, 0x21, 0x0, 0x43, 0x54, 0x41, 0x42, 0x1C, 0x0, 0x0, 0x0, 0x4B, 0x0, 0x0, 0x0, 0x1, 0x1, 0xFF, 0xFF, 0x1, 0x0, 0x0, 0x0, 0x1C, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x44, 0x0, 0x0, 0x0, 0x30, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x1, 0x0, 0x2, 0x0, 0x34, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x63, 0x6F, 0x6C, 0x0, 0x1, 0x0, 0x3, 0x0, 0x1, 0x0, 0x4, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x70, 0x73, 0x5F, 0x31, 0x5F, 0x31, 0x0, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x44, 0x33, 0x44, 0x58, 0x39, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x65, 0x72, 0x20, 0x39, 0x2E, 0x31, 0x35, 0x2E, 0x37, 0x37, 0x39, 0x2E, 0x30, 0x30, 0x30, 0x30, 0x0, 0xAB, 0xAB, 0xAB, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0x80, 0x0, 0x0, 0xE4, 0xA0, 0xFF, 0xFF, 0x0, 0x0 };
pD3DDevice->CreatePixelShader(reinterpret_cast<DWORD*>(colorPixShaderFunc), &colorPixShader);
D3DVERTEXELEMENT9 vdecl[] = {
{0, 0, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITIONT, 0},
D3DDECL_END()
};
pD3DDevice->CreateVertexDeclaration(vdecl, &vDecl);
firstCall = false;
}
pD3DDevice->SetPixelShader(colorPixShader);
pD3DDevice->SetVertexShader(NULL);
pD3DDevice->SetVertexDeclaration(vDecl);
float c0[4] =
{
((color>>16)&0xFF) / 255.f,
((color>>8)&0xFF) / 255.f,
((color)&0xFF) / 255.f,
1.f
};
pD3DDevice->SetPixelShaderConstantF(0, c0, 1);
struct {
float x,y,z,rhw;
} vertices[] = {
{ x1, y1, 0.f, 1.f },
{ x2, y2, 0.f, 1.f }
};
pD3DDevice->DrawPrimitiveUP(D3DPT_LINELIST, 1, vertices, sizeof(vertices[0]));
}
void DrawBox(float x, float y, float w, float h, COLORREF color)
{
x += nBorderPosition[0];
y += nBorderPosition[1];
DrawLine(x, y, x + w, y, color);
DrawLine(x + w, y, x + w, y + h, color);
DrawLine(x + w, y + h, x, y + h, color);
DrawLine(x, y + h, x, y, color);
}
void AngleVector3s(const Vector3 &angles, Vector3 *forward, Vector3 *right, Vector3 *up)
{
float angle;
static float sr, sp, sy, cr, cp, cy, cpi = (M_PI*2/360);
angle = angles.y * cpi;
sy = sin(angle);
cy = cos(angle);
angle = angles.x * cpi;
sp = sin(angle);
cp = cos(angle);
angle = angles.z * cpi;
sr = sin(angle);
cr = cos(angle);
if(forward)
{
forward->x = cp*cy;
forward->y = cp*sy;
forward->z = -sp;
}
if(right)
{
right->x = (-1*sr*sp*cy+-1*cr*-sy);
right->y = (-1*sr*sp*sy+-1*cr*cy);
right->z = -1*sr*cp;
}
if(up)
{
up->x = (cr*sp*cy+-sr*-sy);
up->y = (cr*sp*sy+-sr*cy);
up->z = cr*cp;
}
}
bool WorldToScreen(const Vector3 &WorldLocation, float *fnScreen)
{
Vector3 vPosition = WorldLocation - vLocalPos;
Vector3 vTransform;
vTransform.x = vPosition.dotproduct(vViewAxis[1]);
vTransform.y = vPosition.dotproduct(vViewAxis[2]);
vTransform.z = vPosition.dotproduct(vViewAxis[0]);
if(vTransform.z < 0.1f) {
return false;
}
fnScreen[0] = (nResolution[0] / 2) * (1 - (vTransform.x / fFOV[0] / vTransform.z));
fnScreen[1] = (nResolution[1] / 2) * (1 - (vTransform.y / fFOV[1] / vTransform.z));
return true;
}
BOOL DataCompare( BYTE* pData, BYTE* bMask, char * szMask )
{
for( ; *szMask; ++szMask, ++pData, ++bMask )
if( *szMask == 'x' && *pData != *bMask )
return FALSE;
return ( *szMask == NULL );
}
DWORD FindPatternEx(HANDLE hProcess, BYTE *bMask, char *szMask, DWORD dwAddress, DWORD dwLength)
{
DWORD dwReturn = 0;
DWORD dwDataLength = strlen(szMask);
BYTE *pData = new BYTE[dwDataLength + 1];
SIZE_T dwRead;
for(DWORD i = 0; i < dwLength; i++)
{
DWORD dwCurAddr = dwAddress + i;
bool bSuccess = ReadProcessMemory(hProcess, (LPCVOID)dwCurAddr, pData, dwDataLength, &dwRead);
if(!bSuccess || dwRead == 0)
{
continue;
}
if(DataCompare(pData, bMask, szMask))
{
dwReturn = dwAddress + i;
break;
}
}
delete[] pData;
return dwReturn;
}
DWORD tmp;
void ReadGame()
{
while(addrIsInGame == 0) {
tmp = FindPatternEx(hProcess, sigIsInGame, maskIsInGame, 0x00400000, 0x00A00000);
ReadProcessMemory(hProcess, (PVOID)(tmp + 6), &addrIsInGame, 4, NULL);
}
while(addrViewAngles == 0) {
tmp = FindPatternEx(hProcess, sigViewAngles, maskViewAngles, 0x00400000, 0x00A00000);
ReadProcessMemory(hProcess, (PVOID)(tmp + 5), &addrViewAngles, 4, NULL);
}
while(addrRecoil == 0) {
tmp = FindPatternEx(hProcess, sigRecoil, maskRecoil, 0x00400000, 0x00A00000);
ReadProcessMemory(hProcess, (PVOID)(tmp + 4), &addrRecoil, 4, NULL);
if(addrRecoil > 0)
addrRecoil -= 0x18;
}
while(addrRefDef == 0) {
tmp = FindPatternEx(hProcess, sigRefDef, maskRefDef, 0x00400000, 0x00A00000);
ReadProcessMemory(hProcess, (PVOID)(tmp + 8), &addrRefDef, 4, NULL);
}
while(addrEntity == 0 || addrCGT == 0) {
tmp = FindPatternEx(hProcess, sigEntity, maskEntity, 0x00400000, 0x00A00000);
ReadProcessMemory(hProcess, (PVOID)(tmp + 6), &addrEntity, 4, NULL);
ReadProcessMemory(hProcess, (PVOID)(tmp - 4), &addrCGT, 4, NULL);
}
while(addrClientInfo == 0) {
tmp = FindPatternEx(hProcess, sigClientInfo, maskClientInfo, 0x00400000, 0x00A00000);
ReadProcessMemory(hProcess, (PVOID)(tmp + 2), &addrClientInfo, 4, NULL);
}
ReadProcessMemory(hProcess, (PVOID)addrIsInGame, &bIsInGame, 4, NULL);
if(bIsInGame)
{
ReadProcessMemory(hProcess, (PVOID)(addrCGT + 0x150), &nLocalNum, 4, NULL);
ReadProcessMemory(hProcess, (PVOID)(addrRefDef + 0x10), &fFOV, 8, NULL);
ReadProcessMemory(hProcess, (PVOID)(addrRefDef + 0x18), &vLocalPos, 12, NULL);
ReadProcessMemory(hProcess, (PVOID)(addrRefDef + 0x24), &vViewAxis, 36, NULL);
ReadProcessMemory(hProcess, (PVOID)addrEntity, (PVOID)&pEntity, 4, NULL);
ReadProcessMemory(hProcess, (PVOID)(pEntity - 0xDC8), pEntities, sizeof(pEntities), NULL);
ReadProcessMemory(hProcess, (PVOID)addrClientInfo, pClientInfo, sizeof(pClientInfo), NULL);
nLocalTeam = pClientInfo[nLocalNum].team;
}
}
void Crosshair()
{
if(!crosshair)
return;
float x = (float)(nResolution[0] / 2);
float y = (float)(nResolution[1] / 2);
D3DXVECTOR2 points[2];
DrawLine(x - 4, y, x + 5, y, 0xFF11CC11);
DrawLine(x, y - 4, x, y + 5, 0xFF11CC11);
}
void NoRecoil()
{
if(!norecoil)
return;
BYTE patch[24] = {0};
WriteProcessMemory(hProcess, (PVOID)(addrRecoil + 0xC), (PVOID)&patch, 24, NULL);
}
void Esp()
{
if(!box_esp && !name_esp && !dist_esp && !snapline)
return;
float drawx, drawy;
float nScreen[2];
for(int i = 0; i < ENTITIESMAX; i++)
{
if( !(pEntities[i].alive&1) ||
!(pEntities[i].valid&1) ||
nLocalNum == pEntities[i].clientnum )
continue;
if( pEntities[i].type == ET_PLAYER &&
pClientInfo[pEntities[i].clientnum].name[0] != 0 )
{
int color = (pClientInfo[pEntities[i].clientnum].team == nLocalTeam) ? 0xFF0000FF/*blue*/ : 0xFFFF0000/*red*/;
if(WorldToScreen(pEntities[i].pos, nScreen))
{
float nHead[2];
Vector3 head = pEntities[i].pos;
head.z += 60;
WorldToScreen(head, nHead);
drawy = ((nScreen[1] - nHead[1]) < 10) ? 10 : (nScreen[1] - nHead[1]);
if (pEntities[i].pose & FLAGS_CROUCHED)
{
drawy /= 1.5f;
drawx = drawy / 1.5f;
}
else if (pEntities[i].pose & FLAGS_PRONE)
{
drawy /= 3.f;
drawx = drawy * 2.f;
}
else
{
drawx = drawy / 2.75f;
}
// Box ESP
if(box_esp)
{
DrawBox(nScreen[0] - (drawx / 2), nScreen[1], drawx, -drawy, color);
}
// Snapline
if(snapline)
{
DrawLine((float)(nResolution[0] / 2 + nBorderPosition[0]), (float)(nResolution[1] + nBorderPosition[1]), nScreen[0] + nBorderPosition[0], nScreen[1] + nBorderPosition[1], color);
}
}
}
}
}