Page 1 of 3 123 LastLast
Results 1 to 15 of 45
  1. #1
    Qmo's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Location
    #cmd<user> CONTRIBUTION GAME HACKING
    Posts
    2,008
    Reputation
    246
    Thanks
    5,873
    My Mood
    Relaxed

    Make a SIMPLE D3D MENU Part 2

    Make a SIMPLE D3D MENU Part 2 ( PIZZA MENU PUBLICK HACK )

    > Creadit : me and UC.me since 2006-2007, has experienced many changes until now 2013
    > Edited : me

    I've shared this code in external forums, OMG...this time I see no similar to My Source Code
    > he a copycat Maybe Leeech: LINK

    Don't give any advice to me, I don't need any advice, I dont need thanks or Rep+
    I am here just want to share for anyone who needs it
    This is a continuation of This Threads : Make a SIMPLE D3D MENU

    > TUT for Beginner;
    1. Become a CODE MAKER : LINK
    2. [C++] D3D9 Hooking : LINK
    3. Example If you want to learn make a hacking game : LINK



    Remember : HOOK and DIP Funtion need to edit again for hack can works well
    Clue : For Game guard no need to baypass, just Skip away with system different; ( dont use system E9/0x9 )


    Dont be a leech, Include the name maker if you want share again in external forum


    Directly to the topic

    > Note :
    For a game hack no need to many souce code, the most important is how you trick GAME GUARD
    For me, just need a little code for game hacking

    This you will need:

    > Microsoft Visual Studio C++
    > Microsoft DirectX SDK (June 2010) or (Summer 2004)


    1. Open Microsoft Visual Studio C++
    2. Make new project
    3. Just copy and paste into your new project
    4. Setting project Properties
    5. Include d3d9 & Lib
    6. Build your Project (F7)
    7. Done !

    > For haider :
    mPizza.h
    Code:
    //==================================================================
    // This file is part of Qmobase D3D Private part 2
    // Creadit Qmoainx 2006 
    //==================================================================
    
    #ifndef __QMO_BASE_H
    #define __QMO_BASE_H
    #define WIN32_LEAN_AND_MEAN
    #include <windows.h>
    
    void MEMwrite(void *adr, void *ptr, int size);
    DWORD WINAPI theLoop(LPVOID param);
    
    #endif

    > For File cpp :
    mPizza.cpp
    Code:
    
    //==================================================================
    // This file is part of Qmobase D3D 
    // Creadit Qmoainx 2006 
    //==================================================================
    
    #include <windows.h>
    #include <mmsystem.h>
    #include <stdio.h>
    #include <fstream>
    #include <d3d9.h>
    #include <d3dx9.h>
    #include <time.h>
    #include "mPizza.h"
    //==========pragma comment========
    #pragma comment(lib, "d3d9.lib")
    #pragma comment(lib, "d3dx9.lib")
    #pragma warning(disable:4996 4244)
    #pragma warning(disable:4700)
    //===========Gamemaster===========
    int Qmo  = 0;
    int Qmo1 = 0;
    int Qmo2 = 0;
    int Qmo3 = 0;
    int Qmo4 = 0;
    int Qmo5 = 0;
    int Qmo6 = 0;
    int Qmo7 = 0;
    int Qmo8 = 0;
    int MENUPIZZA=0;
    int PIZZA=0;
    bool hooked=false;
    bool CekHook=false;
    bool Gamemaster=true;
    //--------------------------------define HOOK & UNHOOK--------------------------------------------------------------------------------------------------
    #define HOOK(func,addy) o##func = (t##func)CreateDetour((DWORD)hk##func,(DWORD)addy,Detour_Type_0xB8,7)
    #define UNHOOK(func,addy) o##func = (t##func)CreateDetour((DWORD)o##func,(DWORD)addy,Detour_Type_0xB8,7)
    LPDIRECT3DTEXTURE9    Megaze, Blooderz, Nightmarez, Avenged, Sevenfold, TujuhX, Bondan, Fadetoblack;
    #define ES  0 
    #define DIP 1 
    #define RES 2 
    #define E8 2  
    #define ZE 3  
    #define DrawIndex 0x002B
    #define EndS 0x0023
    #define PI 3.14159265
    using namespace std;
    ofstream infile;
    ofstream myfile;
    ID3DXLine *g_pLine;
    LPD3DXFONT      g_pFont = NULL;
    LPD3DXFONT      g_pFont2 = NULL;
    D3DVIEWPORT9    g_ViewPort;
    DWORD dwProcessID;
    HANDLE hProcess;
    LPDIRECT3DDEVICE9 npDevice;
    LPDIRECT3DTEXTURE9 txHeader;
    D3DXVECTOR3 pHeader;
    HMODULE dwD3D9 = GetModuleHandle("d3d9.dll");
    DWORD BaseD3D= NULL;
    
    //---------------------------------------define Stride-------------------------------------------------------------------------------------------
    #define SMOKE ( Stride == 24 && NumVertices == 256 ||(Stride == 24 && NumVertices == 192))
    #define Dino ((primCount == 57) || (primCount == 161) || (primCount == 186) || (primCount == 197) || (primCount == 349) || (primCount == 495) || (primCount == 955) || (NumVertices == 2517 && primCount == 57) || (NumVertices == 3721 && primCount == 275) || (NumVertices == 0 && primCount == 52) || (NumVertices == 0 && primCount == 105) || (NumVertices ==0 && primCount == 186) || (NumVertices == 0 && primCount == 197) || (primCount == 579) || (primCount == 488))
    #define K400 ((NumVertices == 1002 && primCount == 980))
    #define C5 ((NumVertices == 772 && primCount == 849))
    #define Police ( NumVertices == 490 || NumVertices == 221 || NumVertices == 611|| NumVertices == 102 ||(primCount == 526) || (primCount == 84) || (primCount == 64) || NumVertices == 67 || NumVertices == 92 || NumVertices == 95 || NumVertices == 114 || NumVertices == 504 || NumVertices == 108 || NumVertices == 398 || NumVertices == 520 || NumVertices == 684 || (primCount == 56) || (primCount == 93) )
    #define Boddy ((primCount == 16 || primCount == 28 || primCount == 50 || primCount == 52 || primCount == 76 || primCount == 130))
    #define Teroris ((NumVertices == 88 && primCount == 130) || (NumVertices == 142 && primCount == 266)|| (NumVertices == 472 && primCount == 304) || (NumVertices == 384 && primCount == 346) || (NumVertices == 348 && primCount == 520) || (NumVertices == 596 && primCount == 590)|| (NumVertices == 628 && primCount == 748) || (NumVertices == 3487 && primCount == 1737)|| (NumVertices == 3487 && primCount == 1766) || (NumVertices == 262 && primCount == 196) || (NumVertices == 142 && primCount == 266) || (NumVertices == 244 && primCount == 406) || (NumVertices == 1846 && primCount == 414) || (NumVertices == 528 && primCount == 540) || (NumVertices == 520 && primCount == 593) || (NumVertices == 2728 && primCount == 1344) || (NumVertices == 1091 && primCount == 1390) || (NumVertices == 1095 && primCount == 1460) || (NumVertices == 1846 && primCount == 2090) || (NumVertices == 2263 && primCount == 45) || (NumVertices == 370 && primCount == 278) || (NumVertices == 482 && primCount == 390) || (NumVertices == 734 && primCount == 688) || (NumVertices == 2263 && primCount == 1023) || (NumVertices == 812 && primCount == 1246) || (NumVertices == 2263 && primCount == 1434) || (NumVertices == 2041 && primCount == 1561) || (NumVertices == 1530 && primCount == 1534) || (NumVertices == 749 && primCount == 1374) || (NumVertices == 1831 && primCount == 1267) || (NumVertices == 2010 && primCount == 426) || (NumVertices == 287 && primCount == 396) || (NumVertices == 1831 && primCount == 341) || (NumVertices == 1831 && primCount == 278) || (NumVertices == 185 && primCount == 254) || (NumVertices == 74 && primCount == 66) || (NumVertices == 56 && primCount == 40) || (NumVertices == 185 && primCount == 271) || (NumVertices == 45 && primCount == 56) || (NumVertices == 92 && primCount == 56) || (NumVertices == 611 && primCount == 114) || (NumVertices == 611 && primCount == 526) || (NumVertices == 18 && primCount == 12) || (NumVertices == 96 && primCount == 92) || (NumVertices == 99 && primCount == 61) || (NumVertices == 133 && primCount == 205)|| (NumVertices == 245 && primCount == 276) || (NumVertices == 398 && primCount == 487) || (NumVertices == 26 && primCount == 20) || (NumVertices == 1204 && primCount == 241) || (NumVertices == 80 && primCount == 52) || (NumVertices == 1204 && primCount == 124) || (NumVertices == 113 && primCount == 139) || (NumVertices == 1204 && primCount == 56) || (NumVertices == 684 && primCount == 740) || (NumVertices == 1204 && primCount == 42) || (NumVertices == 45 && primCount == 56) || (NumVertices == 1204 && primCount == 35) || (NumVertices == 334 && primCount == 360) || (NumVertices == 175 && primCount == 246) || (NumVertices == 195 && primCount == 109) || (NumVertices == 71 && primCount == 120) || (NumVertices == 88 && primCount == 130) || (NumVertices == 201 && primCount == 157) || (NumVertices == 224 && primCount == 200) || (NumVertices == 296 && primCount == 166) || (NumVertices == 1353 && primCount == 386) || (NumVertices == 18 && primCount == 20) || (NumVertices == 41 && primCount == 30) || (NumVertices == 62 && primCount == 67) || (NumVertices == 152 && primCount == 168) || (NumVertices == 202 && primCount == 174) || (NumVertices == 237 && primCount == 395) || (NumVertices == 647 && primCount == 716) || (NumVertices == 727 && primCount == 936) || (NumVertices == 90 && primCount == 136) || (NumVertices == 120 && primCount == 170) || (NumVertices == 142 && primCount == 128) || (NumVertices == 218 && primCount == 322) || (NumVertices == 285 && primCount == 94) || (NumVertices == 1316 && primCount == 1574) || (NumVertices == 1316 && primCount == 134) || (NumVertices == 56 && primCount == 158) || (NumVertices == 73 && primCount == 112) || (NumVertices == 143 && primCount == 94) || (NumVertices == 246 && primCount == 120) || (NumVertices == 353 && primCount == 464) || (NumVertices == 381 && primCount == 234) || (NumVertices == 547 && primCount == 700) || (NumVertices == 1353 && primCount == 1404))
    //----------------------------------------------------------------------------------------------------------------------------------
    char *pProcessWindowTitle = "pblackout" ; // Change for target your game
    char *pProcessWindowClass = "I3VIEWER"  ;
    //----------------------------------------------------------------------------------------------------------------------------------
    #define 	            MENUMAXITEMS	100
    #define 	            MENUFOLDER		1
    #define 	            Pizza			1
    #define 	            MENUTEXT		2
    #define 	            MENUITEM		3
    #define 	            MENUWEWITEM		10
    #define                 MENUINFO        0
    //---------------------------------------------------------------------------------------------------------------------------------- 
    int 		            Mpos=0;			  // current highlighted menuitem	
    int 		            Mmax=0;			  // number of menu items
    int			            Mxofs =100;	      // offset for option text
    int			            Mysize=15;        // heigh of a menuline
    int			            Mvisible=0;       // 0,1 = 0 off / 1 = show
    //----------------------------------------------------------------------------------------------------------------------------------
    extern int 		        Mpos;
    extern int 		        Mmax;
    extern int		        Mxofs;
    extern int		        Mysize;
    extern int		        Mvisible;
    extern char		        Mtitle[];
    extern char		       *Moptfolder[];
    extern char		       *Moptonoff[];
    extern char		       *optColor1[11];
    extern char		       *optColor2[11];
    extern char		       *Secondary[4];
    //----------------------------------------------------------------------------------------------------------------------------------
    void                    MenuAddItem(char *txt, char **opt, int *var, int maxvalue, int typ);
    void                    MenuAddText (char *txt, char *opt="");
    void                    MenuShow(int x, int y,	ID3DXFont* g_pFont);
    void                    QmoMenu(void);
    //------------------------------------Colors----------------------------------------------------------------------------------------------
    #define MCOLOR_TITLE    D3DCOLOR_ARGB(255, 255, 255, 000)
    #define MCOLOR_CURRENT	D3DCOLOR_ARGB(255, 255, 255, 000) 
    #define MCOLOR_TEXT		D3DCOLOR_ARGB(255, 255, 255, 000) 
    #define MCOLOR_ACTIVE	D3DCOLOR_ARGB(255, 255, 255, 000)
    #define MENUCOLOR_TITLE	D3DCOLOR_ARGB(255, 255, 255, 000)
    #define MCOLOR_FOLDER	D3DCOLOR_ARGB(255, 255, 000, 000)
    #define MCOLOR_INACTIVE	D3DCOLOR_ARGB(255, 255, 255, 000)
    //-----------------------------------Colors-----------------------------------------------------------------------------------------------
    bool Generate = true;
    #define GREY			D3DCOLOR_ARGB(255, 128, 128, 128)
    #define WHITE			D3DCOLOR_ARGB(255, 255, 255, 255)
    #define RED				D3DCOLOR_ARGB(255, 255, 000, 000)
    #define GREEN			D3DCOLOR_ARGB(255, 000, 255, 000)
    #define YELLOW			D3DCOLOR_ARGB(255, 255, 255, 000) 
    LPDIRECT3DTEXTURE9 White,Red,Green,Yellow;
    //----------------------------------------------------------------------------------------------------------------------------------
    LPDIRECT3DVERTEXBUFFER9 Stream_Data;
    UINT Offset = 0;
    UINT Stride = 0;
    UINT texnum = 0;
    //----------------------------------------------------------------------------------------------------------------------------------
    RECT rect;
    RECT rect2;
    RECT rect3;
    //----------------------------------------------------------------------------------------------------------------------------------
    struct{
    int  *var;
    int  maxvalue;
    int  typ;
    char *txt;
    char **opt;
    }
    //----------------------------------------------------------------------------------------------------------------------------------
    MENU[MENUMAXITEMS];
    //----------------------------------------------------------------------------------------------------------------------------------
    void MenuAddItem(char *txt, char **opt, int *var, int maxvalue, int typ){
      MENU[Mmax].typ=typ;
      MENU[Mmax].txt=txt;
      MENU[Mmax].opt=opt;
      MENU[Mmax].var=var;
      MENU[Mmax].maxvalue=maxvalue;
      Mmax++;
    }
    
    void MenuAddText(char *txt, char *opt){
      MENU[Mmax].typ=MENUTEXT;
      MENU[Mmax].txt=txt;
      MENU[Mmax].opt=(char **)opt;
      MENU[Mmax].var=0;
      MENU[Mmax].maxvalue=0;
      Mmax++;
    }
    
    //--------------------------------MenuShow--------------------------------------------------------------------------------------------------
    void MenuShow(int x, int y,	ID3DXFont *pFont){
      int i, val;
      DWORD color;
        SetRect( &rect, x+Mxofs/3, y, x+Mxofs /2 , y );
      if (!Mvisible) return;
    
      if (Mtitle[0]) {
    
    	  pFont->DrawText(NULL,Mtitle,-1,&rect,DT_NOCLIP | DT_TOP, MCOLOR_CURRENT);
    
    	  y+=Mysize;
      }
    
      for (i=0; i<Mmax; i++) {
    	
    	   val=(MENU[i].var)?(*MENU[i].var):0;
    	   
    		   if (i==Mpos){
               color=WHITE;
    			   }
           else if (MENU[i].typ==MENUFOLDER)
               color=MCOLOR_FOLDER;
    	   else if (MENU[i].typ==Pizza)
               color=MCOLOR_INACTIVE;
           else if (MENU[i].typ==MENUTEXT)
               color=MCOLOR_TEXT;
           else
    		   color=(val)?GREEN:GREY;
         SetRect( &rect3, x, y, x , y );
         SetRect( &rect2, x+Mxofs, y, x+Mxofs , y );
    	   pFont->DrawText(NULL,MENU[i].txt,-1,&rect3, DT_NOCLIP,color);
           if (MENU[i].opt) {
    		   if (MENU[i].typ==MENUTEXT)
    		   	   pFont->DrawText(NULL,(char *)MENU[i].opt,-1,&rect2, DT_NOCLIP | DT_RIGHT, color);
    		   else
    			   pFont->DrawText(NULL,(char *)MENU[i].opt[val],-1,&rect2, DT_NOCLIP | DT_LEFT, color);
    	   }
           y+=Mysize;
      }
    }
    
    //-------------------------------------Menukey---------------------------------------------------------------------------------------------
    void QmoMenu(void){
    
      if (GetAsyncKeyState(VK_INSERT)&1) Mvisible=(!Mvisible);
      if (!Mvisible) return;
    
      if (GetAsyncKeyState(VK_UP)&1) 
            {
    		 do
    		  {
    			Mpos--;
    			 if (Mpos<0)  Mpos=Mmax-1;
    		      }
    		       while (MENU[Mpos].typ==MENUTEXT);
                    } 
                     else 
                      if (GetAsyncKeyState(VK_DOWN)&1) {
    	               do
    	                {
    		              Mpos++;
                           if (Mpos==Mmax) Mpos=0;
    		                 } 
    					       while (MENU[Mpos].typ==MENUTEXT);
                                 } 
    				             else if (MENU[Mpos].var) {
    		                       int dir=0;
                                     if (GetAsyncKeyState(VK_LEFT )&1 && *MENU[Mpos].var > 0                      ) dir=-1;
                                	   if (GetAsyncKeyState(VK_RIGHT)&1 && *MENU[Mpos].var < (MENU[Mpos].maxvalue-1)) dir=1;
    		                             if (dir) {
    			                          *MENU[Mpos].var += dir;
    			                            if (MENU[Mpos].typ==MENUFOLDER) Mmax=0;
    	}
      }
    }
    
    //-----------------------------------------------CreateDetour-----------------------------------------------------------------------------------
    #define Detour_Type_0xE9  1
    #define Detour_Type_0xB8  2
    #define Detour_Type_0x68  3
    DWORD CreateDetour(DWORD dwThread,DWORD dwAdress,DWORD dwType,DWORD dwSize)
    {
    	DWORD dwDetour,dwProtect,i;
    	if (dwAdress&&dwThread&&dwSize>= dwSize)
    	{
    		dwDetour = (DWORD)VirtualAlloc(0,dwSize+dwSize,0x1000,0x40);
    		if (dwDetour&&VirtualProtect((VOID*)dwAdress,dwSize,0x40,&dwProtect))
    		{
    			for (i=0;i<dwSize;i++) 
    			{
    				*(BYTE*)(dwDetour+i)=*(BYTE*)(dwAdress+i);
    			  }
    			       switch (dwType)
    			     {
    			         case Detour_Type_0xE9:
    				     {
    				        *(BYTE*)(dwDetour+dwSize+0)=0xE9;
    				           *(DWORD*)(dwDetour+dwSize+1)=(dwAdress-dwDetour-dwSize);
    	    		             *(BYTE*)(dwAdress+0)=0xE9;
    				                *(DWORD*)(dwAdress+1)=(dwThread-dwAdress-dwSize);
    				                     }
    				break;
    				   case Detour_Type_0xB8:
    				      {
    				        *(BYTE*)(dwDetour+dwSize+0)=0xB8;
    				          *(DWORD*)(dwDetour+dwSize+1)=(dwAdress+dwSize);
    				           *(WORD*)(dwDetour+dwSize+5)=0xE0FF; 
    				             *(BYTE*)(dwAdress+0)=0xB8;            
    				               *(DWORD*)(dwAdress+1)=(dwThread);
    				                 *(WORD*)(dwAdress+5)=0xE0FF; 
    				                  }
    				break;
    				   case Detour_Type_0x68:
    				     {
    				       *(BYTE*)(dwDetour+dwSize+0)=0x68;
    				         *(DWORD*)(dwDetour+dwSize+1)=(dwAdress+dwSize);
    				           *(WORD*)(dwDetour+dwSize+5)=0xC3; 
    				             *(BYTE*)(dwAdress+0)=0x68;            
    				               *(DWORD*)(dwAdress+1)=(dwThread);
    				                 *(WORD*)(dwAdress+5)=0xC3; 
    				                   }
    				break;
    			        }
    			         VirtualProtect((VOID*)dwAdress,dwSize,dwProtect,&dwProtect);
    			          VirtualProtect((VOID*)dwDetour,dwSize+dwSize,0x20,&dwProtect);
    	    	           return dwDetour;
    		                }
    	                     }
    	                      Sleep(10);
    return (0);
    }
    
    //-----------------------------------------HRESULT-----------------------------------------------------------------------------------------
    typedef HRESULT (WINAPI* tEndScene)(LPDIRECT3DDEVICE9 pDevice);
    tEndScene oEndScene = NULL;
    
    typedef HRESULT (WINAPI* tDrawIndexedPrimitive)(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE PrimType,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount);
    tDrawIndexedPrimitive oDrawIndexedPrimitive = NULL;
    
    typedef HRESULT(WINAPI* tReset)(LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters);
    tReset oReset = NULL;
    
    //----------------------------------------PrintText---------------------------------------------------------------------------------------
    void PrintText(char pString[], int x, int y, D3DCOLOR col, ID3DXFont *font)
    {
        RECT FontRect = { x, y, x+500, y+30 };
        font->DrawText( NULL, pString, -1, &FontRect, DT_LEFT | DT_WORDBREAK, col);
    }
    
    //-----------------------------------------FillRGB---------------------------------------------------------------------------------------
    void FillRGB( int x, int y, int w, int h, D3DCOLOR color, IDirect3DDevice9* pDevice )
    {
    	D3DRECT rec = { x, y, x + w, y + h };
    	pDevice->Clear( 1, &rec, D3DCLEAR_TARGET, color, 0, 0 );
    }
    
    //----------------------------------------DrawCircle-----------------------------------------------------------------------------------------
    void DrawCircle(int X, int Y, int radius, int numSides, DWORD Color) 
    { 
    
        D3DXVECTOR2 Line[128]; 
        float Step = PI * 2.0 / numSides; 
        int Count = 0; 
        for (float a=0; a < PI*2.0; a += Step) 
        { 
            float X1 = radius * cos(a) + X; 
            float Y1 = radius * sin(a) + Y; 
            float X2 = radius * cos(a+Step) + X; 
            float Y2 = radius * sin(a+Step) + Y; 
            Line[Count].x = X1; 
            Line[Count].y = Y1; 
            Line[Count+1].x = X2; 
            Line[Count+1].y = Y2; 
            Count += 2; 
        } 
        g_pLine->Begin(); 
        g_pLine->Draw(Line,Count,Color); 
       g_pLine->End(); 
    }
    
    //-----------------------------------Megaze1-----------------------------------------------------------------------------------------------
    char Megaze1(void* address, int* val, char bytes)
    {
        DWORD Comander, Rezpect;
        VirtualProtect(address, bytes, PAGE_EXECUTE_WRITECOPY, &Comander); 
        memcpy(address, val, bytes); 
        VirtualProtect(address,bytes,Comander,&Rezpect); 
    	return(0);
    }
    
    //-----------------------------MENU PIZZA---------------------------------------------------------------------------------------------------
    char  Mtitle              []   = "";
    char *Moptfolder          []   = {"Open", "Close"};
    char *Moptonoff           []   = {"Off", "On"};
    char *optColor1           [11] = {"Off", "On"};
    char *optColor2           [11] = {"Off", "On"};
    
    void RebuildMenu(void)
    {
    	MenuAddItem("MENU PIZZA"    ,Moptfolder, &PIZZA, 2, MENUFOLDER);
    	if (PIZZA)
    	{ 
    	  MenuAddItem("Chams Weapon",optColor2, &Qmo7,     11,MENUITEM);
    	  MenuAddItem("Chams Player",optColor1, &Qmo2,     11,MENUITEM);
    	  MenuAddItem("Glass Wall"  ,Moptonoff, &Qmo1,     2, MENUITEM);
    	  MenuAddItem("Asus"        ,Moptonoff, &Qmo4,     2, MENUITEM);
    	  MenuAddItem("Fullbri"     ,Moptonoff, &Qmo8,     2, MENUITEM);
    	  MenuAddItem("Wireframe"   ,Moptonoff, &MENUPIZZA,3, MENUITEM);
    	  MenuAddItem("No Smoke"    ,Moptonoff, &Qmo5,     2, MENUITEM);
    	  MenuAddItem("No Fog"      ,Moptonoff, &Qmo6,     2, MENUITEM);
        }
    
    }
    
    //-------------------------------VTableFunction---------------------------------------------------------------------------------------------------
    PBYTE HookVTableFunction( PDWORD* dwVTable, PBYTE dwHook, INT Index )
    {
        DWORD dwOld = 0;
        VirtualProtect((void*)((*dwVTable) + (Index) ), 0, PAGE_EXECUTE_READWRITE, &dwOld);
        PBYTE pOrig = ((PBYTE)(*dwVTable)[Index]);
        (*dwVTable)[Index] = (DWORD)dwHook;
        VirtualProtect((void*)((*dwVTable) + (Index)), 0, dwOld, &dwOld);
        return pOrig;
    }
    
    //---------------------------------Texture-------------------------------------------------------------------------------------------------
    HRESULT QmoTexture(IDirect3DDevice9 *pD3Ddev, IDirect3DTexture9 **ppD3Dtex, DWORD colour32)
    {
        if( FAILED(pD3Ddev->CreateTexture(8, 8, 1, 0, D3DFMT_A4R4G4B4, D3DPOOL_MANAGED, ppD3Dtex, NULL)) )
            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;
    }
    
    //----------------------------------ProtectHook------------------------------------------------------------------------------------------------
    PBYTE ProtectHook( PDWORD* dwVTable, PBYTE dwHook, INT Index )
    {
        DWORD d = 0;
         DWORD ds = 0;
          VirtualProtect((PVOID*)((*dwVTable) + (Index*4)), 4, PAGE_EXECUTE_READWRITE, &d);
           Sleep(-0);
            PBYTE pOrig = ((PBYTE)(*dwVTable)[Index]);
             (*dwVTable)[Index] = (DWORD)dwHook;
               memcpy(pOrig, dwVTable, ds);
              Sleep(-0);
             VirtualProtect((PVOID*)((*dwVTable) + (Index*4)), 4, d, &ds);
            Sleep(-0);
           VirtualProtect((void*)(dwVTable), 4, PAGE_EXECUTE_READWRITE, &d);
          memcpy(pOrig,(void*)(pOrig), 4);
        VirtualProtect((void*)(dwHook), 4, d, &ds);
    return pOrig;
    }
    
    
    
    //----------------------------------DrawString------------------------------------------------------------------------------------------------
    void DrawString(int x, int y, DWORD color, const char *fmt, ...)
    {
    	RECT FontPos = { x, y, x + 30, y + 20 };
    	char buf[1024] = {'\0'};
    	va_list va_alist;
    
    	va_start(va_alist, fmt);
    	vsprintf(buf, fmt, va_alist);
    	va_end(va_alist);
    	
    	g_pFont2->DrawText(NULL, buf, -1, &FontPos, DT_NOCLIP, color);
    }
    //------------------------------------Show timeinfo----------------------------------------------------------------------------------------------
    void Time(int x,int y,D3DCOLOR color)
    {
       static float TimeElapsed = 0;
       static char FinalString[MAX_PATH];
       static time_t TimeValue;
       static tm* timeinfo;
    
       RECT FontPos = { x, y, x + 200, y + 16 };
    
       time ( &TimeValue );
       timeinfo = localtime ( &TimeValue );
       if(timeinfo->tm_hour>12)
       sprintf(FinalString, " [Time : %d:%02d:%02d PM] ",timeinfo->tm_hour - 12,timeinfo->tm_min,timeinfo->tm_sec);
       else
       sprintf(FinalString, " [Time : %d:%02d:%02d AM] ",timeinfo->tm_hour, timeinfo->tm_min,timeinfo->tm_sec);
       g_pFont->DrawTextA(NULL, FinalString, -1, &FontPos, DT_NOCLIP, color); 
    }
    //-------------------------------------current time---------------------------------------------------------------------------------------------
    void currenttime(int x,int y,D3DCOLOR color)
    {
    	static char cdate[20] = "" ;
    	struct tm * current_tm;
    
    	RECT FontPos = { x, y, x + 200, y + 16 };
    
    	time_t current_time;
    	time (&current_time);
    	current_tm = localtime (&current_time);
    	sprintf( cdate, " [Date : %d-%d-%02d] ",current_tm->tm_mon+1,current_tm->tm_mday,current_tm->tm_year-100+2000);
    	g_pFont->DrawTextA(NULL, cdate, -1, &FontPos, DT_NOCLIP, color); 
    }
    
    //-------------------------------------EndScene---------------------------------------------------------------------------------------------
    HRESULT WINAPI hkEndScene(LPDIRECT3DDEVICE9 pDevice)
    {
        myfile << "EndScene is Hook\n";
    	__asm PUSHAD;
    	while(!npDevice)
    {
        npDevice = pDevice;
    }
    
    //-----------------------------------------Sett your menu here-----------------------------------------------------------------------------------------
    if(g_pFont == NULL) D3DXCreateFont(pDevice, 15, 0, FW_BOLD, 1, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, ANTIALIASED_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial", &g_pFont); //Create fonts
    if(g_pFont2 == NULL) D3DXCreateFont(pDevice, 15, 0, FW_BOLD, 1, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, ANTIALIASED_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial", &g_pFont2); //Create fonts
    if(g_pLine == NULL) D3DXCreateLine(pDevice, &g_pLine);
    
       pDevice->GetViewport(&g_ViewPort);
       pDevice->GetViewport(&g_ViewPort);
    
       DrawString(419, 1, GREEN, "PIZZA MENU PUBLIC HACK @2013 BY Qmo");
       currenttime(422,15,0xFFFF0000); // x,y = width and height
       Time(540,15,0xFFFF0000);        // x,y = width and height
    if(Qmo == 0)
      {
     
    if(Mmax==0) 
    	RebuildMenu();
        MenuShow(8,20,g_pFont);        // y,x = width and height
        QmoMenu();
    	 
      }
    __asm POPAD;
    return oEndScene(pDevice);
    }
    
    //---------------------------------------------DrawIndexedPrimitive---------------------------------------------------------------------------------------
    HRESULT WINAPI hkDrawIndexedPrimitive(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE PrimType,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount)
    {
           myfile << "DIP is hooked\n"; 
        if(pDevice->GetStreamSource(0, &Stream_Data, &Offset, &Stride) == D3D_OK)
           Stream_Data->Release();
    //----------------------------------------------------------------------------------------------------------------------------------
    if ( Qmo1 == 1 )                                                  
    	{
    	 if((Teroris || Police || Dino || Boddy || C5 || Police))  
    	    {
    		
    			    pDevice->SetRenderState( D3DRS_LIGHTING, false);
                    pDevice->SetRenderState(D3DRS_ZENABLE, false);
    			    oDrawIndexedPrimitive(pDevice, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount); // This for Glass wall
    			    pDevice->SetRenderState(D3DRS_ZENABLE, true);
             }
    	else{
    			pDevice->SetRenderState(D3DRS_AMBIENT, false);
    		}
    }
    		
    if ( Qmo2 == 1 )                                                 
     if((Teroris || Police || Dino || Boddy || C5 || Police))   
    	{
    		{
            pDevice->SetRenderState(D3DRS_ZENABLE, false);
    		pDevice->SetTexture(0, Red);
    		oDrawIndexedPrimitive(pDevice, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount); // Chams for desert camp
    		pDevice->SetRenderState(D3DRS_ZENABLE, true);
    		pDevice->SetTexture(0, Green);
    		}
    }
    
    //----------------------------------------------------------------------------------------------------------------------------------
    if (Qmo8==1)                                                      
        {
        if((Stride == 44 || Stride == 52 ))
            {
          pDevice->SetRenderState(D3DRS_ZENABLE, false);
          pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME); 
          pDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_POINT );
          ( D3DFILL_FORCE_DWORD );
              }
            else{
          pDevice->SetRenderState(D3DRS_ZENABLE, true);
          pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
    			}
    	}
    //----------------------------------------------------------------------------------------------------------------------------------
    if (Qmo7==1)                                                      
    	{
       if((Stride == 32))
    		{
            pDevice->SetRenderState(D3DRS_ZENABLE, false);
    		pDevice->SetTexture(0, Red);
    		oDrawIndexedPrimitive(pDevice, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount); //Chams Weapon
    		pDevice->SetRenderState(D3DRS_ZENABLE, true);
    		pDevice->SetTexture(0, Green);
    		}
    }
    
      if(MENUPIZZA==1)                                        
        {
            if((Stride == 52 || Stride == 44))
            {
                pDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_WIREFRAME ); //this for WIREFRAME
                pDevice->SetTexture(0, Green);
                pDevice->SetTexture(0, Green);
                 }
             else{         
                pDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_SOLID );
            }
        }
    
    if( Qmo3 )
    	{
    		if ((Stride == 24) || (Stride == 23))
    		{
    			DWORD dwOldZEnable;
    			pDevice->GetRenderState(D3DRS_ZENABLE,&dwOldZEnable);
    			pDevice->SetRenderState(D3DRS_ZENABLE,D3DZB_FALSE);
    			oDrawIndexedPrimitive(pDevice, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
    			pDevice->SetRenderState(D3DRS_ZENABLE,dwOldZEnable);
    		}
    	}
    
    if( Qmo4 == 1 )                                                       
    	{
    		if (Stride == 40)
    		{
    			pDevice->SetRenderState( D3DRS_SRCBLEND, 3 );
    			pDevice->SetRenderState( D3DRS_DESTBLEND, 4 );
    			pDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, true );  // Wall ASUS
    			}}
    
    
    	if( Qmo5 == 1 )                                                     
        {
            if( Stride == 24 && NumVertices == 256 ||(Stride == 24 && NumVertices == 192)) // No Smoke
            {        
            return D3D_OK;
    			}}
    
    	if( Qmo6 == 1 )                                                     
    	{
    		pDevice->SetRenderState(D3DRS_FOGENABLE, false);
    	}
        return oDrawIndexedPrimitive(pDevice, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount); // NO FOG 
    }
    //-----------------------------------------Reset is hooked-----------------------------------------------------------------------------------------
    HRESULT WINAPI hkReset(LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters)
    {
        myfile << "Reset is hooked\n";
        if( g_pFont )
            g_pFont->OnLostDevice();
    
        if( g_pLine )
            g_pLine->OnLostDevice();
    
        HRESULT iReturnValue = oReset(pDevice, pPresentationParameters);
    
        if(iReturnValue == D3D_OK) {
    
            if( g_pFont )
                g_pFont->OnResetDevice();
    
            if( g_pLine )
                g_pLine->OnResetDevice();
        }
    
        return iReturnValue;
    }
    //-------------------------------------------CreateWindow---------------------------------------------------------------------------------------
    LRESULT CALLBACK MsgProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam){return DefWindowProc(hwnd, uMsg, wParam, lParam);}
    void DX_Init(DWORD* table)
    {
        WNDCLASSEX wc = {sizeof(WNDCLASSEX),CS_CLASSDC,MsgProc,0L,0L,GetModuleHandle(NULL),NULL,NULL,NULL,NULL,"DX",NULL};
        RegisterClassEx(&wc);
        HWND hWnd = CreateWindow("DX",NULL,WS_OVERLAPPEDWINDOW,100,100,300,300,GetDesktopWindow(),NULL,wc.hInstance,NULL);
        LPDIRECT3D9 pD3D = Direct3DCreate9( D3D_SDK_VERSION );
        D3DPRESENT_PARAMETERS d3dpp;
        ZeroMemory( &d3dpp, sizeof(d3dpp) );
        d3dpp.Windowed = TRUE;
        d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
        d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
        LPDIRECT3DDEVICE9 pd3dDevice;
        pD3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hWnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&d3dpp,&pd3dDevice);
        DWORD* pVTable = (DWORD*)pd3dDevice;
        pVTable = (DWORD*)pVTable[0];
        table[ES]   = pVTable[42];   
        table[DIP]  = pVTable[82];
        DestroyWindow(hWnd);
    }
    //--------------------------------------------LoopFunction--------------------------------------------------------------------------------------
    DWORD WINAPI LoopFunction(LPVOID lpParam)
    {
    		if( hooked == false) {
                DWORD VTable[3] = {0};
    
                while(LoadLibraryA("d3d9.dll")==NULL) {
    			Sleep(100);
    			}
                DX_Init(VTable);
                HOOK(EndScene,VTable[ES]);                                                //Hook EndScene as a device discovery hook
                while(!npDevice) {
                Sleep(50);
                    }
                UNHOOK(EndScene, VTable[ES]);
    void* d3DIP = (void*)(dwD3D9 + (DWORD) + (DWORD) + (DWORD) + (PDWORD)BaseD3D + 1024); //[82]
    void* d3ES = (void*)(dwD3D9 + (DWORD) + (DWORD) + (DWORD) + (PDWORD)BaseD3D + 1036);  //[42]
    {
    int i;
    for (i = 0 ; i <= 0 ; i++){
        DWORD d,ds;
        VirtualProtect((void*)(d3ES), 4, PAGE_EXECUTE_READWRITE, &d);
        memcpy(d3ES,(void*)(d3ES), 4);
        VirtualProtect((void*)(d3ES), 4, d, &ds);
    }
    }
    int C;
    for (C = 0 ; C <= 0 ; C++){
    {
       DWORD d,ds;
       VirtualProtect((void*)(d3DIP), 4, PAGE_EXECUTE_READWRITE, &d);
       memcpy(d3DIP,(void*)(d3DIP), 4);
       VirtualProtect((void*)(d3DIP), 4, d, &ds);
    }
    }
    
    CreateDetour((DWORD)hkDrawIndexedPrimitive, (DWORD)d3DIP*C,Detour_Type_0xB8,7);
    CreateDetour((DWORD)hkEndScene, (DWORD)d3ES*C,Detour_Type_0xB8,7);
    
    
    *(PDWORD)&oDrawIndexedPrimitive = VTable[DIP];
    *(PDWORD)&oEndScene = VTable[ES];
    
    hooked = true;
    }
        Sleep(10);
    void* d3DIP = (void*)(dwD3D9 + (DWORD) + (DWORD) + (DWORD) + (PDWORD)BaseD3D + 1024);   // [82]
    void* d3ES = (void*)(dwD3D9 + (DWORD) + (DWORD) + (DWORD) + (PDWORD)BaseD3D + 1036);    // [42]
    {
        DWORD Dark,ds;
        VirtualProtect((void*)(d3ES), 4, PAGE_EXECUTE_READWRITE, &Dark);
        memcpy((void*)d3ES, (const void*)d3ES, 4);
        VirtualProtect((void*)(d3ES), 4, Dark, &ds);
    }
    int i;
    for (i = 0 ; i <= 15 ; i++){
    {
        DWORD d,ds;
        VirtualProtect((void*)(d3DIP), 4, PAGE_EXECUTE_READWRITE, &d);
        memcpy((void*)d3DIP, (const void*)d3DIP, 4);
        VirtualProtect((void*)(d3DIP), 4, d, &ds);
    }
    }
    for (i = 0 ; i <= 15 ; i++){
    if(memcmp((void *)d3DIP, (void *)d3DIP, 82) == 0 )                                    // Protect Hook Draw Indexed Primitive
       ProtectHook((LPDWORD*)npDevice, (PBYTE)d3DIP, 82);
    }
    
    for (i = 0 ; i <= 15 ; i++){
    if(memcmp((void *)d3ES, (void *)d3ES, 42) == 0 )                                      // Protect Hook End Scene
       ProtectHook((LPDWORD*)npDevice, (PBYTE)d3ES, 42);
    }
    {
       Sleep(100);
    }
    return 0;
    }
    
    
    BOOL WINAPI DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpvReserved)
    {
    if(dwReason == DLL_PROCESS_ATTACH) { 
            CreateThread(0, 0,LoopFunction, 0, 0, 0);
        } 
    	return TRUE;
    }
    > Here for Screenshut :

    Try test your hack, Injact to D3D9test, if successful, it will be like this picture :


    Hotkey : INSERT for menu show


    In Game :
    try test your hack, Injact to the Game, if successful,,,it will be like this picture :



    Complete !

    Use your creativity, learn C++ language & dDirectX SDK
    If you have questions, you can PM me or Post here

    Hopefully Useful for all
    Last edited by Qmo; 06-03-2013 at 02:42 PM.





    اَللّهُ اَكْبَرُ

    .:If u can respect other people work, then u will get what u want:.

  2. The Following 5 Users Say Thank You to Qmo For This Useful Post:

    brokim (06-03-2013),David Jashon (04-29-2014),toronto9696 (06-05-2013),WillyTony (05-28-2015),xcellsior (10-15-2013)

  3. #2
    KOoOMI's Avatar
    Join Date
    May 2013
    Gender
    male
    Location
    At Some Where One The Earth
    Posts
    26
    Reputation
    10
    Thanks
    2
    My Mood
    Pensive
    very thnx QMO you are great but

    im have questions :
    1- which thing should i Download or just copy and paste into your new project?
    2-wht is the haider and file cpp

    and thank you ..

  4. The Following User Says Thank You to KOoOMI For This Useful Post:

    David Jashon (04-29-2014)

  5. #3
    Qmo's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Location
    #cmd<user> CONTRIBUTION GAME HACKING
    Posts
    2,008
    Reputation
    246
    Thanks
    5,873
    My Mood
    Relaxed
    Quote Originally Posted by KOoOMI View Post
    very thnx QMO you are great but

    im have questions :
    1- which thing should i Download or just copy and paste into your new project?
    2-wht is the haider and file cpp

    and thank you ..
    1. Just copy and paste into your new project,
    2. haider = fungtion your hack & cpp = call your hack

    Remember : HOOK and DIP Funtion need to edit again for hack can works well
    Clue : For Game guard no need to baypass, just Skip away with system different; ( dont use system E9/0x9 )
    Last edited by Qmo; 06-03-2013 at 02:45 PM.





    اَللّهُ اَكْبَرُ

    .:If u can respect other people work, then u will get what u want:.

  6. The Following User Says Thank You to Qmo For This Useful Post:

    zkaren (12-25-2014)

  7. #4
    brokim's Avatar
    Join Date
    Jun 2012
    Gender
    male
    Location
    ~~MGMT~~
    Posts
    907
    Reputation
    76
    Thanks
    1,981
    My Mood
    Psychedelic
    wow nice tutorial XD
    Quote Originally Posted by Qmo View Post
    Make a SIMPLE D3D MENU Part 2 ( PIZZA MENU PUBLICK HACK )

    > Creadit : me and UC.me since 2006-2007, has experienced many changes until now 2013
    > Edited : me

    I've shared this code in external forums, OMG...this time I see no similar to My Source Code
    > he a copycat Maybe Leeech: LINK

    Don't give any advice to me, I don't need any advice, I dont need thanks or Rep+
    I am here just want to share for anyone who needs it
    This is a continuation of This Threads : Make a SIMPLE D3D MENU

    > TUT for Beginner;
    1. Become a CODE MAKER : LINK
    2. [C++] D3D9 Hooking : LINK
    3. Example If you want to learn make a hacking game : LINK



    Remember : HOOK and DIP Funtion need to edit again for hack can works well
    Clue : For Game guard no need to baypass, just Skip away with system different; ( dont use system E9/0x9 )


    Dont be a leech, Include the name maker if you want share again in external forum


    Directly to the topic

    > Note :
    For a game hack no need to many souce code, the most important is how you trick GAME GUARD
    For me, just need a little code for game hacking

    This you will need:

    > Microsoft Visual Studio C++
    > Microsoft DirectX SDK (June 2010) or (Summer 2004)


    1. Open Microsoft Visual Studio C++
    2. Make new project
    3. Just copy and paste into your new project
    4. Setting project Properties
    5. Include d3d9 & Lib
    6. Build your Project (F7)
    7. Done !

    > For haider :
    mPizza.h
    Code:
    //==================================================================
    // This file is part of Qmobase D3D Private part 2
    // Creadit Qmoainx 2006 
    //==================================================================
    
    #ifndef __QMO_BASE_H
    #define __QMO_BASE_H
    #define WIN32_LEAN_AND_MEAN
    #include <windows.h>
    
    void MEMwrite(void *adr, void *ptr, int size);
    DWORD WINAPI theLoop(LPVOID param);
    
    #endif

    > For File cpp :
    mPizza.cpp
    Code:
    
    //==================================================================
    // This file is part of Qmobase D3D 
    // Creadit Qmoainx 2006 
    //==================================================================
    
    #include <windows.h>
    #include <mmsystem.h>
    #include <stdio.h>
    #include <fstream>
    #include <d3d9.h>
    #include <d3dx9.h>
    #include <time.h>
    #include "mPizza.h"
    //==========pragma comment========
    #pragma comment(lib, "d3d9.lib")
    #pragma comment(lib, "d3dx9.lib")
    #pragma warning(disable:4996 4244)
    #pragma warning(disable:4700)
    //===========Gamemaster===========
    int Qmo  = 0;
    int Qmo1 = 0;
    int Qmo2 = 0;
    int Qmo3 = 0;
    int Qmo4 = 0;
    int Qmo5 = 0;
    int Qmo6 = 0;
    int Qmo7 = 0;
    int Qmo8 = 0;
    int MENUPIZZA=0;
    int PIZZA=0;
    bool hooked=false;
    bool CekHook=false;
    bool Gamemaster=true;
    //--------------------------------define HOOK & UNHOOK--------------------------------------------------------------------------------------------------
    #define HOOK(func,addy) o##func = (t##func)CreateDetour((DWORD)hk##func,(DWORD)addy,Detour_Type_0xB8,7)
    #define UNHOOK(func,addy) o##func = (t##func)CreateDetour((DWORD)o##func,(DWORD)addy,Detour_Type_0xB8,7)
    LPDIRECT3DTEXTURE9    Megaze, Blooderz, Nightmarez, Avenged, Sevenfold, TujuhX, Bondan, Fadetoblack;
    #define ES  0 
    #define DIP 1 
    #define RES 2 
    #define E8 2  
    #define ZE 3  
    #define DrawIndex 0x002B
    #define EndS 0x0023
    #define PI 3.14159265
    using namespace std;
    ofstream infile;
    ofstream myfile;
    ID3DXLine *g_pLine;
    LPD3DXFONT      g_pFont = NULL;
    LPD3DXFONT      g_pFont2 = NULL;
    D3DVIEWPORT9    g_ViewPort;
    DWORD dwProcessID;
    HANDLE hProcess;
    LPDIRECT3DDEVICE9 npDevice;
    LPDIRECT3DTEXTURE9 txHeader;
    D3DXVECTOR3 pHeader;
    HMODULE dwD3D9 = GetModuleHandle("d3d9.dll");
    DWORD BaseD3D= NULL;
    
    //---------------------------------------define Stride-------------------------------------------------------------------------------------------
    #define SMOKE ( Stride == 24 && NumVertices == 256 ||(Stride == 24 && NumVertices == 192))
    #define Dino ((primCount == 57) || (primCount == 161) || (primCount == 186) || (primCount == 197) || (primCount == 349) || (primCount == 495) || (primCount == 955) || (NumVertices == 2517 && primCount == 57) || (NumVertices == 3721 && primCount == 275) || (NumVertices == 0 && primCount == 52) || (NumVertices == 0 && primCount == 105) || (NumVertices ==0 && primCount == 186) || (NumVertices == 0 && primCount == 197) || (primCount == 579) || (primCount == 488))
    #define K400 ((NumVertices == 1002 && primCount == 980))
    #define C5 ((NumVertices == 772 && primCount == 849))
    #define Police ( NumVertices == 490 || NumVertices == 221 || NumVertices == 611|| NumVertices == 102 ||(primCount == 526) || (primCount == 84) || (primCount == 64) || NumVertices == 67 || NumVertices == 92 || NumVertices == 95 || NumVertices == 114 || NumVertices == 504 || NumVertices == 108 || NumVertices == 398 || NumVertices == 520 || NumVertices == 684 || (primCount == 56) || (primCount == 93) )
    #define Boddy ((primCount == 16 || primCount == 28 || primCount == 50 || primCount == 52 || primCount == 76 || primCount == 130))
    #define Teroris ((NumVertices == 88 && primCount == 130) || (NumVertices == 142 && primCount == 266)|| (NumVertices == 472 && primCount == 304) || (NumVertices == 384 && primCount == 346) || (NumVertices == 348 && primCount == 520) || (NumVertices == 596 && primCount == 590)|| (NumVertices == 628 && primCount == 748) || (NumVertices == 3487 && primCount == 1737)|| (NumVertices == 3487 && primCount == 1766) || (NumVertices == 262 && primCount == 196) || (NumVertices == 142 && primCount == 266) || (NumVertices == 244 && primCount == 406) || (NumVertices == 1846 && primCount == 414) || (NumVertices == 528 && primCount == 540) || (NumVertices == 520 && primCount == 593) || (NumVertices == 2728 && primCount == 1344) || (NumVertices == 1091 && primCount == 1390) || (NumVertices == 1095 && primCount == 1460) || (NumVertices == 1846 && primCount == 2090) || (NumVertices == 2263 && primCount == 45) || (NumVertices == 370 && primCount == 278) || (NumVertices == 482 && primCount == 390) || (NumVertices == 734 && primCount == 688) || (NumVertices == 2263 && primCount == 1023) || (NumVertices == 812 && primCount == 1246) || (NumVertices == 2263 && primCount == 1434) || (NumVertices == 2041 && primCount == 1561) || (NumVertices == 1530 && primCount == 1534) || (NumVertices == 749 && primCount == 1374) || (NumVertices == 1831 && primCount == 1267) || (NumVertices == 2010 && primCount == 426) || (NumVertices == 287 && primCount == 396) || (NumVertices == 1831 && primCount == 341) || (NumVertices == 1831 && primCount == 278) || (NumVertices == 185 && primCount == 254) || (NumVertices == 74 && primCount == 66) || (NumVertices == 56 && primCount == 40) || (NumVertices == 185 && primCount == 271) || (NumVertices == 45 && primCount == 56) || (NumVertices == 92 && primCount == 56) || (NumVertices == 611 && primCount == 114) || (NumVertices == 611 && primCount == 526) || (NumVertices == 18 && primCount == 12) || (NumVertices == 96 && primCount == 92) || (NumVertices == 99 && primCount == 61) || (NumVertices == 133 && primCount == 205)|| (NumVertices == 245 && primCount == 276) || (NumVertices == 398 && primCount == 487) || (NumVertices == 26 && primCount == 20) || (NumVertices == 1204 && primCount == 241) || (NumVertices == 80 && primCount == 52) || (NumVertices == 1204 && primCount == 124) || (NumVertices == 113 && primCount == 139) || (NumVertices == 1204 && primCount == 56) || (NumVertices == 684 && primCount == 740) || (NumVertices == 1204 && primCount == 42) || (NumVertices == 45 && primCount == 56) || (NumVertices == 1204 && primCount == 35) || (NumVertices == 334 && primCount == 360) || (NumVertices == 175 && primCount == 246) || (NumVertices == 195 && primCount == 109) || (NumVertices == 71 && primCount == 120) || (NumVertices == 88 && primCount == 130) || (NumVertices == 201 && primCount == 157) || (NumVertices == 224 && primCount == 200) || (NumVertices == 296 && primCount == 166) || (NumVertices == 1353 && primCount == 386) || (NumVertices == 18 && primCount == 20) || (NumVertices == 41 && primCount == 30) || (NumVertices == 62 && primCount == 67) || (NumVertices == 152 && primCount == 168) || (NumVertices == 202 && primCount == 174) || (NumVertices == 237 && primCount == 395) || (NumVertices == 647 && primCount == 716) || (NumVertices == 727 && primCount == 936) || (NumVertices == 90 && primCount == 136) || (NumVertices == 120 && primCount == 170) || (NumVertices == 142 && primCount == 128) || (NumVertices == 218 && primCount == 322) || (NumVertices == 285 && primCount == 94) || (NumVertices == 1316 && primCount == 1574) || (NumVertices == 1316 && primCount == 134) || (NumVertices == 56 && primCount == 158) || (NumVertices == 73 && primCount == 112) || (NumVertices == 143 && primCount == 94) || (NumVertices == 246 && primCount == 120) || (NumVertices == 353 && primCount == 464) || (NumVertices == 381 && primCount == 234) || (NumVertices == 547 && primCount == 700) || (NumVertices == 1353 && primCount == 1404))
    //----------------------------------------------------------------------------------------------------------------------------------
    char *pProcessWindowTitle = "pblackout" ; // Change for target your game
    char *pProcessWindowClass = "I3VIEWER"  ;
    //----------------------------------------------------------------------------------------------------------------------------------
    #define 	            MENUMAXITEMS	100
    #define 	            MENUFOLDER		1
    #define 	            Pizza			1
    #define 	            MENUTEXT		2
    #define 	            MENUITEM		3
    #define 	            MENUWEWITEM		10
    #define                 MENUINFO        0
    //---------------------------------------------------------------------------------------------------------------------------------- 
    int 		            Mpos=0;			  // current highlighted menuitem	
    int 		            Mmax=0;			  // number of menu items
    int			            Mxofs =100;	      // offset for option text
    int			            Mysize=15;        // heigh of a menuline
    int			            Mvisible=0;       // 0,1 = 0 off / 1 = show
    //----------------------------------------------------------------------------------------------------------------------------------
    extern int 		        Mpos;
    extern int 		        Mmax;
    extern int		        Mxofs;
    extern int		        Mysize;
    extern int		        Mvisible;
    extern char		        Mtitle[];
    extern char		       *Moptfolder[];
    extern char		       *Moptonoff[];
    extern char		       *optColor1[11];
    extern char		       *optColor2[11];
    extern char		       *Secondary[4];
    //----------------------------------------------------------------------------------------------------------------------------------
    void                    MenuAddItem(char *txt, char **opt, int *var, int maxvalue, int typ);
    void                    MenuAddText (char *txt, char *opt="");
    void                    MenuShow(int x, int y,	ID3DXFont* g_pFont);
    void                    QmoMenu(void);
    //------------------------------------Colors----------------------------------------------------------------------------------------------
    #define MCOLOR_TITLE    D3DCOLOR_ARGB(255, 255, 255, 000)
    #define MCOLOR_CURRENT	D3DCOLOR_ARGB(255, 255, 255, 000) 
    #define MCOLOR_TEXT		D3DCOLOR_ARGB(255, 255, 255, 000) 
    #define MCOLOR_ACTIVE	D3DCOLOR_ARGB(255, 255, 255, 000)
    #define MENUCOLOR_TITLE	D3DCOLOR_ARGB(255, 255, 255, 000)
    #define MCOLOR_FOLDER	D3DCOLOR_ARGB(255, 255, 000, 000)
    #define MCOLOR_INACTIVE	D3DCOLOR_ARGB(255, 255, 255, 000)
    //-----------------------------------Colors-----------------------------------------------------------------------------------------------
    bool Generate = true;
    #define GREY			D3DCOLOR_ARGB(255, 128, 128, 128)
    #define WHITE			D3DCOLOR_ARGB(255, 255, 255, 255)
    #define RED				D3DCOLOR_ARGB(255, 255, 000, 000)
    #define GREEN			D3DCOLOR_ARGB(255, 000, 255, 000)
    #define YELLOW			D3DCOLOR_ARGB(255, 255, 255, 000) 
    LPDIRECT3DTEXTURE9 White,Red,Green,Yellow;
    //----------------------------------------------------------------------------------------------------------------------------------
    LPDIRECT3DVERTEXBUFFER9 Stream_Data;
    UINT Offset = 0;
    UINT Stride = 0;
    UINT texnum = 0;
    //----------------------------------------------------------------------------------------------------------------------------------
    RECT rect;
    RECT rect2;
    RECT rect3;
    //----------------------------------------------------------------------------------------------------------------------------------
    struct{
    int  *var;
    int  maxvalue;
    int  typ;
    char *txt;
    char **opt;
    }
    //----------------------------------------------------------------------------------------------------------------------------------
    MENU[MENUMAXITEMS];
    //----------------------------------------------------------------------------------------------------------------------------------
    void MenuAddItem(char *txt, char **opt, int *var, int maxvalue, int typ){
      MENU[Mmax].typ=typ;
      MENU[Mmax].txt=txt;
      MENU[Mmax].opt=opt;
      MENU[Mmax].var=var;
      MENU[Mmax].maxvalue=maxvalue;
      Mmax++;
    }
    
    void MenuAddText(char *txt, char *opt){
      MENU[Mmax].typ=MENUTEXT;
      MENU[Mmax].txt=txt;
      MENU[Mmax].opt=(char **)opt;
      MENU[Mmax].var=0;
      MENU[Mmax].maxvalue=0;
      Mmax++;
    }
    
    //--------------------------------MenuShow--------------------------------------------------------------------------------------------------
    void MenuShow(int x, int y,	ID3DXFont *pFont){
      int i, val;
      DWORD color;
        SetRect( &rect, x+Mxofs/3, y, x+Mxofs /2 , y );
      if (!Mvisible) return;
    
      if (Mtitle[0]) {
    
    	  pFont->DrawText(NULL,Mtitle,-1,&rect,DT_NOCLIP | DT_TOP, MCOLOR_CURRENT);
    
    	  y+=Mysize;
      }
    
      for (i=0; i<Mmax; i++) {
    	
    	   val=(MENU[i].var)?(*MENU[i].var):0;
    	   
    		   if (i==Mpos){
               color=WHITE;
    			   }
           else if (MENU[i].typ==MENUFOLDER)
               color=MCOLOR_FOLDER;
    	   else if (MENU[i].typ==Pizza)
               color=MCOLOR_INACTIVE;
           else if (MENU[i].typ==MENUTEXT)
               color=MCOLOR_TEXT;
           else
    		   color=(val)?GREEN:GREY;
         SetRect( &rect3, x, y, x , y );
         SetRect( &rect2, x+Mxofs, y, x+Mxofs , y );
    	   pFont->DrawText(NULL,MENU[i].txt,-1,&rect3, DT_NOCLIP,color);
           if (MENU[i].opt) {
    		   if (MENU[i].typ==MENUTEXT)
    		   	   pFont->DrawText(NULL,(char *)MENU[i].opt,-1,&rect2, DT_NOCLIP | DT_RIGHT, color);
    		   else
    			   pFont->DrawText(NULL,(char *)MENU[i].opt[val],-1,&rect2, DT_NOCLIP | DT_LEFT, color);
    	   }
           y+=Mysize;
      }
    }
    
    //-------------------------------------Menukey---------------------------------------------------------------------------------------------
    void QmoMenu(void){
    
      if (GetAsyncKeyState(VK_INSERT)&1) Mvisible=(!Mvisible);
      if (!Mvisible) return;
    
      if (GetAsyncKeyState(VK_UP)&1) 
            {
    		 do
    		  {
    			Mpos--;
    			 if (Mpos<0)  Mpos=Mmax-1;
    		      }
    		       while (MENU[Mpos].typ==MENUTEXT);
                    } 
                     else 
                      if (GetAsyncKeyState(VK_DOWN)&1) {
    	               do
    	                {
    		              Mpos++;
                           if (Mpos==Mmax) Mpos=0;
    		                 } 
    					       while (MENU[Mpos].typ==MENUTEXT);
                                 } 
    				             else if (MENU[Mpos].var) {
    		                       int dir=0;
                                     if (GetAsyncKeyState(VK_LEFT )&1 && *MENU[Mpos].var > 0                      ) dir=-1;
                                	   if (GetAsyncKeyState(VK_RIGHT)&1 && *MENU[Mpos].var < (MENU[Mpos].maxvalue-1)) dir=1;
    		                             if (dir) {
    			                          *MENU[Mpos].var += dir;
    			                            if (MENU[Mpos].typ==MENUFOLDER) Mmax=0;
    	}
      }
    }
    
    //-----------------------------------------------CreateDetour-----------------------------------------------------------------------------------
    #define Detour_Type_0xE9  1
    #define Detour_Type_0xB8  2
    #define Detour_Type_0x68  3
    DWORD CreateDetour(DWORD dwThread,DWORD dwAdress,DWORD dwType,DWORD dwSize)
    {
    	DWORD dwDetour,dwProtect,i;
    	if (dwAdress&&dwThread&&dwSize>= dwSize)
    	{
    		dwDetour = (DWORD)VirtualAlloc(0,dwSize+dwSize,0x1000,0x40);
    		if (dwDetour&&VirtualProtect((VOID*)dwAdress,dwSize,0x40,&dwProtect))
    		{
    			for (i=0;i<dwSize;i++) 
    			{
    				*(BYTE*)(dwDetour+i)=*(BYTE*)(dwAdress+i);
    			  }
    			       switch (dwType)
    			     {
    			         case Detour_Type_0xE9:
    				     {
    				        *(BYTE*)(dwDetour+dwSize+0)=0xE9;
    				           *(DWORD*)(dwDetour+dwSize+1)=(dwAdress-dwDetour-dwSize);
    	    		             *(BYTE*)(dwAdress+0)=0xE9;
    				                *(DWORD*)(dwAdress+1)=(dwThread-dwAdress-dwSize);
    				                     }
    				break;
    				   case Detour_Type_0xB8:
    				      {
    				        *(BYTE*)(dwDetour+dwSize+0)=0xB8;
    				          *(DWORD*)(dwDetour+dwSize+1)=(dwAdress+dwSize);
    				           *(WORD*)(dwDetour+dwSize+5)=0xE0FF; 
    				             *(BYTE*)(dwAdress+0)=0xB8;            
    				               *(DWORD*)(dwAdress+1)=(dwThread);
    				                 *(WORD*)(dwAdress+5)=0xE0FF; 
    				                  }
    				break;
    				   case Detour_Type_0x68:
    				     {
    				       *(BYTE*)(dwDetour+dwSize+0)=0x68;
    				         *(DWORD*)(dwDetour+dwSize+1)=(dwAdress+dwSize);
    				           *(WORD*)(dwDetour+dwSize+5)=0xC3; 
    				             *(BYTE*)(dwAdress+0)=0x68;            
    				               *(DWORD*)(dwAdress+1)=(dwThread);
    				                 *(WORD*)(dwAdress+5)=0xC3; 
    				                   }
    				break;
    			        }
    			         VirtualProtect((VOID*)dwAdress,dwSize,dwProtect,&dwProtect);
    			          VirtualProtect((VOID*)dwDetour,dwSize+dwSize,0x20,&dwProtect);
    	    	           return dwDetour;
    		                }
    	                     }
    	                      Sleep(10);
    return (0);
    }
    
    //-----------------------------------------HRESULT-----------------------------------------------------------------------------------------
    typedef HRESULT (WINAPI* tEndScene)(LPDIRECT3DDEVICE9 pDevice);
    tEndScene oEndScene = NULL;
    
    typedef HRESULT (WINAPI* tDrawIndexedPrimitive)(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE PrimType,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount);
    tDrawIndexedPrimitive oDrawIndexedPrimitive = NULL;
    
    typedef HRESULT(WINAPI* tReset)(LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters);
    tReset oReset = NULL;
    
    //----------------------------------------PrintText---------------------------------------------------------------------------------------
    void PrintText(char pString[], int x, int y, D3DCOLOR col, ID3DXFont *font)
    {
        RECT FontRect = { x, y, x+500, y+30 };
        font->DrawText( NULL, pString, -1, &FontRect, DT_LEFT | DT_WORDBREAK, col);
    }
    
    //-----------------------------------------FillRGB---------------------------------------------------------------------------------------
    void FillRGB( int x, int y, int w, int h, D3DCOLOR color, IDirect3DDevice9* pDevice )
    {
    	D3DRECT rec = { x, y, x + w, y + h };
    	pDevice->Clear( 1, &rec, D3DCLEAR_TARGET, color, 0, 0 );
    }
    
    //----------------------------------------DrawCircle-----------------------------------------------------------------------------------------
    void DrawCircle(int X, int Y, int radius, int numSides, DWORD Color) 
    { 
    
        D3DXVECTOR2 Line[128]; 
        float Step = PI * 2.0 / numSides; 
        int Count = 0; 
        for (float a=0; a < PI*2.0; a += Step) 
        { 
            float X1 = radius * cos(a) + X; 
            float Y1 = radius * sin(a) + Y; 
            float X2 = radius * cos(a+Step) + X; 
            float Y2 = radius * sin(a+Step) + Y; 
            Line[Count].x = X1; 
            Line[Count].y = Y1; 
            Line[Count+1].x = X2; 
            Line[Count+1].y = Y2; 
            Count += 2; 
        } 
        g_pLine->Begin(); 
        g_pLine->Draw(Line,Count,Color); 
       g_pLine->End(); 
    }
    
    //-----------------------------------Megaze1-----------------------------------------------------------------------------------------------
    char Megaze1(void* address, int* val, char bytes)
    {
        DWORD Comander, Rezpect;
        VirtualProtect(address, bytes, PAGE_EXECUTE_WRITECOPY, &Comander); 
        memcpy(address, val, bytes); 
        VirtualProtect(address,bytes,Comander,&Rezpect); 
    	return(0);
    }
    
    //-----------------------------MENU PIZZA---------------------------------------------------------------------------------------------------
    char  Mtitle              []   = "";
    char *Moptfolder          []   = {"Open", "Close"};
    char *Moptonoff           []   = {"Off", "On"};
    char *optColor1           [11] = {"Off", "On"};
    char *optColor2           [11] = {"Off", "On"};
    
    void RebuildMenu(void)
    {
    	MenuAddItem("MENU PIZZA"    ,Moptfolder, &PIZZA, 2, MENUFOLDER);
    	if (PIZZA)
    	{ 
    	  MenuAddItem("Chams Weapon",optColor2, &Qmo7,     11,MENUITEM);
    	  MenuAddItem("Chams Player",optColor1, &Qmo2,     11,MENUITEM);
    	  MenuAddItem("Glass Wall"  ,Moptonoff, &Qmo1,     2, MENUITEM);
    	  MenuAddItem("Asus"        ,Moptonoff, &Qmo4,     2, MENUITEM);
    	  MenuAddItem("Fullbri"     ,Moptonoff, &Qmo8,     2, MENUITEM);
    	  MenuAddItem("Wireframe"   ,Moptonoff, &MENUPIZZA,3, MENUITEM);
    	  MenuAddItem("No Smoke"    ,Moptonoff, &Qmo5,     2, MENUITEM);
    	  MenuAddItem("No Fog"      ,Moptonoff, &Qmo6,     2, MENUITEM);
        }
    
    }
    
    //-------------------------------VTableFunction---------------------------------------------------------------------------------------------------
    PBYTE HookVTableFunction( PDWORD* dwVTable, PBYTE dwHook, INT Index )
    {
        DWORD dwOld = 0;
        VirtualProtect((void*)((*dwVTable) + (Index) ), 0, PAGE_EXECUTE_READWRITE, &dwOld);
        PBYTE pOrig = ((PBYTE)(*dwVTable)[Index]);
        (*dwVTable)[Index] = (DWORD)dwHook;
        VirtualProtect((void*)((*dwVTable) + (Index)), 0, dwOld, &dwOld);
        return pOrig;
    }
    
    //---------------------------------Texture-------------------------------------------------------------------------------------------------
    HRESULT QmoTexture(IDirect3DDevice9 *pD3Ddev, IDirect3DTexture9 **ppD3Dtex, DWORD colour32)
    {
        if( FAILED(pD3Ddev->CreateTexture(8, 8, 1, 0, D3DFMT_A4R4G4B4, D3DPOOL_MANAGED, ppD3Dtex, NULL)) )
            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;
    }
    
    //----------------------------------ProtectHook------------------------------------------------------------------------------------------------
    PBYTE ProtectHook( PDWORD* dwVTable, PBYTE dwHook, INT Index )
    {
        DWORD d = 0;
         DWORD ds = 0;
          VirtualProtect((PVOID*)((*dwVTable) + (Index*4)), 4, PAGE_EXECUTE_READWRITE, &d);
           Sleep(-0);
            PBYTE pOrig = ((PBYTE)(*dwVTable)[Index]);
             (*dwVTable)[Index] = (DWORD)dwHook;
               memcpy(pOrig, dwVTable, ds);
              Sleep(-0);
             VirtualProtect((PVOID*)((*dwVTable) + (Index*4)), 4, d, &ds);
            Sleep(-0);
           VirtualProtect((void*)(dwVTable), 4, PAGE_EXECUTE_READWRITE, &d);
          memcpy(pOrig,(void*)(pOrig), 4);
        VirtualProtect((void*)(dwHook), 4, d, &ds);
    return pOrig;
    }
    
    
    
    //----------------------------------DrawString------------------------------------------------------------------------------------------------
    void DrawString(int x, int y, DWORD color, const char *fmt, ...)
    {
    	RECT FontPos = { x, y, x + 30, y + 20 };
    	char buf[1024] = {'\0'};
    	va_list va_alist;
    
    	va_start(va_alist, fmt);
    	vsprintf(buf, fmt, va_alist);
    	va_end(va_alist);
    	
    	g_pFont2->DrawText(NULL, buf, -1, &FontPos, DT_NOCLIP, color);
    }
    //------------------------------------Show timeinfo----------------------------------------------------------------------------------------------
    void Time(int x,int y,D3DCOLOR color)
    {
       static float TimeElapsed = 0;
       static char FinalString[MAX_PATH];
       static time_t TimeValue;
       static tm* timeinfo;
    
       RECT FontPos = { x, y, x + 200, y + 16 };
    
       time ( &TimeValue );
       timeinfo = localtime ( &TimeValue );
       if(timeinfo->tm_hour>12)
       sprintf(FinalString, " [Time : %d:%02d:%02d PM] ",timeinfo->tm_hour - 12,timeinfo->tm_min,timeinfo->tm_sec);
       else
       sprintf(FinalString, " [Time : %d:%02d:%02d AM] ",timeinfo->tm_hour, timeinfo->tm_min,timeinfo->tm_sec);
       g_pFont->DrawTextA(NULL, FinalString, -1, &FontPos, DT_NOCLIP, color); 
    }
    //-------------------------------------current time---------------------------------------------------------------------------------------------
    void currenttime(int x,int y,D3DCOLOR color)
    {
    	static char cdate[20] = "" ;
    	struct tm * current_tm;
    
    	RECT FontPos = { x, y, x + 200, y + 16 };
    
    	time_t current_time;
    	time (¤t_time);
    	current_tm = localtime (¤t_time);
    	sprintf( cdate, " [Date : %d-%d-%02d] ",current_tm->tm_mon+1,current_tm->tm_mday,current_tm->tm_year-100+2000);
    	g_pFont->DrawTextA(NULL, cdate, -1, &FontPos, DT_NOCLIP, color); 
    }
    
    //-------------------------------------EndScene---------------------------------------------------------------------------------------------
    HRESULT WINAPI hkEndScene(LPDIRECT3DDEVICE9 pDevice)
    {
        myfile << "EndScene is Hook\n";
    	__asm PUSHAD;
    	while(!npDevice)
    {
        npDevice = pDevice;
    }
    
    //-----------------------------------------Sett your menu here-----------------------------------------------------------------------------------------
    if(g_pFont == NULL) D3DXCreateFont(pDevice, 15, 0, FW_BOLD, 1, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, ANTIALIASED_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial", &g_pFont); //Create fonts
    if(g_pFont2 == NULL) D3DXCreateFont(pDevice, 15, 0, FW_BOLD, 1, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, ANTIALIASED_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial", &g_pFont2); //Create fonts
    if(g_pLine == NULL) D3DXCreateLine(pDevice, &g_pLine);
    
       pDevice->GetViewport(&g_ViewPort);
       pDevice->GetViewport(&g_ViewPort);
    
       DrawString(419, 1, GREEN, "PIZZA MENU PUBLIC HACK @2013 BY Qmo");
       currenttime(422,15,0xFFFF0000); // x,y = width and height
       Time(540,15,0xFFFF0000);        // x,y = width and height
    if(Qmo == 0)
      {
     
    if(Mmax==0) 
    	RebuildMenu();
        MenuShow(8,20,g_pFont);        // y,x = width and height
        QmoMenu();
    	 
      }
    __asm POPAD;
    return oEndScene(pDevice);
    }
    
    //---------------------------------------------DrawIndexedPrimitive---------------------------------------------------------------------------------------
    HRESULT WINAPI hkDrawIndexedPrimitive(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE PrimType,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount)
    {
           myfile << "DIP is hooked\n"; 
        if(pDevice->GetStreamSource(0, &Stream_Data, &Offset, &Stride) == D3D_OK)
           Stream_Data->Release();
    //----------------------------------------------------------------------------------------------------------------------------------
    if ( Qmo1 == 1 )                                                  
    	{
    	 if((Teroris || Police || Dino || Boddy || C5 || Police))  
    	    {
    		
    			    pDevice->SetRenderState( D3DRS_LIGHTING, false);
                    pDevice->SetRenderState(D3DRS_ZENABLE, false);
    			    oDrawIndexedPrimitive(pDevice, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount); // This for Glass wall
    			    pDevice->SetRenderState(D3DRS_ZENABLE, true);
             }
    	else{
    			pDevice->SetRenderState(D3DRS_AMBIENT, false);
    		}
    }
    		
    if ( Qmo2 == 1 )                                                 
     if((Teroris || Police || Dino || Boddy || C5 || Police))   
    	{
    		{
            pDevice->SetRenderState(D3DRS_ZENABLE, false);
    		pDevice->SetTexture(0, Red);
    		oDrawIndexedPrimitive(pDevice, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount); // Chams for desert camp
    		pDevice->SetRenderState(D3DRS_ZENABLE, true);
    		pDevice->SetTexture(0, Green);
    		}
    }
    
    //----------------------------------------------------------------------------------------------------------------------------------
    if (Qmo8==1)                                                      
        {
        if((Stride == 44 || Stride == 52 ))
            {
          pDevice->SetRenderState(D3DRS_ZENABLE, false);
          pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME); 
          pDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_POINT );
          ( D3DFILL_FORCE_DWORD );
              }
            else{
          pDevice->SetRenderState(D3DRS_ZENABLE, true);
          pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
    			}
    	}
    //----------------------------------------------------------------------------------------------------------------------------------
    if (Qmo7==1)                                                      
    	{
       if((Stride == 32))
    		{
            pDevice->SetRenderState(D3DRS_ZENABLE, false);
    		pDevice->SetTexture(0, Red);
    		oDrawIndexedPrimitive(pDevice, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount); //Chams Weapon
    		pDevice->SetRenderState(D3DRS_ZENABLE, true);
    		pDevice->SetTexture(0, Green);
    		}
    }
    
      if(MENUPIZZA==1)                                        
        {
            if((Stride == 52 || Stride == 44))
            {
                pDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_WIREFRAME ); //this for WIREFRAME
                pDevice->SetTexture(0, Green);
                pDevice->SetTexture(0, Green);
                 }
             else{         
                pDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_SOLID );
            }
        }
    
    if( Qmo3 )
    	{
    		if ((Stride == 24) || (Stride == 23))
    		{
    			DWORD dwOldZEnable;
    			pDevice->GetRenderState(D3DRS_ZENABLE,&dwOldZEnable);
    			pDevice->SetRenderState(D3DRS_ZENABLE,D3DZB_FALSE);
    			oDrawIndexedPrimitive(pDevice, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
    			pDevice->SetRenderState(D3DRS_ZENABLE,dwOldZEnable);
    		}
    	}
    
    if( Qmo4 == 1 )                                                       
    	{
    		if (Stride == 40)
    		{
    			pDevice->SetRenderState( D3DRS_SRCBLEND, 3 );
    			pDevice->SetRenderState( D3DRS_DESTBLEND, 4 );
    			pDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, true );  // Wall ASUS
    			}}
    
    
    	if( Qmo5 == 1 )                                                     
        {
            if( Stride == 24 && NumVertices == 256 ||(Stride == 24 && NumVertices == 192)) // No Smoke
            {        
            return D3D_OK;
    			}}
    
    	if( Qmo6 == 1 )                                                     
    	{
    		pDevice->SetRenderState(D3DRS_FOGENABLE, false);
    	}
        return oDrawIndexedPrimitive(pDevice, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount); // NO FOG 
    }
    //-----------------------------------------Reset is hooked-----------------------------------------------------------------------------------------
    HRESULT WINAPI hkReset(LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters)
    {
        myfile << "Reset is hooked\n";
        if( g_pFont )
            g_pFont->OnLostDevice();
    
        if( g_pLine )
            g_pLine->OnLostDevice();
    
        HRESULT iReturnValue = oReset(pDevice, pPresentationParameters);
    
        if(iReturnValue == D3D_OK) {
    
            if( g_pFont )
                g_pFont->OnResetDevice();
    
            if( g_pLine )
                g_pLine->OnResetDevice();
        }
    
        return iReturnValue;
    }
    //-------------------------------------------CreateWindow---------------------------------------------------------------------------------------
    LRESULT CALLBACK MsgProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam){return DefWindowProc(hwnd, uMsg, wParam, lParam);}
    void DX_Init(DWORD* table)
    {
        WNDCLASSEX wc = {sizeof(WNDCLASSEX),CS_CLASSDC,MsgProc,0L,0L,GetModuleHandle(NULL),NULL,NULL,NULL,NULL,"DX",NULL};
        RegisterClassEx(&wc);
        HWND hWnd = CreateWindow("DX",NULL,WS_OVERLAPPEDWINDOW,100,100,300,300,GetDesktopWindow(),NULL,wc.hInstance,NULL);
        LPDIRECT3D9 pD3D = Direct3DCreate9( D3D_SDK_VERSION );
        D3DPRESENT_PARAMETERS d3dpp;
        ZeroMemory( &d3dpp, sizeof(d3dpp) );
        d3dpp.Windowed = TRUE;
        d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
        d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
        LPDIRECT3DDEVICE9 pd3dDevice;
        pD3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hWnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&d3dpp,&pd3dDevice);
        DWORD* pVTable = (DWORD*)pd3dDevice;
        pVTable = (DWORD*)pVTable[0];
        table[ES]   = pVTable[42];   
        table[DIP]  = pVTable[82];
        DestroyWindow(hWnd);
    }
    //--------------------------------------------LoopFunction--------------------------------------------------------------------------------------
    DWORD WINAPI LoopFunction(LPVOID lpParam)
    {
    		if( hooked == false) {
                DWORD VTable[3] = {0};
    
                while(LoadLibraryA("d3d9.dll")==NULL) {
    			Sleep(100);
    			}
                DX_Init(VTable);
                HOOK(EndScene,VTable[ES]);                                                //Hook EndScene as a device discovery hook
                while(!npDevice) {
                Sleep(50);
                    }
                UNHOOK(EndScene, VTable[ES]);
    void* d3DIP = (void*)(dwD3D9 + (DWORD) + (DWORD) + (DWORD) + (PDWORD)BaseD3D + 1024); //[82]
    void* d3ES = (void*)(dwD3D9 + (DWORD) + (DWORD) + (DWORD) + (PDWORD)BaseD3D + 1036);  //[42]
    {
    int i;
    for (i = 0 ; i <= 0 ; i++){
        DWORD d,ds;
        VirtualProtect((void*)(d3ES), 4, PAGE_EXECUTE_READWRITE, &d);
        memcpy(d3ES,(void*)(d3ES), 4);
        VirtualProtect((void*)(d3ES), 4, d, &ds);
    }
    }
    int C;
    for (C = 0 ; C <= 0 ; C++){
    {
       DWORD d,ds;
       VirtualProtect((void*)(d3DIP), 4, PAGE_EXECUTE_READWRITE, &d);
       memcpy(d3DIP,(void*)(d3DIP), 4);
       VirtualProtect((void*)(d3DIP), 4, d, &ds);
    }
    }
    
    CreateDetour((DWORD)hkDrawIndexedPrimitive, (DWORD)d3DIP*C,Detour_Type_0xB8,7);
    CreateDetour((DWORD)hkEndScene, (DWORD)d3ES*C,Detour_Type_0xB8,7);
    
    
    *(PDWORD)&oDrawIndexedPrimitive = VTable[DIP];
    *(PDWORD)&oEndScene = VTable[ES];
    
    hooked = true;
    }
        Sleep(10);
    void* d3DIP = (void*)(dwD3D9 + (DWORD) + (DWORD) + (DWORD) + (PDWORD)BaseD3D + 1024);   // [82]
    void* d3ES = (void*)(dwD3D9 + (DWORD) + (DWORD) + (DWORD) + (PDWORD)BaseD3D + 1036);    // [42]
    {
        DWORD Dark,ds;
        VirtualProtect((void*)(d3ES), 4, PAGE_EXECUTE_READWRITE, &Dark);
        memcpy((void*)d3ES, (const void*)d3ES, 4);
        VirtualProtect((void*)(d3ES), 4, Dark, &ds);
    }
    int i;
    for (i = 0 ; i <= 15 ; i++){
    {
        DWORD d,ds;
        VirtualProtect((void*)(d3DIP), 4, PAGE_EXECUTE_READWRITE, &d);
        memcpy((void*)d3DIP, (const void*)d3DIP, 4);
        VirtualProtect((void*)(d3DIP), 4, d, &ds);
    }
    }
    for (i = 0 ; i <= 15 ; i++){
    if(memcmp((void *)d3DIP, (void *)d3DIP, 82) == 0 )                                    // Protect Hook Draw Indexed Primitive
       ProtectHook((LPDWORD*)npDevice, (PBYTE)d3DIP, 82);
    }
    
    for (i = 0 ; i <= 15 ; i++){
    if(memcmp((void *)d3ES, (void *)d3ES, 42) == 0 )                                      // Protect Hook End Scene
       ProtectHook((LPDWORD*)npDevice, (PBYTE)d3ES, 42);
    }
    {
       Sleep(100);
    }
    return 0;
    }
    
    
    BOOL WINAPI DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpvReserved)
    {
    if(dwReason == DLL_PROCESS_ATTACH) { 
            CreateThread(0, 0,LoopFunction, 0, 0, 0);
        } 
    	return TRUE;
    }
    > Here for Screenshut :

    Try test your hack, Injact to D3D9test, if successful, it will be like this picture :


    Hotkey : INSERT for menu show


    In Game :
    try test your hack, Injact to the Game, if successful,,,it will be like this picture :



    Complete !

    Use your creativity, learn C++ language & dDirectX SDK
    If you have questions, you can PM me or Post here

    Hopefully Useful for all

  8. #5
    Qmo's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Location
    #cmd<user> CONTRIBUTION GAME HACKING
    Posts
    2,008
    Reputation
    246
    Thanks
    5,873
    My Mood
    Relaxed
    brokim : wow nice tutorial XD
    no need to many souce code, simple hack bro





    اَللّهُ اَكْبَرُ

    .:If u can respect other people work, then u will get what u want:.

  9. #6

  10. #7
    Qmo's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Location
    #cmd<user> CONTRIBUTION GAME HACKING
    Posts
    2,008
    Reputation
    246
    Thanks
    5,873
    My Mood
    Relaxed
    Quote Originally Posted by brokim View Post
    yupity yup yup. xD and check ur email hahaha
    I was online on mobile, maybe later I'll open the email ok
    I had to immediately go to sleep, see you later xD





    اَللّهُ اَكْبَرُ

    .:If u can respect other people work, then u will get what u want:.

  11. #8

  12. #9
    KOoOMI's Avatar
    Join Date
    May 2013
    Gender
    male
    Location
    At Some Where One The Earth
    Posts
    26
    Reputation
    10
    Thanks
    2
    My Mood
    Pensive
    Qmo pls help me can i see screenshot of the project in visual studio C++ with codes

  13. #10
    ayawmanmik's Avatar
    Join Date
    Dec 2011
    Gender
    male
    Location
    In Your Window
    Posts
    277
    Reputation
    10
    Thanks
    2,754
    My Mood
    Aggressive
    @Qmo Stop Posting Base Bro
    The Leccher Is Here

    ---------- Post added at 09:14 PM ---------- Previous post was at 09:10 PM ----------

    Your Use Hook Bro Is By @joshRose in UC??

  14. #11
    The Conjurer's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Posts
    1,934
    Reputation
    608
    Thanks
    6,336
    My Mood
    Pensive
    Quote Originally Posted by ayawmanmik View Post
    @Qmo Stop Posting Base Bro
    The Leccher Is Here

    ---------- Post added at 09:14 PM ---------- Previous post was at 09:10 PM ----------

    Your Use Hook Bro Is By @joshRose in UC??
    You dont have the rights to forbid Qmo posting bases and besides your not the one who putted all of the hard work in making that base, so why bother?

  15. #12
    brokim's Avatar
    Join Date
    Jun 2012
    Gender
    male
    Location
    ~~MGMT~~
    Posts
    907
    Reputation
    76
    Thanks
    1,981
    My Mood
    Psychedelic
    plus the base hooking method is old and not updated. you have to update it using a new hook and DIP function. so no matter what, it will work. xD
    Quote Originally Posted by ellekim00 View Post
    You dont have the rights to forbid Qmo posting bases and besides your not the one who putted all of the hard work in making that base, so why bother?

  16. #13
    ayawmanmik's Avatar
    Join Date
    Dec 2011
    Gender
    male
    Location
    In Your Window
    Posts
    277
    Reputation
    10
    Thanks
    2,754
    My Mood
    Aggressive
    Quote Originally Posted by brokim View Post
    plus the base hooking method is old and not updated. you have to update it using a new hook and DIP function. so no matter what, it will work. xD
    Not detected add bypass in source make it undetected

  17. #14
    brokim's Avatar
    Join Date
    Jun 2012
    Gender
    male
    Location
    ~~MGMT~~
    Posts
    907
    Reputation
    76
    Thanks
    1,981
    My Mood
    Psychedelic
    the hook and DIP function are detected. we need a new method to make it work. or a hs bypass. both will work XD
    Quote Originally Posted by ayawmanmik View Post
    Not detected add bypass in source make it undetected

  18. #15
    ayawmanmik's Avatar
    Join Date
    Dec 2011
    Gender
    male
    Location
    In Your Window
    Posts
    277
    Reputation
    10
    Thanks
    2,754
    My Mood
    Aggressive
    Quote Originally Posted by brokim View Post
    the hook and DIP function are detected. we need a new method to make it work. or a hs bypass. both will work XD
    Yeah

Page 1 of 3 123 LastLast

Similar Threads

  1. [Release] Make a SIMPLE D3D MENU
    By Qmo in forum DirectX/D3D Development
    Replies: 119
    Last Post: 10-11-2016, 06:45 AM
  2. [Release] Make a SIMPLE D3D MENU Part 2
    By Qmo in forum DirectX/D3D Development
    Replies: 15
    Last Post: 11-26-2015, 05:15 PM
  3. [Release] Make a Simple D3D Menu [ Visual C++ ]
    By Kingsurff in forum Blackshot Hacks & Cheats
    Replies: 8
    Last Post: 11-20-2012, 05:39 AM
  4. [Tutorial] How To Make A Simple D3D Menu [ Detailed Tutorial ]
    By Dead(H)ell in forum CrossFire Hack Coding / Programming / Source Code
    Replies: 51
    Last Post: 10-02-2012, 02:47 PM
  5. [Release] Make a SIMPLE D3D MENU
    By Qmo in forum Piercing Blow Hack Coding/Source Code
    Replies: 45
    Last Post: 10-30-2011, 12:59 PM