D3D AimBot

Posts 1–15 of 42 · Page 1 of 3
D3D AimBot
Hello dear MPGH members and leechers
Today I am releasing a source code for D3D AimBot.
This is not a hack release, but a source code!
For the ZBUFFER;
HRESULT WINAPI Direct3DCreate9_VMTable(VOID)
{
LPDIRECT3D9 Direct3D_Object = Direct3DCreate9(D3D_SDK_VERSION);

if(Direct3D_Object == NULL)
return D3DERR_INVALIDCALL;

Direct3D_VMTable = (PDWORD)*(PDWORD)Direct3D_Object;
Direct3D_Object->Release();

DWORD dwProtect;

if(VirtualProtect(&Direct3D_VMTable[16], sizeof(DWORD), PAGE_READWRITE, &dwProtect) != 0)
{
*(PDWORD)&CreateDevice_Pointer = Direct3D_VMTable[16];
*(PDWORD)&Direct3D_VMTable[16] = (DWORD)CreateDevice_Detour;

if(VirtualProtect(&Direct3D_VMTable[16], sizeof(DWORD), dwProtect, &dwProtect) == 0)
return D3DERR_INVALIDCALL;
}
else
return D3DERR_INVALIDCALL;

return D3D_OK;
}
For the detour;
HRESULT WINAPI CreateDevice_Detour(LPDIRECT3D9 Direct3D_Object, UINT Adapter, D3DDEVTYPE DeviceType, HWND FocusWindow,
DWORD BehaviorFlags, D3DPRESENT_PARAMETERS* PresentationParameters,
LPDIRECT3DDEVICE9* Returned_Device_Interface)
{
HRESULT Returned_Result = CreateDevice_Pointer(Direct3D_Object, Adapter, DeviceType, FocusWindow, BehaviorFlags,
PresentationParameters, Returned_Device_Interface);

DWORD dwProtect;

if(VirtualProtect(&Direct3D_VMTable[16], sizeof(DWORD), PAGE_READWRITE, &dwProtect) != 0)
{
*(PDWORD)&Direct3D_VMTable[16] = *(PDWORD)&CreateDevice_Pointer;
CreateDevice_Pointer = NULL;

if(VirtualProtect(&Direct3D_VMTable[16], sizeof(DWORD), dwProtect, &dwProtect) == 0)
return D3DERR_INVALIDCALL;
}
else
return D3DERR_INVALIDCALL;

if(Returned_Result == D3D_OK)
{
Direct3D_VMTable = (PDWORD)*(PDWORD)*Returned_Device_Interface;

*(PDWORD)&Reset_Pointer = (DWORD)Direct3D_VMTable[16];
*(PDWORD)&BeginScene_Pointer = (DWORD)Direct3D_VMTable[41];
*(PDWORD)&EndScene_Pointer = (DWORD)Direct3D_VMTable[42];
*(PDWORD)&DrawIndexedPrimitive_Pointer = (DWORD)Direct3D_VMTable[82];

if(CreateThread(NULL, 0, VirtualMethodTableRepatchingLoopToCounterExtension Repatching, NULL, 0, NULL) == NULL)
return D3DERR_INVALIDCALL;
}

return Returned_Result;
}
For resetting the detour;
HRESULT WINAPI Reset_Detour(LPDIRECT3DDEVICE9 Device_Interface,
D3DPRESENT_PARAMETERS* PresentationParameters)
{

if( texOrange )
if(texOrange->Release() == S_OK)
texOrange = NULL;

if( texMaroon )
if(texMaroon->Release() == S_OK)
texMaroon = NULL;

if( texBlue )
if(texBlue->Release() == S_OK)
texBlue = NULL;

if( texLBlue )
if(texLBlue->Release() == S_OK)
texLBlue = NULL;

if( pFont )
if(pFont->Release() == S_OK)
pFont = NULL;

if( pLine )
if(pLine->Release() == S_OK)
pLine = NULL;

if( NewSurface )
if(NewSurface->Release() == S_OK)
NewSurface = NULL;

if( NewLSurface )
if(NewLSurface->Release() == S_OK)
NewLSurface = NULL;

if( originalSurface )
if(originalSurface->Release() == S_OK)
originalSurface = NULL;

if( originalDStencilSurface )
if(originalDStencilSurface->Release() == S_OK)
originalDStencilSurface = NULL;

if( OriginalShaders )
if(OriginalShaders->Release() == S_OK)
OriginalShaders = NULL;

for( int x = 0;x < NumberOfObjects;x++ )
if( shadecolor[x] )
if(shadecolor[x]->Release() == S_OK)
shadecolor[x] = NULL;

InitResources = 0x00;

return Reset_Pointer(Device_Interface, PresentationParameters);
}
For the BeginScene;
HRESULT WINAPI BeginScene_Detour(LPDIRECT3DDEVICE9 Device_Interface)
{
Device_Interface->GetViewport( &Viewport );

if( !bLoad && btIngame ){
Load();
bLoad = 0x01;
}

if( bIngameDetector )
btIngame = 0x01;
else
btIngame = 0x00;

if( !InitResources ){

/* Create Textures */
D3DXCreateTextureFromFileInMemory(Device_Interface , (LPCVOID)&bOrange, 60, &texOrange);
D3DXCreateTextureFromFileInMemory(Device_Interface , (LPCVOID)&bMaroon, 60, &texMaroon);
D3DXCreateTextureFromFileInMemory(Device_Interface , (LPCVOID)&bBlue, 60, &texBlue);
D3DXCreateTextureFromFileInMemory(Device_Interface , (LPCVOID)&bLBlue, 60, &texLBlue);

/* Create font */
D3DXCreateFont(Device_Interface, 14,0, FW_BOLD, 0, FALSE,DEFAULT_CHARSET, OUT_DEFAULT_PRECIS,
DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,TEXT("Cambria"), &pFont );

/* Create a line */
D3DXCreateLine( Device_Interface, &pLine );
pLine->SetAntialias( TRUE );
pLine->SetWidth( 2.0f );

/* Get Original Rendertarget Data */
Device_Interface->GetRenderTarget( 0,&originalSurface );
originalSurface->GetDesc( &originalSurfaceDesc );

if( originalSurface )
if(originalSurface->Release() == S_OK)
originalSurface = NULL;

/* Set The Default Radius */
Radius = Viewport.Width/8;

/* Screen size difference */
Scale = (UINT)(Viewport.Width/400);

/* Create Small RenderTarget */
Device_Interface->CreateRenderTarget( (UINT)(Viewport.Width/Scale),
(UINT)(Viewport.Height/Scale), D3DFMT_A8R8G8B8,
D3DMULTISAMPLE_NONE, 0,TRUE, &NewSurface, NULL);

/* Create Large RenderTarget */
Device_Interface->CreateRenderTarget((UINT)Viewport.Width,
(UINT)Viewport.Height, D3DFMT_A8R8G8B8, D3DMULTISAMPLE_NONE,
0, TRUE, &NewLSurface, NULL);

/* Create Shaders */
NumberOfShaders = 0;
for(int x = 1;x < 7;x++)
{
for(int y = 1;y < 7;y++)
{
for(int z = 1;z < 7;z++)
{
MyBuffer = NULL;

sprintf( MyShader, "ps.1.1\ndef c0, %f, %f, %f, %f\nmov r0,c0",
(float)((float)x*(float)40)/(float)255, (float)((float)y*(float)40)/(float)255,
(float)((float)z*(float)40)/(float)255,(float) (float)255/(float)255 );

D3DXAssembleShader( MyShader, sizeof( MyShader ), NULL, NULL, 0, &MyBuffer , NULL );

Device_Interface->CreatePixelShader((const DWORD*)MyBuffer ->GetBufferPointer(), &shadecolor[NumberOfShaders]);

color[NumberOfShaders] = (DWORD)D3DXCOLOR((float)((float)x*(float)40)/(float)255,
(float)((float)y*(float)40)/(float)255, (float)((float)z*(float)40)/(float)255,
(float) ((float)255/(float)255));

NumberOfShaders++;
}
}
}

/* Initialize StretchRect */
Device_Interface->StretchRect( NewLSurface, NULL,
NewSurface, NULL, D3DTEXF_NONE );

InitResources = 0x01;
}

/* Set The FOV */
FOV = GetDistance( Radius + Viewport.Width/2, Viewport.Width/2, 0, 0 );

/* Circle drawing */
Step = 3.14159265f * 2.0f / (float)(Radius/2);

Count = 0;

for (float index=0; index < 3.14159265 *2.0; index += Step)
{
circ1 = (float)Radius * cos(index) + (float)(Viewport.Width/2);
circ2 = (float)Radius * sin(index) + (float)(Viewport.Height/2);
circ3 = (float)Radius * cos(index+Step) + (float)(Viewport.Width/2);
circ4 = (float)Radius * sin(index+Step) + (float)(Viewport.Height/2);
LineX[Count].x = circ1;
LineX[Count].y = circ2;
LineX[Count+1].x = circ3;
LineX[Count+1].y = circ4;
Count += 2;
}

/* SetWindowHookEx */
if( !btKeyProc ){
DWORD ThdID = GetCurrentThreadId();
KeyHook = SetWindowsHookExA(WH_KEYBOARD,&KeyProc,0,ThdID);
btKeyProc = 0x01;
}

bIngameDetector = 0x00;
NumberOfObjects = 0;

return BeginScene_Pointer(Device_Interface);
}
For the pointers;
BOOL __stdcall DrawConsole( LPDIRECT3DDEVICE9 Device_Interface )
{
if( btConsole && btIngame )
{
rConsole.x1 = (Viewport.Width/2) - (Viewport.Width/4);
rConsole.y1 = (Viewport.Height/2) - (Viewport.Height/8);
rConsole.x2 = (Viewport.Width/2) + (Viewport.Width/4);
rConsole.y2 = (Viewport.Height/2) + (Viewport.Height/4);

rFont.left = rConsole.x1 + 10;
rFont.top = rConsole.y2 - 18;
rFont.right = rConsole.x2;
rFont.bottom = rConsole.y2;

rConsoleLine.x1 = rConsole.x1;
rConsoleLine.y1 = rFont.top - 6;
rConsoleLine.x2 = rConsole.x2;
rConsoleLine.y2 = rFont.top - 5;

rConsoleTitle.x1 = rConsole.x1;
rConsoleTitle.y1 = rConsole.y1 - 18;
rConsoleTitle.x2 = rConsole.x2;
rConsoleTitle.y2 = rConsole.y1;

Device_Interface->Clear( 1, &rConsole, D3DCLEAR_TARGET,
ConsoleColor, 0, 0 );

Device_Interface->Clear( 1, &rConsoleLine, D3DCLEAR_TARGET,
ConsoleLineColor, 0, 0 );

Device_Interface->Clear( 1, &rConsoleTitle, D3DCLEAR_TARGET,
ConsoleTitleColor, 0, 0 );

rConsoleLine.x1 = rConsole.x1;
rConsoleLine.y1 = rConsole.y1;
rConsoleLine.x2 = rConsole.x2;
rConsoleLine.y2 = rConsole.y1 + 1;

Device_Interface->Clear( 1, &rConsoleLine, D3DCLEAR_TARGET,
ConsoleLineColor, 0, 0 );

pFont->DrawTextA(NULL, (LPCSTR)chConsole, -1, &rFont, DT_LEFT, FontColor);

rFont.top = rConsoleTitle.y1 + 2;
rFont.bottom = rConsoleTitle.y2;

char chTitle[] = "CONSOLE";


}

return TRUE;

}
//================================================== ===================================

int __stdcall GetDistance( long x1, long x2, long y1, long y2 )
{
long ResA = (x1 - x2) * (x1 - x2);

long ResB = (y1 - y2) * (y1 - y2);

double ResC = (double)(ResA + ResB);

return (int)sqrt( ResC );
}
For the EndScene;
HRESULT WINAPI EndScene_Detour(LPDIRECT3DDEVICE9 Device_Interface)
{
DrawConsole( Device_Interface );

/* // View NewLSuface
RECT rectx;
rectx.left = Viewport.Width - (Viewport.Width/4);
rectx.top = 0;
rectx.right = Viewport.Width;
rectx.bottom = (Viewport.Height/4);

Device_Interface->GetRenderTarget( 0,&originalSurface );

Device_Interface->StretchRect( NewLSurface, NULL,
originalSurface, &rectx, D3DTEXF_NONE );

if( originalSurface ){
originalSurface->Release();
originalSurface = NULL;
}*/

int PixelCtr = 0;
POINT ClosestTarget;
ClosestTarget.x = -1;
ClosestTarget.y = -1;

/* Lock the small rendertarget to get 2d coords . auto edge included . */
if( NumberOfObjects > 0 && btIngame )
{
Device_Interface->StretchRect( NewLSurface, NULL,
NewSurface, NULL, D3DTEXF_NONE );
}

/* Draw Crosshair */
if( !btConsole && XHair && btIngame ){

int Len = 15;

Line[0].x = (float)((Viewport.Width/2));
Line[0].y = (float)((Viewport.Height/2) - Len);
Line[1].x = (float)((Viewport.Width/2));
Line[1].y = (float)((Viewport.Height/2) + Len);
pLine->Begin();
pLine->Draw(Line,2,XHairColor);
pLine->End();

Line[0].x = (float)((Viewport.Width/2) - Len);
Line[0].y = (float)((Viewport.Height/2));
Line[1].x = (float)((Viewport.Width/2) + Len);
Line[1].y = (float)((Viewport.Height/2));
pLine->Begin();
pLine->Draw(Line,2,XHairColor);
pLine->End();
}

/* Draw Circle */
if( FOV > 0 && !btConsole && btIngame ){
pLine->Begin();
pLine->Draw(LineX,Count,D3DXCOLOR(1.0, 0.0, 0.0, 1.0));
pLine->End();
}

if( NumberOfObjects > 0 && btIngame )
{
if( NewSurface->LockRect( &LOCKEDRECT, NULL,
D3DLOCK_READONLY ) == S_OK )
{
for( long scy = (long)1; scy <= (long)
( Viewport.Height / (int) +Scale ); scy++ )
{
for( long scx = (long)1; scx <= (long)
( Viewport.Width / (int) +Scale); scx++ )
{
AimAt[ PixelCtr ].x = -1;
AimAt[ PixelCtr ].y = -1;
ColorArray[ PixelCtr ] = -1;
pBits = ( LPBYTE ) LOCKEDRECT.pBits;
pBits += ( ( scy * LOCKEDRECT.Pitch )
+ ( scx * ( BITSPERPIXEL / 8 ) ) );
pColor = ( D3DCOLOR* ) pBits;
if( *pColor != NULL )
{
AimAt[ PixelCtr ].x = scx;
AimAt[ PixelCtr ].y = scy;
ColorArray[ PixelCtr ] = *pColor;
if( PixelCtr < 400000 )
PixelCtr++;
}
}
}
NewSurface->UnlockRect( );
}

/* loop through the pixel data to get colors */
int ClosestPosition = 0;

if( FOV )
ClosestPosition = +FOV;
else
ClosestPosition = (int)+Viewport.Width;

for( int i = 0; i < NumberOfObjects; i++ )
{
ColorDetector = 0x00;
TempX[i] = -1;
TempY[i] = -1;
for( int j = 0; j <= PixelCtr; j++ )
{
if( ColorArray[j] == color[i] && !ColorDetector )
{
FirstPos = j;
ColorDetector = 0x01;
}
if( ColorArray[j] == color[i] && ColorDetector )
{
LastPos = j;
}

}
if( ColorDetector )
{
TempX[i] = ( DWORD )( AimAt[FirstPos].x + AimAt[LastPos].x ) / 2;
TempY[i] = ( DWORD )( AimAt[FirstPos].y + AimAt[LastPos].y ) / 2;

TempX[i] *= Scale;
TempY[i] *= Scale;

if( +GetDistance( TempX[i], Viewport.Width/2, TempY[i],
Viewport.Height/2 ) < +ClosestPosition ){
ClosestTarget.x = TempX[i];
ClosestTarget.y = TempY[i];
}
}
}
}

if( btIngame && NumberOfObjects > 0 )
{
/* Draw esp on all objects */
for( int i = 0; i < NumberOfObjects; i++ )
{
if( TempX[i] != -1 && TempY[i] != -1 && !btConsole && ESP )
{
int Len = 4;

LineA[0].x = (float)(TempX[i] - Len);
LineA[0].y = (float)(TempY[i] - Len);
LineA[1].x = (float)(TempX[i] + Len);
LineA[1].y = (float)(TempY[i] + Len);
pLine->Begin();
pLine->Draw(LineA,2,ESPColor);
pLine->End();

LineB[0].x = (float)(TempX[i] + Len);
LineB[0].y = (float)(TempY[i] - Len);
LineB[1].x = (float)(TempX[i] - Len);
LineB[1].y = (float)(TempY[i] + Len);
pLine->Begin();
pLine->Draw(LineB,2,ESPColor);
pLine->End();
}
}

/* Aim at closest position */
if( ClosestTarget.x != -1 && ClosestTarget.y != -1 && !btConsole && AIM )
{

POINT Target;
if((DWORD)ClosestTarget.x > (Viewport.Width/2)){
Target.x = ClosestTarget.x - (Viewport.Width/2);
Target.x /= 4;
Target.x = +Target.x;
}

if((DWORD)ClosestTarget.x < (Viewport.Width/2)){
Target.x = (Viewport.Width/2) - ClosestTarget.x;
Target.x /= 4;
Target.x = -Target.x;
}

if((DWORD)ClosestTarget.x == (Viewport.Width/2)){
Target.x = 0;
}

if((DWORD)ClosestTarget.y > (Viewport.Height/2)){
Target.y = ClosestTarget.y - (Viewport.Height/2);
Target.y /= 4;
Target.y = +Target.y;
}

if((DWORD)ClosestTarget.y < (Viewport.Height/2)){
Target.y = (Viewport.Height/2) - ClosestTarget.y;
Target.y /= 4;
Target.y = -Target.y;
}

if((DWORD)ClosestTarget.y == (Viewport.Height/2)){
Target.y = 0;
}

// Use with ingame sensitivity below 1.4 in BF2
if( GetKeyState( VK_XBUTTON1 )<0 )
mouse_event( MOUSEEVENTF_MOVE, Target.x,
Target.y, 0, NULL );
}


/* Clear RenderTarget */
Device_Interface->GetRenderTarget( 0,&originalSurface );
Device_Interface->GetDepthStencilSurface( &originalDStencilSurface );
Device_Interface->SetRenderTarget( 0,NewLSurface );
Device_Interface->SetDepthStencilSurface( originalDStencilSurface );
Device_Interface->Clear( 0, NULL, D3DCLEAR_TARGET , WhiteColor, 0.0f, 0 );
Device_Interface->SetRenderTarget( 0,originalSurface );
Device_Interface->SetDepthStencilSurface( originalDStencilSurface );

if( originalSurface )
if(originalSurface->Release() == S_OK)
originalSurface = NULL;

if( originalDStencilSurface )
if(originalDStencilSurface->Release() == S_OK)
originalDStencilSurface = NULL;

}

return EndScene_Pointer(Device_Interface);
}
AimBot function;
BOOL __stdcall Aimbot(LPDIRECT3DDEVICE9 Device_Interface, D3DPRIMITIVETYPE Type,
INT Base, UINT Min, UINT Num, UINT start, UINT prim)
{
/* Filter calls to setrenderstate that distort color (incomplete) */

Device_Interface->GetRenderState( D3DRS_FOGENABLE, reinterpret_cast<DWORD*>(&FGE) );
Device_Interface->GetRenderState( D3DRS_SRGBWRITEENABLE, reinterpret_cast<DWORD*>(&SRGBE) );

/* Switch Rendertarget */
Device_Interface->GetPixelShader( &OriginalShaders );
Device_Interface->GetRenderTarget( 0,&originalSurface );
Device_Interface->GetDepthStencilSurface( &originalDStencilSurface );
Device_Interface->SetRenderTarget( 0,NewLSurface );
Device_Interface->SetDepthStencilSurface( originalDStencilSurface );

Device_Interface->SetRenderState( D3DRS_FOGENABLE, FALSE );
Device_Interface->SetRenderState( D3DRS_SRGBWRITEENABLE, FALSE );

Device_Interface->SetPixelShader( shadecolor[NumberOfObjects] );

if( AimThru ){
Device_Interface->SetRenderState( D3DRS_ZENABLE,D3DZB_FALSE );
DrawIndexedPrimitive_Pointer(Device_Interface, Type, Base, Min, Num, start, prim);
}

Device_Interface->SetRenderState( D3DRS_ZENABLE, D3DZB_TRUE );
DrawIndexedPrimitive_Pointer(Device_Interface, Type, Base, Min, Num, start, prim);

Device_Interface->SetRenderTarget( 0,originalSurface );
Device_Interface->SetDepthStencilSurface( originalDStencilSurface );
Device_Interface->SetPixelShader( OriginalShaders );

Device_Interface->SetRenderState( D3DRS_FOGENABLE, *reinterpret_cast<DWORD*>(&FGE) );
Device_Interface->SetRenderState( D3DRS_SRGBWRITEENABLE, *reinterpret_cast<DWORD*>(&SRGBE) );

if( originalSurface )
if(originalSurface->Release() == S_OK)
originalSurface = NULL;

if( originalDStencilSurface )
if(originalDStencilSurface->Release() == S_OK)
originalDStencilSurface = NULL;

if( OriginalShaders )
if(OriginalShaders->Release() == S_OK)
OriginalShaders = NULL;

if( NumberOfObjects < 216 )
NumberOfObjects++;

return TRUE;
}
Credits: @Caezer99 @zicos77

Please do not PM me about this. All PMs will be ignored.
Just need's abit of adjusting for the aimbot source code to be used on BlackShot, and find your own D3D Base.
This code is new or old code? This code already patch?
Nice info
Thanks+ Given
Quote Originally Posted by Aliimran2000 View Post
how to use?
Its a source code,if dont know what to do?so wait for them to edit it
LOL nice but i dont have logiciel to reales dll .....
Quote Originally Posted by Caezer99 View Post
Hello dear MPGH members and leechers
Today I am releasing a source code for D3D AimBot.
This is not a hack release, but a source code!
For the ZBUFFER;


For the detour;


For resetting the detour;


For the BeginScene;


For the pointers;


For the EndScene;


AimBot function;


Credits: @Caezer99 @zicos77

Please do not PM me about this. All PMs will be ignored.
Just need's abit of adjusting for the aimbot source code to be used on BlackShot, and find your own D3D Base.
Thanks given.Useful post
Killing pliz what is logiciel to reales this hack pliz ?
mmm. Free detour
Quote Originally Posted by DawgiiStylz View Post
mmm. Free detour
This is just one of my old detours I used. I believe it's undetected. Enjoy MPGH. Add
this code into your d3d, there is no need to replace the buffer.
Who to use PLIZZZ LOL PLIZ Caezer99
Likebanana who to use ? pliz comment tu fait ?
Posts 1–15 of 42 · Page 1 of 3
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?