FTBGUIDE

More Tutorials More Hacking
 
HomeHome  PortalPortal  CalendarCalendar  FAQFAQ  SearchSearch  MemberlistMemberlist  UsergroupsUsergroups  RegisterRegister  Log inLog in  
Log in
Username:
Password:
Log in automatically: 
:: I forgot my password
Astig FM
By: Jhun┬╗

Share | 
 

 SpecialForce DFI D3D Hack Source Code

Go down 
AuthorMessage
Crimee
C++ Coder
C++ Coder
avatar

Posts : 26
AP : 21336
Join date : 24/08/2012
Age : 21

PostSubject: SpecialForce DFI D3D Hack Source Code   Sat Nov 24, 2012 5:20 am

SpecialForce DFI D3D Hack Source

Features:
Chams // Only Character, missing addons, weapons and zombies
Crosshair
Asus
FullBright

Hotkey: Numpad 1-Crosshair; 2- Chams; 3- Fullbright; 4-Asus

Status: Undetected
Supported OS: Xp, Vista and 7

CMain.cpp
Code:
#include "CTools.h"
#include "CMain.h"
#pragma comment(lib, "d3dx9.lib")
#pragma comment(lib, "d3d9.lib")
LPDIRECT3DTEXTURE9 Red,Green;
BOOL DrawIndexedPrimitive_Check = TRUE;
DWORD DrawIndexedPrimitive_Hook;
DWORD DrawIndexedPrimitive_Jump;
BOOL DrawIndexedPrimitive_CheckPtr = FALSE;
VOID WINAPI DrawIndexedPrimitive_Breakpoint();
LONG WINAPI DrawIndexedPrimitive_Exception(EXCEPTION_POINTERS* ExceptionInfo);
HRESULT (WINAPI* DrawIndexedPrimitive_Pointer)(LPDIRECT3DDEVICE9,D3DPRIMITIVETYPE,INT,UINT,UINT,UINT,UINT);
float CenterX = 0.0f;
float CenterY = 0.0f;
VOID WINAPI DrawIndexedPrimitive_Main(LPDIRECT3DDEVICE9 pDevice,D3DPRIMITIVETYPE Type,INT BaseVertexIndex,UINT MinIndex,UINT NumVertices,UINT StartIndex,UINT PrimitiveCount)
{
LPDIRECT3DVERTEXBUFFER9 Stream;
UINT Stride;
UINT Offset;
if ( pDevice->GetStreamSource(0,&Stream,&Offset,&Stride) == D3D_OK )
{
Stream->Release();
}
DrawIndexedPrimitive_CheckPtr = TRUE;
        if(!Tools.DrawTexture)
{
Tools.GenerateTexture(pDevice,&Green,D3DCOLOR_ARGB(255,0,255,0));
Tools.GenerateTexture(pDevice,&Red,D3DCOLOR_ARGB(255,255,0,0));
Tools.DrawTexture = true;
}

if(GetAsyncKeyState(VK_NUMPAD4)&1) Tools.Asus=!Tools.Asus;
if(GetAsyncKeyState(VK_NUMPAD3)&1) Tools.FullBright=!Tools.FullBright;
if(GetAsyncKeyState(VK_NUMPAD2)&1) Tools.DrawChams=!Tools.DrawChams;
if(GetAsyncKeyState(VK_NUMPAD1)&1) Tools.DrawCrosshair=!Tools.DrawCrosshair;
pDevice->GetViewport(&Tools.pViewport);
CenterX = (float)Tools.pViewport.Width / 2;
CenterY = (float)Tools.pViewport.Height / 2;
if(Tools.DrawCrosshair)
{
D3DRECT rec1 = {CenterX-8, CenterY, CenterX+ 8+1, CenterY+1};
D3DRECT rec2 = {CenterX, CenterY-8, CenterX+ 1, CenterY+8+1};
pDevice->Clear( 1, &rec1, D3DCLEAR_TARGET, D3DCOLOR_ARGB(255,0,255,255), 0, 0 );
pDevice->Clear( 1, &rec2, D3DCLEAR_TARGET, D3DCOLOR_ARGB(255,0,255,255), 0, 0 );
D3DRECT rec3 = {CenterX-2, CenterY, CenterX+ 2+1, CenterY+1};
D3DRECT rec4 = {CenterX, CenterY-2, CenterX+ 1, CenterY+2+1};
pDevice->Clear( 1, &rec3, D3DCLEAR_TARGET, D3DCOLOR_ARGB(255,255,0,0), 0, 0 );
pDevice->Clear( 1, &rec4, D3DCLEAR_TARGET, D3DCOLOR_ARGB(255,255,0,0), 0, 0 );
}
if(Tools.DrawChams)
{
if(SSD1||SSD2||SSD3||SSD4||SSD5||SSD6||SSD7||SSD8||SSD9||PSU1||PSU2||PSU3||PSU4||PSU5||PSU6||PSU7||PSU8||PSU9||Mulan1||Mulan2||Mulan3||Mulan4||Mulan5||Mulan6||Mulan7||Mulan8||Mulan9||ForceRecon1||ForceRecon2||ForceRecon3||ForceRecon4||ForceRecon5||ForceRecon6||ForceRecon7||ForceRecon8||ForceRecon9||SRG1||SRG2||SRG3||SRG4||SRG5||SRG6||SRG7||SRG8||SRG9||KSF1||KSF2||KSF3||KSF4||KSF5||KSF6||KSF7||KSF8||KSF9||SAS1||SAS2||SAS3||SAS4||SAS5||SAS6||SAS7||SAS8||ROKMC1||ROKMC2||ROKMC3||ROKMC4||ROKMC5||ROKMC6||GSG91||GSG92||GSG93||GSG94||GSG95||GSG96||GSG97||GSG98||GSG99||GIGN1||GIGN2||GIGN3||GIGN4||GIGN5||GIGN6||Delta||Spetsnaz1||Spetsnaz2||Spetsnaz3||Spetsnaz4||Spetsnaz5||Spetsnaz6||PASKAL1||PASKAL2||PASKAL3||RISA1||RISA2||RISA3||BlackDevil1||BlackDevil2||BlackDevil3||BlackDevil4||BlackDevil5)
{
pDevice->SetRenderState(D3DRS_ZENABLE,FALSE);
pDevice->SetTexture( 0, Red ); // Disable for Naked
DrawIndexedPrimitive_Pointer(pDevice,Type,BaseVertexIndex,MinIndex,NumVertices,StartIndex,PrimitiveCount);
pDevice->SetTexture( 0, Green ); // Disable for Naked
pDevice->SetRenderState(D3DRS_ZENABLE,TRUE);
}
}
if(Tools.FullBright)
{
if(Stride == 40) pDevice->SetRenderState(D3DRS_LIGHTING, false);
}
if(!Tools.FullBright)
{
if(Stride == 40) pDevice->SetRenderState(D3DRS_LIGHTING, true);
}
if(Tools.Asus)
{
if(Stride == 40)
{
pDevice->SetRenderState( D3DRS_SRCBLEND, 2 );
pDevice->SetRenderState( D3DRS_DESTBLEND, 3 );
pDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, true );
}
}
if(!Tools.Asus)
{
if(Stride == 40)
{
pDevice->SetRenderState( D3DRS_SRCBLEND, 0 );
pDevice->SetRenderState( D3DRS_DESTBLEND, 0 );
pDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, false );
}
}
DrawIndexedPrimitive_CheckPtr = FALSE;
}
__declspec(naked)VOID WINAPI DrawIndexedPrimitive_Call()
{
if ( DrawIndexedPrimitive_Check == TRUE )
{
DrawIndexedPrimitive_Breakpoint();
DrawIndexedPrimitive_Check = FALSE;
}
if ( Tools.CheckWindowsVersion(6,1,VER_NT_WORKSTATION) || Tools.CheckWindowsVersion(6,0,VER_NT_WORKSTATION) )
{
__asm
{
MOV EDI,DWORD PTR SS:[EBP+0x8] // --- Vista and 7
XOR EBX,EBX   
CMP EDI,EBX
PUSHFD
PUSHAD
JMP SEXY
}
}
if ( Tools.CheckWindowsVersion(5,1,VER_NT_WORKSTATION) || Tools.CheckWindowsVersion(5,2,VER_NT_WORKSTATION) )
{
__asm
{
PUSH EBX // --- XP
PUSH ESI
MOV ESI,dword ptr ss:[ebp+8]
PUSHFD
PUSHAD
JMP SEXY
}
}
__asm
{
SEXY:
                        MOV EDX,[DrawIndexedPrimitive_CheckPtr]
CMP EDX,0x0
JG Jump
PUSH [EBP+0x20]
PUSH [EBP+0x1C]
PUSH [EBP+0x18]
PUSH [EBP+0x14]
PUSH [EBP+0x10]
PUSH [EBP+0xC]
PUSH [EBP+0x8]
                CALL [DrawIndexedPrimitive_Main]
Jump:
                        POPAD
                        POPFD
CMP EDI,EBX
JMP [DrawIndexedPrimitive_Jump]
}
}
LONG WINAPI DrawIndexedPrimitive_Exception(EXCEPTION_POINTERS* ExceptionInfo)
{
if ( ExceptionInfo->ExceptionRecord->ExceptionCode == EXCEPTION_SINGLE_STEP && (DWORD)ExceptionInfo->ExceptionRecord->ExceptionAddress == DrawIndexedPrimitive_Hook )
{
ExceptionInfo->ContextRecord->Eip = (DWORD)DrawIndexedPrimitive_Call;
return ( EXCEPTION_CONTINUE_EXECUTION );
}
return ( EXCEPTION_CONTINUE_SEARCH );
}
VOID WINAPI DrawIndexedPrimitive_Breakpoint()
{
AddVectoredExceptionHandler((rand()%0xFFFFFF),DrawIndexedPrimitive_Exception);
CONTEXT Context = {CONTEXT_DEBUG_REGISTERS};
Context.Dr0 = DrawIndexedPrimitive_Hook;
Context.Dr7 = 0x1;
SetThreadContext(GetCurrentThread(),&Context);
}
}
}
VOID WINAPI D3DHack()
{
PDWORD dwD3DVTable;
do
{
*(DWORD*)&dwD3DVTable = *(DWORD*)Tools.D3D9vTable();
}
while ( !dwD3DVTable );
if ( Tools.CheckWindowsVersion(6,1,VER_NT_WORKSTATION) || Tools.CheckWindowsVersion(6,0,VER_NT_WORKSTATION) )
{
        DrawIndexedPrimitive_Hook = ( dwD3DVTable[82] + 0x2D );
        DrawIndexedPrimitive_Jump = ( DrawIndexedPrimitive_Hook + 0x7 );
        *(PDWORD)(&DrawIndexedPrimitive_Pointer) = (DWORD)dwD3DVTable[82];
Tools.DetourCreate((BYTE*)DrawIndexedPrimitive_Hook,(BYTE*)DrawIndexedPrimitive_Call,5);
}
else if( Tools.CheckWindowsVersion(5,1,VER_NT_WORKSTATION) || Tools.CheckWindowsVersion(5,2,VER_NT_WORKSTATION) )
{
DrawIndexedPrimitive_Hook = ( dwD3DVTable[82] + 0x1D );
        DrawIndexedPrimitive_Jump = ( DrawIndexedPrimitive_Hook + 0x5 );
        *(PDWORD)(&DrawIndexedPrimitive_Pointer) = (DWORD)dwD3DVTable[82];
Tools.DetourCreate((BYTE*)DrawIndexedPrimitive_Hook,(BYTE*)DrawIndexedPrimitive_Call,5);
}
else
{
MessageBoxA(GetActiveWindow()," CoderName: Your System IsN't Supported","Error",MB_OK);
ExitProcess(0);
}
}
BOOL WINAPI DllMain(HMODULE hModule,DWORD dwReason,LPVOID lpReserved)
{
UNREFERENCED_PARAMETER(lpReserved);
if ( dwReason == DLL_PROCESS_ATTACH )
{
CreateThread(0,0,(LPTHREAD_START_ROUTINE)D3DHack,0,0,0);
}
return ( TRUE );
}

CMain.h
Code:
//----- Special Force Character Defines------------------------------------------------------------------------------------------------------------------------
//----- SSD Character
#define SSD1 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==0) && (NumVertices==130) && (StartIndex==0) && (PrimitiveCount==213))
#define SSD2 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==130) && (NumVertices==100) && (StartIndex==639) && (PrimitiveCount==146))
#define SSD3 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==230) && (NumVertices==113) && (StartIndex==1077) && (PrimitiveCount==168))
#define SSD4 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==343) && (NumVertices==525) && (StartIndex==1581) && (PrimitiveCount==716))
#define SSD5 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==868) && (NumVertices==130) && (StartIndex==3729) && (PrimitiveCount==213))
#define SSD6 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==998) && (NumVertices==100) && (StartIndex==4368) && (PrimitiveCount==146))
#define SSD7 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==1098) && (NumVertices==113) && (StartIndex==4806) && (PrimitiveCount==168))
#define SSD8 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==1211) && (NumVertices==260) && (StartIndex==5310) && (PrimitiveCount==394))
#define SSD9 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==1471) && (NumVertices==591) && (StartIndex==6492) && (PrimitiveCount==948))
//----- End SSD Character
//----- PSU Character
#define PSU1 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==0) && (NumVertices==87) && (StartIndex==0) && (PrimitiveCount==139))
#define PSU2 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==87) && (NumVertices==79) && (StartIndex==417) && (PrimitiveCount==105))
#define PSU3 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==166) && (NumVertices==126) && (StartIndex==732) && (PrimitiveCount==172))
#define PSU4 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==292) && (NumVertices==555) && (StartIndex==1248) && (PrimitiveCount==740))
#define PSU5 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==847) && (NumVertices==87) && (StartIndex==3468) && (PrimitiveCount==139))
#define PSU6 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==934) && (NumVertices==79) && (StartIndex==3885) && (PrimitiveCount==105))
#define PSU7 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==1013) && (NumVertices==126) && (StartIndex==4200) && (PrimitiveCount==172))
#define PSU8 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==1139) && (NumVertices==499) && (StartIndex==4716) && (PrimitiveCount==624))
#define PSU9 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==1638) && (NumVertices==523) && (StartIndex==6588) && (PrimitiveCount==846))
//----- End PSU Character
//----- Mulan Character
#define Mulan1 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==0) && (NumVertices==90) && (StartIndex==0) && (PrimitiveCount==146))
#define Mulan2 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==90) && (NumVertices==118) && (StartIndex==438) && (PrimitiveCount==126))
#define Mulan3 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==208) && (NumVertices==121) && (StartIndex==816) && (PrimitiveCount==180))
#define Mulan4 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==329) && (NumVertices==299) && (StartIndex==1356) && (PrimitiveCount==452))
#define Mulan5 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==628) && (NumVertices==90) && (StartIndex==2712) && (PrimitiveCount==146))
#define Mulan6 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==718) && (NumVertices==124) && (StartIndex==3150) && (PrimitiveCount==126))
#define Mulan7 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==842) && (NumVertices==121) && (StartIndex==3528) && (PrimitiveCount==180))
#define Mulan8 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==963) && (NumVertices==295) && (StartIndex==4068) && (PrimitiveCount==482))
#define Mulan9 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==1258) && (NumVertices==474) && (StartIndex==5514) && (PrimitiveCount==728))
//----- End Mulan Character
//----- ForceRecon Character
#define ForceRecon1 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==0) && (NumVertices==83) && (StartIndex==0) && (PrimitiveCount==137))
#define ForceRecon2 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==83) && (NumVertices==79) && (StartIndex==411) && (PrimitiveCount==105))
#define ForceRecon3 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==162) && (NumVertices==142) && (StartIndex==726) && (PrimitiveCount==174))
#define ForceRecon4 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==304) && (NumVertices==278) && (StartIndex==1248) && (PrimitiveCount==462))
#define ForceRecon5 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==582) && (NumVertices==83) && (StartIndex==2634) && (PrimitiveCount==137))
#define ForceRecon6 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==665) && (NumVertices==79) && (StartIndex==3045) && (PrimitiveCount==105))
#define ForceRecon7 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==744) && (NumVertices==142) && (StartIndex==3360) && (PrimitiveCount==174))
#define ForceRecon8 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==886) && (NumVertices==263) && (StartIndex==3882) && (PrimitiveCount==290))
#define ForceRecon9 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==1149) && (NumVertices==316) && (StartIndex==4752) && (PrimitiveCount==556))
//----- End ForceRecon Character
//----- SRG Character
#define SRG1 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==0) && (NumVertices==159) && (StartIndex==0) && (PrimitiveCount==200))
#define SRG2 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==159) && (NumVertices==100) && (StartIndex==600) && (PrimitiveCount==121))
#define SRG3 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==259) && (NumVertices==132) && (StartIndex==963) && (PrimitiveCount==180))
#define SRG4 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==391) && (NumVertices==338) && (StartIndex==1503) && (PrimitiveCount==534))
#define SRG5 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==729) && (NumVertices==105) && (StartIndex==3105) && (PrimitiveCount==168))
#define SRG6 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==834) && (NumVertices==100) && (StartIndex==3609) && (PrimitiveCount==121))
#define SRG7 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==934) && (NumVertices==132) && (StartIndex==3972) && (PrimitiveCount==180))
#define SRG8 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==1066) && (NumVertices==804) && (StartIndex==4512) && (PrimitiveCount==1016))
#define SRG9 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==1870) && (NumVertices==448) && (StartIndex==7560) && (PrimitiveCount==776))
//----- End SRG Character
//----- KSF Character
#define KSF1 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==0) && (NumVertices==75) && (StartIndex==0) && (PrimitiveCount==121))
#define KSF2 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==75) && (NumVertices==92) && (StartIndex==363) && (PrimitiveCount==115))
#define KSF3 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==167) && (NumVertices==124) && (StartIndex==708) && (PrimitiveCount==168))
#define KSF4 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==291) && (NumVertices==301) && (StartIndex==1212) && (PrimitiveCount==522))
#define KSF5 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==592) && (NumVertices==75) && (StartIndex==2778) && (PrimitiveCount==121))
#define KSF6 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==667) && (NumVertices==92) && (StartIndex==3141) && (PrimitiveCount==115))
#define KSF7 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==759) && (NumVertices==124) && (StartIndex==3486) && (PrimitiveCount==168))
#define KSF8 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==883) && (NumVertices==187) && (StartIndex==3990) && (PrimitiveCount==288))
#define KSF9 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==1070) && (NumVertices==353) && (StartIndex==4854) && (PrimitiveCount==556))
//----- End KSF Character
//----- SAS Character
#define SAS1 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==75) && (NumVertices==85) && (StartIndex==363) && (PrimitiveCount==105))
#define SAS2 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==160) && (NumVertices==124) && (StartIndex==678) && (PrimitiveCount==168))
#define SAS3 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==284) && (NumVertices==370) && (StartIndex==1182) && (PrimitiveCount==650))
#define SAS4 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==654) && (NumVertices==75) && (StartIndex==3132) && (PrimitiveCount==121))
#define SAS5 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==729) && (NumVertices==85) && (StartIndex==3495) && (PrimitiveCount==105))
#define SAS6 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==814) && (NumVertices==124) && (StartIndex==3810) && (PrimitiveCount==168))
#define SAS7 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==938) && (NumVertices==180) && (StartIndex==4314) && (PrimitiveCount==274))
#define SAS8 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==1118) && (NumVertices==367) && (StartIndex==5136) && (PrimitiveCount==612))
//----- End SAS Character
//----- ROKMC Character
#define ROKMC1 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==284) && (NumVertices==365) && (StartIndex==1182) && (PrimitiveCount==642))
#define ROKMC2 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==649) && (NumVertices==75) && (StartIndex==3108) && (PrimitiveCount==121))
#define ROKMC3 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==724) && (NumVertices==85) && (StartIndex==3471) && (PrimitiveCount==105))
#define ROKMC4 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==809) && (NumVertices==124) && (StartIndex==3786) && (PrimitiveCount==168))
#define ROKMC5 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==933) && (NumVertices==194) && (StartIndex==4290) && (PrimitiveCount==260))
#define ROKMC6 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==1127) && (NumVertices==379) && (StartIndex==5070) && (PrimitiveCount==592))
//----- End ROKMC Character
//----- GSG9 Character
#define GSG91 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==75) && (NumVertices==88) && (StartIndex==363) && (PrimitiveCount==105))
#define GSG92 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==163) && (NumVertices==124) && (StartIndex==678) && (PrimitiveCount==168))
#define GSG93 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==287) && (NumVertices==369) && (StartIndex==1182) && (PrimitiveCount==650))
#define GSG94 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==656) && (NumVertices==75) && (StartIndex==3132) && (PrimitiveCount==121))
#define GSG95 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==731) && (NumVertices==88) && (StartIndex==3495) && (PrimitiveCount==105))
#define GSG96 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==819) && (NumVertices==124) && (StartIndex==3810) && (PrimitiveCount==168))
#define GSG97 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==943) && (NumVertices==196) && (StartIndex==4314) && (PrimitiveCount==314))
#define GSG98 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==1139) && (NumVertices==355) && (StartIndex==5256) && (PrimitiveCount==568))
#define GSG99 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==1494) && (NumVertices==22) && (StartIndex==6960) && (PrimitiveCount==24))
//----- End GSG9 Character
//----- GIGN Character
#define GIGN1 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==284) && (NumVertices==369) && (StartIndex==1182) && (PrimitiveCount==650))
#define GIGN2 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==653) && (NumVertices==75) && (StartIndex==3132) && (PrimitiveCount==121))
#define GIGN3 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==728) && (NumVertices==85) && (StartIndex==3495) && (PrimitiveCount==105))
#define GIGN4 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==813) && (NumVertices==124) && (StartIndex==3810) && (PrimitiveCount==168))
#define GIGN5 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==937) && (NumVertices==212) && (StartIndex==4314) && (PrimitiveCount==306))
#define GIGN6 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==1149) && (NumVertices==362) && (StartIndex==5232) && (PrimitiveCount==604))
//----- End GIGN Character
//----- Delta Character
#define Delta ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==1118) && (NumVertices==349) && (StartIndex==5136) && (PrimitiveCount==580))
//----- End Delta Character
//----- Spetsnaz Character
#define Spetsnaz1 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==284) && (NumVertices==380) && (StartIndex==1182) && (PrimitiveCount==658))
#define Spetsnaz2 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==664) && (NumVertices==75) && (StartIndex==3156) && (PrimitiveCount==121))
#define Spetsnaz3 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==739) && (NumVertices==85) && (StartIndex==3519) && (PrimitiveCount==105))
#define Spetsnaz4 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==824) && (NumVertices==124) && (StartIndex==3834) && (PrimitiveCount==168))
#define Spetsnaz5 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==948) && (NumVertices==183) && (StartIndex==4338) && (PrimitiveCount==268))
#define Spetsnaz6 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==1131) && (NumVertices==361) && (StartIndex==5142) && (PrimitiveCount==604))
//----- End Spetsnaz Character
//----- New Character Defines
#define PASKAL1 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==0) && (NumVertices==1441) && (StartIndex==0) && (PrimitiveCount==1776))
#define PASKAL2 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==1441) && (NumVertices==1631) && (StartIndex==5328) && (PrimitiveCount==1577))
#define PASKAL3 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==3072) && (NumVertices==122) && (StartIndex==10059) && (PrimitiveCount==128))
#define RISA1 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==0) && (NumVertices==1516) && (StartIndex==0) && (PrimitiveCount==2122))
#define RISA2 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==1516) && (NumVertices==713) && (StartIndex==6366) && (PrimitiveCount==962))
#define RISA3 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==2229) && (NumVertices==214) && (StartIndex==9252) && (PrimitiveCount==130))
#define BlackDevil1 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==0) && (NumVertices==1322) && (StartIndex==0) && (PrimitiveCount==1674))
#define BlackDevil2 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==1322) && (NumVertices==1091) && (StartIndex==5022) && (PrimitiveCount==1702))
#define BlackDevil3 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==2413) && (NumVertices==8) && (StartIndex==10128) && (PrimitiveCount==6))
#define BlackDevil4 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==2421) && (NumVertices==8) && (StartIndex==10146) && (PrimitiveCount==6))
#define BlackDevil5 ((Stride==40) && (BaseVertexIndex==0) && (MinIndex==2429) && (NumVertices==10) && (StartIndex==10164) && (PrimitiveCount==8))
//----- End New Character Defines
//----- End Special Force Character Defines-----------------------------------------------------------------------------------------------------------------------


CTools.cpp

Code:
#include "CTools.h"
CTools Tools;
DWORD CTools::D3D9VTable()
{
DWORD dwObjBase = (DWORD)LoadLibraryA("D3D9.DLL");
while ( dwObjBase++ < dwObjBase + 0x127850 )
{
        if ( (*(WORD*)(dwObjBase + 0x00)) == 0x06C7 && (*(WORD*)(dwObjBase + 0x06)) == 0x8689 && (*(WORD*)(dwObjBase + 0x0C)) == 0x8689 )
{
dwObjBase += 2;
break;
}
}
return ( dwObjBase );
}
BOOL CTools::CheckWindowsVersion(DWORD dwMajorVersion,DWORD dwMinorVersion,DWORD dwProductType)
{
OSVERSIONINFOEX VersionInfo;
ZeroMemory(&VersionInfo,sizeof(OSVERSIONINFOEX));
VersionInfo.dwOSVersionInfoSize = sizeof(VersionInfo);
GetVersionEx((OSVERSIONINFO*)&VersionInfo);
if ( VersionInfo.dwMajorVersion == dwMajorVersion )
{
if ( VersionInfo.dwMinorVersion == dwMinorVersion )
{
if ( VersionInfo.wProductType == dwProductType )
{
return ( TRUE );
}
}
}
return ( FALSE );
}
void *CTools::DetourCreate(BYTE *src, const BYTE *dst, const int len)
{
BYTE *jmp = (BYTE*)malloc(len+5);
DWORD dwBack;
VirtualProtect(src, len, PAGE_EXECUTE_READWRITE, &dwBack);
memcpy(jmp, src, len);
jmp += len;
jmp[0] = 0xE9;
*(DWORD*)(jmp+1) = (DWORD)(src+len - jmp) - 5;
src[0] = 0xE9;
*(DWORD*)(src+1) = (DWORD)(dst - src) - 5;
for (int i=5; i<len; i++) src[i]=0x90;
VirtualProtect(src, len, dwBack, &dwBack);
return (jmp-len);
}
HRESULT CTools::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;
}


CTools.h

Code:
#include <windows.h>
#include <d3d9.h>
#include <d3dx9.h>
class CTools
{
public:
D3DVIEWPORT9 pViewport;
BOOL DrawTexture;
BOOL DrawCrosshair;
BOOL DrawChams;
BOOL FullBright;
BOOL Asus;
DWORD D3D9VTable();
BOOL CheckWindowsVersion(DWORD dwMajorVersion,DWORD dwMinorVersion,DWORD dwProductType);
void *DetourCreate( BYTE *src, const BYTE *dst, const int len );
HRESULT GenerateTexture( IDirect3DDevice9 *pD3Ddev, IDirect3DTexture9 **ppD3Dtex, DWORD colour32 );
};
extern CTools Tools;


Require:
Brain.exe
C++

Back to top Go down
View user profile
 
SpecialForce DFI D3D Hack Source Code
Back to top 
Page 1 of 1
 Similar topics
-
» Building setback??

Permissions in this forum:You cannot reply to topics in this forum
FTBGUIDE :: MMO FPS Games :: Soldier Front/Special Force (Tools,Tutorials,SourceCode)-
Jump to: