2a. Make a new C++ file (.cpp) and give a new name ( It's up to you ) or that I recommend, then copy/paste all this code :
#ADE32.cpp
Code:
#include "stdafx.h"
#include "ADE32.h"
DWORD ade32_table[512] = {
/* 00 */ C_MODRM,
/* 01 */ C_MODRM,
/* 02 */ C_MODRM,
/* 03 */ C_MODRM,
/* 04 */ C_DATA1,
/* 05 */ C_DATA66,
/* 06 */ C_BAD,
/* 07 */ C_BAD,
/* 08 */ C_MODRM,
/* 09 */ C_MODRM,
/* 0A */ C_MODRM,
/* 0B */ C_MODRM,
/* 0C */ C_DATA1,
/* 0D */ C_DATA66,
/* 0E */ C_BAD,
/* 0F */ C_OPCODE2,
/* 10 */ C_MODRM+C_BAD,
/* 11 */ C_MODRM,
/* 12 */ C_MODRM+C_BAD,
/* 13 */ C_MODRM,
/* 14 */ C_DATA1+C_BAD,
/* 15 */ C_DATA66+C_BAD,
/* 16 */ C_BAD,
/* 17 */ C_BAD,
/* 18 */ C_MODRM+C_BAD,
/* 19 */ C_MODRM,
/* 1A */ C_MODRM,
/* 1B */ C_MODRM,
/* 1C */ C_DATA1+C_BAD,
/* 1D */ C_DATA66+C_BAD,
/* 1E */ C_BAD,
/* 1F */ C_BAD,
/* 20 */ C_MODRM,
/* 21 */ C_MODRM,
/* 22 */ C_MODRM,
/* 23 */ C_MODRM,
/* 24 */ C_DATA1,
/* 25 */ C_DATA66,
/* 26 */ C_SEG+C_BAD,
/* 27 */ C_BAD,
/* 28 */ C_MODRM,
/* 29 */ C_MODRM,
/* 2A */ C_MODRM,
/* 2B */ C_MODRM,
/* 2C */ C_DATA1,
/* 2D */ C_DATA66,
/* 2E */ C_SEG+C_BAD,
/* 2F */ C_BAD,
/* 30 */ C_MODRM,
/* 31 */ C_MODRM,
/* 32 */ C_MODRM,
/* 33 */ C_MODRM,
/* 34 */ C_DATA1,
/* 35 */ C_DATA66,
/* 36 */ C_SEG+C_BAD,
/* 37 */ C_BAD,
/* 38 */ C_MODRM,
/* 39 */ C_MODRM,
/* 3A */ C_MODRM,
/* 3B */ C_MODRM,
/* 3C */ C_DATA1,
/* 3D */ C_DATA66,
/* 3E */ C_SEG+C_BAD,
/* 3F */ C_BAD,
/* 40 */ 0,
/* 41 */ 0,
/* 42 */ 0,
/* 43 */ 0,
/* 44 */ C_BAD,
/* 45 */ 0,
/* 46 */ 0,
/* 47 */ 0,
/* 48 */ 0,
/* 49 */ 0,
/* 4A */ 0,
/* 4B */ 0,
/* 4C */ C_BAD,
/* 4D */ 0,
/* 4E */ 0,
/* 4F */ 0,
/* 50 */ 0,
/* 51 */ 0,
/* 52 */ 0,
/* 53 */ 0,
/* 54 */ 0,
/* 55 */ 0,
/* 56 */ 0,
/* 57 */ 0,
/* 58 */ 0,
/* 59 */ 0,
/* 5A */ 0,
/* 5B */ 0,
/* 5C */ C_BAD,
/* 5D */ 0,
/* 5E */ 0,
/* 5F */ 0,
/* 60 */ C_BAD,
/* 61 */ C_BAD,
/* 62 */ C_MODRM+C_BAD,
/* 63 */ C_MODRM+C_BAD,
/* 64 */ C_SEG,
/* 65 */ C_SEG+C_BAD,
/* 66 */ C_66,
/* 67 */ C_67,
/* 68 */ C_DATA66,
/* 69 */ C_MODRM+C_DATA66,
/* 6A */ C_DATA1,
/* 6B */ C_MODRM+C_DATA1,
/* 6C */ C_BAD,
/* 6D */ C_BAD,
/* 6E */ C_BAD,
/* 6F */ C_BAD,
/* 70 */ C_DATA1+C_REL+C_BAD,
/* 71 */ C_DATA1+C_REL+C_BAD,
/* 72 */ C_DATA1+C_REL,
/* 73 */ C_DATA1+C_REL,
/* 74 */ C_DATA1+C_REL,
/* 75 */ C_DATA1+C_REL,
/* 76 */ C_DATA1+C_REL,
/* 77 */ C_DATA1+C_REL,
/* 78 */ C_DATA1+C_REL,
/* 79 */ C_DATA1+C_REL,
/* 7A */ C_DATA1+C_REL+C_BAD,
/* 7B */ C_DATA1+C_REL+C_BAD,
/* 7C */ C_DATA1+C_REL,
/* 7D */ C_DATA1+C_REL,
/* 7E */ C_DATA1+C_REL,
/* 7F */ C_DATA1+C_REL,
/* 80 */ C_MODRM+C_DATA1,
/* 81 */ C_MODRM+C_DATA66,
/* 82 */ C_MODRM+C_DATA1+C_BAD,
/* 83 */ C_MODRM+C_DATA1,
/* 84 */ C_MODRM,
/* 85 */ C_MODRM,
/* 86 */ C_MODRM,
/* 87 */ C_MODRM,
/* 88 */ C_MODRM,
/* 89 */ C_MODRM,
/* 8A */ C_MODRM,
/* 8B */ C_MODRM,
/* 8C */ C_MODRM+C_BAD,
/* 8D */ C_MODRM,
/* 8E */ C_MODRM+C_BAD,
/* 8F */ C_MODRM,
/* 90 */ 0,
/* 91 */ 0,
/* 92 */ 0,
/* 93 */ C_BAD,
/* 94 */ C_BAD,
/* 95 */ C_BAD,
/* 96 */ C_BAD,
/* 97 */ C_BAD,
/* 98 */ C_BAD,
/* 99 */ 0,
/* 9A */ C_DATA66+C_DATA2+C_BAD,
/* 9B */ 0,
/* 9C */ C_BAD,
/* 9D */ C_BAD,
/* 9E */ C_BAD,
/* 9F */ C_BAD,
/* A0 */ C_ADDR67,
/* A1 */ C_ADDR67,
/* A2 */ C_ADDR67,
/* A3 */ C_ADDR67,
/* A4 */ 0,
/* A5 */ 0,
/* A6 */ 0,
/* A7 */ 0,
/* A8 */ C_DATA1,
/* A9 */ C_DATA66,
/* AA */ 0,
/* AB */ 0,
/* AC */ 0,
/* AD */ C_BAD,
/* AE */ 0,
/* AF */ C_BAD,
/* B0 */ C_DATA1,
/* B1 */ C_DATA1,
/* B2 */ C_DATA1,
/* B3 */ C_DATA1,
/* B4 */ C_DATA1,
/* B5 */ C_DATA1,
/* B6 */ C_DATA1+C_BAD,
/* B7 */ C_DATA1+C_BAD,
/* B8 */ C_DATA66,
/* B9 */ C_DATA66,
/* BA */ C_DATA66,
/* BB */ C_DATA66,
/* BC */ C_DATA66+C_BAD,
/* BD */ C_DATA66,
/* BE */ C_DATA66,
/* BF */ C_DATA66,
/* C0 */ C_MODRM+C_DATA1,
/* C1 */ C_MODRM+C_DATA1,
/* C2 */ C_DATA2+C_STOP,
/* C3 */ C_STOP,
/* C4 */ C_MODRM+C_BAD,
/* C5 */ C_MODRM+C_BAD,
/* C6 */ C_MODRM+C_DATA1,
/* C7 */ C_MODRM+C_DATA66,
/* C8 */ C_DATA2+C_DATA1,
/* C9 */ 0,
/* CA */ C_DATA2+C_STOP+C_BAD,
/* CB */ C_STOP+C_BAD,
/* CC */ C_BAD,
/* CD */ C_BAD,
/* CE */ C_BAD,
/* CF */ C_STOP+C_BAD,
/* D0 */ C_MODRM,
/* D1 */ C_MODRM,
/* D2 */ C_MODRM,
/* D3 */ C_MODRM,
/* D4 */ C_DATA1+C_BAD,
/* D5 */ C_DATA1+C_BAD,
/* D6 */ C_BAD,
/* D7 */ C_BAD,
/* D8 */ C_MODRM,
/* D9 */ C_MODRM,
/* DA */ C_MODRM,
/* DB */ C_MODRM,
/* DC */ C_MODRM,
/* DD */ C_MODRM,
/* DE */ C_MODRM,
/* DF */ C_MODRM,
/* E0 */ C_DATA1+C_REL+C_BAD,
/* E1 */ C_DATA1+C_REL+C_BAD,
/* E2 */ C_DATA1+C_REL,
/* E3 */ C_DATA1+C_REL,
/* E4 */ C_DATA1+C_BAD,
/* E5 */ C_DATA1+C_BAD,
/* E6 */ C_DATA1+C_BAD,
/* E7 */ C_DATA1+C_BAD,
/* E8 */ C_DATA66+C_REL,
/* E9 */ C_DATA66+C_REL+C_STOP,
/* EA */ C_DATA66+C_DATA2+C_BAD,
/* EB */ C_DATA1+C_REL+C_STOP,
/* EC */ C_BAD,
/* ED */ C_BAD,
/* EE */ C_BAD,
/* EF */ C_BAD,
/* F0 */ C_LOCK+C_BAD,
/* F1 */ C_BAD,
/* F2 */ C_REP,
/* F3 */ C_REP,
/* F4 */ C_BAD,
/* F5 */ C_BAD,
/* F6 */ C_MODRM,
/* F7 */ C_MODRM,
/* F8 */ 0,
/* F9 */ 0,
/* FA */ C_BAD,
/* FB */ C_BAD,
/* FC */ 0,
/* FD */ 0,
/* FE */ C_MODRM,
/* FF */ C_MODRM,
/* 00 */ C_MODRM,
/* 01 */ C_MODRM,
/* 02 */ C_MODRM,
/* 03 */ C_MODRM,
/* 04 */ C_ERROR,
/* 05 */ C_ERROR,
/* 06 */ 0,
/* 07 */ C_ERROR,
/* 08 */ 0,
/* 09 */ 0,
/* 0A */ 0,
/* 0B */ 0,
/* 0C */ C_ERROR,
/* 0D */ C_ERROR,
/* 0E */ C_ERROR,
/* 0F */ C_ERROR,
/* 10 */ C_ERROR,
/* 11 */ C_ERROR,
/* 12 */ C_ERROR,
/* 13 */ C_ERROR,
/* 14 */ C_ERROR,
/* 15 */ C_ERROR,
/* 16 */ C_ERROR,
/* 17 */ C_ERROR,
/* 18 */ C_ERROR,
/* 19 */ C_ERROR,
/* 1A */ C_ERROR,
/* 1B */ C_ERROR,
/* 1C */ C_ERROR,
/* 1D */ C_ERROR,
/* 1E */ C_ERROR,
/* 1F */ C_ERROR,
/* 20 */ C_ERROR,
/* 21 */ C_ERROR,
/* 22 */ C_ERROR,
/* 23 */ C_ERROR,
/* 24 */ C_ERROR,
/* 25 */ C_ERROR,
/* 26 */ C_ERROR,
/* 27 */ C_ERROR,
/* 28 */ C_ERROR,
/* 29 */ C_ERROR,
/* 2A */ C_ERROR,
/* 2B */ C_ERROR,
/* 2C */ C_ERROR,
/* 2D */ C_ERROR,
/* 2E */ C_ERROR,
/* 2F */ C_ERROR,
/* 30 */ C_ERROR,
/* 31 */ C_ERROR,
/* 32 */ C_ERROR,
/* 33 */ C_ERROR,
/* 34 */ C_ERROR,
/* 35 */ C_ERROR,
/* 36 */ C_ERROR,
/* 37 */ C_ERROR,
/* 38 */ C_ERROR,
/* 39 */ C_ERROR,
/* 3A */ C_ERROR,
/* 3B */ C_ERROR,
/* 3C */ C_ERROR,
/* 3D */ C_ERROR,
/* 3E */ C_ERROR,
/* 3F */ C_ERROR,
/* 40 */ C_ERROR,
/* 41 */ C_ERROR,
/* 42 */ C_ERROR,
/* 43 */ C_ERROR,
/* 44 */ C_ERROR,
/* 45 */ C_ERROR,
/* 46 */ C_ERROR,
/* 47 */ C_ERROR,
/* 48 */ C_ERROR,
/* 49 */ C_ERROR,
/* 4A */ C_ERROR,
/* 4B */ C_ERROR,
/* 4C */ C_ERROR,
/* 4D */ C_ERROR,
/* 4E */ C_ERROR,
/* 4F */ C_ERROR,
/* 50 */ C_ERROR,
/* 51 */ C_ERROR,
/* 52 */ C_ERROR,
/* 53 */ C_ERROR,
/* 54 */ C_ERROR,
/* 55 */ C_ERROR,
/* 56 */ C_ERROR,
/* 57 */ C_ERROR,
/* 58 */ C_ERROR,
/* 59 */ C_ERROR,
/* 5A */ C_ERROR,
/* 5B */ C_ERROR,
/* 5C */ C_ERROR,
/* 5D */ C_ERROR,
/* 5E */ C_ERROR,
/* 5F */ C_ERROR,
/* 60 */ C_ERROR,
/* 61 */ C_ERROR,
/* 62 */ C_ERROR,
/* 63 */ C_ERROR,
/* 64 */ C_ERROR,
/* 65 */ C_ERROR,
/* 66 */ C_ERROR,
/* 67 */ C_ERROR,
/* 68 */ C_ERROR,
/* 69 */ C_ERROR,
/* 6A */ C_ERROR,
/* 6B */ C_ERROR,
/* 6C */ C_ERROR,
/* 6D */ C_ERROR,
/* 6E */ C_ERROR,
/* 6F */ C_ERROR,
/* 70 */ C_ERROR,
/* 71 */ C_ERROR,
/* 72 */ C_ERROR,
/* 73 */ C_ERROR,
/* 74 */ C_ERROR,
/* 75 */ C_ERROR,
/* 76 */ C_ERROR,
/* 77 */ C_ERROR,
/* 78 */ C_ERROR,
/* 79 */ C_ERROR,
/* 7A */ C_ERROR,
/* 7B */ C_ERROR,
/* 7C */ C_ERROR,
/* 7D */ C_ERROR,
/* 7E */ C_ERROR,
/* 7F */ C_ERROR,
/* 80 */ C_DATA66+C_REL,
/* 81 */ C_DATA66+C_REL,
/* 82 */ C_DATA66+C_REL,
/* 83 */ C_DATA66+C_REL,
/* 84 */ C_DATA66+C_REL,
/* 85 */ C_DATA66+C_REL,
/* 86 */ C_DATA66+C_REL,
/* 87 */ C_DATA66+C_REL,
/* 88 */ C_DATA66+C_REL,
/* 89 */ C_DATA66+C_REL,
/* 8A */ C_DATA66+C_REL,
/* 8B */ C_DATA66+C_REL,
/* 8C */ C_DATA66+C_REL,
/* 8D */ C_DATA66+C_REL,
/* 8E */ C_DATA66+C_REL,
/* 8F */ C_DATA66+C_REL,
/* 90 */ C_MODRM,
/* 91 */ C_MODRM,
/* 92 */ C_MODRM,
/* 93 */ C_MODRM,
/* 94 */ C_MODRM,
/* 95 */ C_MODRM,
/* 96 */ C_MODRM,
/* 97 */ C_MODRM,
/* 98 */ C_MODRM,
/* 99 */ C_MODRM,
/* 9A */ C_MODRM,
/* 9B */ C_MODRM,
/* 9C */ C_MODRM,
/* 9D */ C_MODRM,
/* 9E */ C_MODRM,
/* 9F */ C_MODRM,
/* A0 */ 0,
/* A1 */ 0,
/* A2 */ 0,
/* A3 */ C_MODRM,
/* A4 */ C_MODRM+C_DATA1,
/* A5 */ C_MODRM,
/* A6 */ C_ERROR,
/* A7 */ C_ERROR,
/* A8 */ 0,
/* A9 */ 0,
/* AA */ 0,
/* AB */ C_MODRM,
/* AC */ C_MODRM+C_DATA1,
/* AD */ C_MODRM,
/* AE */ C_ERROR,
/* AF */ C_MODRM,
/* B0 */ C_MODRM,
/* B1 */ C_MODRM,
/* B2 */ C_MODRM,
/* B3 */ C_MODRM,
/* B4 */ C_MODRM,
/* B5 */ C_MODRM,
/* B6 */ C_MODRM,
/* B7 */ C_MODRM,
/* B8 */ C_ERROR,
/* B9 */ C_ERROR,
/* BA */ C_MODRM+C_DATA1,
/* BB */ C_MODRM,
/* BC */ C_MODRM,
/* BD */ C_MODRM,
/* BE */ C_MODRM,
/* BF */ C_MODRM,
/* C0 */ C_MODRM,
/* C1 */ C_MODRM,
/* C2 */ C_ERROR,
/* C3 */ C_ERROR,
/* C4 */ C_ERROR,
/* C5 */ C_ERROR,
/* C6 */ C_ERROR,
/* C7 */ C_ERROR,
/* C8 */ 0,
/* C9 */ 0,
/* CA */ 0,
/* CB */ 0,
/* CC */ 0,
/* CD */ C_DATA1,
/* CE */ 0,
/* CF */ 0,
/* D0 */ C_ERROR,
/* D1 */ C_ERROR,
/* D2 */ C_ERROR,
/* D3 */ C_ERROR,
/* D4 */ C_ERROR,
/* D5 */ C_ERROR,
/* D6 */ C_ERROR,
/* D7 */ C_ERROR,
/* D8 */ C_ERROR,
/* D9 */ C_ERROR,
/* DA */ C_ERROR,
/* DB */ C_ERROR,
/* DC */ C_ERROR,
/* DD */ C_ERROR,
/* DE */ C_ERROR,
/* DF */ C_ERROR,
/* E0 */ C_ERROR,
/* E1 */ C_ERROR,
/* E2 */ C_ERROR,
/* E3 */ C_ERROR,
/* E4 */ C_ERROR,
/* E5 */ C_ERROR,
/* E6 */ C_ERROR,
/* E7 */ C_ERROR,
/* E8 */ C_ERROR,
/* E9 */ C_ERROR,
/* EA */ C_ERROR,
/* EB */ C_ERROR,
/* EC */ C_ERROR,
/* ED */ C_ERROR,
/* EE */ C_ERROR,
/* EF */ C_ERROR,
/* F0 */ C_ERROR,
/* F1 */ C_ERROR,
/* F2 */ C_ERROR,
/* F3 */ C_ERROR,
/* F4 */ C_ERROR,
/* F5 */ C_ERROR,
/* F6 */ C_ERROR,
/* F7 */ C_ERROR,
/* F8 */ C_ERROR,
/* F9 */ C_ERROR,
/* FA */ C_ERROR,
/* FB */ C_ERROR,
/* FC */ C_ERROR,
/* FD */ C_ERROR,
/* FE */ C_ERROR,
/* FF */ C_ERROR
}; // ade32_table[]
int disasm(BYTE* opcode0, disasm_struct* diza){
BYTE* opcode = opcode0;
memset(diza, 0x00, sizeof(disasm_struct));
diza->disasm_defdata = 4;
diza->disasm_defaddr = 4;
if(*(WORD*)opcode == 0x0000)
return 0;
if(*(WORD*)opcode == 0xFFFF)
return 0;
DWORD flag = 0;
repeat_prefix:
BYTE c = *opcode++;
DWORD t = ade32_table[ c ];
if(t & C_ANYPREFIX){
if(flag & t)
return 0;
flag |= t;
if(t & C_67)
diza->disasm_defaddr ^= 2^4;
else if(t & C_66)
diza->disasm_defdata ^= 2^4;
else if(t & C_SEG)
diza->disasm_seg = c;
else if(t & C_REP)
diza->disasm_rep = c;
// LOCK
goto repeat_prefix;
} // C_ANYPREFIX
flag |= t;
diza->disasm_opcode = c;
if(c == 0x0F){
c = *opcode++;
diza->disasm_opcode2 = c;
flag |= ade32_table[256+c]; // 2nd flagtable half
if(flag == C_ERROR)
return 0;
}else if(c == 0xF7){
if(((*opcode) & 0x38) == 0)
flag |= C_DATA66;
}else if(c == 0xF6){
if(((*opcode) & 0x38) == 0)
flag |= C_DATA1;
}else if(c == 0xCD){
if(*opcode == 0x20)
flag |= C_DATA4;
}
if(flag & C_MODRM){
c = *opcode++;
diza->disasm_modrm = c;
if(((c & 0x38) == 0x20) && (diza->disasm_opcode == 0xFF))
flag |= C_STOP;
BYTE mod = c & 0xC0;
BYTE rm = c & 0x07;
if(mod != 0xC0){
if(diza->disasm_defaddr == 4){
if(rm == 4){
flag |= C_SIB;
c = *opcode++;
diza->disasm_sib = c;
rm = c & 0x07;
}
if(mod == 0x40)
flag |= C_ADDR1;
else if(mod == 0x80)
flag |= C_ADDR4;
else if (rm == 5)
flag |= C_ADDR4;
}else{ // MODRM 16-bit
if(mod == 0x40)
flag |= C_ADDR1;
else if(mod == 0x80)
flag |= C_ADDR2;
else if(rm == 6)
flag |= C_ADDR2;
}
}
} // C_MODRM
diza->disasm_flag = flag;
DWORD a = flag & (C_ADDR1 | C_ADDR2 | C_ADDR4);
DWORD d = (flag & (C_DATA1 | C_DATA2 | C_DATA4)) >> 8;
if(flag & C_ADDR67)
a += diza->disasm_defaddr;
if(flag & C_DATA66)
d += diza->disasm_defdata;
diza->disasm_addrsize = a;
diza->disasm_datasize = d;
DWORD i;
for(i = 0; i < a; i++)
diza->disasm_addr_b[i] = *opcode++;
for(i = 0; i < d; i++)
diza->disasm_data_b[i] = *opcode++;
diza->disasm_len = opcode - opcode0;
return diza->disasm_len;
}
int oplen(BYTE *opcode){
disasm_struct diza;
memset(&diza,0,sizeof(diza));
disasm((BYTE*)opcode,&diza);
if((diza.disasm_flag == C_ERROR) || ((diza.disasm_flag&C_STOP) == C_STOP) || ((diza.disasm_flag&C_REL)==C_REL) || ((diza.disasm_flag&C_BAD)==C_BAD))
return -1;
return diza.disasm_len;
}
#QmoBase.cpp
Code:
//-----------------------------------------------------------------------------
// Copyright © November/2011. MPGH/Qmoa. All rights reserved.
// || Do not forget to credits ||
//-----------------------------------------------------------------------------
// flavor from the Base cheat ... need to Edit ok, and the creation of your abilities
//( Clue : discard the unnecessary )
//-----------------------------------------------------------------------------
#include "QmoBase.h"
#include "QmoMenu.h"
#include "QmoSound.h"
#include "QmoDetour.h"
#include "pragma.h"
#define D3DparamX , UINT paramx
#define D3DparamvalX , paramx
#pragma comment(lib, "d3d9.lib")
#pragma comment(lib, "d3dx9.lib")
int SumStride;
//========================================================//
UCHAR
szFileSys[255],
szVolNameBuff[255];
DWORD
dwMFL,
dwSysFlags,
dwSerial;
//========================================================//
bool Color = true;
LPDIRECT3DDEVICE9 pDevice;
UINT OffsetInBytes;
UINT m_Stride;
LPDIRECT3DVERTEXBUFFER9 Stream_Data;
UINT Offset = 0;
UINT Stride = 0;
bool CekHook = true;
/**************************/
LPDIRECT3DTEXTURE9 texYellow, texRed, texGreen, texBlue, texBlack, texWhite, texPink, texOrange, texLightBlue, texCyan, texPurple, texSteelBlue, texLightSteelBlue, texSalmon, texBrown, texTeal, texLime, texElectricLime, texGold, texOrangeRed, texGreenYellow, texAquaMarine, texSkyBlue, texSlateBlue, texCrimson, texDarkOliveGreen, texPaleGreen, texDarkGoldenRod, texFireBrick, texDarkBlue, texDarkerBlue, texDarkYellow, texLightYellow;
/**************************/
cBase Base;
cMenu Menu;
copt opt;
cSound Sound;
HRESULT GenerateTexture(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;
}
void PreReset( LPDIRECT3DDEVICE9 pDevice )
{
// Code here
Menu.PreReset();
return;
}
void PostReset( LPDIRECT3DDEVICE9 pDevice )
{
// Code here
Menu.PostReset(pDevice);
return;
}
typedef HRESULT ( WINAPI* oReset )( LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters );
oReset pReset;
HRESULT APIENTRY myReset( LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters )
{
PreReset( pDevice );
HRESULT hRet = pReset( pDevice, pPresentationParameters );
if( SUCCEEDED( hRet ) )
{
PostReset( pDevice );
}
return hRet;
}
typedef HRESULT (WINAPI* oDrawIndexedPrimitive) (LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT primCount);
oDrawIndexedPrimitive pDrawIndexedPrimitive;
HRESULT WINAPI myDrawIndexedPrimitive(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE pType D3DparamX ,UINT nMinIndex, UINT nNumVertices, UINT nStartIndex, UINT nPrimitiveCount )
{
if(pDevice->GetStreamSource(0,&Stream_Data,&OffsetInBytes,&m_Stride) == D3D_OK)
Stream_Data->Release();
DWORD dwOldZEnable = D3DZB_TRUE;
if(Color)
{
GenerateTexture(pDevice, &texGreen , D3DCOLOR_ARGB(255,0,255,0));
GenerateTexture(pDevice, &texRed , D3DCOLOR_ARGB(255,255,0,0));
GenerateTexture(pDevice, &texBlue , D3DCOLOR_ARGB(255,0,0,255));
GenerateTexture(pDevice, &texOrange , D3DCOLOR_ARGB(255,255,165,0));
GenerateTexture(pDevice, &texYellow , D3DCOLOR_ARGB(255,255,255,0));
GenerateTexture(pDevice, &texPink , D3DCOLOR_ARGB(255,255,192,203));
GenerateTexture(pDevice, &texCyan , D3DCOLOR_ARGB(255,0,255,255));
GenerateTexture(pDevice, &texPurple , D3DCOLOR_ARGB(255,160,32,240));
GenerateTexture(pDevice, &texBlack , D3DCOLOR_ARGB(255,0,0,0));
GenerateTexture(pDevice, &texWhite , D3DCOLOR_ARGB(255,255,255,255));
GenerateTexture(pDevice, &texSteelBlue , D3DCOLOR_ARGB(255,33,104,140));
GenerateTexture(pDevice, &texLightSteelBlue, D3DCOLOR_ARGB(255,201,255,255));
GenerateTexture(pDevice, &texLightBlue , D3DCOLOR_ARGB(255,26,140,306));
GenerateTexture(pDevice, &texSalmon , D3DCOLOR_ARGB(255,196,112,112));
GenerateTexture(pDevice, &texBrown , D3DCOLOR_ARGB(255,168,99,20));
GenerateTexture(pDevice, &texTeal , D3DCOLOR_ARGB(255,38,140,140));
GenerateTexture(pDevice, &texLime , D3DCOLOR_ARGB(255,50,205,50));
GenerateTexture(pDevice, &texElectricLime , D3DCOLOR_ARGB(255,204,255,0));
GenerateTexture(pDevice, &texGold , D3DCOLOR_ARGB(255,255, 215, 0));
GenerateTexture(pDevice, &texOrangeRed , D3DCOLOR_ARGB(255,255,69,0));
GenerateTexture(pDevice, &texGreenYellow , D3DCOLOR_ARGB(255,173,255,47));
GenerateTexture(pDevice, &texAquaMarine , D3DCOLOR_ARGB(255,127,255,212));
GenerateTexture(pDevice, &texSkyBlue , D3DCOLOR_ARGB(255,0,191,255));
GenerateTexture(pDevice, &texSlateBlue , D3DCOLOR_ARGB(255,132, 112, 255));
GenerateTexture(pDevice, &texCrimson , D3DCOLOR_ARGB(255,220,20,60));
GenerateTexture(pDevice, &texDarkOliveGreen, D3DCOLOR_ARGB(255,188,238,104 ));
GenerateTexture(pDevice, &texPaleGreen , D3DCOLOR_ARGB(255,154,255, 154));
GenerateTexture(pDevice, &texDarkGoldenRod , D3DCOLOR_ARGB(255,255, 185, 15 ));
GenerateTexture(pDevice, &texFireBrick , D3DCOLOR_ARGB(255,255,48,48));
GenerateTexture(pDevice, &texDarkBlue , D3DCOLOR_ARGB(255,0,0,204));
GenerateTexture(pDevice, &texDarkerBlue , D3DCOLOR_ARGB(255,0,0,153));
GenerateTexture(pDevice, &texDarkYellow , D3DCOLOR_ARGB(255,255,204,0));
GenerateTexture(pDevice, &texLightYellow , D3DCOLOR_ARGB(255,255,255,153));
Color = false;
}
if(opt.d3d.ChamsCT)
{
if((m_Stride == 44))
{
pDevice->SetRenderState(D3DRS_ZENABLE, false);
pDevice->SetTexture(0, texGreen);
pDrawIndexedPrimitive(pDevice,pType D3DparamvalX,nMinIndex,nNumVertices,nStartIndex,nPrimitiveCount);
pDevice->SetTexture(0, texRed);
pDevice->SetRenderState(D3DRS_ZENABLE, true);
}
}
if(opt.d3d.ChamsTERO)
{
if((m_Stride == 52))
{
pDevice->SetRenderState(D3DRS_ZENABLE, false);
pDevice->SetTexture(0, texGreenYellow);
pDrawIndexedPrimitive(pDevice,pType D3DparamvalX,nMinIndex,nNumVertices,nStartIndex,nPrimitiveCount);
}
}
if(opt.d3d.WHGlass)
{
if((m_Stride == 48 || m_Stride == 52 || m_Stride == 64))
{
SumStride=SumStride+4;
pDevice->SetRenderState(D3DRS_ZENABLE,false);
pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,true);
pDevice->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVDESTCOLOR);
pDevice->SetRenderState(D3DRS_ZENABLE,false);
}
}
return pDrawIndexedPrimitive(pDevice,pType D3DparamvalX,nMinIndex,nNumVertices,nStartIndex,nPrimitiveCount);
}
typedef HRESULT ( WINAPI* oEndScene )( LPDIRECT3DDEVICE9 pDevice );
oEndScene pEndScene;
HRESULT APIENTRY myEndScene( LPDIRECT3DDEVICE9 pDevice )
{
PostReset(pDevice);
Menu.ShowMenu(pDevice);
PreReset(pDevice);
return pEndScene( pDevice );
}
PVOID D3Ddiscover(void *tbl, int size)
{
HWND hWnd;
void *pInterface=0 ;
D3DPRESENT_PARAMETERS d3dpp;
if ((hWnd=CreateWindowEx(NULL,WC_DIALOG,"",WS_OVERLAPPED,0,0,50,50,NULL,NULL,NULL,NULL))==NULL) return 0;
ShowWindow(hWnd, SW_HIDE);
LPDIRECT3D9 pD3D;
LPDIRECT3DDEVICE9 pD3Ddev;
if ((pD3D = Direct3DCreate9(D3D_SDK_VERSION))!=NULL)
{
ZeroMemory(&d3dpp, sizeof(d3dpp));
d3dpp.Windowed = TRUE;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.hDeviceWindow = hWnd;
d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;
d3dpp.BackBufferWidth = d3dpp.BackBufferHeight = 600;
pD3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hWnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&d3dpp,&pD3Ddev);
if (pD3Ddev) {
pInterface = (PDWORD)*(DWORD *)pD3Ddev;
memcpy(tbl,(void *)pInterface,size);
pD3Ddev->Release();
}
pD3D->Release();
}
DestroyWindow(hWnd);
return pInterface;
}
int __stdcall D3D(void)
{
HINSTANCE hD3D;
DWORD vTable[105];
hD3D=0;
do {
hD3D = GetModuleHandle("d3d9.dll");
if (!hD3D) Sleep(100);
} while(!hD3D);
if (D3Ddiscover((void *)&vTable[0],420)==0) return 0;
{
while(1)
{
if(memcmp((void*)vTable[82],(void*)(PBYTE)"\x8B\xFF",2)== 0)
{
pDrawIndexedPrimitive = (oDrawIndexedPrimitive) DetourCreate((PBYTE)vTable[82], (PBYTE)myDrawIndexedPrimitive, 5);
pEndScene = (oEndScene) DetourCreate((PBYTE) vTable[42], (PBYTE)myEndScene,5);
}
Sleep(50);
}
return 0;
}
}
char* cBase::GetFile(char *file)
{
static char path[320];
for(int i= 0;i<strlen(path);i++)
path[i]=0;
strcpy(path, Base.dllpath);
strcat(path, file);
return path;
}
BOOL __stdcall DllMain(HMODULE hDll, DWORD dwReason, LPVOID lpReserved)
{
DisableThreadLibraryCalls(hDll);
if (dwReason == DLL_PROCESS_ATTACH)
{
MessageBox (0,"Creadits by Qmo","MPGH.NET", MB_OK);
CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)D3D, NULL, NULL, NULL);
//CreateThread(0, 0, (LPTHREAD_START_ROUTINE)DevilHack,0, 0, 0);
}
return TRUE;
}
#QmoFont.cpp
Code:
// -----------------------------------------------------------------------------
// File: D3DFont.cpp
// Desc: Texture-based font class
// Copyright (c) 1999-2001 Microsoft Corporation. All rights reserved.
// - Added D3D_FONT_RIGHT
// - Added D3D_FONT_SHADOW
// - Stripped not needed functions
//
// Edite file by Qmo MPGH
// -----------------------------------------------------------------------------
#include <stdio.h>
#include <tchar.h>
#include <D3DX9.h>
#include "QmoFont.h"
#include "pragma.h"
//-----------------------------------------------------------------------------
// Custom vertex types for rendering text
//-----------------------------------------------------------------------------
#define MAX_NUM_VERTICES 50*6
struct FONT2DVERTEX { D3DXVECTOR4 p; DWORD color; FLOAT tu, tv; };
struct FONT3DVERTEX { D3DXVECTOR3 p; D3DXVECTOR3 n; FLOAT tu, tv; };
#define D3DFVF_FONT2DVERTEX (D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1)
#define D3DFVF_FONT3DVERTEX (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1)
inline FONT2DVERTEX InitFont2DVertex( const D3DXVECTOR4& p, D3DCOLOR color,
FLOAT tu, FLOAT tv )
{
FONT2DVERTEX v; v.p = p; v.color = color; v.tu = tu; v.tv = tv;
return v;
}
inline FONT3DVERTEX InitFont3DVertex( const D3DXVECTOR3& p, const D3DXVECTOR3& n,
FLOAT tu, FLOAT tv )
{
FONT3DVERTEX v; v.p = p; v.n = n; v.tu = tu; v.tv = tv;
return v;
}
//-----------------------------------------------------------------------------
// Name: CD3DFont()
// Desc: Font class constructor
//-----------------------------------------------------------------------------
CD3DFont::CD3DFont( TCHAR* strFontName, DWORD dwHeight, DWORD dwFlags )
{
strcpy( m_strFontName, strFontName );
m_dwFontHeight = dwHeight;
m_dwFontFlags = dwFlags;
m_pd3dDevice = NULL;
m_pTexture = NULL;
m_pVB = NULL;
m_dwSavedStateBlock = 0L;
m_dwDrawTextStateBlock = 0L;
}
//-----------------------------------------------------------------------------
// Name: ~CD3DFont()
// Desc: Font class destructor
//-----------------------------------------------------------------------------
CD3DFont::~CD3DFont()
{
InvalidateDeviceObjects();
DeleteDeviceObjects();
}
//-----------------------------------------------------------------------------
// Name: InitDeviceObjects()
// Desc: Initializes device-dependent objects, including the vertex buffer used
// for rendering text and the texture map which stores the font image.
//-----------------------------------------------------------------------------
HRESULT CD3DFont::InitDeviceObjects( LPDIRECT3DDEVICE9 pd3dDevice )
{
HRESULT hr;
// Keep a local copy of the device
m_pd3dDevice = pd3dDevice;
// Establish the font and texture size
m_fTextScale = 1.0f; // Draw fonts into texture without scaling
// Large fonts need larger textures
if( m_dwFontHeight > 40 )
m_dwTexWidth = m_dwTexHeight = 1024;
else if( m_dwFontHeight > 20 )
m_dwTexWidth = m_dwTexHeight = 512;
else
m_dwTexWidth = m_dwTexHeight = 256;
// If requested texture is too big, use a smaller texture and smaller font,
// and scale up when rendering.
D3DCAPS9 d3dCaps;
m_pd3dDevice->GetDeviceCaps( &d3dCaps );
if( m_dwTexWidth > d3dCaps.MaxTextureWidth )
{
m_fTextScale = (FLOAT)d3dCaps.MaxTextureWidth / (FLOAT)m_dwTexWidth;
m_dwTexWidth = m_dwTexHeight = d3dCaps.MaxTextureWidth;
}
// Create a new texture for the font
hr = m_pd3dDevice->CreateTexture( m_dwTexWidth, m_dwTexHeight, 1,
0, D3DFMT_A4R4G4B4,
D3DPOOL_MANAGED, &m_pTexture, NULL );
if( FAILED(hr) )
return hr;
// Prepare to create a bitmap
DWORD* pBitmapBits;
BITMAPINFO bmi;
ZeroMemory( &bmi.bmiHeader, sizeof(BITMAPINFOHEADER) );
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = (int)m_dwTexWidth;
bmi.bmiHeader.biHeight = -(int)m_dwTexHeight;
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biCompression = BI_RGB;
bmi.bmiHeader.biBitCount = 32;
// Create a DC and a bitmap for the font
HDC hDC = CreateCompatibleDC( NULL );
HBITMAP hbmBitmap = CreateDIBSection( hDC, &bmi, DIB_RGB_COLORS,
(VOID**)&pBitmapBits, NULL, 0 );
SetMapMode( hDC, MM_TEXT );
// Create a font. By specifying ANTIALIASED_QUALITY, we might get an
// antialiased font, but this is not guaranteed.
INT nHeight = -MulDiv( m_dwFontHeight,
(INT)(GetDeviceCaps(hDC, LOGPIXELSY) * m_fTextScale), 72 );
DWORD dwBold = (m_dwFontFlags&D3DFONT_BOLD) ? FW_BOLD : FW_NORMAL;
DWORD dwItalic = (m_dwFontFlags&D3DFONT_ITALIC) ? TRUE : FALSE;
HFONT hFont = CreateFont( nHeight, 0, 0, 0, dwBold, dwItalic,
FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY,
VARIABLE_PITCH, m_strFontName );
if( NULL==hFont )
return E_FAIL;
SelectObject( hDC, hbmBitmap );
SelectObject( hDC, hFont );
// Set text properties
SetTextColor( hDC, RGB(255,255,255) );
SetBkColor( hDC, 0x00000000 );
SetTextAlign( hDC, TA_TOP );
// Loop through all printable character and output them to the bitmap..
// Meanwhile, keep track of the corresponding tex coords for each character.
DWORD x = 0;
DWORD y = 0;
TCHAR str[2] = _T("x");
SIZE size;
// Calculate the spacing between characters based on line height
GetTextExtentPoint32( hDC, TEXT(" "), 1, &size );
x = m_dwSpacing = (DWORD) ceil(size.cy * 0.3f);
for( TCHAR c=32; c<127; c++ )
{
str[0] = c;
GetTextExtentPoint32( hDC, str, 1, &size );
if( (DWORD)(x+size.cx+1) > m_dwTexWidth )
{
x = m_dwSpacing;
y += size.cy+1;
}
ExtTextOut( hDC, x+0, y+0, ETO_OPAQUE, NULL, str, 1, NULL );
m_fTexCoords[c-32][0] = ((FLOAT)(x+0 -m_dwSpacing))/m_dwTexWidth;
m_fTexCoords[c-32][1] = ((FLOAT)(y+0 +0 ))/m_dwTexHeight;
m_fTexCoords[c-32][2] = ((FLOAT)(x+size.cx+m_dwSpacing))/m_dwTexWidth;
m_fTexCoords[c-32][3] = ((FLOAT)(y+size.cy+0 ))/m_dwTexHeight;
x += size.cx+(2 * m_dwSpacing);
}
// Lock the surface and write the alpha values for the set pixels
D3DLOCKED_RECT d3dlr;
m_pTexture->LockRect( 0, &d3dlr, 0, 0 );
BYTE* pDstRow = (BYTE*)d3dlr.pBits;
WORD* pDst16;
BYTE bAlpha; // 4-bit measure of pixel intensity
for( y=0; y < m_dwTexHeight; y++ )
{
pDst16 = (WORD*)pDstRow;
for( x=0; x < m_dwTexWidth; x++ )
{
bAlpha = (BYTE)((pBitmapBits[m_dwTexWidth*y + x] & 0xff) >> 4);
if (bAlpha > 0)
{
*pDst16++ = (bAlpha << 12) | 0x0fff;
}
else
{
*pDst16++ = 0x0000;
}
}
pDstRow += d3dlr.Pitch;
}
// Done updating texture, so clean up used objects
m_pTexture->UnlockRect(0);
DeleteObject( hbmBitmap );
DeleteDC( hDC );
DeleteObject( hFont );
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: RestoreDeviceObjects()
// Desc:
//-----------------------------------------------------------------------------
HRESULT CD3DFont::RestoreDeviceObjects()
{
HRESULT hr;
// Create vertex buffer for the letters
if( FAILED( hr = m_pd3dDevice->CreateVertexBuffer(
MAX_NUM_VERTICES*sizeof(FONT2DVERTEX),
D3DUSAGE_WRITEONLY, 0,
D3DPOOL_DEFAULT, &m_pVB, NULL ) ) )
{
return hr;
}
// Create the state blocks for rendering text
for( UINT which=0; which<2; which++ )
{
m_pd3dDevice->BeginStateBlock();
m_pd3dDevice->SetTexture( 0, m_pTexture );
if ( D3DFONT_ZENABLE & m_dwFontFlags )
m_pd3dDevice->SetRenderState( D3DRS_ZENABLE, TRUE );
else
m_pd3dDevice->SetRenderState( D3DRS_ZENABLE, FALSE );
m_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
m_pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );
m_pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
m_pd3dDevice->SetRenderState( D3DRS_ALPHATESTENABLE, TRUE );
m_pd3dDevice->SetRenderState( D3DRS_ALPHAREF, 0x08 );
m_pd3dDevice->SetRenderState( D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL );
m_pd3dDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_SOLID );
m_pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW );
m_pd3dDevice->SetRenderState( D3DRS_STENCILENABLE, FALSE );
m_pd3dDevice->SetRenderState( D3DRS_CLIPPING, TRUE );
m_pd3dDevice->SetRenderState( D3DRS_CLIPPLANEENABLE, FALSE );
m_pd3dDevice->SetRenderState( D3DRS_VERTEXBLEND, FALSE );
m_pd3dDevice->SetRenderState( D3DRS_INDEXEDVERTEXBLENDENABLE, FALSE );
m_pd3dDevice->SetRenderState( D3DRS_FOGENABLE, FALSE );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );
m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_POINT );
m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT );
m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MIPFILTER, D3DTEXF_NONE );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX, 0 );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE );
m_pd3dDevice->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_DISABLE );
m_pd3dDevice->SetTextureStageState( 1, D3DTSS_ALPHAOP, D3DTOP_DISABLE );
if( which==0 )
m_pd3dDevice->EndStateBlock( &m_dwSavedStateBlock );
else
m_pd3dDevice->EndStateBlock( &m_dwDrawTextStateBlock );
}
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: InvalidateDeviceObjects()
// Desc: Destroys all device-dependent objects
//-----------------------------------------------------------------------------
HRESULT CD3DFont::InvalidateDeviceObjects()
{
m_pVB->Release();
// Delete the state blocks
if( m_pd3dDevice )
{
if( m_dwSavedStateBlock )
m_dwSavedStateBlock->Release();
if( m_dwDrawTextStateBlock )
m_dwDrawTextStateBlock->Release();
}
m_dwSavedStateBlock = 0L;
m_dwDrawTextStateBlock = 0L;
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: DeleteDeviceObjects()
// Desc: Destroys all device-dependent objects
//-----------------------------------------------------------------------------
HRESULT CD3DFont::DeleteDeviceObjects()
{
m_pTexture->Release();
m_pd3dDevice = NULL;
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: GetTextExtent()
// Desc: Get the dimensions of a text string
//-----------------------------------------------------------------------------
HRESULT CD3DFont::GetTextExtent( TCHAR* strText, SIZE* pSize )
{
if( NULL==strText || NULL==pSize )
return E_FAIL;
FLOAT fRowWidth = 0.0f;
FLOAT fRowHeight = (m_fTexCoords[0][3]-m_fTexCoords[0][1])*m_dwTexHeight;
FLOAT fWidth = 0.0f;
FLOAT fHeight = fRowHeight;
while( *strText )
{
TCHAR c = *strText++;
if( c == _T('\n') )
{
fRowWidth = 0.0f;
fHeight += fRowHeight;
}
if( (c-32) < 0 || (c-32) >= 158-32 )
continue;
FLOAT tx1 = m_fTexCoords[c-32][0];
FLOAT tx2 = m_fTexCoords[c-32][2];
fRowWidth += (tx2-tx1)*m_dwTexWidth - 2*m_dwSpacing;
if( fRowWidth > fWidth )
fWidth = fRowWidth;
}
pSize->cx = (int)fWidth;
pSize->cy = (int)fHeight;
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: DrawText()
// Desc: Draws 2D text
//-----------------------------------------------------------------------------
HRESULT CD3DFont::DrawText( FLOAT sx, FLOAT sy, DWORD dwColor,
TCHAR* strText, DWORD dwFlags )
{
if( m_pd3dDevice == NULL )
return E_FAIL;
// Setup renderstate
m_dwSavedStateBlock->Capture();
m_dwDrawTextStateBlock->Apply();
m_pd3dDevice->SetFVF( D3DFVF_FONT2DVERTEX );
m_pd3dDevice->SetPixelShader( NULL );
m_pd3dDevice->SetStreamSource( 0, m_pVB, 0, sizeof(FONT2DVERTEX) );
// Set filter states
if( dwFlags & D3DFONT_FILTERED )
{
m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
}
// Hans211: small adaption for right an centered alignment
if( dwFlags & DT_RIGHT )
{
SIZE sz;
GetTextExtent( strText, &sz ); sx -= (FLOAT)sz.cx;
}
if( dwFlags & DT_CENTER )
{
SIZE sz;
GetTextExtent( strText, &sz ); sx -= (FLOAT)(sz.cx / 2.0);
}
// Adjust for character spacing
sx -= m_dwSpacing;
FLOAT fStartX = sx;
// Fill vertex buffer
FONT2DVERTEX* pVertices = NULL;
DWORD dwNumTriangles = 0;
m_pVB->Lock( 0, 0, (VOID**)&pVertices, D3DLOCK_DISCARD );
while( *strText )
{
TCHAR c = *strText++;
if( c == _T('\n') )
{
sx = fStartX;
sy += (m_fTexCoords[0][3]-m_fTexCoords[0][1])*m_dwTexHeight;
}
if( (c-32) < 0 || (c-32) >= 158-32 )
continue;
FLOAT tx1 = m_fTexCoords[c-32][0];
FLOAT ty1 = m_fTexCoords[c-32][1];
FLOAT tx2 = m_fTexCoords[c-32][2];
FLOAT ty2 = m_fTexCoords[c-32][3];
FLOAT w = (tx2-tx1) * m_dwTexWidth / m_fTextScale;
FLOAT h = (ty2-ty1) * m_dwTexHeight / m_fTextScale;
if( c != _T(' ') )
{
// Hans211: Add shadowing
if( dwFlags & DT_SHADOW ) {
float sxa,sya;
sxa = sx;
sya = sy;
sxa=sx+1.0f;
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sxa+0-0.5f,sy+h-0.5f,0.9f,1.0f), 0xff000000, tx1, ty2 );
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sxa+0-0.5f,sy+0-0.5f,0.9f,1.0f), 0xff000000, tx1, ty1 );
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sxa+w-0.5f,sy+h-0.5f,0.9f,1.0f), 0xff000000, tx2, ty2 );
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sxa+w-0.5f,sy+0-0.5f,0.9f,1.0f), 0xff000000, tx2, ty1 );
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sxa+w-0.5f,sy+h-0.5f,0.9f,1.0f), 0xff000000, tx2, ty2 );
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sxa+0-0.5f,sy+0-0.5f,0.9f,1.0f), 0xff000000, tx1, ty1 );
sxa=sx-1.0f;
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sxa+0-0.5f,sy+h-0.5f,0.9f,1.0f), 0xff000000, tx1, ty2 );
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sxa+0-0.5f,sy+0-0.5f,0.9f,1.0f), 0xff000000, tx1, ty1 );
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sxa+w-0.5f,sy+h-0.5f,0.9f,1.0f), 0xff000000, tx2, ty2 );
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sxa+w-0.5f,sy+0-0.5f,0.9f,1.0f), 0xff000000, tx2, ty1 );
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sxa+w-0.5f,sy+h-0.5f,0.9f,1.0f), 0xff000000, tx2, ty2 );
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sxa+0-0.5f,sy+0-0.5f,0.9f,1.0f), 0xff000000, tx1, ty1 );
sya=sy-1.0f;
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+0-0.5f,sya+h-0.5f,0.9f,1.0f), 0xff000000, tx1, ty2 );
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+0-0.5f,sya+0-0.5f,0.9f,1.0f), 0xff000000, tx1, ty1 );
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+w-0.5f,sya+h-0.5f,0.9f,1.0f), 0xff000000, tx2, ty2 );
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+w-0.5f,sya+0-0.5f,0.9f,1.0f), 0xff000000, tx2, ty1 );
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+w-0.5f,sya+h-0.5f,0.9f,1.0f), 0xff000000, tx2, ty2 );
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+0-0.5f,sya+0-0.5f,0.9f,1.0f), 0xff000000, tx1, ty1 );
sya=sy+1.0f;
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+0-0.5f,sya+h-0.5f,0.9f,1.0f), 0xff000000, tx1, ty2 );
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+0-0.5f,sya+0-0.5f,0.9f,1.0f), 0xff000000, tx1, ty1 );
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+w-0.5f,sya+h-0.5f,0.9f,1.0f), 0xff000000, tx2, ty2 );
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+w-0.5f,sya+0-0.5f,0.9f,1.0f), 0xff000000, tx2, ty1 );
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+w-0.5f,sya+h-0.5f,0.9f,1.0f), 0xff000000, tx2, ty2 );
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+0-0.5f,sya+0-0.5f,0.9f,1.0f), 0xff000000, tx1, ty1 );
dwNumTriangles += 8;
}
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+0-0.5f,sy+h-0.5f,0.9f,1.0f), dwColor, tx1, ty2 );
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+0-0.5f,sy+0-0.5f,0.9f,1.0f), dwColor, tx1, ty1 );
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+w-0.5f,sy+h-0.5f,0.9f,1.0f), dwColor, tx2, ty2 );
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+w-0.5f,sy+0-0.5f,0.9f,1.0f), dwColor, tx2, ty1 );
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+w-0.5f,sy+h-0.5f,0.9f,1.0f), dwColor, tx2, ty2 );
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+0-0.5f,sy+0-0.5f,0.9f,1.0f), dwColor, tx1, ty1 );
dwNumTriangles += 2;
// Hans211: adapt calculation so it works with shadowing also
if( dwNumTriangles*3 > (MAX_NUM_VERTICES-(dwNumTriangles*3)) )
{
// Unlock, render, and relock the vertex buffer
m_pVB->Unlock();
m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, dwNumTriangles );
pVertices = NULL;
m_pVB->Lock( 0, 0, (VOID**)&pVertices, D3DLOCK_DISCARD );
dwNumTriangles = 0L;
}
}
sx += w - (2 * m_dwSpacing);
}
// Unlock and render the vertex buffer
m_pVB->Unlock();
if( dwNumTriangles > 0 )
m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, dwNumTriangles );
// Restore the modified renderstates
m_dwSavedStateBlock->Apply();
return S_OK;
}
#QmoMenu.cpp
Code:
//-----------------------------------------------------------------------------
// Copyright © November/2011. MPGH/Qmoa. All rights reserved.
// || Do not forget to credits ||
//-----------------------------------------------------------------------------
// flavor from the Base cheat ... need to Edit ok, and the creation of your abilities
//( Clue : discard the unnecessary )
//-----------------------------------------------------------------------------
#include "stdafx.h"
#include "QmoMenu.h"
#include "QmoSound.h"
#include "QmoBase.h"
#include "Sounds.h"
#include "pragma.h"
//-----------------------------------------------------------------------------
// Name: PostReset()
// Desc: Creates Fonts and other Resources for Menu
//-----------------------------------------------------------------------------
void cMenu::PostReset(LPDIRECT3DDEVICE9 pDevice)
{
font = new CD3DFont("Impac", 6, D3DFONT_BOLD);
font->InitDeviceObjects(pDevice);
font->RestoreDeviceObjects();
}
//-----------------------------------------------------------------------------
// Name: PreReset()
// Desc: Releases Fonts / objects for menu
//-----------------------------------------------------------------------------
void cMenu::PreReset(void)
{
font->InvalidateDeviceObjects();
font->DeleteDeviceObjects();
delete font;
font = NULL;
}
//-----------------------------------------------------------------------------
// Name: Init()
// Desc: Load Menu Defaults / Prepare Menu For Usage
//-----------------------------------------------------------------------------
void cMenu::Init()
{
if (opt.options.reset)INIT=false;
if(!INIT){
opt.options.move=0; // BUG FIX FOR RESET DISABLE MOVE BEFORE SETTING COORDINATES
X=Y=100; // TOP LEFT START
WIDTH=200; // MENU WIDTH
I_OFS=4; // OFSET FOR ITEM
S_OFS=WIDTH-2; // OFSET FOR STATE
T_SPC=20; // Space from Title and Start of Items
F_SPC=20; // Footer Spacing Hook Menu
I_SPC=17; // Item Spacing
I_CUR=0; // Set current Item
ABOR=0; // ANIMATION MOVE
BDIR=0; // ANIMATION HIGHLIGHT
SHOW=true; // false=hide true=show
INIT=true; // STOP INITATION
}
}
//-----------------------------------------------------------------------------
// Name: FPS()
// Desc: Keeps Track of Current Frames Persecond Make sure if its already called to specify a 1 as parameter
//-----------------------------------------------------------------------------
char* cMenu::FPS(int en)
{
static int FPScounter = 0;
static float FPSfLastTickCount = 0.0f;
static float FPSfCurrentTickCount;
static char cfps[6] = "";
if(!en)
{
FPSfCurrentTickCount = clock() * 0.001f;
FPScounter++;
if((FPSfCurrentTickCount - FPSfLastTickCount) > 1.0f)
{
FPSfLastTickCount = FPSfCurrentTickCount;
sprintf(cfps," %d",FPScounter);
FPScounter = 0;
}
}
return cfps;
}
//-----------------------------------------------------------------------------
// Name: TIME()
// Desc: Outputs Current Time in USA Format
//-----------------------------------------------------------------------------
char* cMenu::TIME(void)
{
static char ctime[20] = "" ;
struct tm * current_tm;
time_t current_time;
time (¤t_time);
current_tm = localtime (¤t_time);
if(current_tm->tm_hour>12)
sprintf( ctime, "%d:%02d:%02d PM", current_tm->tm_hour - 12, current_tm->tm_min, current_tm->tm_sec );
else
sprintf( ctime, "%d:%02d:%02d AM", current_tm->tm_hour, current_tm->tm_min, current_tm->tm_sec );
return ctime;
}
//-----------------------------------------------------------------------------
// Name: DATE()
// Desc: Outputs Current Date in USA Format
//-----------------------------------------------------------------------------
char* cMenu::DATE(void)
{
static char cdate[20] = "" ;
struct tm * current_tm;
time_t current_time;
time (¤t_time);
current_tm = localtime (¤t_time);
sprintf( cdate, "%d-%02d-%d",current_tm->tm_mon+1,current_tm->tm_mday,current_tm->tm_year-100+2000);
return cdate;
}
//-----------------------------------------------------------------------------
// Name: oprintf()
// Desc: equiv to sprintf but for output into of dest
//-----------------------------------------------------------------------------
char* cMenu::oprintf (const char *fmt, ...)
{
static char buffer[225] = "";
va_list va_alist;
va_start (va_alist, fmt);
_vsnprintf (buffer,sizeof(buffer), fmt, va_alist);
va_end (va_alist);
return buffer;
}
//-----------------------------------------------------------------------------
// Name: Save()
// Desc: Saves Menu Item states for later Restoration
//-----------------------------------------------------------------------------
void cMenu::Save(char* szSection, char* szKey, int iValue,LPCSTR file)
{
char szValue[255];
sprintf(szValue, "%d", iValue);
WritePrivateProfileString(szSection, szKey, szValue, file);
}
//-----------------------------------------------------------------------------
// Name: Load()
// Desc: Loads Menu Item States From Previously Saved File
//-----------------------------------------------------------------------------
int cMenu::Load(char* szSection, char* szKey, int iDefaultValue,LPCSTR file)
{
int iResult = GetPrivateProfileInt(szSection, szKey, iDefaultValue, file);
return iResult;
}
//-----------------------------------------------------------------------------
// Name: additem()
// Desc: BaseFunction for aitem,acat,and atext
//-----------------------------------------------------------------------------
void cMenu::additem(char *title, char *states,int type, int *var, int show, int when)
{
if(show==when)
{
strcpy(items[NO].title,title);
getfield(states,items[NO].state,*var+1);
items[NO].type=type;
items[NO].max=nofields(states);
items[NO].val=var;
NO++;
}
if(type!=T_TEXT)
{
if (opt.options.load)
*var = Load("Items", title, *var,Base.GetFile("mset.ini"));
if (opt.options.save)
Save("Items", title, *var,Base.GetFile("mset.ini"));
if (opt.options.reset)
*var=0;
}
}
//-----------------------------------------------------------------------------
// Name: acat()
// Desc: Adds Folder/Category to Item index
//-----------------------------------------------------------------------------
void cMenu::acat(char *title, char *states,int *var)
{
additem(title,states,T_CAT,var,0,0);
}
//-----------------------------------------------------------------------------
// Name: aitem()
// Desc: Adds regular item to Item index
//-----------------------------------------------------------------------------
void cMenu::aitem(char *title, char *states,int *var,int show,int when)
{
additem(title,states,T_ITEM,var,show,when);
}
//-----------------------------------------------------------------------------
// Name: atext()
// Desc: Adds Text item to item index
//-----------------------------------------------------------------------------
void cMenu::atext(char *title, char *states,int show,int when)
{
additem(title,states,T_TEXT,&opt.text,show,when);
}
void cMenu::atext(char *title, char *states)
{
additem(title,states,T_TEXT,&opt.text,1,1);
}
//-----------------------------------------------------------------------------
// Name: nofields()
// Desc: Calculates Number of Fields in a String based on deliminator
//-----------------------------------------------------------------------------
int cMenu::nofields(char *str)
{
char *ptr;
int no;
for(no=1; (ptr=strchr(str,(char)'|'))!=NULL; no++)str=ptr+1;
return no;
}
//-----------------------------------------------------------------------------
// Name: getfield()
// Desc: Grabs Field in string based on deliminator
//-----------------------------------------------------------------------------
void cMenu::getfield(char *str,char *dst,int no)
{
char *ptr;
int i;
for(i=1; (ptr=strchr(str,(char)'|'))!=NULL ; i++)
{
if(i==no) break;
str=ptr+1;
}
if(ptr)
{
i=(int)(ptr-str);
strncpy(dst,str,i);
dst[i]=0;
}
else
strcpy(dst,str);
}
//-----------------------------------------------------------------------------
// Name: DrawBox()
// Desc: Fills Rectangle using DrawPrimitive Up
//-----------------------------------------------------------------------------
void cMenu::DrawBox( int x, int y, int w, int h, D3DCOLOR Color,LPDIRECT3DDEVICE9 pDevice)
{
struct Vertex
{
float x,y,z,ht;
DWORD Color;
}V[4] = {
{x,y+h, 0.0f, 0.0f, Color},
{x,y, 0.0f, 0.0f, Color},
{x+w,y+h, 0.0f, 0.0f, Color},
{x+w,y, 0.0f, 0.0f, Color}
};
pDevice->SetTexture(0, NULL);
pDevice->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1);
pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,true);
pDevice->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA);
pDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP,2,V,sizeof(Vertex));
return;
}
//-----------------------------------------------------------------------------
// Name: DrawBorder()
// Desc: Fills outside of Rectangle using 4 calls to DrawBox
//-----------------------------------------------------------------------------
void cMenu::DrawBorder( int x, int y, int w, int h, D3DCOLOR Color,LPDIRECT3DDEVICE9 pDevice)
{
DrawBox(x, y, 1, h,Color,pDevice);
DrawBox(x,y+h, w, 1,Color,pDevice);
DrawBox(x, y, w, 1,Color,pDevice);
DrawBox(x+w,y, 1,h+1,Color,pDevice);
return;
}
//-----------------------------------------------------------------------------
// Name: ShowMenu()
// Desc: Core Menu Function Displays Menu Calls Other Menu functions and navigation
//-----------------------------------------------------------------------------
void cMenu::ShowMenu(LPDIRECT3DDEVICE9 pDevice)
{
//-----------------------------------------------------------------------------
// Desc: Check Hotkeys
//-----------------------------------------------------------------------------
int lm = GetAsyncKeyState(VK_LBUTTON)&1;
int rm = GetAsyncKeyState(VK_RBUTTON)&1;
int left = GetAsyncKeyState(VK_LEFT )&1;
int right = GetAsyncKeyState(VK_RIGHT)&1;
int up = GetAsyncKeyState(VK_UP )&1;
int down = GetAsyncKeyState(VK_DOWN )&1;
//-----------------------------------------------------------------------------
// Desc: Prepare/Reset Menu
//-----------------------------------------------------------------------------
Init();
//-----------------------------------------------------------------------------
// Desc: Show The Menu
//-----------------------------------------------------------------------------
if(GetAsyncKeyState(VK_INSERT)&1) SHOW=(!SHOW);
if(SHOW){
//-----------------------------------------------------------------------------
// Desc: Get Mouse Coordinates and translate
//-----------------------------------------------------------------------------
GetCursorPos(&mpos);// Update Mouse Coordinates
ScreenToClient(GetForegroundWindow(),&mpos); // Translate to Current Window
//-----------------------------------------------------------------------------
// Desc: Move Menu
//-----------------------------------------------------------------------------
//if(mpos.x>X && mpos.x<X+WIDTH && mpos.y>Y && mpos.y<Y+T_SPC && GetAsyncKeyState(VK_LBUTTON)&1 && !opt.options.move) // If Header Clicked on
//{
// M_DRAG=1;
//}
//else
//{
// mofs.x=mpos.x - X;
// mofs.y=mpos.y - Y;
//}
//if(M_DRAG)
//{
// if(GetAsyncKeyState(VK_LBUTTON)&1)M_DRAG=0;
// X = mpos.x - mofs.x;
// Y = mpos.y - mofs.y;
//}
if(opt.options.move && GetAsyncKeyState(VK_LCONTROL)) // If Options for Left Control is Set
{
X =(((X<=mpos.x+4) && (X>=mpos.x)) || ((X>=mpos.x-4) && (X<=mpos.x)))?(X=mpos.x):(X+=((mpos.x-X)/4));
Y =(((Y<=mpos.y+4) && (Y>=mpos.y)) || ((Y>=mpos.y-4) && (Y<=mpos.y)))?(Y=mpos.y):(Y+=((mpos.y-Y)/4));
}
//-----------------------------------------------------------------------------
// Desc: Draw Menu Header
//-----------------------------------------------------------------------------
DrawBox(X,Y,WIDTH,T_SPC,C_BOX,pDevice); // Render Menu Header Backround
DrawBorder(X,Y,WIDTH,T_SPC,C_BORDER,pDevice);// set-up border
font->DrawText(MC_FCTR(X,MC_MAXX),Y+10,C_TITLE,"Qmo MPGH Class",DT_CENTER|DT_SHADOW);
//-----------------------------------------------------------------------------
// Desc: Fill Item Array and Render Menu Border and Box
//-----------------------------------------------------------------------------
NO=0;
acat("[CHEAT PB]","[OPEN]|[CLOSE]",&opt.d3d.main);
aitem("CHAMS CT","OFF|ON",&opt.d3d.ChamsCT,opt.d3d.main,1);
aitem("CHAMS TERO","OFF|ON",&opt.d3d.ChamsTERO,opt.d3d.main,1);
aitem("WH Glass","OFF|ON",&opt.d3d.WHGlass,opt.d3d.main,1);
acat("[OPTIONS]","[OPEN]|[CLOSE]",&opt.options.main);
aitem("Move Menu","NO|L-CTRL",&opt.options.move,opt.options.main,1);
/*aitem("Save Menu","Off|Saving",&opt.options.save,opt.options.main,1);
aitem("Load Menu","Off|Loading",&opt.options.load,opt.options.main,1);*/
aitem("Reset Menu","Off|Resetting",&opt.options.reset,opt.options.main,1);
acat("|INFO|","[OPEN]|[CLOSE]",&opt.info.main);
atext("By:","Qmo",opt.info.main,1);
atext("Version","D3D Menu 2011",opt.info.main,1);
atext("FPS",FPS(0),opt.info.main,1);
atext("Time",TIME(),opt.info.main,1);
atext("Date",DATE(),opt.info.main,1);
opt.options.save=0;
opt.options.load=0;
DrawBox(X,MC_MSY,WIDTH,(NO*I_SPC),C_BOX,pDevice);// Render Menu Backround for items
DrawBorder(X,MC_MSY,WIDTH,(NO*I_SPC),C_BORDER,pDevice);// set-up border
//-----------------------------------------------------------------------------
// Desc: Loop Threw Item Index and Render Items
//-----------------------------------------------------------------------------
for(int no=0; no<NO; no++)
{
D3DCOLOR text;
text=(*(items[no].val)>0)?C_ON:C_OFF; // Is ON OR OFF
if(items[no].type==T_CAT)
text=C_CAT; // Category
if(I_CUR==no)
{
if(BDIR==0)
(BTEX<0xFF/4)?BTEX+=1:BDIR=1;
if(BDIR==1)
(BTEX>0x00)?BTEX-=1:BDIR=0;
if(ABOR>I_SPC*I_CUR)
ABOR=I_SPC*I_CUR;
else if (ABOR<(-I_SPC*I_CUR))
ABOR=(-I_SPC*I_CUR);
if(ABOR<0)
ABOR++;
else if(ABOR>0)
ABOR--;
text=0xFF000000+(0x10000*(BTEX*4))+(0x100*(BTEX*4))+0x1*(BTEX*4);
DrawBorder(X,MC_ITEMY(no)-ABOR,WIDTH,I_SPC,C_CUR,pDevice);
}
if(mpos.x>X && mpos.x<MC_MAXX && mpos.y>MC_ITEMY(no) && mpos.y<MC_ITEMY(no)+I_SPC)
{
text=0xFF000000+(0x10000*(BTEX*4))+(0x100*(BTEX*4))+0x1*(BTEX*4);
DrawBorder(X,MC_ITEMY(no),WIDTH,I_SPC,C_CUR,pDevice);
}
font->DrawText(X+I_OFS,MC_ITEMY(no)+2,text,items[no].title,DT_SHADOW);
font->DrawText(X+S_OFS,MC_ITEMY(no)+2,text,items[no].state,DT_RIGHT|DT_SHADOW);
}
//-----------------------------------------------------------------------------
// Desc: Draw Menu Footer
//-----------------------------------------------------------------------------
DrawBox(X,MC_ITEMY(NO)+(F_SPC/2),WIDTH,(F_SPC),C_BOX,pDevice);// Draw Footer Filled
DrawBorder(X,MC_ITEMY(NO)+(F_SPC/2),WIDTH,(F_SPC),C_BORDER,pDevice);// Footer Border
font->DrawText(MC_FCTR(X,MC_MAXX),MC_ITEMY(NO)+(F_SPC/2)+2,RED,"MPGH.net",DT_CENTER|DT_SHADOW);
//-----------------------------------------------------------------------------
// Desc: Keyboard Navigation
//-----------------------------------------------------------------------------
if(left && (*items[I_CUR].val)>0)
{
(*items[I_CUR].val)-=1;
Sound.wav.playsoundmem((LPCSTR)SWITCH);
}
if(right && (*items[I_CUR].val)<(items[I_CUR].max-1))
{
(*items[I_CUR].val)+=1;
Sound.wav.playsoundmem((LPCSTR)SWITCH);
}
if(up)
{
do {
I_CUR=(I_CUR==0)?(NO-1):(I_CUR-1);
if(ABOR>(-(I_SPC)))ABOR-=I_SPC;
} while (items[I_CUR].type==T_TEXT);
Sound.wav.playsoundmem((LPCSTR)MOVE);
}
if(down || items[I_CUR].type==T_TEXT)
{
do
{
I_CUR=(I_CUR+1)%NO;
if(ABOR<(I_SPC))ABOR+=I_SPC;
} while (items[I_CUR].type==T_TEXT);
Sound.wav.playsoundmem((LPCSTR)MOVE);
}
//-----------------------------------------------------------------------------
// Desc: Menu Saftey / Sanity Checks and ReEncryption
//-----------------------------------------------------------------------------
if(I_CUR>NO)I_CUR=NO-1; // Prevent Selection From Hiding be hind hidden item
//-----------------------------------------------------------------------------
}
}
Part 3
2a. Make a new C++ file (.cpp) and give a new name ( It's up to you ) or that I recommend, then copy/paste all this code :
#QmoSound.cpp
Code:
//-----------------------------------------------------------------------------
// Copyright © November/2011. MPGH/Qmoa. All rights reserved.
// || Do not forget to credits ||
//-----------------------------------------------------------------------------
#include "QmoSound.h"
#pragma comment(lib, "WinMM.Lib")
void cSound::swav::playsound(LPCSTR sound)
{
sndPlaySound(sound,SND_ASYNC);
}
void cSound::swav::playsoundmem(LPCSTR sound)
{
sndPlaySound(sound,SND_ASYNC|SND_MEMORY);
}
Finally Completed, Although tired
but it does't matter
I hope this is useful for all members
keep spirit and Keep learning if you want to be a hack maker
If things go wrong and Sorry if my english is not good
If you have questions ? you can ask me or VM/PM me and good luck
D3D9 MENU HACK Class Part 2 by Qmo
GREETINGS MPGH LOVERS
THANKS.