PostEnginePK Source

Posts 1–15 of 22 · Page 1 of 2
EnginePK Source
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
Interesting..
Great job!
This is really nice. Do you have any experience with d3dmenus ?
Quote Originally Posted by Terell. View Post
This is really nice. Do you have any experience with d3dmenus ?
It seems like the answer is yes..
Quote Originally Posted by TheCamels8 View Post
Interesting..
Great job!
Thank you
What is the intresting part?

Quote Originally Posted by Terell. View Post
This is really nice. Do you have any experience with d3dmenus ?
yes
Quote Originally Posted by EnginePK View Post
Thank you
What is the intresting part?
Everything ^^
It's always interesting to know more things
I was asking cause if he didn't I would be amazed .
WelCome and thanks for this
Quote Originally Posted by TheCamels8 View Post
Everything ^^
It's always interesting to know more things
yes it is

Quote Originally Posted by Mike Shinoda View Post
WelCome and thanks for this
Thank you
good job :P
I Gotta try this, i hope i'll succsessing
THis is AWEEEsome.
Can i have some detours and i have this 2 errors:
Code:
1>c:\documents and settings\tolis !!!\τα έγγραφά μου\visual studio 2008\projects\_apostolos_ nomenu\_apostolos_ nomenu\direct3d9.cpp(117) : error C3861: 'EngineDetour': identifier not found
1>c:\documents and settings\tolis !!!\τα έγγραφά μου\visual studio 2008\projects\_apostolos_ nomenu\_apostolos_ nomenu\direct3d9.cpp(118) : error C3861: 'EngineDetour': identifier not found
and i not understand where i put the #defines address and source for the address
Posts 1–15 of 22 · Page 1 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us