Simple D3D9 Aimbot

Posts 16–30 of 51 · Page 2 of 4
Quote Originally Posted by lvous View Post
I don't play anymore but I used this:

Logged the shader
// cbPerObjectBones c0 204
// cbSharedPerView c204 4
// cbPerObject c223 4

and then by trial and error:
Code:
D3DXMATRIX ProjMatrix, ViewMatrix, WorldMatrix;
D3DXVECTOR3 VectorMiddle(0, 0, 0), ScreenMiddle(0, 0, 0);

Device->GetVertexShaderConstantF(204, ProjMatrix, 4); 
Device->GetVertexShaderConstantF(223, ViewMatrix, 4); 

D3DXMatrixIdentity(&WorldMatrix);
D3DXMatrixTranspose(&ViewMatrix, &ViewMatrix);
D3DXMatrixTranspose(&ProjMatrix, &ProjMatrix);

D3DXVec3Project(&VectorMiddle, &pModel->Position3D, &Viewport, &ProjMatrix, &ViewMatrix, &WorldMatrix);

if (VectorMiddle.z < 1.0f && ProjMatrix._44 < 1.0f) //not sure
{
	pModel->Position2D.x = VectorMiddle.x;
	pModel->Position2D.y = VectorMiddle.y;
}
I don't see any boxes now, am I missing something? :P
Code:
void Worldtoscreen(LPDIRECT3DDEVICE9 Device)
{
	ModelInfo_t* pModel = new ModelInfo_t;

	D3DXMATRIX ProjMatrix, ViewMatrix, WorldMatrix;
	D3DXVECTOR3 VectorMiddle(0, 0, 0), ScreenMiddle(0, 0, 0);

	Device->GetVertexShaderConstantF(204, ProjMatrix, 4); 
	Device->GetVertexShaderConstantF(223, ViewMatrix, 4); 

	D3DXMatrixIdentity(&WorldMatrix);
	D3DXMatrixTranspose(&ViewMatrix, &ViewMatrix);
	D3DXMatrixTranspose(&ProjMatrix, &ProjMatrix);

	D3DXVec3Project(&VectorMiddle, &pModel->Position3D, &Viewport, &ProjMatrix, &ViewMatrix, &WorldMatrix);

	if (VectorMiddle.z < 1.0f && ProjMatrix._44 < 1.0f) //not sure
	{
		pModel->Position2D.x = VectorMiddle.x;
		pModel->Position2D.y = VectorMiddle.y;
	}
}
Quote Originally Posted by ves23 View Post
I don't see any boxes now, am I missing something? :P
can't test but remove this line "if (VectorMiddle.z < 1.0f && ProjMatrix._44 < 1.0f)" and look if it works. If not, you have to log the shader and look whether or not this changed:
// cbSharedPerView c204 4
// cbPerObject c223 4
Quote Originally Posted by lvous View Post
223
I don't know how to log the shader. Is it bad if I use stride and set texture? I had problems with set pixel shader, models would become transparent in heroes and generals, and I dont know to make them work
Quote Originally Posted by ves23 View Post
I don't know how to log the shader. Is it bad if I use stride and set texture? I had problems with set pixel shader, models would become transparent in heroes and generals, and I dont know to make them work
Stride and SetTexture(1.. worked for me, pixel shader was buggy. To log the shader use this:
Code:
void doDisassembleShader(LPDIRECT3DDEVICE9 pDevice,char* FileName)
{
    std::ofstream oLogFile(FileName,std::ios::trunc);
    if (!oLogFile.is_open())
        return;
    IDirect3DVertexShader9* pShader;
    pDevice->GetVertexShader(&pShader);
    UINT pSizeOfData;
    pShader->GetFunction(NULL,&pSizeOfData);
    BYTE* pData = new BYTE[pSizeOfData];
    pShader->GetFunction(pData,&pSizeOfData);
    LPD3DXBUFFER bOut;
    D3DXDisassembleShader(reinterpret_cast<DWORD*>(pData),NULL,NULL,&bOut);
    oLogFile << static_cast<char*>(bOut->GetBufferPointer()) << std::endl;
    oLogFile.close();
    delete[] pData;
    pShader->Release();
}

in drawindexedp:

if(Stride == 40)
if (GetAsyncKeyState(VK_F9) & 1)
	doDisassembleShader(pDevice, "shader1.txt");
or
if (GetAsyncKeyState(VK_F10) & 1)
if(Stride == 40)
	doDisassembleShader(pDevice, "shader2.txt");
Quote Originally Posted by lvous View Post
Stride and SetTexture(1.. worked for me, pixel shader was buggy. To log the shader use this:
Logged the pixel shader = pastebin . com/e35jXu32
and the vertex shader = pastebin . com/wuuNFZCc
Quote Originally Posted by ves23 View Post
Logged the pixel shader = pastebin . com/e35jXu32
and the vertex shader = pastebin . com/wuuNFZCc
Looks similar to what I logged two patches ago, so worldtoscreen should work. I left out GetViewport maybe that's the problem?
Code:
..
Device->GetViewport(&Viewport);
Device->GetVertexShaderConstantF(204, ProjMatrix, 4); 
Device->GetVertexShaderConstantF(223, ViewMatrix, 4); 
..
Quote Originally Posted by lvous View Post
Looks similar to what I logged two patches ago, so worldtoscreen should work. I left out GetViewport maybe that's the problem?
Code:
..
Device->GetViewport(&Viewport);
Device->GetVertexShaderConstantF(204, ProjMatrix, 4); 
Device->GetVertexShaderConstantF(223, ViewMatrix, 4); 
..
Works :P puu.sh/hjnd7/c3444eb5e3.jpg Aiming at feet, but I guess I'll find the head chams, or body chams. Or maybe just fix the Y coord where the mouse goes.

Thanks for your source, your time, and the will to help some random guy

Code:
void Worldtoscreen(LPDIRECT3DDEVICE9 Device)
{
	ModelInfo_t* pModel = new ModelInfo_t;

	D3DXMATRIX ProjMatrix, ViewMatrix, WorldMatrix;
	D3DXVECTOR3 VectorMiddle(0, 0, 0), ScreenMiddle(0, 0, 0);

	Device->GetViewport(&Viewport);
	Device->GetVertexShaderConstantF(204, ProjMatrix, 4); 
	Device->GetVertexShaderConstantF(223, ViewMatrix, 4); 

	D3DXMatrixIdentity(&WorldMatrix);
	D3DXMatrixTranspose(&ViewMatrix, &ViewMatrix);
	D3DXMatrixTranspose(&ProjMatrix, &ProjMatrix);

	D3DXVec3Project(&VectorMiddle, &pModel->Position3D, &Viewport, &ProjMatrix, &ViewMatrix, &WorldMatrix);

// 	if (VectorMiddle.z < 1.0f && ProjMatrix._44 < 1.0f) //not sure
// 	{
		pModel->Position2D.x = VectorMiddle.x;
		pModel->Position2D.y = VectorMiddle.y;
	//}
	ModelInfo.push_back(pModel);
}
Quote Originally Posted by ves23 View Post
Works :P puu.sh/hjnd7/c3444eb5e3.jpg Aiming at feet, but I guess I'll find the head chams, or body chams. Or maybe just fix the Y coord where the mouse goes.

Thanks for your source, your time, and the will to help some random guy
Glad it works, I think you can adjust height if you edit the last value of ScreenMiddle or pModel->Position3D somehow, try this:
Code:
..
D3DXVECTOR3 VectorMiddle(0, 0, 0), ScreenMiddle(0, 0, (float)aimheight);
pModel->Position3D = ScreenMiddle;
..
Quote Originally Posted by lvous View Post
Glad it works, I think you can adjust height if you edit the last value of ScreenMiddle or pModel->Position3D somehow, try this:
Code:
..
D3DXVECTOR3 VectorMiddle(0, 0, 0), ScreenMiddle(0, 0, (float)aimheight);
pModel->Position3D = ScreenMiddle;
..
Hey I can use this W2S? too.

Code:
bool WorldToScreen(D3DXVECTOR3 inpos, D3DXVECTOR3 &outpos, LPDIRECT3DDEVICE9 pDevice)
{
	DWORD dwRenderData = (DWORD)GetModuleHandleA("i3GfxDx.dll") + 00000;
	CRenderData* RenderData = (CRenderData*)(dwRenderData);

	D3DXVECTOR3 vScreen;
	D3DVIEWPORT9 g_ViewPort;

	pDevice->GetViewport(&g_ViewPort);
	g_ViewPort.X = g_ViewPort.Y = 0;
	g_ViewPort.MinZ = 0;
	g_ViewPort.MaxZ = 1;
	D3DXVec3Project(&vScreen, &inpos, &g_ViewPort,
		&RenderData->RenderData->ProjectMatrix,
		&RenderData->RenderData->ViewMatrix,
		&RenderData->RenderData->WorldMatrix);

	if (vScreen.z < 1.0f && vScreen.x > 0.0f && vScreen.y > 0.0f && vScreen.x < g_ViewPort.Width && vScreen.y < g_ViewPort.Height)
	{
		outpos.x = vScreen.x;
		outpos.y = vScreen.y;
		outpos.z = vScreen.z;

		return true;
	}

	return false;
}
Quote Originally Posted by Jhem View Post
Hey I can use this W2S? too.

Code:
bool WorldToScreen(D3DXVECTOR3 inpos, D3DXVECTOR3 &outpos, LPDIRECT3DDEVICE9 pDevice)
{
	DWORD dwRenderData = (DWORD)GetModuleHandleA("i3GfxDx.dll") + 00000;
	CRenderData* RenderData = (CRenderData*)(dwRenderData);
..
which game pointblank? if you have the classes and the right offset then yes
Even if I use the head only chams, its still drawing a box, aiming at the feet. Why is that?
All's working good now. Thanks once again.

puu.sh/hl7G6/70572b3f7e.jpg
Ivous, I require your help again, doing it now for a different game, UE3 Engine.

Logged this
Code:
//   ViewProjecti********  c0       4
//   CameraPosition       c4       1
//   BoneMatrices         c5     225
//   LocalToWorld         c230     4
//   WorldToLocal         c234     3
Which one am I supposed to use? I've tried them all, if I use 4, it kinda works, rotating my screen moves the boxes, but they're all in the middle of my screen

Code:
Device->GetVertexShaderConstantF(0, ProjMatrix, 4); 
Device->GetVertexShaderConstantF(4, ViewMatrix, 4);
I can make videos, if needed
Quote Originally Posted by ves23 View Post
Ivous, I require your help again, doing it now for a different game, UE3 Engine.

Logged this
Code:
//   ViewProjecti********  c0       4
//   CameraPosition       c4       1
//   BoneMatrices         c5     225
//   LocalToWorld         c230     4
//   WorldToLocal         c234     3
Which one am I supposed to use? I've tried them all, if I use 4, it kinda works, rotating my screen moves the boxes, but they're all in the middle of my screen

Code:
Device->GetVertexShaderConstantF(0, ProjMatrix, 4); 
Device->GetVertexShaderConstantF(4, ViewMatrix, 4);
I can make videos, if needed
use viewprojection & localtoworld

Code:
Device->GetVertexShaderConstantF(0, ProjMatrix, 4);
Device->GetVertexShaderConstantF(230, ViewMatrix, 4);

D3DXMatrixIdentity(&WorldMatrix);
D3DXVec3Project..
Quote Originally Posted by lvous View Post
use viewprojection & localtoworld

Code:
Device->GetVertexShaderConstantF(0, ProjMatrix, 4);
Device->GetVertexShaderConstantF(230, ViewMatrix, 4);

D3DXMatrixIdentity(&WorldMatrix);
D3DXVec3Project..
Using viewprojection & localtoworld, no boxes are being drawn, heres the full shader log pastebin.com/1m39x6a5
Posts 16–30 of 51 · Page 2 of 4
This thread is closed for replies.

Similar Threads

Tags for this Thread

Talk with us