hi,
i'm new to this site, but today im did a little work and i made this "engine source"
What is it?
It is like a nomenu, but i added a bit of code (that i coded) and now you can draw UNDETECTED lines on the game
example:
You will need:
updated detours
Direct3D9.cpp
Code:
#include <windows.h>
#include <d3dx9.h>
#include <d3d9.h>
#include <fstream>
#include "Detour.h"
#include "Class.h"
#pragma comment(lib,"d3dx9.lib")
#pragma comment(lib,"d3d9.lib")
Engine *engine;
ID3DXFont *pfont;
INT ShowEngine=0;
bool DrawHook;
typedef HRESULT (__stdcall * oReset) (LPDIRECT3DDEVICE9 pDev,D3DPRESENT_PARAMETERS *pPara);
oReset pReset;
typedef HRESULT (__stdcall *oPresent) (LPDIRECT3DDEVICE9 pDev,CONST RECT *pBegin,CONST RECT *pMid,HWND hWnd,CONST RGNDATA *pEnd);
oPresent pPresent;
HRESULT WINAPI myReset(LPDIRECT3DDEVICE9 pDev,D3DPRESENT_PARAMETERS *pPara)
{
pfont->OnLostDevice();
HRESULT pResetDevice = pReset(pDev,pPara);
pfont->OnLostDevice();
return pResetDevice;
}
void DrawLine(int x, int y, DWORD Color, const char *txt, LPD3DXFONT nfont, DWORD Style = DT_NOCLIP )
{
RECT Newstring = { x, y, x + 120, y + 20 };
char buffer[500] = {'\0'};
va_list va_alist;
va_start(va_alist, txt);
vsprintf_s(buffer, txt, va_alist);
va_end(va_alist);
nfont->DrawTextA(NULL, buffer, -1, &Newstring, Style, Color);
}
HRESULT WINAPI cHacks(char *Dest)
{
if(GetModuleHandle(Dest))
{
if(GetAsyncKeyState(VK_F1)&1){ *(int*)0x00/*Adress*/ = 1; }
if(GetAsyncKeyState(VK_F2)&1){ *(int*)0x00/*Adress*/ = 0; }
}
return 0;
}
void Funcs()
{
DrawLine(10,25,D3DCOLOR_ARGB(255,0,255,255),"-GlassWalls on - F1",pfont);
DrawLine(10,40,D3DCOLOR_ARGB(255,0,255,255),"-GlassWalls off - F2",pfont);
DrawLine(10,55,D3DCOLOR_ARGB(255,0,255,255),"-Functions here",pfont);
DrawLine(10,70,D3DCOLOR_ARGB(255,0,255,255),"-mpgh.net",pfont);
DrawLine(10,85,D3DCOLOR_ARGB(255,0,255,255),"-Coded by EnginePK",pfont);
}
void Controls()
{
if(ShowEngine==0)
{
if(GetAsyncKeyState(VK_INSERT)&1)
{
ShowEngine=1;
}
}
if(ShowEngine==1)
{
if(GetAsyncKeyState(VK_INSERT)&1)
{
ShowEngine=0;
}
}
}
HRESULT WINAPI myPresent(LPDIRECT3DDEVICE9 pDev,CONST RECT *pBegin,CONST RECT *pMid,HWND hWnd,CONST RGNDATA *pEnd)
{
if(!DrawHook)
{
D3DXCreateFont(pDev,13,0,FW_NORMAL,1,0,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH | FF_DONTCARE,(LPCSTR)"Verdana",&pfont);
DrawHook=true;
}
if(pfont == NULL)
pfont->OnLostDevice();
Controls();
DrawLine(10,10,D3DCOLOR_ARGB(255,255,255,0),"Press Insert to show/hide the engine hotkeys!",pfont);
if(ShowEngine==1)
{
Funcs();
}
cHacks("WarRock.exe");
return pPresent(pDev,pBegin,pMid,hWnd,pEnd);
}
int Direct3D9Hook()
{
HINSTANCE hInst;
hInst=0;
DWORD vTable[105];
do{
hInst = GetModuleHandle("d3d9.dll");
if(!hInst)
Sleep(20);
}while(!hInst);
{
pReset = (oReset)EngineDetour((DWORD)vTable[16],(DWORD)myReset,5);
pPresent = (oPresent)EngineDetour((DWORD)vTable[17],(DWORD)myPresent,7);
}
return 0;
}
BOOL __stdcall DllMain(HINSTANCE hDll,DWORD dwReason,LPVOID lpv)
{
if(dwReason == DLL_PROCESS_ATTACH)
{
CreateThread(0,0,(LPTHREAD_START_ROUTINE)Direct3D9Hook,0,0,0);
}
return TRUE;
}
Menu.cpp
Code:
#include <d3dx9.h>
#include <d3d9.h>
#include <windows.h>
#include <fstream>
#include "Class.h"
ID3DXFont *pNewFonts;
void Engine::AddItem(char *txt, char **opt, int *var, int MaxValue)
{
MENU[Mmax]->typ=MENUITEM;
MENU[Mmax]->txt=txt;
MENU[Mmax]->opt=opt;
MENU[Mmax]->var=var;
MENU[Mmax]->MaxValue=MaxValue;
Mmax++;
}
void NewLine(int x, int y, DWORD Color, const char *txt, LPD3DXFONT nfont )
{
RECT Newstring = { x, y, x + 120, y + 20 };
char buffer[500] = {'\0'};
va_list va_alist;
va_start(va_alist, txt);
vsprintf_s(buffer, txt, va_alist);
va_end(va_alist);
pNewFonts->DrawTextA(NULL, buffer, -1, &Newstring, DT_NOCLIP, Color);
}
void Engine::Display()
{
NewLine(20,200,D3DCOLOR_ARGB(255,255,255,0),"Press Insert to show/hide the engine hotkeys!",pNewFonts);
}
Class.h
Code:
#include <windows.h>
#include <d3d9.h>
#include <d3dx9.h>
#define MAXMENUITEMS 10
#define MENUITEM 1
#define MENUFOLDER 2
typedef struct
{
int typ;
char *txt;
char **opt;
int *var;
int MaxValue;
} EngineMenu;
class Engine
{
public:
Engine(char *EngineTitle=0)
{
Mmax=0;
ShowMenu = 1;
MENU = (EngineMenu **)malloc(4*MAXMENUITEMS);
for(int i=0; i<MAXMENUITEMS; i++) MENU[i] = (EngineMenu *)malloc(sizeof(EngineMenu));
} ~Engine(){
for(int i=0; i<MAXMENUITEMS; i++)
free(MENU[i]);
free(MENU);
}
EngineMenu **MENU;
int ShowMenu;
int Mmax;
void Display();
void Render(float x,float y,ID3DXFont *pfont,LPDIRECT3DDEVICE9 pDev);
void AddItem(char *txt,char **opt,int *var,int MaxValue);
private:
char *WeWant;
float Max_Ofs;
float Size;
};
Credits ~EnginePK