missingchord

Posts: 59 Join date: 2009-12-23 Age: 21 Location: Talisay, Camarines Norte
 | Subject: [Tutorial]How to Make a Hacks , Chams/Wallhack (FULL TUT) Wed Dec 23, 2009 11:57 am | |
| Tools You need: 1. D3D Starterkit v3.0 or Download 2. Microsoft Visual C++ 6.0 Let's go first in D3D Starter Kit. D3D StarterKitWhat will this starter kit do? It will permit you to hook the game you want and then start hacking it. If you do not have this...It's like not having the button On / Off off an normal hack. What program do I need to do D3D with Microsoft Visual C++ 6.0How do I use the satrter kit? You need to go on to D3D8 and then you will see some file and also a folder named "old workspace" all the files that are in D3D8 put them in the "old workspace" folder then open the workspace. A file .dsw D3D Text TutorialTo start this we need 2 files | Code: | D3DFont.h D3DFont.cpp |
Download them here. Mirror
Place them in your project folder with all the other files. Then you must include them into the workspace. To do this, go to "Project -> Add Existing Item" and search for the 2 files you have just added to the folder. Now that we have added them, let's use them!
Go to D3D8Dev.cpp and then at the top of the file, add this to include the font class.
| Code: | #include <fstream> #include <stdio.h> //these are for your sprintf #include "d3dfont.h" //this is for the font |
Next we want to make a pointer to our font so we would do that like this :
| Code: | CD3DFont* m_pFont_new = NULL; //one for menu CD3DFont* m_pFont_INFO = NULL; //one for other text (such as a header) |
Now let's go ahead and make a char to define our strings we want to pass to text.
| Code: | char Display_Line[256]; ///256 is the max text it will pass |
And add D3D Colors
| Code: | const D3DCOLOR txtRed = D3DCOLOR_ARGB(255, 255, 0, 0); |
Can we do other colors?? Yes you can.Go take a look at [You must be registered and logged in to see this link.] the RGB values. So you will only need to change the green things in code to the colour you want. Do not touche the first "255"
Here's what all that should look like at the top.
| Code: | #include "d3dfont.h"
CD3DFont* m_pFont_new = NULL;//one for menu CD3DFont* m_pFont_INFO = NULL;////one for other text (such as a header) char Display_Line[256];///256 is the max text it will pass const D3DCOLOR txtRed = D3DCOLOR_ARGB(255, 255, 0, 0);
|
Now let's create our font. So search for this in D3D8d3v.cpp
| Code: | HRESULT CD3DManager::Initialize() |
Place this in there. **You can either keep the text that is in there or delete it. Your choice**
| Code: | // Fonts to show text m_pFont_new = new CD3DFont("Arial", 13, D3DFONT_BOLD); m_pFont_new->InitDeviceObjects(m_pD3Ddev); m_pFont_new->RestoreDeviceObjects(); m_pFont_INFO = new CD3DFont("Arial", 8, D3DFONT_BOLD); m_pFont_INFO->InitDeviceObjects(m_pD3Ddev); m_pFont_INFO->RestoreDeviceObjects(); |
Now, if you did this part the good way, here's what it should look like.
| Code: | HRESULT CD3DManager::Initialize() { /* initialize Resources such as textures (managed and unmanaged [D3DPOOL]), vertex buffers, and other D3D rendering resources ... m_pD3Ddev->CreateTexture(..., ..., &m_pD3Dtexture); */ D3DXCreateTextureFromFileInMemory(m_pD3Ddev, (LPCVOID)&bRed, 60, &texRed); D3DXCreateTextureFromFileInMemory(m_pD3Ddev, (LPCVOID)&bBlue, 60, &texBlue); D3DXCreateTextureFromFileInMemory(m_pD3Ddev, (LPCVOID)&bGreen, 60, &texGreen); D3DXCreateTextureFromFileInMemory(m_pD3Ddev, (LPCVOID)&bYellow, 60, &texYellow); D3DXCreateTextureFromFileInMemory(m_pD3Ddev, (LPCVOID)&bPink, 60, &texPink); D3DXCreateTextureFromFileInMemory(m_pD3Ddev, (LPCVOID)&bTur, 60, &texTur); D3DXCreateTextureFromFileInMemory(m_pD3Ddev, (LPCVOID)&bOrange, 60, &texOrange); D3DXCreateTextureFromFileInMemory(m_pD3Ddev, (LPCVOID )&bWhite, 60, &texWhite); D3DXCreateTextureFromFileInMemory(m_pD3Ddev, (LPCVOID )&bGrenade, 60, &texGrenade);///////////these are for creating cham colors(incase you didnt know)
// Fonts to show text m_pFont_new = new CD3DFont("Arial", 13, D3DFONT_BOLD); m_pFont_new->InitDeviceObjects(m_pD3Ddev); m_pFont_new->RestoreDeviceObjects(); m_pFont_INFO = new CD3DFont("Arial", 8, D3DFONT_BOLD); m_pFont_INFO->InitDeviceObjects(m_pD3Ddev); m_pFont_INFO->RestoreDeviceObjects();
CH_Chams = true; phandle = NULL;
return S_OK; } |
So if you did it the right way, here how it should look like.
| Code: | HRESULT CD3DManager::PreReset()
{ /* release all UNMANAGED [D3DPOOL_DEFAULT] textures, vertex buffers, and other volitile resources ... _SAFE_RELEASE(m_pD3Dtexture); */ m_pFont_new->InvalidateDeviceObjects(); m_pFont_new->DeleteDeviceObjects(); m_pFont_new = NULL; m_pFont_INFO->InvalidateDeviceObjects(); m_pFont_INFO->DeleteDeviceObjects(); m_pFont_INFO = NULL;
return S_OK; } |
Yellow part is not obligated to be here as I said
Next : Search for
| Code: | HRESULT CD3DManager::PostReset() |
And add this
| Code: | m_pFont_new = new CD3DFont("Arial", 13, D3DFONT_BOLD); m_pFont_new->InitDeviceObjects(m_pD3Ddev); m_pFont_new->RestoreDeviceObjects(); m_pFont_INFO = new CD3DFont("Arial", 8, D3DFONT_BOLD); m_pFont_INFO->InitDeviceObjects(m_pD3Ddev); m_pFont_INFO->RestoreDeviceObjects(); |
And again, here is how it should look like
| Code: | HRESULT CD3DManager::PostReset() { /* re-initialize all UNMANAGED [D3DPOOL_DEFAULT] textures, vertex buffers, and other volitile resources ... m_pD3Ddev->CreateTexture(..., ..., &m_pD3Dtexture); */ m_pFont_new = new CD3DFont("Arial", 13, D3DFONT_BOLD); m_pFont_new->InitDeviceObjects(m_pD3Ddev); m_pFont_new->RestoreDeviceObjects(); m_pFont_INFO = new CD3DFont("Arial", 8, D3DFONT_BOLD); m_pFont_INFO->InitDeviceObjects(m_pD3Ddev); m_pFont_INFO->RestoreDeviceObjects();
return S_OK; } |
Yellow part is not obligated to be here as I said And finally, search for
| Code: | HRESULT CD3DManager::Release() |
And add:
| Code: | m_pFont_new->InvalidateDeviceObjects(); m_pFont_new->DeleteDeviceObjects(); m_pFont_new = NULL; m_pFont_INFO->InvalidateDeviceObjects(); m_pFont_INFO->DeleteDeviceObjects(); m_pFont_INFO = NULL; CloseHandle(phandle); phandle = NULL; |
Here is how it should look like
| Code: | HRESULT CD3DManager::Release() { /* Release all textures, vertex buffers, and other resources ... _SAFE_RELEASE(m_pD3Dtexture); */ m_pFont_new->InvalidateDeviceObjects(); m_pFont_new->DeleteDeviceObjects(); m_pFont_new = NULL; m_pFont_INFO->InvalidateDeviceObjects(); m_pFont_INFO->DeleteDeviceObjects(); m_pFont_INFO = NULL; CloseHandle(phandle); phandle = NULL;
return S_OK; } |
Yellow part is not obligated to be here as I said
Now we have created our font and released our font if the game was to be minimized.
So now on to the fun stuff Drawing text. How to write it in other words. Scroll down till you find "EndScene", this is were we will draw all of our text.
Here is a header to put your name or site.
| Code: | if (m_pFont_new) m_pFont_new->DrawText(400.0f, 0.0f, txtRed, "*My D3D Hack*"); |
And here's how to do a hack On / Off in text
| Code: | if (m_pFont_INFO) { // Chams Info sprintf(Display_Line, "Chams is: %s", (CH_Chams ? "ON" : "OFF") ); m_pFont_INFO->DrawText(15.0f, 90.0f, txtRed, Display_Line); } |
This is the end of D3D text tutorial. Hope this helps.
Next tutorial will be a highlighted menu system.
D3D Highlight Text Menu
If the D3D text tutorial was easy...This is even easier!
First off we need to start up top again in D3D8dev.cpp
Add this :
| Code: | bool CH_Menu; bool CH_Chams; bool CH_Wire; //bool your hacks for on/off
int highlight[3] = {1,0,0,0}; ///this defines how many in the menu//always add +1
char chamsstring[20] = {NULL}; char wirestring[20] = {NULL}; |
I'll explain why you added this for
| Code: | Blue : We bool our hacks so we can use them as true or false. You need to bool every hack you have in your D3D Orange : This is for the highlight menu system. You need to change it to the number of hacks +1. EX: If your hack has 10 hacks you need to remplace the 1 for an 11 This is where we char our strings so they can pass as text. In others words, without charing the strings, you can't write text |
Now, go to EndScene and add this :
| Code: | if (m_pFont_INFO) { if(GetAsyncKeyState(VK_INSERT)&1) CH_Menu = !CH_Menu; if (CH_Menu) { sprintf (chamstring, "%s", (CH_Chams ? "ON" : "OFF")); sprintf (wirestring, " %s", (CH_Wire ? "ON" : "OFF")); //use your strings here
////--------------------------- this determines if the hack is highlighted -------------//
if(highlight[1]==1) m_pFont_INFO->DrawText(15.0f, 220.0f, txtWhite, chamsstring); else m_pFont_INFO->DrawText(15.0f,220.0f, txtRed, chamsstring);
if(highlight[2]==1) m_pFont_INFO->DrawText(15.0f, 230.0f,txtWhite, wirestring); else m_pFont_INFO->DrawText(15.0f, 230.0f,txtRed, wirestring);
////-------------------------------------------------------------------------------------------------//
////------------------------This is how to use our menu ----------------------------------//
if(GetAsyncKeyState(VK_UP)&1) { for(int i=0; i < 3; i++) /////add +1 to menu here ,change the 3 { if (highlight[i] == 1) { int a = i-1;
if(a < 0) break;
else { highlight[a]=1; highlight[i]=0; break; } } } }
if(GetAsyncKeyState(VK_DOWN)&1) { for(int i=0; i < 3; i++) //////same here change the 3 to +1 of menu { if (highlight[i] == 1) { int a = i+1;
if(a > 2) ////amount in the menu goes here ,change the 2 break;
else { highlight[a]=1; highlight[i]=0; break; } } } }
////------------------------ Activate hacks on/off here ------------------------------------//
if (GetAsyncKeyState(VK_INSERT)&1)) CH_Menu = !CH_Menu;
if(highlight[1] == 1 && (GetAsyncKeyState(VK_RIGHT)&1)) CH_Chams = !CH_Chams;
if(highlight[2] == 1 && (GetAsyncKeyState(VK_RIGHT)&1)) CH_Wire = !CH_Wire;
}
|
This is the Highlight menu system!
D3D Chams and Wallhack
First we are going to start with Wallhack :
In the starter kit go to d3d8dev.ccp Under the #defines at the top :
| Code: | bool wallhack; UINT m_Stride |
Now, Search for
| Code: | DrawIndexedPrimitive |
And add :
| Code: | if (wallhack) //If wallhack bool is called. { if(m_stride == 44) //On the players model. { m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE); //Then bring to the front } else { m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, TRUE); //Evertyhing else is normal } }
if ((GetAsyncKeyState(VK_NUMPAD1)&1) == 1) // If get numpad 1 then wallhack = !wallhack; //activate wallhack |
Now let's go with chams :
In the starter kit go again to d3d8dev.ccp and add
| Code: | bool chams; UINT m_Stride; LPDIRECT3DTEXTURE8 texRed, texGreen; //textures. If you add textures add them here |
If this is already there one time...Do not add 2 times. One time is enough
Search again for
| Code: | DrawIndexedPrimitive |
And add:
| Code: | if (chams) //if cham bool is called { if (m_Stride == 44) //on the player models { m_pD3Ddev->SetRenderState(D3DRS_ZENABLE,false); //bring to front m_pD3Ddev->SetRenderState(D3DRS_FILLMODE,D3DFILL_SOLID); //fill it with a solid color m_pD3Ddev->SetTexture( 0, texRed); //fill it wih red m_pD3Ddev->DrawIndexedPrimitive(PrimitiveType, minIndex, NumVertices, startIndex, primCount); m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, true); m_pD3Ddev->SetRenderState(D3DRS_FILLMODE,D3DFILL_SOLID); m_pD3Dde->SetTexture( 0, texGreen); //fill it with green } }
if ((GetAsyncKeyState(VK_NUMPAD2)&1) == 1) //if numpad 2 is called then Chams = !Chams; //chams on and off |
So good now the chams code is made but we need to make our coulours!
Here is how we do it. Search for
| Code: | HRESULT CD3DManager::Release() |
And UNDER this code :
| Code: | HRESULT CD3DManager::Release() { return S_OK; } |
Add this one :
| Code: | HRESULT GenerateTexture(IDirect3DDevice8 *pD3Ddev, IDirect3DTexture8 **ppD3Dtex, DWORD colour32) { if( FAILED(pD3Ddev->CreateTexture(8, 8, 1, 0, D3DFMT_A4R4G4B4, D3DPOOL_MANAGED, ppD3Dtex)) ) return E_FAIL; WORD colour16 = ((WORD)((colour32>>28)&0xF)<<12) |(WORD)(((colour32>>20)&0xF)<<8) |(WORD)(((colour32>>12)&0xF)<<4) |(WORD)(((colour32>>4)&0xF)<<0);
D3DLOCKED_RECT d3dlr; (*ppD3Dtex)->LockRect(0, &d3dlr, 0, 0); WORD *pDst16 = (WORD*)d3dlr.pBits;
for(int xy=0; xy < 8*8; xy++) *pDst16++ = colour16;
(*ppD3Dtex)->UnlockRect(0);
return S_OK; } |
So now that we created our GenerateTexture that will permit us to create colours, let's make use of it!
Searche for EndScene and then add this to define our colours
| Code: | GenerateTexture(m_pD3Ddev, &texRed,D3DCOLOR_ARGB(255,255,0,0)); GenerateTexture(m_pD3Ddev, &texGreen,D3DCOLOR_ARGB(255,0,255,0)); |
And in SetStreamSource we put
| Code: | if( StreamNumber == 0 ){m_Stride = Stride;} |
Here is the basic code for doing a pointer hack Pointer hacks are :
-Super Jump -No Recoil -Player Boxes -Shutgun
| Code: | void Stamina() { Wrrk = GetCurrentProcess(); int addy=Player_Pointer; int offset=0x28C; int value=1120403456; long maddy; long saddy;
ReadProcessMemory(Wrrk, (LPVOID*)(DWORD) addy, &maddy, sizeof(maddy), NULL);
saddy = maddy + offset;
WriteProcessMemory(Wrrk, (LPVOID*)(DWORD) saddy, &value, sizeof(value), NULL); } |
Now I will explain it to you so you can use it for yourself I will put colours legend
Handle Wrrk : This is important. Without this you can't hack the game you want.
So you need to add this everywhere in your D3DDev8.cpp
| Code: | HANDLE Wrrk; //<<< you can name this whatever I chose Wrrk for this example |
And then find Initializ() and add this:
| Code: | Wrrk = GetCurrentProcess(); |
Address The adress is the most important part. The better is to define them somewhere up with the HANDLE. We define it like this :
| Code: | #define Player_Pointer 0xADDRESS |
Offset The offset is only for pointer...This is why pointer are different then memory hacks. This you only put it like this 0xOFFSET
Value This is what you freeze the value to. You juste need to change 1120403456 to what your hack needs to be freezed. NFD is -2000 for exemple
Long or Float Here if your hack is long, keep the "long". If exemple you want to make shotgun hack, you need to change the "long" to "float" Now to activate the hack you need to bool it and then in EndScene make a hotkey for it.
| Code: | ////up top bool your hack bool means true or false///
bool H_Spawn;
/////in End Scene/////Do the hotkey and hack
if( GetAsyncKeyState( VK_NUMPAD1)&1 ) H_Spawn = !H_Spawn; ////this tells it on or off
if (H_Spawn) ////if H_Spawn is true { Spawn(); /// hack } |
D3D Memory Hacks
As in pointers, you need to add somewhere on top:
| Code: | HANDLE Wrrk; //<<< you can name this whatever i chose Wrrk for this example |
And then in Initialize() :
| Code: | Wrrk = GetCurrentProcess(); //This need to be same as in HANDLE |
So now for the hack, you need to define the addy like this:
| Code: | #define Spawn_Addie1 0xADDRESS #define Spawn_Addie2 0xADDRESS //<<<<<<define your address up top somewere with the HANDLE |
And then to do the hack you need to do :
| Code: | void Spawn() { long t=0; unsigned long Protection; VirtualProtect((void*)Spawn_Addie1, sizeof(t), PAGE_READWRITE, &Protection); memcpy((void*)Spwan_Addie1, &t , sizeof(t)); VirtualProtect((void*)Spawn_Addie1, sizeof(t), Protection, 0);
VirtualProtect((void*)Spawn_Addie2, sizeof(t), PAGE_READWRITE, &Protection); memcpy((void*)Spwan_Addie2, &t , sizeof(t)); VirtualProtect((void*)Spawn_Addie2, sizeof(t), Protection, 0); } |
Long or Float. This is the same as before. If the hack needs a float value change the "long" to "float" Freeze value : Same as pointers, this is the value you need to freeze hack. If you need to freeze at 5 change 0 to a 5 like this
This is how you use your defined Spawn addie.
Now to activate the hack you need to bool it and then in EndScene make a hotkey for it.
| Code: | ////up top bool your hack bool means true or false///
bool H_Spawn;
/////in End Scene/////Do the hotkey and hack
if( GetAsyncKeyState( VK_NUMPAD1)&1 ) H_Spawn = !H_Spawn; ////this tells it on or off
if (H_Spawn) ////if H_Spawn is true { Spawn(); /// hack } |
Have Fun for this.  |
|