PDA

View Full Version : [TUTORIAL]Easy way to find NumVertices ModelRec



teh leetz0rz
15th November 2005, 05:26
ok, we are going to use:


DrawIndexedPrimitive


this tutorial tells the method i use to find NumVertices actually reletivly easy. instead of getting a lot of numbers, you get only the ones you want. alright, im going to assume you have the stride number, if you dont thats another topic.

make a conditional statement testing strides:



if(strides==64)//w/e you want, for css this is for models :D
{
}


inside of that, make 12 if statements of switch statements for GetAsyncKeyState. test for f1-f12. it should look like this:



if(GetAsyncKeyState(VK_F1) & 0x8000)
{
}
else if(GetAsyncKeyState(VK_F2) & 0x8000)
{
}
else if(GetAsyncKeyState(VK_F3) & 0x8000)
{
}
else if(GetAsyncKeyState(VK_F4) & 0x8000)
{
}
else if(GetAsyncKeyState(VK_F5) & 0x8000)
{
}
else if(GetAsyncKeyState(VK_F6) & 0x8000)
{
}
else if(GetAsyncKeyState(VK_F7) & 0x8000)
{
}
else if(GetAsyncKeyState(VK_F8) & 0x8000)
{
}
else if(GetAsyncKeyState(VK_F9) & 0x8000)
{
}
else if(GetAsyncKeyState(VK_F10) & 0x8000)
{
}
else if(GetAsyncKeyState(VK_F11) & 0x8000)
{
}
else if(GetAsyncKeyState(VK_F12) & 0x8000)
{
}



Now, you want to test the NumVertices to get different counts for the model you want. this is what i did:

(first, declare a simple long int,we'll start it at 250 because we are using the pattern of +50)



long int num = 250;
/*if(GetAsyncKeyState(VK_F1) & 0x8000)
{
num = 350;
}
else if(GetAsyncKeyState(VK_F2) & 0x8000)
{
num = 400;
}
else if(GetAsyncKeyState(VK_F3) & 0x8000)
{
num = 450;
}
else if(GetAsyncKeyState(VK_F4) & 0x8000)
{
num = 500;
}
else if(GetAsyncKeyState(VK_F5) & 0x8000)
{
num = 550;
}
else if(GetAsyncKeyState(VK_F6) & 0x8000)
{
num = 600;
}
else if(GetAsyncKeyState(VK_F7) & 0x8000)
{
num = 650;
}
else if(GetAsyncKeyState(VK_F8) & 0x8000)
{
num = 700;
}
else if(GetAsyncKeyState(VK_F9) & 0x8000)
{
num = 750;
}
else if(GetAsyncKeyState(VK_F10) & 0x8000)
{
num = 800;
}
else if(GetAsyncKeyState(VK_F11) & 0x8000)
{
num = 850;
}
else if(GetAsyncKeyState(VK_F12) & 0x8000)
{
num = 900;
}



Next, make an if statement testing the NumVertices.

Do:



if(NumVertices<=num)//easier to do less than or equal to, because then the lowest possible number is 0.
{
}



Now, add in wallhack material inside the new statement you made.



if(NumVertices<=num)//easier to do less than or equal to, because then the lowest possible number is 0.
{
DWORD dwOldZEnable = D3DZB_TRUE;
m_pD3Ddev->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable);
m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, dwOldZEnable);
}


Now, we want to add in another series of if statements or switch statements inside of the if thats testing the NumVertices. add in a logger so we know which textures are being shown when we enable different textures to be shown:



if(GetAsyncKeyState(VK_F1) & 0x8000)
{
add_log("f1 %i",NumVertices);

}
else if(GetAsyncKeyState(VK_F2) & 0x8000)
{
add_log("f2 %i",NumVertices);

}
else if(GetAsyncKeyState(VK_F3) & 0x8000)
{
add_log("f3 %i",NumVertices);

}
else if(GetAsyncKeyState(VK_F4) & 0x8000)
{
add_log("f4 %i",NumVertices);

}
else if(GetAsyncKeyState(VK_F5) & 0x8000)
{
add_log("f5 %i",NumVertices);

}
else if(GetAsyncKeyState(VK_F6) & 0x8000)
{
add_log("f6 %i",NumVertices);

}
else if(GetAsyncKeyState(VK_F7) & 0x8000)
{
add_log("f7 %i",NumVertices);

}
else if(GetAsyncKeyState(VK_F8) & 0x8000)
{
add_log("f8 %i",NumVertices);

}
else if(GetAsyncKeyState(VK_F9) & 0x8000)
{
add_log("f9 %i",NumVertices);

}
else if(GetAsyncKeyState(VK_F10) & 0x8000)
{
add_log("f10 %i",NumVertices);

}
else if(GetAsyncKeyState(VK_F11) & 0x8000)
{
add_log("f11 %i",NumVertices);

}
else if(GetAsyncKeyState(VK_F12) & 0x8000)
{

add_log("f12 %i",NumVertices);
}


Now...start up your game. make sure nothing by the game is bound to F1-12. i know is CSS F10 is quit. press F1-F12 untill you see what you like through the walls. (rather its people, guns, windows, boxes, whatever. whatever tickles your fancy) then, close the game and look at the log file created by the hack. there should be text similer to this:


(assuming F2 was what showed what you wanted)
f2 373
f2 393
f2 396
f2 359
(but a lot more, probably)


ok, now you do something extremly easy. you replace:



if(NumVertices<=num)


with



if(NumVertices==373||393||396||359)


if what you liked is still being shown, then narrow it untill you only have one, and in some cases, two numbers left.


if this is unclear in anyway, im sorry. i wrote this while i was high


if you have questions, ill answer them.

either respond, or email/msn me: leetster@mpph.net

\\SoLo//
15th November 2005, 06:12
way to much un-needed code.

Sparker
15th November 2005, 13:15
just make the verts go up 1 by 1 and color them something when Numberverts = numvert if you hold down the key you can cycle through all the games verts pretty quickly..

Neural
15th November 2005, 20:25
I tried model recognition using NumVertices with COD2, but they change everytime the games loaded?

teh leetz0rz
15th November 2005, 22:45
Sparker - since DrawIndexedPrimitive is called every frame, if you do it one by one you'll be in the hundreds in one second (assuming you get 70 fps per second)


Neural - numvertices dont change everytime its reloaded. but they do change upon distance.

example:

in CSS the terrorists have a different numverticie in 3 locations.

near
about 25 feet
and really far.
probably even more than that


also, depending on the texture thats used to texture the models.


im new to D3D (about a week)

so if im wrong someone please correct me:D