Code:
#include "Base.h"
#include "Menu.h"
#include "DirectX.h"
#define NoRecoil 0x37238E99
#define NoReloaded 0x374B8C94
#define SuperBullets 0x374B3996
#define Nametags1 0x373723AC
#define Nametags2 0x3737244D
#define WeaponRange1 0x374B8F19
#define WeaponRange2 0x374B9169
//Menu Position
int menux = 50;
int menuy = 200;
//Menu Groups
int visual;
int removals;
int other;
int vip;
int modifiers;
//Hack Variables
int chams = 0;
int speed = 0;
int fog = 0;
int sb = 0;
int fps = 0;
int weaponrange = 0;
int recoil = 0;
int reload = 0;
int tags = 0;
int sway = 0;
int wireppl = 0;
int wireworld = 0;
int pickup = 0;
LPD3DXSPRITE Sprite;
LPDIRECT3DTEXTURE9 MenuTexture;
static BOOL sprite = TRUE;
BYTE Menupic[] = { 0xC3, 0x86, 0x7F, 0x0B, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x0B, 0x82};
void cMenu::RenderMenu(void)
{
AddItem("[ Visual ]", Opt_Folder, &visual, 2, MENUFOLDER);
if(visual){
AddItem("NX Cham " , Opt_on_off , &chams , 2 , MENUITEM);
AddItem("Nametags " , Opt_on_off , &tags , 2 , MENUITEM);
AddItem("Wire People " , Opt_on_off , &wireppl , 2 , MENUITEM);
AddItem("Wire World " , Opt_on_off , &wireworld , 2 , MENUITEM);
}
AddItem("[ Removals ]", Opt_Folder, &removals, 2, MENUFOLDER);
if(removals){
AddItem("No Fog " , Opt_on_off , & fog, 2 , MENUITEM);
AddItem("No Reload " , Opt_on_off , & reload, 2 , MENUITEM);
AddItem("No Recoil " , Opt_on_off , & recoil, 2 , MENUITEM);
AddItem("No Sway " , Opt_on_off , &sway , 2 , MENUITEM);
}
AddItem("[ Modifiers ]", Opt_Folder, &modifiers, 2, MENUFOLDER);
if(modifiers){
AddItem("Sprint " , Opt_on_off , & speed, 2 , MENUITEM);
AddItem("Long Pickup " , Opt_on_off , &pickup , 2 , MENUITEM);
}
AddItem("[ V.I.P ]", Opt_Folder, &vip, 2, MENUFOLDER);
if(vip){
AddItem("Super Bullet " , Opt_on_off , & sb, 2 , MENUITEM);
AddItem("Knife Hack " , Opt_on_off , & weaponrange, 2 , MENUITEM);
}
AddItem("[ Other ]", Opt_Folder, &other, 2, MENUFOLDER);
if(other){
AddItem("Show FPS " , Opt_on_off , & fps, 2 , MENUITEM);
}
}
void cBase::Push(const char* cmd)
{
_asm
{
PUSH cmd
MOV EAX, 0x485E10
CALL EAX
ADD ESP, 0x4
}
}
cBase Base;
typedef bool (*IsConnected_t)(void);
bool cBase::IsIngame()
{
DWORD* LTBase = (DWORD*)0x37825D44;//0x37817E30
IsConnected_t pConnected = *(IsConnected_t*)(*LTBase + 0x8C);
return pConnected();
}
void cBase::RenderFrame(LPDIRECT3DDEVICE9 pDevice)
{
if(sb && IsIngame()){
memcpy((LPVOID)SuperBullets, "\x90\x90\x90", 3);
} else {
memcpy((LPVOID)SuperBullets, "\x0F\x94\xC0", 3);
}
if(tags && IsIngame()){
memcpy((LPVOID)Nametags1, "\x90\x90", 2);
memcpy((LPVOID)Nametags2, "\x90\x90", 2);
}else{
memcpy((LPVOID)Nametags1, "\x75\x21", 2);
memcpy((LPVOID)Nametags2, "\x75\x05", 2);
}
if(reload && IsIngame()){
memcpy(( void* )( NoReloaded ), "\x90\x90\x90\x90\x90\x90", 6 );
}else{
memcpy(( void* )( NoReloaded ), "\x0F\x84\xB1\x01\x00\x00", 6 );
}
if(weaponrange && IsIngame()){
memcpy( (PBYTE)WeaponRange1, (PBYTE)"\xB8\x00\x00\x00\x10\x90", 6 );
memcpy( (PBYTE)WeaponRange2, (PBYTE)"\xB8\x00\x00\x00\x10\x90", 6 );
}else{
memcpy( (PBYTE)WeaponRange1, (PBYTE)"\x8B\x80\xC8\x02\x00\x00", 6 );
memcpy( (PBYTE)WeaponRange2, (PBYTE)"\x8B\x80\xC8\x02\x00\x00", 6 );
}
if(recoil && IsIngame()){
memcpy((LPVOID)NoRecoil, "\x90\x90\x90", 3);
}else{
memcpy((LPVOID)NoRecoil, "\xD8\x69\x51", 3);
}
if(chams && IsIngame()){
Push("SkelModelStencil 1");
}else{
Push("SkelModelStencil 0");
}
if(fog && IsIngame()){
Push("FogEnable 1");
}else{
Push("FogEnable 0");
}
if(speed && IsIngame()){
Push("BaseMoveAccel 3000.000000");
Push("StartAccel 3000.000000");
Push("MaxAccel 3000.000000");
Push("AccelInc 3000.000000");
Push("WalkVel 3000.000000");
Push("FRunVel 3000.000000");
Push("BRunVel 3000.000000");
Push("SRunVel 3000.000000");
Push("JumpVel 3000.000000");
Push("DuckVel 3000.000000");
}else{
Push("BaseMoveAccel 3000.000000");
Push("StartAccel 500.000000");
Push("MaxAccel 2000.000000");
Push("AccelInc 5000.000000");
Push("WalkVel 70.000000");
Push("FRunVel 285.000000");
Push("BRunVel 285.000000");
Push("SRunVel 285.000000");
Push("DuckVel 50.000000");
}
if(sway && IsIngame()){
Push("WeaponSway 0.000000");
}else{
Push("WeaponSway 0.020000");
}
if(pickup && IsIngame()){
Push("ActivationDistance 999999");
}else{
Push("ActivationDistance 000500");
}
if(wireworld && IsIngame()){
Push("WireFrame 1");
}else{
Push("WireFrame 0");
}
if(wireppl && IsIngame()){
Push("WireframeModels 1");
}else{
Push("WireframeModels 0");
}
if(Directx.pFont == NULL)
D3DXCreateFont(pDevice, 15, 0, 350, 0, 0, DEFAULT_CHARSET, OUT_TT_ONLY_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial", &Directx.pFont );
if(Directx.pFont2 == NULL)
D3DXCreateFont(pDevice, 18, 0, 700, 0, 0, DEFAULT_CHARSET, OUT_TT_ONLY_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial Black", &Directx.pFont2 );
if(sprite){
D3DXCreateTextureFromFileInMemory(pDevice,&Menupic,sizeof(Menupic),&MenuTexture);
D3DXCreateSprite(pDevice,&Sprite);
sprite = FALSE;
}
D3DXVECTOR3 POS;
POS.x = 15;
POS.y = 15;
POS.z = 0;
if (Mmax==0) Menu.RenderMenu();
if(Mvisible){
Sprite->Begin(D3DXSPRITE_ALPHABLEND);
Sprite->Draw(MenuTexture,NULL,NULL,&POS,0xFFFFFFFF);
Sprite->End();
Directx.DrawString(35, 180, White,Directx.pFont2,"Version 1.1 - MPGH");
Directx.DrawString(35, 160, Orange,Directx.pFont2,"Dead 4 Real");
}
Menu.MenuShow(menux,menuy,Directx.pFont);
Menu.MenuNav();
}
DWORD cBase::GetPointer(int index)
{
DWORD* devicePtr = ***(DWORD****)0x90BF20;// Device Pointer
if( devicePtr == NULL )
return 0;
return devicePtr[index];
}
bool cBase::IsGameReadyForHook(void)
{
if( GetModuleHandle( "d3d9.dll" ) != NULL
&& GetModuleHandle( "ClientFX.fxd" ) != NULL
&& GetModuleHandle( "CShell.dll" ) != NULL )
return true;
return false;
}
DWORD WINAPI dwMainThread(LPVOID)
{
while ( !Base.IsGameReadyForHook() )
Sleep(iWaitTime);
Directx.Hook();
return 0;
}
BOOL WINAPI DllMain ( HMODULE hDll, DWORD dwReason, LPVOID lpReserved )
{
DisableThreadLibraryCalls(hDll);
if ( dwReason == DLL_PROCESS_ATTACH )
{
CreateThread(NULL, NULL, dwMainThread, NULL, NULL, NULL);
}
return TRUE;
}