Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Cwall.h"
- #include "CMenu.h"
- //
- #include <conio.h>
- #include <d3d9.h>
- #include <iostream>
- #include <windows.h>
- #include <vector>
- #include <stdio.h>
- #include <stdlib.h>
- #include <tchar.h>
- #include "CStruc.h"
- #pragma comment(lib, "d3d9.lib")
- //
- #include <d3dx9.h>
- #pragma comment(lib, "d3dx9.lib")
- #define NumVertices 1
- #define chams (NumVertices == 1557 || NumVertices == 1666 || NumVertices == 1765)
- LPDIRECT3DTEXTURE9 g_pTexRed = NULL;
- LPDIRECT3DTEXTURE9 g_pTexOrange = NULL;
- const BYTE red[ 58 ] = {
- 0x42, 0x4D, 0x3A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00,
- 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00
- };
- const BYTE orange[ 58 ] = {
- 0x42, 0x4D, 0x3A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00,
- 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA5, 0xFF, 0x00
- };
- //---------------------------------------------------------------------------------------------------------------------------------
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- typedef HRESULT ( WINAPI * DrawIPrim )
- ( LPDIRECT3DDEVICE9, D3DPRIMITIVETYPE,
- INT, UINT, UINT, UINT, UINT );
- void Jump( DWORD Address, DWORD Your_Detour );
- DWORD Old = NULL;
- int xhair;
- int xhair2;
- int xhair3;
- int string;
- int wireframe;
- LPD3DXFONT g_pFont;
- LPDIRECT3DDEVICE9 pDevice;
- //wepon name and all that by cardoow
- int nameTag;
- typedef bool (*w2s_)(int unknown, w2s_t * w2scalc, Vec3 vPoint, float Screen[2]);
- w2s_ w2s = (w2s_)0x514820;
- typedef w2s_t *(*GetCalc_)();
- GetCalc_ GetCalc = (GetCalc_)0x4CE3C0;
- typedef bool (*RankIcon_)(int Rank, int Prestige, DWORD ptr);
- RankIcon_ RankIcon = (RankIcon_)0x5330D0;
- //end right here
- IDirect3DPixelShader9 *Red,*Yellow,*Green,*Blue,*Purple,*Pink,*Orange,*White,*Black;
- LPDIRECT3DDEVICE9 m_pD3Ddev;
- D3DCOLOR colBlack = D3DCOLOR_XRGB( 0, 0, 0 );
- D3DCOLOR colRed = D3DCOLOR_XRGB(255, 0, 0);
- LPDIRECT3D9 pD3D;
- DrawIPrim pDrawIPrim = NULL;
- PDEVICE pDevice1;
- FONT pFont = NULL;
- DWORD dwEndscene_hook = NULL;
- DWORD dwEndscene_ret = NULL;
- DWORD dwDIP_hook = NULL;
- DWORD dwDIP_ret = NULL;
- DWORD dwReset_hook = NULL;
- DWORD dwReset_ret = NULL;
- DWORD bJump = NULL;
- D3DVIEWPORT9 Viewport;
- D3DVIEWPORT9 g_ViewPort;
- D3DRECT RectA;
- D3DRECT RectB;
- DWORD CrossHairColor = D3DCOLOR_ARGB( 255, 20, 255, 20 );
- DWORD ScreenCenterX = NULL;
- DWORD ScreenCenterY = NULL;
- //LPD3DXFONT pFont = NULL;
- HMODULE D3D9 = NULL;
- UINT fHeight = 16;
- RECT FontRect;
- D3DPRESENT_PARAMETERS D3D_PP = {0};
- IDirect3D9 * (WINAPI *oDirect3DCreate9)(UINT SDKVersion);
- //=====================================================================================
- //pixelshader Section
- HRESULT GenerateShader(IDirect3DDevice9 *pDev, IDirect3DPixelShader9 **pShader, float r, float g, float b )//credits silentk
- {
- char szShader[ 256 ];
- ID3DXBuffer *pShaderBuf = NULL;
- sprintf( szShader, "ps.1.1\ndef c0, %f, %f, %f, %f\nmov r0,c0", r, g, b, 1.0f );
- D3DXAssembleShader( szShader, sizeof( szShader ), NULL, NULL, 0, &pShaderBuf, NULL );
- if( FAILED( pDev->CreatePixelShader((const DWORD*)pShaderBuf->GetBufferPointer(), pShader)) )return E_FAIL;
- return S_OK;
- }
- //end here
- void PostReset(PDEVICE pde){
- if (pDevice1 != pde)
- {
- pDevice1 = pde;
- try
- {
- if (pFont != NULL){
- pFont->Release();
- }
- } catch (...) {}
- pFont = NULL;
- D3DXCreateFontA(pde, 14, 0, FW_BOLD, 0, 0, DEFAULT_CHARSET, OUT_TT_ONLY_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial", &pFont);
- }
- if( pFont == NULL)
- D3DXCreateFontA(pde, 14, 0, FW_BOLD, 0, 0, DEFAULT_CHARSET, OUT_TT_ONLY_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial", &pFont);
- }
- void myFillRGB( 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 );
- }
- 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);
- }
- void DisplaySomeText()
- {
- #define RED D3DCOLOR_ARGB(255, 255, 0, 0)
- #define DEEPPINK D3DCOLOR_ARGB(155, 255, 20, 147)
- #define NAVY D3DCOLOR_ARGB(255,00,00,128)
- D3DXCreateFontA(pDevice, 14, 0, FW_BOLD, 0, 0, DEFAULT_CHARSET, OUT_TT_ONLY_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial", &g_pFont );
- PrintText("._.[100x100]", 100, 100, DEEPPINK , pFont);
- PrintText("@Nukem [200x200]", 200,200,NAVY, pFont);
- PrintText("Orange[500x500]", 500,500,RED, pFont);
- PrintText("._.[100x650]", 100,650,NAVY, pFont);
- }
- VOID WINAPI MY_MAIN_ENDSCENE( LPDIRECT3DDEVICE9 pDev )
- {
- if (pFont){
- RenderMenu(pDev);
- //DisplaySomeText();
- }else{
- PostReset(pDev);
- RenderMenu(pDev);
- //DisplaySomeText();
- }
- if( pFont == NULL )
- D3DXCreateFontA( pDev, fHeight, 0, FW_BOLD, 0, TRUE,
- DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY,
- DEFAULT_PITCH | FF_DONTCARE, "Calibri", &pFont );
- if( pFont != NULL )
- {
- int istrlen = strlen( "Galaretka." ) * 3;
- FontRect.left = ScreenCenterX - istrlen;
- FontRect.top = Viewport.Height - fHeight - fHeight;
- FontRect.right = Viewport.Width;
- FontRect.bottom = Viewport.Height;
- pFont->DrawTextA( 0, "Galaretka.", -1, &FontRect,
- DT_NOCLIP, D3DCOLOR_ARGB( 255, 20, 128, 255 ) );
- }
- if (xhair)
- {
- D3DRECT rec2 = {ScreenCenterX-8, ScreenCenterY, ScreenCenterX+8, ScreenCenterY+1};
- D3DRECT rec3 = {ScreenCenterX, ScreenCenterY-8, ScreenCenterX+1, ScreenCenterY+8};
- pDev->Clear(1, &rec2, D3DCLEAR_TARGET,colRed, 0, 0);
- pDev->Clear(1, &rec3, D3DCLEAR_TARGET,colRed, 0, 0);
- DisplaySomeText();
- }
- if(xhair)
- {
- /*pDev->GetViewport(&g_ViewPort);
- ScreenCenterX = (float)g_ViewPort.Width / 2;
- ScreenCenterY = (float)g_ViewPort.Height / 2;
- D3DRECT rec4 = {ScreenCenterX-35, ScreenCenterY, ScreenCenterX+ 35, ScreenCenterY+1};
- D3DRECT rec5 = {ScreenCenterX, ScreenCenterY-35, ScreenCenterX+ 1,ScreenCenterY+35};
- pDev->Clear( 1, &rec4, D3DCLEAR_TARGET, D3DXCOLOR(0.62745098, 0.125490, 0.959999, 1.0), 0, 0 );//purple
- pDev->Clear( 1, &rec5, D3DCLEAR_TARGET, D3DXCOLOR(0.62745098, 0.125490, 0.959999, 1.0), 0, 0 );
- D3DRECT rec6 = {ScreenCenterX-30, ScreenCenterY, ScreenCenterX+ 30, ScreenCenterY+1};
- D3DRECT rec7 = {ScreenCenterX, ScreenCenterY-30, ScreenCenterX+ 1,ScreenCenterY+30};
- pDev->Clear( 1, &rec6, D3DCLEAR_TARGET, D3DXCOLOR(0.0, 0.0, 1.0, 1.0), 0, 0 );//blue
- pDev->Clear( 1, &rec7, D3DCLEAR_TARGET, D3DXCOLOR(0.0, 0.0, 1.0, 1.0), 0, 0 );
- D3DRECT rec8 = {ScreenCenterX-25, ScreenCenterY, ScreenCenterX+ 25, ScreenCenterY+1};
- D3DRECT rec9 = {ScreenCenterX, ScreenCenterY-25, ScreenCenterX+ 1,ScreenCenterY+25};
- pDev->Clear( 1, &rec8, D3DCLEAR_TARGET, D3DXCOLOR(0.0, 1.0, 1.0, 1.0), 0, 0 );//cyan
- pDev->Clear( 1, &rec9, D3DCLEAR_TARGET, D3DXCOLOR(0.0, 1.0, 1.0, 1.0), 0, 0 );
- D3DRECT rec10 = {ScreenCenterX-20, ScreenCenterY, ScreenCenterX+ 20, ScreenCenterY+1};
- D3DRECT rec11 = {ScreenCenterX, ScreenCenterY-20, ScreenCenterX+ 1,ScreenCenterY+20};
- pDev->Clear( 1, &rec10, D3DCLEAR_TARGET, D3DXCOLOR(0.0, 1.0, 0.0, 1.0), 0, 0 );// green
- pDev->Clear( 1, &rec11, D3DCLEAR_TARGET, D3DXCOLOR(0.0, 1.0, 0.0, 1.0), 0, 0 );
- D3DRECT rec12 = {ScreenCenterX-15, ScreenCenterY, ScreenCenterX+ 15, ScreenCenterY+1};
- D3DRECT rec13 = {ScreenCenterX, ScreenCenterY-15, ScreenCenterX+ 1,ScreenCenterY+15};
- pDev->Clear( 1, &rec12, D3DCLEAR_TARGET, D3DXCOLOR(1.0, 1.0, 0.0, 1.0), 0, 0 );// yellow
- pDev->Clear( 1, &rec13, D3DCLEAR_TARGET, D3DXCOLOR(1.0, 1.0, 0.0, 1.0), 0, 0 );
- D3DRECT rec14 = {ScreenCenterX-10, ScreenCenterY, ScreenCenterX+ 10, ScreenCenterY+1};
- D3DRECT rec15 = {ScreenCenterX, ScreenCenterY-10, ScreenCenterX+ 1,ScreenCenterY+10};
- pDev->Clear( 1, &rec14, D3DCLEAR_TARGET, D3DXCOLOR(1.0, 0.549019608, 0.0, 1.0), 0, 0 );// orange
- pDev->Clear( 1, &rec15, D3DCLEAR_TARGET, D3DXCOLOR(1.0, 0.549019608, 0.0, 1.0), 0, 0 );
- D3DRECT rec16 = {ScreenCenterX-5, ScreenCenterY, ScreenCenterX+ 5, ScreenCenterY+1};
- D3DRECT rec17 = {ScreenCenterX, ScreenCenterY-5, ScreenCenterX+ 1,ScreenCenterY+5};
- pDev->Clear( 1, &rec16, D3DCLEAR_TARGET, D3DXCOLOR(1.0, 0.0, 0.0, 1.0), 0, 0 );//red
- pDev->Clear( 1, &rec17, D3DCLEAR_TARGET, D3DXCOLOR(1.0, 0.0, 0.0, 1.0), 0, 0 );
- */
- }
- if (xhair2)
- {
- D3DRECT rec1 = {ScreenCenterX-25, ScreenCenterY, ScreenCenterX+ 25, ScreenCenterY+1};
- D3DRECT rec2 = {ScreenCenterX, ScreenCenterY-25, ScreenCenterX+ 1,ScreenCenterY+25};
- pDev->Clear( 1, &rec1, D3DCLEAR_TARGET, D3DXCOLOR(1.0, 0.0, 0.0, 1.0), 0, 0 );
- pDev->Clear( 1, &rec2, D3DCLEAR_TARGET, D3DXCOLOR(1.0, 0.0, 0.0, 1.0), 0, 0 );
- //red
- D3DRECT rec3 = {ScreenCenterX-15, ScreenCenterY, ScreenCenterX+ 15, ScreenCenterY+1};
- D3DRECT rec4 = {ScreenCenterX, ScreenCenterY-15, ScreenCenterX+ 1,ScreenCenterY+15};
- pDev->Clear( 1, &rec3, D3DCLEAR_TARGET, D3DXCOLOR(0.0, 0.0, 0.0, 0.0), 0, 0 );
- pDev->Clear( 1, &rec4, D3DCLEAR_TARGET, D3DXCOLOR(0.0, 0.0, 0.0, 0.0), 0, 0 );
- // black
- D3DRECT rec5 = {ScreenCenterX-3, ScreenCenterY, ScreenCenterX+ 3, ScreenCenterY+1};
- D3DRECT rec6 = {ScreenCenterX, ScreenCenterY-3, ScreenCenterX+ 1,ScreenCenterY+3};
- pDev->Clear( 1, &rec5, D3DCLEAR_TARGET, D3DXCOLOR(1.0, 0.0, 0.0, 1.0), 0, 0 );
- pDev->Clear( 1, &rec6, D3DCLEAR_TARGET, D3DXCOLOR(1.0, 0.0, 0.0, 1.0), 0, 0 );
- // black
- }
- if(xhair3)
- {
- D3DRECT rec2 = {ScreenCenterX-10, ScreenCenterY, ScreenCenterX+10, ScreenCenterY+1};
- D3DRECT rec3 = {ScreenCenterX, ScreenCenterY-10, ScreenCenterX+ 1,ScreenCenterY+10};
- pDev->Clear(1, &rec2, D3DCLEAR_TARGET,D3DXCOLOR(1.0, 0.0, 0.0, 1.0), 0, 0 );//red
- pDev->Clear(1, &rec3, D3DCLEAR_TARGET,D3DXCOLOR(1.0, 0.0, 0.0, 1.0), 0, 0 );
- }
- if(string)
- {
- /*D3DRECT rec2 = {ScreenCenterX-15, ScreenCenterY, ScreenCenterX+ 15, ScreenCenterY+2};
- D3DRECT rec3 = {ScreenCenterX, ScreenCenterY-15, ScreenCenterX+ 2,ScreenCenterY+15};
- pDev->Clear(1, &rec2, D3DCLEAR_TARGET,D3DXCOLOR(1.0, 1.0, 0.0, 1.0), 0, 0 );// yellow
- pDev->Clear(1, &rec3, D3DCLEAR_TARGET,D3DXCOLOR(1.0, 1.0, 0.0, 1.0), 0, 0 );
- */
- DisplaySomeText();
- /*
- numvert 1557 - NOGI SAS
- numvert 1666 - tułów SAS
- numvert 1765 - pas z bronią PMC
- */
- if(NumVertices == 1557 || NumVertices == 1666 || NumVertices == 1765)
- {
- pDevice->SetRenderState(D3DRS_ZENABLE,false);
- pDevice->SetRenderState( D3DRS_FILLMODE,D3DFILL_SOLID );
- pDevice->SetPixelShader(Red);
- oDrawIndexedPrimitive(pDevice, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
- pDevice->SetRenderState(D3DRS_ZENABLE,true);
- pDevice->SetRenderState( D3DRS_FILLMODE,D3DFILL_SOLID );
- pDevice->SetPixelShader(Orange);
- }
- }
- GenerateShader(pDev, &Red, 1.0f,0.0f ,0.0f);
- GenerateShader(pDev, &Yellow,1.0f,1.0f,0.0f);
- GenerateShader(pDev, &Green,0.0f,1.0f,0.0f);
- GenerateShader(pDev, &Blue,0.0f,0.0f,1.0f);
- GenerateShader(pDev, &Purple,102.0f,0,153.0f);
- GenerateShader(pDev, &Pink,255.0f,20.0f,147.0f);
- GenerateShader(pDev, &Orange,255.0f,165.0f,0.0f);
- GenerateShader(pDev, &Black,0.0f,0.0f,0.0f);
- GenerateShader(pDev, &White,1.0f,1.0f,1.0f);
- if(nameTag)
- {
- void DrawNameTags( CEntity * pEnt, float Alpha );
- }
- }
- //here is a extra methods to get info on game.
- void DrawNameTags( CEntity * pEnt, float Alpha )
- {
- DWORD dwNameTags = 0x580C30;
- __asm{
- push Alpha
- push pEnt
- push 0x0
- call [dwNameTags]
- add esp, 0xC
- }
- }
- //end here
- __declspec(naked) void MyEndscene( )
- {
- __asm
- {
- MOV DWORD PTR SS:[EBP-0x10],ESP
- MOV ESI,DWORD PTR SS:[EBP+0x8]
- XOR EBX,EBX //replace patched code
- PUSHFD
- PUSHAD
- PUSH [EBP+0x8]
- CALL MY_MAIN_ENDSCENE;
- POPAD
- POPFD
- CMP ESI,EBX //replace patched code
- jmp dwEndscene_ret; //jump back to normal endscene
- }
- }
- VOID WINAPI MY_MAIN_DIP( LPDIRECT3DDEVICE9 pDev,
- D3DPRIMITIVETYPE Type, INT BIndex, UINT MIndex,
- UINT NVertices, UINT SIndex, UINT PCount )
- {
- LPDIRECT3DVERTEXBUFFER9 Stream_Data;
- UINT Offset = 0;
- UINT Stride = 0;
- if( pDev->GetStreamSource( 0, &Stream_Data, &Offset, &Stride ) == S_OK )
- Stream_Data->Release();
- if(g_pTexRed == NULL)
- {
- D3DXCreateTextureFromFileInMemory(pDevice, (LPCVOID)&red, sizeof(red), &g_pTexRed);
- }
- if(g_pTexOrange == NULL)
- {
- D3DXCreateTextureFromFileInMemory(pDevice, (LPCVOID)&orange, sizeof(orange), &g_pTexOrange);
- }
- GenerateShader( pDevice, &Red, 1.0f, 0.0f, 0.0f);
- GenerateShader( pDevice, &Green, 0.0f, 1.0f, 0.0f);
- if( Stride == 44 )
- {
- if(wireframe)
- {
- bJump = TRUE;
- pDev->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE);
- pDev->SetPixelShader(Red);
- pDrawIPrim( pDev, Type, BIndex, MIndex,
- NVertices, SIndex, PCount );
- pDev->SetRenderState( D3DRS_ZENABLE, D3DZB_TRUE);
- pDev->SetPixelShader(White);
- bJump = FALSE;
- }
- }
- }
- __declspec(naked) void MyDIP( )
- {
- __asm
- {
- MOV EDI,DWORD PTR SS:[EBP+0x8]
- XOR EBX,EBX
- CMP EDI,EBX // replace patched code
- PUSHFD
- PUSHAD
- MOV EDX,[bJump]
- CMP EDX,0x0
- JG DONE
- PUSH [EBP+0x20] // Push arguments of DIP
- PUSH [EBP+0x1C]
- PUSH [EBP+0x18]
- PUSH [EBP+0x14]
- PUSH [EBP+0x10]
- PUSH [EBP+0x0C]
- PUSH [EBP+0x08]
- CALL MY_MAIN_DIP
- DONE: POPAD
- POPFD
- jmp dwDIP_ret; // jump back to normal DIP
- }
- }
- VOID WINAPI MY_MAIN_RESET( )
- {
- if( pFont != NULL )
- if( pFont->Release( ) == S_OK )
- pFont = NULL;
- if( pFont )
- pFont->OnLostDevice();
- if(pFont == D3D_OK) {
- if( pFont )
- pFont->OnLostDevice();
- }
- }
- /*__declspec(naked) void MyReset( )
- {
- __asm
- {
- PUSHAD
- PUSHFD
- CALL MY_MAIN_RESET
- POPFD
- POPAD
- MOV ESI,DWORD PTR SS:[EBP-0x08]
- MOV EDI,DWORD PTR SS:[EBP-0x04]
- POP EBX
- JMP dwReset_ret
- }
- }
- */
- //=====================================================================================
- VOID WINAPI GETD3D( VOID )
- {
- HWND ConsoleWindow = GetConsoleWindow( );
- //ShowWindow( ConsoleWindow, SW_HIDE ); // Your Choice ...
- while( D3D9 == NULL )
- {
- D3D9 = GetModuleHandleA( "d3d9.dll" );
- Sleep( 100 );
- }
- *(PDWORD)&oDirect3DCreate9 = (DWORD)
- GetProcAddress( D3D9, "Direct3DCreate9" );
- _cprintf( "Direct3DCreate9\n" );
- pD3D = oDirect3DCreate9( D3D_SDK_VERSION );
- D3D_PP.Windowed = TRUE;
- D3D_PP.SwapEffect = D3DSWAPEFFECT_DISCARD;
- D3D_PP.BackBufferFormat = D3DFMT_UNKNOWN;
- _cprintf( "CreateDevice\n" );
- pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
- ConsoleWindow, D3DCREATE_SOFTWARE_VERTEXPROCESSING,
- &D3D_PP, &m_pD3Ddev );
- PDWORD VTABLE = *(DWORD**)m_pD3Ddev;
- dwEndscene_hook = VTABLE[42] + 0x2A;
- dwEndscene_ret = dwEndscene_hook + 0x0A;
- dwDIP_hook = VTABLE[82] + 0x2D;
- dwDIP_ret = dwDIP_hook + 0x7;
- dwReset_hook = VTABLE[16] + 165;
- dwReset_ret = dwReset_hook + 0x7;
- *(PDWORD)&pDrawIPrim = (DWORD)VTABLE[82];
- _cprintf( "Jump\n" );
- Jump( (DWORD)dwEndscene_hook, (DWORD)MyEndscene );
- Jump( (DWORD)dwDIP_hook, (DWORD)MyDIP );
- // Jump( (DWORD)dwReset_hook, (DWORD)MyReset );
- _cprintf( "Done\n" );
- Sleep( 400 );
- m_pD3Ddev->Release( );
- pD3D->Release( );
- FreeConsole( );
- }
- //=====================================================================================
- BOOL WINAPI DllMain( HINSTANCE hModule, DWORD dwReason, LPVOID lpvReserved )
- {
- if( dwReason == DLL_PROCESS_ATTACH )
- {
- DisableThreadLibraryCalls( hModule );
- AllocConsole( );
- _cprintf( "Ready\n" );
- CreateThread( NULL, NULL, (LPTHREAD_START_ROUTINE)
- GETD3D, NULL, NULL, NULL);
- }
- return TRUE;
- }
- //=====================================================================================
- void Jump( DWORD Address, DWORD Your_Detour )
- {
- VirtualProtect( (LPVOID)Address, 5,
- PAGE_EXECUTE_READWRITE, &Old );
- *(PBYTE)Address = (BYTE)0xE9;
- *(PDWORD)(Address + 1) =
- ( Your_Detour - Address - 5) ;
- VirtualProtect( (LPVOID)Address, 5,
- Old, &Old );
- }
- //=====================================================================================
- //////////////////////HACK PART////////////////////////////////////////////////////////////////
- // group states
- int CH_cheats = 1;
- int CH_Wall = 1;
- // item states
- int a[15], b[15], c[15];
- // none standard options
- char *opt_Grp[] = { ("+"),("-") };
- char *opt_OffOn[] = { ("Off"),("On") };
- char *opt_CRSHAR[] = { ("Off"),("Blue"),("Green"),("Red"),("Orange"),("Black"),("White")};
- D3DMenu *pMenu = NULL;
- // --- simple FPS vars and function
- char sFPS[20]= "xxx Fps";
- int FPScounter = 0;
- float FPSfLastTickCount = 0.0f;
- float FPSfCurrentTickCount;
- void FPScheckW(char*str)
- {
- FPSfCurrentTickCount = clock() * 0.001f;
- FPScounter++;
- if((FPSfCurrentTickCount - FPSfLastTickCount) > 1.0f) {
- FPSfLastTickCount = FPSfCurrentTickCount;
- sprintf(str, "%d",FPScounter);
- FPScounter = 0;
- }
- }
- void MakeMenu(){
- //pMenu->AddGroup( ("[D3D Hacks]"), &CH_cheats, opt_Grp);
- if (CH_cheats) {
- pMenu->AddItem(("xhair") , &xhair , opt_OffOn);
- pMenu->AddItem(("xhair2") , &xhair2 , opt_OffOn);
- pMenu->AddItem(("xhair3") , &xhair3 , opt_OffOn);
- pMenu->AddItem(("String & chams") , &string , opt_OffOn);
- }
- if (CH_Wall)
- {
- pMenu->AddItem(("wireFrame") , &wireframe , opt_OffOn);
- pMenu->AddItem(("NameTag") , &nameTag , opt_OffOn);
- pMenu->AddText("Framerate", sFPS);
- pMenu->AddText("Galaretka Haxxery 2012");
- }
- }
- void RenderMenu(PDEVICE pDev){
- if (pMenu==0) { // first time , create the menu
- pMenu = new D3DMenu("Features",300,130,20,50, true); // title, maxitems,width
- pMenu->visible=0; // make it visible
- pMenu->col_title=0xffffffff; // change title color to white
- }
- else {
- D3DCOLOR xcolor;
- switch(a[6]){
- case 0: xcolor = D3DCOLOR_ARGB( 255, 0, 0, 255 );//("Blue"),
- break;
- case 1: xcolor = D3DCOLOR_ARGB( 255, 0, 0, 255 );//("Green"),
- break;
- case 2: xcolor = D3DCOLOR_ARGB( 255, 0, 255, 0 );//("Red"),
- break;
- case 3: xcolor = D3DCOLOR_ARGB( 255, 255, 0, 0 );//("Orange")
- break;
- case 4: xcolor = D3DCOLOR_ARGB(255 , 255 , 165 , 0 );//("Black"),
- break;
- case 5: xcolor = D3DCOLOR_ARGB (255 , 0 , 0 , 0 );//("White")
- break;
- case 6: xcolor = D3DCOLOR_ARGB (255 , 255 , 255 , 255 );
- break;
- }
- if( a[6] > 0 ){
- int size = 10, strong = 1;
- D3DVIEWPORT9 viewP;
- pDev->GetViewport( &viewP );
- int iCenterX = (viewP.Width / 2) - 1;
- int iCenterY = (viewP.Height / 2) -1;
- if( iCenterX < 10 && iCenterY < 10 )
- {
- iCenterX = ( GetSystemMetrics( 0 ) / 2 );
- iCenterY = ( GetSystemMetrics( 1 ) / 2 );
- }
- D3DRECT rec2 = {ScreenCenterX-8, ScreenCenterY, ScreenCenterX+8, ScreenCenterY+1};
- D3DRECT rec3 = {ScreenCenterX, ScreenCenterY-8, ScreenCenterX+1, ScreenCenterY+8};
- pDev->Clear(1, &rec2, D3DCLEAR_TARGET, xcolor, 0, 0);
- pDev->Clear(1, &rec3, D3DCLEAR_TARGET, xcolor, 0, 0);
- }
- if(pMenu->visible) FPScheckW(sFPS);
- if (pMenu->noitems==0) MakeMenu();
- pMenu->Show(pFont, pDev);
- pMenu->Nav();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment