Solved Direct X menu Tutorial C++

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

Brackston

Newbie
Full Member
Dec 2, 2013
9
144
0
Hi everyone again. I decided to tackle the DX Menu tutorial and everything seemed successful, but I am having this issue where the menu decides to work randomly. I have been running this in the d3d9test environment. I am not sure how else to describe this in words so I made a video showing how it behaves. I am one of the users running on Win7 x64 Ultimate .

failed at embedding =(

here is link

https://www.youtube.com/watch?v=43ORE2C3xzc

nvm...looks like linking is how you embed here.
 
Last edited:

Rake

Cesspool Admin
Administrator
Jan 21, 2014
12,205
78,998
2,400

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
1,187
12,638
76
Iirc it hooks createdevice so the dll has to be injected before createdevice gets called. I can't watch yout vid atm tho
 

NTvalk

Hacker
Meme Tier VIP
Jul 6, 2013
499
3,108
8
We cant really help you if you dont show your source and methods you are using.
 

Brackston

Newbie
Full Member
Dec 2, 2013
9
144
0
Thanks for the response. Here is the hacks.cpp and hacks.h that I followed along with fleep in his video.Everything else would have come from the precompiled files with the tutorial. Let's see if I can get these tags right.

Hacks.cpp:

C++:
#include "hacks.h";



int MenuIndex = 0;


D3DCOLOR fontRed = D3DCOLOR_ARGB(255, 255, 0, 0);  
D3DCOLOR fontGreen = D3DCOLOR_ARGB(255, 0, 255, 0);    
D3DCOLOR fontBlue = D3DCOLOR_ARGB(255, 0, 0, 255);    
D3DCOLOR fontWhite = D3DCOLOR_ARGB(255, 255, 255, 255);  
D3DCOLOR fontBlack = D3DCOLOR_ARGB(255, 0, 0, 0);  


void Hacks::CreateFont(IDirect3DDevice9 *d3dDevice, std::string choiceFont)
{
		D3DXCreateFont( d3dDevice, 20, 0, FW_BOLD, 0, FALSE, DEFAULT_CHARSET, 
				OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, 
				choiceFont.c_str(), &font );
}


void Hacks::InitializeMenuItems()
{
	hack[WALLHACK].name = "Feature 1";
	hack[CUSTOM_CROSSHAIR].name = "Features 2";
	hack[NO_RECOIL].name = "Features 3";
	hack[UNLIM_AMMO].name = "Features 4";
	hack[AUTO_FIRE].name = "Features 5";
	hack[HIDE_MENU].name = "Hide hack [INSERT]";
	hack[HIDE_MENU].on = false; //Makes the hack show on startup
}

void Hacks::DrawText(LPCSTR TextToDraw, int x, int y, D3DCOLOR Colour)
{
	
	RECT rct = { x - 120, y, x + 120, y + 15 }; 
	font->DrawText(NULL, TextToDraw, -1, &rct, DT_NOCLIP, Colour);
}

void Hacks::DrawMenu(IDirect3DDevice9 *d3dDevice)
{
	if(!hack[HIDE_MENU].on)
	{
		DrawFilledRectangle( 55, 20, 200, 50, fontBlue, d3dDevice );
		DrawBorderBox(55, 20, 200, 50, 4, fontBlack, d3dDevice );
		DrawText("DX Menu TUT", 190, 30, fontWhite);

		
		DrawFilledRectangle( 30, 55, 250, (62*MAX_MENU_ITEMS),fontBlue, d3dDevice );
		DrawBorderBox(30, 55, 250, (62*MAX_MENU_ITEMS), 6, fontBlack, d3dDevice );
		
		int y = 40;
		for(int i = 0; i < MAX_MENU_ITEMS; i ++)
		{
			
			DrawFilledRectangle( 45, 30+y, 220, 40, hack[i].on ? fontGreen : fontRed, d3dDevice );
			DrawBorderBox(45, 30+y, 220, 40, 4, fontBlack, d3dDevice );

			if(MenuIndex == i)
			{
				DrawBorderBox(41, 26+y, 228, 48, 4, fontWhite, d3dDevice );
			}

			
			DrawText(hack[i].name.c_str(), 170 , 39+y, fontBlack);
		
			y+= 50;
		}
		DrawText("Select using arrow keys", 170, ((62*MAX_MENU_ITEMS)+7), fontWhite);
		DrawText("Turn ON/OFF [END] key", 170, ((62*MAX_MENU_ITEMS)+27), fontWhite);
	}
}
 

void Hacks::DrawFilledRectangle(int x, int y, int w, int h, D3DCOLOR color, IDirect3DDevice9* d3dDevice)
{
	D3DRECT rec = { x, y, x + w, y + h };
	d3dDevice->Clear(1, &rec, D3DCLEAR_TARGET | D3DCLEAR_TARGET, color, 0, 0);
}




void Hacks::DrawBorderBox( int x, int y, int w, int h, int thickness, D3DCOLOR Colour, IDirect3DDevice9 *d3dDevice)
{
	
	DrawFilledRectangle( x, y, w, thickness,  Colour, d3dDevice );
	
	DrawFilledRectangle( x, y, thickness, h, Colour, d3dDevice );
	
	DrawFilledRectangle( (x + w), y, thickness, h, Colour, d3dDevice );
	
	DrawFilledRectangle( x, y + h, w+thickness, thickness, Colour, d3dDevice );
}



void Hacks::KeyboardInput()
{
	if(GetAsyncKeyState(VK_UP)&1)
	{
		if(MenuIndex > 0)
		{
			MenuIndex--;
		}
	}

	if(GetAsyncKeyState(VK_DOWN)&1)
	{
		if(MenuIndex < MAX_MENU_ITEMS-1)
		{
			MenuIndex++;
		}
	}

	if(GetAsyncKeyState(VK_END)&1)
	{
		hack[MenuIndex].on = !hack[MenuIndex].on;
		
	}

	if(GetAsyncKeyState(VK_INSERT)&1)
	{
		
		hack[HIDE_MENU].on = !hack[HIDE_MENU].on;
	}
}
Hacks.h:

C++:
#pragma once

#include <Windows.h>
#include "d3d9.h"
#include <ctime> 
#include <iostream>

#define D3DHOOK_TEXTURES 
#define MAX_MENU_ITEMS 6 



#define WALLHACK 0
#define CUSTOM_CROSSHAIR 1
#define NO_RECOIL 2
#define UNLIM_AMMO 3
#define AUTO_FIRE 4
#define HIDE_MENU 5

// definition for our chams

class Hacks
{
public:
	int m_Stride;
	
	void Hacks::CreateFont(IDirect3DDevice9 *d3dDevice, std::string choiceFont);
	void Hacks::InitializeMenuItems();
	void Hacks::DrawText(LPCSTR TextToDraw, int x, int y, D3DCOLOR Colour);
	void Hacks::DrawMenu(IDirect3DDevice9 *d3dDevice);
	void Hacks::DrawFilledRectangle(int x, int y, int w, int h, D3DCOLOR color, IDirect3DDevice9* d3dDevice);
	void Hacks::DrawBorderBox( int x, int y, int w, int h, int thickness, D3DCOLOR Colour, IDirect3DDevice9 *d3dDevice);
	void Hacks::KeyboardInput();

	
	LPDIRECT3DTEXTURE9 texRed;
	LPDIRECT3DTEXTURE9 texGreen;

	
	LPDIRECT3DTEXTURE9 texBlue; 
	LPDIRECT3DTEXTURE9 texWhite; 

	
	D3DVIEWPORT9 ViewPort;  

	
	LPD3DXFONT font;

	
	struct d3dMenuHack
	{
		bool on;
		std::string name;
	};

	d3dMenuHack hack[MAX_MENU_ITEMS];
};

Hrm. I put the tags around like how my last post was edited, but they don't seem to be working for me. Sorry for the unreadable mess.
 
Last edited:

NTvalk

Hacker
Meme Tier VIP
Jul 6, 2013
499
3,108
8
hmm for me it looks like there is nothing wrong with your Hacks class but im not 100% sure, i personally think it has something to do with the hook.
 

Brackston

Newbie
Full Member
Dec 2, 2013
9
144
0
Ok, thanks for the reply. I am still very new at this stuff. Only been studying c++ and game hacking for about 3 weeks now . I finished the antiRTFM C++ spoonfeed tutorials on youtube recently and followed along just fine , but a lot of the stuff on this site is still foreign language. I am gonna go hang out in this thread https://guidedhacking.com/showthread.php?4157-Hooking-tutorial-%28Vtable-JMP-UNIX-etc%29-10 and see what I can come up with.

Looks like the tags do work, Just gotta refresh the page after posting :)
 

till0sch

Respected Hacker
Dank Tier VIP
Dank Tier Donator
Oct 14, 2012
1,104
12,593
51
Show us your hook, not the menu code please :). Seems like you forgot something small like refonting?

For me this menu has never worked and I just used VTable because you can inject when you want and you can hook those functions easier.
 

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
1,187
12,638
76
The hook used was crap indeed, think it originated from some starter kit.

Attach a debugger, see where it crashes.
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods