For Cmenu.H
Code:
#pragma once
#include "d3d9.h"
#include <windows.h>
#include <vector>
using namespace std;
class CMenu
{
public:
CMenu(LPDIRECT3DDEVICE9 lpDev);
/***[BOX]***/
void SetBodyBox(int x, int y, int r, int g, int b, int border_width, int border_height, int border_r, int border_g, int border_b, int text_r, int text_g, int text_b, int value_r, int value_g, int value_b, int highlight_r, int highlight_g, int highlight_b);
void SetBodyBox(int x, int y, int width, int r, int g, int b, int border_width, int border_height, int border_r, int border_g, int border_b, int text_r, int text_g, int text_b, int value_r, int value_g, int value_b, int highlight_r, int highlight_g, int highlight_b);
void SetTitleBox(int r, int g, int b, int border_width, int border_height, int border_r, int border_g, int border_b);
/***[\BOX]***/
/***[TEXT]***/
void SetTitleText(int r, int g, int b, char *text);
void DrawFreeMenuText(int x, int y, int width, int height, int r, int g, int b, char *text);
/***[\TEXT]***/
/***[HACKS]***/
void AddHack(char *hack_name, int default_value, int max_value);
BOOL UpdateHack(char *hack_name, int value, int number);
/***[\HACKS]***/
/***[MISC]***/
void DrawMenu();
void DoInput();
int GetNumHacks();
/***[\MISC]***/
private:
void DrawBox(D3DRECT *dimensions, D3DCOLOR back_color, D3DRECT *border_dimensions, D3DCOLOR border_color);
void DrawTitleText();
void DrawHackText(LPRECT rect, D3DCOLOR color, char *text);
void DrawHackText(LPRECT rect, D3DCOLOR color, int number);
void DrawHacks();
char *int_to_char_p(int to_char_p);
struct HACK
{
char *szName;
int default_value, max_value, current_value;
};
vector<HACK> hacks;
int hack_selection;
int hack_offset;
int hack_offset_width;
int title_offset_height;
BOOL bMenu;
D3DRECT body_box;
D3DCOLOR body_box_color;
D3DRECT body_box_border;
D3DCOLOR body_box_border_color;
D3DCOLOR body_box_text_color;
D3DCOLOR body_box_value_color;
D3DCOLOR body_box_highlight_color;
RECT body_box_rect;
D3DRECT title_box;
D3DCOLOR title_box_color;
D3DRECT title_box_border;
D3DCOLOR title_box_border_color;
RECT text_title_box;
D3DCOLOR text_title_color;
char *text_title_text;
LPDIRECT3DDEVICE9 m_pDev;
LPD3DXFONT font_body;
LPD3DXFONT font_title;
LPD3DXFONT font_free;
char *itcp_buf;
};Cmenu.cpp
Code:
#include "CMenu.h"
#include "d3d9.h"
#include <windows.h>
#include <vector>
#include <string>
#include <sstream>
using namespace std;
CMenu::CMenu(LPDIRECT3DDEVICE9 lpDev) : m_pDev(lpDev)
{
hack_selection = 0;
hack_offset = 17;
hack_offset_width = 160;
title_offset_height = 26;
bMenu = FALSE;
text_title_text = "None";
hacks.clear();
D3DXCreateFont(m_pDev, 14, 5, FW_BOLD, 1, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, ANTIALIASED_QUALITY, DEFAULT_PITCH|FF_DONTCARE, "Arial", &font_body);
D3DXCreateFont(m_pDev, 16, 7, FW_BOLD, 1, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, ANTIALIASED_QUALITY, DEFAULT_PITCH|FF_DONTCARE, "Arial", &font_title);
D3DXCreateFont(m_pDev, 15, 5, FW_BOLD, 1, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, ANTIALIASED_QUALITY, DEFAULT_PITCH|FF_DONTCARE, "Arial", &font_free);
itcp_buf = (char *)malloc(5); // 2 extra for the lulz
}
/***[BOX]***/
void CMenu:: SetBodyBox(int x, int y, int r, int g, int b, int border_width, int border_height, int border_r, int border_g, int border_b, int text_r, int text_g, int text_b, int value_r, int value_g, int value_b, int highlight_r, int highlight_g, int highlight_b)
{
body_box.x1 = x;
body_box.x2 = x + hack_offset_width;
body_box.y1 = y;
body_box.y2 = y + (hack_offset * GetNumHacks() - 1);
body_box_color = D3DCOLOR_ARGB(255, r, g, b);
body_box_border.x1 = body_box.x1 - border_width;
body_box_border.x2 = body_box.x2 + border_width;
body_box_border.y1 = body_box.y1 - border_height;
body_box_border.y2 = body_box.y2 + border_height;
/***[TEXT]***/
body_box_rect.top = body_box.y1;
body_box_rect.bottom = body_box.y2;
body_box_rect.right = body_box.x2;
body_box_rect.left = body_box.x1;
body_box_text_color = D3DCOLOR_XRGB(text_r, text_g, text_b);
body_box_value_color = D3DCOLOR_XRGB(value_r, value_g, value_b);
body_box_highlight_color = D3DCOLOR_XRGB(highlight_r, highlight_g, highlight_b);
/***[\TEXT]***/
body_box_border_color = D3DCOLOR_ARGB(255, border_r, border_g, border_b);
}
void CMenu:: SetBodyBox(int x, int y, int width, int r, int g, int b, int border_width, int border_height, int border_r, int border_g, int border_b, int text_r, int text_g, int text_b, int value_r, int value_g, int value_b, int highlight_r, int highlight_g, int highlight_b)
{
hack_offset_width = width;
body_box.x1 = x;
body_box.x2 = x + hack_offset_width;
body_box.y1 = y;
body_box.y2 = y + (hack_offset * GetNumHacks() - 1);
body_box_color = D3DCOLOR_ARGB(255, r, g, b);
body_box_border.x1 = body_box.x1 - border_width;
body_box_border.x2 = body_box.x2 + border_width;
body_box_border.y1 = body_box.y1 - border_height;
body_box_border.y2 = body_box.y2 + border_height;
/***[TEXT]***/
body_box_rect.top = body_box.y1;
body_box_rect.bottom = body_box.y2;
body_box_rect.right = body_box.x2;
body_box_rect.left = body_box.x1;
body_box_text_color = D3DCOLOR_XRGB(text_r, text_g, text_b);
body_box_value_color = D3DCOLOR_XRGB(value_r, value_g, value_b);
body_box_highlight_color = D3DCOLOR_XRGB(highlight_r, highlight_g, highlight_b);
/***[\TEXT]***/
body_box_border_color = D3DCOLOR_ARGB(255, border_r, border_g, border_b);
}
void CMenu:: SetTitleBox(int r, int g, int b, int border_width, int border_height, int border_r, int border_g, int border_b)
{
title_box.x1 = body_box.x1;
title_box.x2 = body_box.x2;
title_box.y1 = body_box.y1 - title_offset_height;
title_box.y2 = body_box.y1;
title_box_color = D3DCOLOR_ARGB(255, r, g, b);
title_box_border.x1 = title_box.x1 - border_width;
title_box_border.x2 = title_box.x2 + border_width;
title_box_border.y1 = title_box.y1 - border_height;
title_box_border.y2 = title_box.y2 + border_height;
title_box_border_color = D3DCOLOR_ARGB(255, border_r, border_g, border_b);
}
/***[\BOX]***/
/***[TEXT]***/
void CMenu::SetTitleText(int r, int g, int b, char *text)
{
text_title_box.top = title_box.y1;
text_title_box.bottom = title_box.y2;
text_title_box.right = title_box.x2;
text_title_box.left = title_box.x1;
text_title_color = D3DCOLOR_XRGB(r, g, b);
text_title_text = text;
}
void CMenu:: DrawFreeMenuText(int x, int y, int width, int height, int r, int g, int b, char *text)
{
if(bMenu)
{
RECT rect = {x, y, width, height};
font_free->DrawTextA(NULL, text, -1, &rect, 0, D3DCOLOR_XRGB(r, g, b));
}
}
/***[\TEXT]***/
/***[HACKS]***/
void CMenu:: AddHack(char *hack_name, int default_value, int max_value)
{
HACK hack = {hack_name, default_value, max_value, default_value};
hacks.push_back(hack);
}
BOOL CMenu:: UpdateHack(char *hack_name, int value, int number)
{
if(hacks.at(number - 1).szName == hack_name)
{
if(hacks.at(number - 1).current_value == value)
{
return TRUE;
}
}
return FALSE;
}
/***[\HACKS]***/
/***[MISC]***/
void CMenu:: DrawMenu()
{
if(bMenu)
{
DrawBox(&body_box, body_box_color, &body_box_border, body_box_border_color);
DrawHacks();
if(text_title_text != "None")
{
DrawBox(&title_box, title_box_color, &title_box_border, title_box_border_color);
DrawTitleText();
}
}
}
void CMenu:: DoInput()
{
while(1)
{
if(GetAsyncKeyState(VK_INSERT))
bMenu = !bMenu;
if(bMenu)
{
if(GetAsyncKeyState(VK_UP))
{
if(hack_selection == 0)
{
hack_selection = (GetNumHacks() - 1);
}
else if(hack_selection >= 1)
{
hack_selection--;
}
}
else if(GetAsyncKeyState(VK_DOWN))
{
if(hack_selection == (GetNumHacks() - 1))
{
hack_selection = 0;
}
else if(hack_selection < (GetNumHacks() - 1))
{
hack_selection++;
}
}
if(GetAsyncKeyState(VK_RIGHT))
{
if(hacks.at(hack_selection).current_value < hacks.at(hack_selection).max_value)
{
hacks.at(hack_selection).current_value++;
}
else
{
hacks.at(hack_selection).current_value = 0;
}
}
else if(GetAsyncKeyState(VK_LEFT))
{
if(hacks.at(hack_selection).current_value > 0)
{
hacks.at(hack_selection).current_value--;
}
else
{
hacks.at(hack_selection).current_value = hacks.at(hack_selection).max_value;
}
}
}
Sleep(103);
}
}
int CMenu:: GetNumHacks()
{
return ((int)hacks.size());
}
/***[\MISC]***/
/***[PRIVATE]***/
void CMenu:: DrawBox(D3DRECT *dimensions, D3DCOLOR back_color, D3DRECT *border_dimensions, D3DCOLOR border_color)
{
m_pDev->Clear(1, border_dimensions, D3DCLEAR_TARGET, border_color, 1.0f, 0);
m_pDev->Clear(1, dimensions, D3DCLEAR_TARGET, back_color, 1.0f, 0);
}
void CMenu:: DrawTitleText()
{
font_title->DrawTextA(NULL, text_title_text, -1, &text_title_box, DT_CENTER | DT_VCENTER, text_title_color);
}
void CMenu:: DrawHackText(LPRECT rect, D3DCOLOR color, char *text)
{
font_body->DrawTextA(NULL, text, -1, rect, 0, color);
}
void CMenu:: DrawHackText(LPRECT rect, D3DCOLOR color, int number)
{
font_body->DrawTextA(NULL, int_to_char_p(number), -1, rect, 0, color);
}
void CMenu:: DrawHacks()
{
for(int i = 0;i < hacks.size();i++)
{
/***[DRAW HACKS]***/
if(hack_selection == i)
DrawHackText(&body_box_rect, body_box_highlight_color, hacks.at(i).szName);
else
DrawHackText(&body_box_rect, body_box_text_color, hacks.at(i).szName);
body_box_rect.left += hack_offset_width - 8;
if(strlen(int_to_char_p(hacks.at(i).current_value) ) > strlen("a"))
{
for(int j = 1;j <= (strlen(int_to_char_p(hacks.at(i).current_value)) - 1);j++)
{
body_box_rect.left -= 6;
}
}
DrawHackText(&body_box_rect, body_box_value_color, hacks.at(i).current_value);
body_box_rect.left = body_box.x1;
/***[\DRAW HACKS]***/
body_box_rect.top += hack_offset;
}
body_box_rect.top = body_box.y1;
}
char *CMenu::int_to_char_p(int to_char_p)
{
stringstream ss;
ss << to_char_p;
strcpy(itcp_buf, ss.str().c_str());
return itcp_buf;
}
/***[\PRIVATE]***/
if(m_pMenu->UpdateHack("Chams", 1, 1)) // the second 1 = the position in the list of hacks
{
// do chams
}
typedef HRESULT ( WINAPI* oDrawIndexedPrimitive ) ( LPDIRECT3DDEVICE8 pDevice, D3DPRIMITIVETYPE pType, UINT nMinIndex, UINT nNumVertices, UINT nStartIndex, UINT nPrimitiveCount );
oDrawIndexedPrimitive pDrawIndexedPrimitive;
HRESULT WINAPI myDrawIndexedPrimitive(LPDIRECT3DDEVICE8 pDevice, D3DPRIMITIVETYPE pType, UINT nMinIndex, UINT nNumVertices, UINT nStartIndex, UINT nPrimitiveCount)
{
if(Chams)
{
texnum = (nNumVertices*100000)+nPrimitiveCount;
if(m_Stride==40 &&
(texnum==7500121 )||(texnum==8500105 )||(texnum==12400168)||(texnum==37000650)||
(texnum==18000274)||(texnum==8800105 )||(texnum==36900650)||(texnum==19600314)||
(texnum==21800306)||(texnum==7500121 )||(texnum==8500105 )||(texnum==12400168)||
(texnum==21800306)||(texnum==36900650)||(texnum==7 500121 )||(texnum==37000650)||
(texnum==18000274)||(texnum==7500121 )||(texnum==8500105 )||(texnum==38000658)||
(texnum==22100268)||(texnum==62400752)||(texnum==2 7900456)||(texnum==45700654)||
(texnum==4800040 )||(texnum==83600752)||(texnum==33400477)||(texnum ==38100666)||
(texnum==2800036 )||(texnum==62400752)||(texnum==29700492)||(texnum ==84900778)||
(texnum==27500442)||(texnum==52100658)||(texnum==6 2400752)||(texnum==33600552)||
(texnum==44100646)||(texnum==18000274)||(texnum==3 7200508)||(texnum==45700654)||
(texnum==37200508)||(texnum==52100658)||(texnum==5 2100658) &&
(nNumVertices == 100 && nPrimitiveCount == 121) || //Foot
(nNumVertices == 105 && nPrimitiveCount == 168) || //Right Arm
(nNumVertices == 132 && nPrimitiveCount == 180) || //Hand
(nNumVertices == 159 && nPrimitiveCount == 200) || //Left Arm
(nNumVertices == 338 && nPrimitiveCount == 534) || //Underbody thanks japennese guy =)
//(nNumVertices == 448 && nPrimitiveCount == 776) || //Head
(nNumVertices == 804 && nPrimitiveCount == 1016) || //Body //SRG Option item
(nNumVertices == 109 && nPrimitiveCount == 110) || //Bulletproof Vest
(nNumVertices == 336 && nPrimitiveCount == 532)) //Battle Pants
{
pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_NEVER);
pDevice->SetTexture(0,Orange);
//pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME );
pDrawIndexedPrimitive(pDevice, pType, nMinIndex, nNumVertices, nStartIndex, nPrimitiveCount);
//pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID );
pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_LESSEQUAL);
pDevice->SetTexture(0,Pink);
}
if(m_Stride==40 && texnum== 21300174)
{
pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_NEVER);
pDevice->SetTexture(0,Green);//GreenNade
pDrawIndexedPrimitive(pDevice, pType, nMinIndex, nNumVertices, nStartIndex, nPrimitiveCount);
pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_LESSEQUAL);
pDevice->SetTexture(0,Purple);
}
if(nNumVertices == 158 && nPrimitiveCount == 131)
{
pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_NEVER);
pDevice->SetTexture(0,Red);//GreenNade
pDrawIndexedPrimitive(pDevice, pType, nMinIndex, nNumVertices, nStartIndex, nPrimitiveCount);
pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_LESSEQUAL);
pDevice->SetTexture(0,Yellow);
}
if (nNumVertices == 171 && nPrimitiveCount == 143)
{
pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_NEVER);
pDevice->SetTexture(0,Red);//GreenNade
pDrawIndexedPrimitive(pDevice, pType, nMinIndex, nNumVertices, nStartIndex, nPrimitiveCount);
pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_LESSEQUAL);
pDevice->SetTexture(0,Yellow);
}
if(m_Stride==40 &&//face,mask etc...
(texnum==36700612) ||
(texnum==9600172 ) ||
(texnum==14200236) ||
(texnum==37800552) ||
(texnum==28100486) ||
(texnum==35500568) ||
(texnum==2200024 ) ||
(texnum==16200243) ||
(texnum==31900466) ||
(texnum==19300342) ||
(texnum==36200604) ||
(texnum==21300290) ||
(texnum==35700558) ||
(texnum==22100396) ||
(texnum==36100604) ||
(texnum==27100464) ||
(texnum==11400180) ||
(texnum==34900580) ||
(texnum==13200212) ||
(texnum==34700538) ||
(texnum==19500352)&&
(nNumVertices == 448 && nPrimitiveCount == 776))
{
pDevice->SetTexture(0,Blue);
}
{
pDevice->SetRenderState(D3DRS_FOGENABLE,false);
}
Hey this wallhack code still detected .. make this undected with this code:
Code:
// your create device code