Welcome to the UnKnoWnCheaTs - Multiplayer Game Hacks and Cheats.
You have to register before you can post and see and access any of the advanced forum features, please click the register link to proceed to the registration form. To start viewing threads or posts, select a forum that you want to visit from the selection below.
Direct3D hacking programming reversing
You are Unregistered, please register to gain Full access.
maybe its also an idea to add drawing functions liek drawline, drawtext and drawcircle etc.
Take a look in tte contributorssection at my thread.. there is an example of how I do it
Here you can see the header file as impression:
Code:
/**********************************************************************************************\
|*--------------------------------------------------------------------------------------------*|
|*------------------------------------- FrameWork V1.0 ---------------------------------------*|
|*------------------------------------- Made by Freaky ---------------------------------------*|
|*------------------------------------ www.uc-forum.com --------------------------------------*|
|*--------------------------------------------------------------------------------------------*|
\**********************************************************************************************/
// CREDITS TO: \\
// UC-forum(www.uc-forum.com) for all the information \\
// learn_more(uc-forum) for undependant d3dx \\
// Jugga(uc-forum) for Matrix -> Vector functions \\
// DarkCode(uc-forum) for Bordered text \\
// CallMeEclipse(uc-forum) for createShader function \\
// ms uploaded by scrapdizle(uc-forum) for D3D9 test enviroment \\
// Evo Menu(Stefan thisgamesux.net) for example mouse-menu \\
// D3D Starterkit v3.0b(Matthew L (Azorbix)) for logging function and example \\
//********************************************************************************************\\
#ifndef FRAMEWORK_H
#define FRAMEWORK_H
#include <windows.h>
#include <process.h>
#include <string>
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <ctype.h>
#include <time.h>
#include <detours.h>
#include <tlhelp32.h>
#include <intrin.h>
#include "Resource.h"
using namespace std;
#include <d3d9.h>
#include <d3dx9.h>
#pragma comment(lib, "d3d9.lib")
//#pragma comment(lib, "d3dx9.lib")
#pragma comment(lib, "nod3dx9.lib")
extern "C" HMODULE __stdcall initD3DX( DWORD version );
//FrameWork class define
class frameWork;
class frameWorkDraw;
class frameWorkMenu;
class frameWorkConfig;
class frameWorkHook;
class frameWorkHack;
//Max of some array's
#define MAX_FONTS 30
#define MAX_SHADERS 30
#define MAX_TEXTURES 30
#define MAX_TABS 5
#define MAX_TEXTS 20
#define MAX_MAINTEXTS 10
#define MAX_SELECTBOXES 30
#define MAX_KEYSELECTS 5
#define MAX_BUTTONS 5
//Matrix -> Vector3 (Jugga uc-forum)
#define GET_ORIGIN(VecOut,pMatrix) {VecOut.x = pMatrix._41;VecOut.y = pMatrix._42;VecOut.z = pMatrix._43;};
#define GET_X(VecOut,pMatrix) {D3DXVec3Normalize(&VecOut,&D3DXVECTOR3(pMatrix._11,pMatrix._12,pMatrix._13));};
#define GET_Y(VecOut,pMatrix) {D3DXVec3Normalize(&VecOut,&D3DXVECTOR3(pMatrix._21,pMatrix._22,pMatrix._23));};
#define GET_Z(VecOut,pMatrix) {D3DXVec3Normalize(&VecOut,&D3DXVECTOR3(pMatrix._31,pMatrix._32,pMatrix._33));};
////////////////////////////////////////////// BEGIN OF CLASSES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
class frameWork {
public:
char* fileConfig;
char* fileLog;
bool debugging;
int debuggingType;
bool fullScreen;
frameWorkConfig* config;
frameWorkDraw* draw;
frameWorkMenu* menu;
frameWorkHook* hook;
frameWorkHack* hack;
LPDIRECT3DDEVICE9 d3dDevice;
D3DVIEWPORT9 d3dViewport;
HMODULE dllModule;
HANDLE hProcess;
HWND mainHwnd;
RECT mainHwndRect;
frameWork( HMODULE hModule, char* windowName = NULL );
~frameWork( );
void mainRootine( LPDIRECT3DDEVICE9 pDevice );
void onResetDevice( );
void onLostDevice( );
char* getDirectoryFile( char* file );
int getOS( );
void addLog( int debugType, const char * fmt, ... );
void addLog( const char * fmt, ... );
private:
char dir[320];
bool isInitialized;
};
//The config Manager
class frameWorkConfig {
public:
char* keys[252];
frameWorkConfig( frameWork* fwg );
bool saveVar( char* sectionName, char* varName, char* value );
bool saveVar( char* sectionName, char* varName, bool value );
bool saveVar( char* sectionName, char* varName, float value );
bool saveVar( char* sectionName, char* varName, int value );
bool saveVarKey( char* sectionName, char* varName, int value );
void loadVarChar( char* sectionName, char* varName, char* value, int valueSize );
void loadVarBool( char* sectionName, char* varName, bool* value );
void loadVarFloat( char* sectionName, char* varName, float* value );
void loadVarInt( char* sectionName, char* varName, int* value );
void loadVarKey( char* sectionName, char* varName, int* value );
private:
frameWork* fw;
};
//The draw Manager
class frameWorkDraw {
public:
ID3DXFont* fontList[MAX_FONTS];
IDirect3DPixelShader9* shaderList[MAX_SHADERS];
IDirect3DTexture9* textureList[MAX_TEXTURES];
ID3DXLine* line;
ID3DXSprite* sprite;
frameWorkDraw( frameWork* fwg );
void initOnce( LPDIRECT3DDEVICE9 pDevice );
void onResetDevice( );
void onLostDevice( );
int createFont( LPCSTR fontName, int Height = 12, int Weight = FW_NORMAL, bool bItalic = false );
int createShader( float r, float g, float b, bool bSetZBuf );
int createTexture( DWORD color );
int createTexture( char* fileName );
int createTexture( int resourceId );
void calcTextSize( int* width, int* height, int fontId, DWORD color, char* text,... );
void calcTextSize( int* width, int* height, int fontId, DWORD color , DWORD format, char* text,... );
void drawText( int posX, int posY, int fontId, DWORD color, char* text,... );
void drawText( int posX, int posY, int fontId, DWORD color, DWORD format, char* text,... );
void drawTextBordered( int posX, int posY, int fontId, DWORD color, DWORD borderColor, char* text,... );
void drawTextBordered( int posX, int posY, int fontId, DWORD color, DWORD borderColor , DWORD format, char* text,... );
void drawLine( int posX, int posY, int posX2, int posY2, int width, DWORD color );
void drawLine( D3DXVECTOR2* vertexList, int vertexCount, int width, DWORD color );
void drawRectangle( int posX, int posY, int width, int height, float lineWidth, DWORD color, bool outer = false );
void drawFilledRectangle( int posX, int posY, int width, int height, DWORD color );
void drawCircle( int posX, int posY, int radius, int sideCount, int width, DWORD color );
void drawTexture( int posX, int posY, int textureId, float rotation = 0, float scaleX = 1, float scaleY = 1 );
private:
frameWork* fw;
};
//The menu Manager
class frameWorkMenu {
public:
bool isShowing;
//Style your menu
char* title;
int menuKey;
int menuX;
int menuY;
int menuW;
int menuH;
int menuBetween;
char* menuFontName;
int menuFontSize;
int tabBetweenLR;
int tabHeight;
int tabPaddingLR;
int selectBoxSize;
bool menuSave;
bool menuLoad;
frameWorkMenu( frameWork* fwg );
void initOnce( );
void mainRootine( );
void initCursor( char* fileName );
void initCursor( int resourceId );
int addTab( char* name );
void addText( int tabId, int posX, int posY, char* name, DWORD color, bool center = false );
void addMainText( int tabId, int posX, int posY, char* name, DWORD color, bool center = false );
void addSelectBox( int tabId, int posX, int posY, bool* bStatus, char* name );
void addKeySelect( int tabId, int posX, int posY, int* bStatus, char* name );
void addButton( int tabId, int posX, int posY, bool* bStatus, char* name );
void addSaveButton( int tabId, int posX, int posY );
void addLoadButton( int tabId, int posX, int posY );
void drawBackground( );
void drawCursor( );
void updateTabs( );
void updateTexts( );
void updateMainTexts( );
void updateSelectBoxes( );
void updateKeySelects( );
void updateButtons( );
private:
frameWork* fw;
int menuFont;
int activeTab;
int cursorTexture;
bool mouseClicked;
int getKey;
typedef struct tab
{
bool set;
char* name;
int textWidth;
int textHeight;
};
typedef struct text
{
bool set;
int tabId;
char* name;
DWORD color;
int posX;
int posY;
bool center;
};
typedef struct mainText
{
bool set;
int tabId;
char* name;
DWORD color;
int posX;
int posY;
bool center;
};
typedef struct selectBox
{
bool set;
int tabId;
char* name;
bool* status;
int posX;
int posY;
};
typedef struct keySelect
{
bool set;
int tabId;
char* name;
int* status;
int posX;
int posY;
int width;
};
typedef struct button
{
bool set;
int tabId;
char* name;
bool* status;
int posX;
int posY;
int width;
int height;
};
tab tabList[MAX_TABS];
text textList[MAX_TEXTS];
mainText mainTextList[MAX_MAINTEXTS];
selectBox selectBoxList[MAX_SELECTBOXES];
keySelect keySelectList[MAX_KEYSELECTS];
button buttonList[MAX_BUTTONS];
bool isInRectangle( int posX, int posY, int width, int height);
};
//Breakpoint for hook manager
typedef struct breakpoint
{
bool set;
DWORD address;
DWORD destination;
};
//The hook Manager
class frameWorkHook
{
public:
frameWorkHook( frameWork* fwg );
void readMemory( DWORD address, void* buffer, int size );
void readMemory( HANDLE process, DWORD address, void* buffer, int size );
void writeMemory( DWORD address, void* buffer, int size );
DWORD findPattern( DWORD startAddres, DWORD searchLength, BYTE* pattern, char mask[] );
DWORD getModuleSize( DWORD processID );
PBYTE detourFunction( DWORD address, PBYTE hookedFunction );
PBYTE detourFunctionInner( DWORD address, PBYTE hookedFunction, const int detourLen, const int bytesSkip );
PBYTE detourFunctionMS( DWORD addres, PBYTE hookedFunction );
PBYTE detourVTable( PDWORD* VTableAddress, PBYTE hookedFunction, INT index );
int breakpointDetour( DWORD address, DWORD hookedFunction );
int breakpointJump( DWORD address, DWORD bytes );
void breakpointSet( int id, bool status );
static LONG WINAPI ExceptionFilter( struct _EXCEPTION_POINTERS *pException );
private:
frameWork* fw;
static breakpoint breakpointList[4];
CONTEXT context;
LPTOP_LEVEL_EXCEPTION_FILTER origExeptionFilter;
};
//The hack Manager
class frameWorkHack
{
public:
frameWorkHack( frameWork* fwg );
void initOnce( );
void onSave( );
void onLoad( );
void mainRootine( );
//Game functions
private:
frameWork* fw;
};
/*---------------------------------------------------------------------------------------------------------------------*/
/////////////////////////////////////////////// END OF CLASSES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
#endif
* This header is an old version (and yes I know its mainRoutine)
__________________ Proud to be a hacker! Programming languages I know: PHP, Javascript, XHTML, Flash Actionscript, c++
Also good at: MYSQL/Oracle databases, ERD, SQL-injection and XSS
Games I hack: Battlefield Heroes, Face of Mankind and Call of Duty MW2
May want to add support for checking if device ptr changed as well. If it does you will need to release/re-create lines, fonts etc.
__________________
I'm like a virus, you can delete me but I am never really gone.
Links die, searching does not. (Fravia : searchlores.org)
Solving problems requires effort not a college degree.
May want to add support for checking if device ptr changed as well. If it does you will need to release/re-create lines, fonts etc.
A good idea, although my current game never seems to recreate the device.
Quote:
Originally Posted by raiders
Code:
if( this->CompareFlag( true, l_bhack[3]) )
Uhhh... why not just do
Code:
if(l_bhack[3])
Just an example, useful if you want to iterate through an array of booleans.
Same with SetHackFlag( bool, bool ) second param to pointer.
Although as SEGnosis said, it does just generate more jmp's :z