 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
iPromise Grandmaster Cheater
Reputation: -1
Joined: 27 Jun 2009 Posts: 529 Location: Canada
|
Posted: Sun Jun 06, 2010 5:20 pm Post subject: Comparing Bitmaps |
|
|
Hello,
As some of you may know i'm creating an aimbot for GunBound. So far so good, I found all my neccessary addresses including Wind Speed and Wind Angle except for Player Angle. The player angle I hear is encrypted, and no matter how much I try or what I try I can never seem to find it. Having said so, I was suggested to use pixels to obtain my Player Angle. I thought using such a commonly used method sucked and I should just use my own, so what I am doing is creating a bitmap image of the Player Angle, and for testing purposes display it.
Heres my code:
Code: |
void display()
{
while (true)
{
HDC CopyDC = CreateDC(L"DISPLAY", NULL, NULL, NULL);
HDC MemDC = CreateCompatibleDC(CopyDC);
HBITMAP Bitmap = CreateCompatibleBitmap(CopyDC, 34, 31);
SelectObject(MemDC, Bitmap);
HDC PlayerAngle = CreateDC(L"DISPLAY", NULL, NULL, NULL);
POINT Point;
Point.x = 303;
Point.y = 528;
BitBltX(MemDC, 0, 0, 34, 31, PlayerAngle, Point.x, Point.y, SRCCOPY);
//TextOut(MemDC, 10, 10, L"Hello", 5);
BitBltX(CopyDC, 0, 0, 34, 31, MemDC, 0, 0, SRCCOPY);
Sleep(100);
}
}
|
This displays the player angle perfectly from the old interface, now my idea here is, take screenshots of the player angle from 0 - 90, and compare it with what I have, if I find the right screenshot then I have my player angle.
My problem is:
If I take screenshots of the player angle from 0 - 90, and add it to my resource files in my C++ project, I wouldn't need the pictures again after I compile right? it will be 'inside' my application?
And
[/b]How would I compare bitmaps, or how can I take my screenshot, make it a bitmap and compare it as fast as possible?[/b]
Thanks guys for your great contribuations!
|
|
Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Sun Jun 06, 2010 6:16 pm Post subject: |
|
|
memcmp
and don't use CreateDC, use GetDC
create a DIB Section, select it into your memory DC, blit your DC into your memory DC. like magic, you have the raw pixel data.
just make sure your byte ordering is correct and memcmp.
|
|
Back to top |
|
 |
iPromise Grandmaster Cheater
Reputation: -1
Joined: 27 Jun 2009 Posts: 529 Location: Canada
|
Posted: Sun Jun 06, 2010 6:38 pm Post subject: |
|
|
What about my questions?
Wouldn't that give me a copy of the bitmap and not compare it? I'm so lost.
|
|
Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Sun Jun 06, 2010 6:39 pm Post subject: |
|
|
you'll end up with a pointer to the bitmap data.
compare it against whatever.
|
|
Back to top |
|
 |
iPromise Grandmaster Cheater
Reputation: -1
Joined: 27 Jun 2009 Posts: 529 Location: Canada
|
Posted: Sun Jun 06, 2010 6:44 pm Post subject: |
|
|
Can you show me an example link or give me an example code? I get what your saying, but how would I create a DIB section? Also, I dont get the bytes, etc. Please help.
|
|
Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
|
Back to top |
|
 |
iPromise Grandmaster Cheater
Reputation: -1
Joined: 27 Jun 2009 Posts: 529 Location: Canada
|
Posted: Sun Jun 06, 2010 7:34 pm Post subject: |
|
|
But I don't want to read the bitmap Pixel By Pixel, I dont get what ReadPixel() does in your examples, does it read the whole bitmaps pixels or just one pixel? Also, lets say I took a screenshot of my picture and named it bla.bmp and added it to my projects resource folder, how can I turn bla.bmp into a compatible bitmap?
Assuming I have bla.bmp into a bitmap.
I use CreateDC() because GetDC() is hooked in GunBound
Code: |
DWORD Bits;
// Coded on the spot, the player angle is 31x34 pixels.
BITMAPINFO BI;
BI.bmiHeader.biSize = sizeof(BI);
BI.bmiHeader.biWidth = 31;
BI.bmiHeader.biHeight = 34;
HBITMAP Bla, DIB;
HDC DC = CreateDC(L"DISPLAY", NULL, NULL, NULL);
HDC MemDC = CreateCompatibleDC(DC);
HBITMAP Bitmap = CreateCompatibleBitmap(MemDC, 31, 34);
SelectObject(MemDC, Bitmap);
BitBlt(MemDC, 0, 0, 31, 34, DC, 303, 528, SRCCOPY);
DIB = CreateDIBSection(MemDC, &BI, DIB_RGB_COLORS, (void**)[b]&[/b]Bits, NULL, 0);
// Close DC's, etc.
DWORD p = Bits + (528 * 34 * 303);
if (p == BlaPBits)
{
return true;
}
else
{
return false;
}
|
|
|
Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Sun Jun 06, 2010 7:58 pm Post subject: |
|
|
use fkin memcmp like i said before.
just read the bitmap manually, it's the easiest file in the universe to load. look up the header on wikipedia, one of the entries is the pointer to the actual bitmap data.
|
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|