Simple d3d menu (code)

08/05/2010 11:12 Ovenran#1
Hey i found this code in other website :D

Im here to release and make your own hacks with this menu

NOTE!!!!: someone's not listening Download first Visual C++ 2008 to compile this!!

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]***/
This will be an example (i tried it in special force)
GLobals
Code:
/***[OBJECTS]***/
CMenu		*m_pMenu;
/***[\OBJECTS]***/


/***[THREAD FUNCS]***/
void		thread_menu_input();
/***[\THREAD FUNCS]***/
Initialize
Code:
m_pMenu = new CMenu(m_pD3Ddev);

m_pMenu->AddHack("Chams", 0, 1);
m_pMenu->AddHack("Unli ammo", 0, 1);
m_pMenu->AddHack("Aimbot", 0, 1);
m_pMenu->AddHack("3D boxes", 0, 1);

m_pMenu->SetBodyBox(600, 100, 150, 0, 0, 0, 2, 2, 255, 255, 255, 255, 255, 255, 255, 0, 255, 255, 0, 255); // use the overloaded function if you want don't want to specify the width
m_pMenu->SetTitleBox(0, 0, 0, 2, 2, 255, 255, 255); // optional

m_pMenu->SetTitleText(255, 255, 255, "Ovenran Simple d3d menu"); // optional

CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)thread_menu_input, NULL, 0, 0);
somewhere
Code:
void thread_menu_input()
{
	m_pMenu->DoInput();
}
endscene
Code:
m_pMenu->DrawMenu();
m_pMenu->DrawFreeMenuText(0, 0, 300, 300, 255, 255, 255, "Ovenran simple d3d menu"); // optional
to update
Code:
if(m_pMenu->UpdateHack("Chams", 1, 1)) // the second 1 = the position in the list of hacks
	{
		// do chams
	}
If you don't have any codes just get my wallhack here!
Code:
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==7500121 )||(texnum==37000650)||
  (texnum==18000274)||(texnum==7500121 )||(texnum==8500105 )||(texnum==38000658)||
  (texnum==22100268)||(texnum==62400752)||(texnum==27900456)||(texnum==45700654)|| 
  (texnum==4800040 )||(texnum==83600752)||(texnum==33400477)||(texnum==38100666)|| 
  (texnum==2800036 )||(texnum==62400752)||(texnum==29700492)||(texnum==84900778)|| 
  (texnum==27500442)||(texnum==52100658)||(texnum==62400752)||(texnum==33600552)|| 
  (texnum==44100646)||(texnum==18000274)||(texnum==37200508)||(texnum==45700654)|| 
  (texnum==37200508)||(texnum==52100658)||(texnum==52100658) &&
 
 
 
     (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
//the we move onto
//Device Unhooking
unsigned long ulProtect;
        VirtualProtect(&D3D8_object[15], 4, PAGE_EXECUTE_READWRITE, &ulProtect);
        *(unsigned long*)&D3D8_object[15] = (unsigned long)pCreateDevice;
        VirtualProtect(&D3D8_object[15], 4, ulProtect, &ulProtect);
//
you must initialize your device (rename "YourDevice")
Code:
YourDevice = *ppReturnedDeviceInterface; //Rename to your Device
Don't know how to compile? try this! to help you : [Only registered and activated users can see links. Click Here To Register...]
08/05/2010 23:26 GoDzAssassiN-#2
Quote:
Originally Posted by wweraw7 View Post
Hey Man If You Can Do TeamViewer With Me And Teach me how to doo all these stuff i will really appreciate it Ty.
its not that simple and u shud of pmed him reported*
08/06/2010 05:19 Ovenran#3
^ right

And later i will put aimbot,chams and xhair here
08/06/2010 06:08 rodmaniwan#4
how to make it to dll file?
08/06/2010 06:39 Ovenran#5
Quote:
Originally Posted by rodmaniwan View Post
how to make it to dll file?
Try to compile it in Visual C++ 2008
08/06/2010 07:48 grandfenrirstooth#6
can you show to us how can we put that code to an dll file?? please put a video or instruction??
08/06/2010 09:02 Ovenran#7
here's sir to make you happy : [Only registered and activated users can see links. Click Here To Register...]
08/06/2010 17:26 Match*Star.#8
Nice.
Is this undetected?
08/07/2010 09:09 Ovenran#9
Hmmmm... try it:)
08/07/2010 15:30 xouicidal13#10
d nmn kami programmer haha!
08/08/2010 18:41 Match*Star.#11
Tnx.
I can program this.
08/09/2010 15:59 Ovenran#12
Quote:
Originally Posted by xouicidal13 View Post
d nmn kami programmer haha!
Please speak in english when you enter soldier front hacks bots cheats & exploits...

im letting you to make a hack with this one and search some hacks source codes :)
08/09/2010 16:32 bloodluster23#13
Just try it!!! and when you create an dll featuring aimbot no recoil just try to share it!!
08/09/2010 16:55 dezpair#14
i wish i can program those too... T_T

im only a web designer (HTML, JS, CSS, PHP).. lol
08/10/2010 11:36 Ovenran#15
^ try to ask some pro coders to help you in programming hacks :)

not me! im not a pro coder im just a coder XD

and some psf hacks company have hired me to make their hack :P but retired because of "makakalimutin" :D sorry i forgot what's the english...

anyway thanks for using my code :)