| View previous topic :: View next topic |
| Author |
Message |
iPromise Grandmaster Cheater
Reputation: -1
Joined: 27 Jun 2009 Posts: 529 Location: Canada
|
Posted: Tue Jun 29, 2010 3:32 pm Post subject: Is this faster ? |
|
|
Copying all of the memory regions bytes, and comparing ?
| Code: |
if ( MBI.Protect == PAGE_READWRITE )
{
BYTE *Buffer;
Buffer = new BYTE[ MBI.RegionSize ];
memcpy( (void *) Buffer, MBI.BaseAddress, MBI.RegionSize );
for (int i = 0; i <= (int) MBI.RegionSize; i ++)
{
if ( Buffer[i] == 1 ) // Example scan for 1 byte
{
File << (LPVOID) ( (DWORD) MBI.BaseAddress + (DWORD) i ) << endl;
}
}
}
|
Thanks for your help guys.
Last edited by iPromise on Tue Jun 29, 2010 4:11 pm; edited 1 time in total |
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Tue Jun 29, 2010 3:44 pm Post subject: |
|
|
for the millionth time, yes. also for the millionth time, when doing the scan, don't do something which does a disk access or makes an item in a listview.. what i would do is to make a custom windows message and in the case when there is a match, do a postmessage with the address with your custom windows message. then in the handler for that you can do your disk writes or whatever. then the heavy lifting is done by the main thread and not by the scanning thread. hence your scanning will become a concurrent action along with the disk writes.
also lolwat at your code
|
|
| Back to top |
|
 |
iPromise Grandmaster Cheater
Reputation: -1
Joined: 27 Jun 2009 Posts: 529 Location: Canada
|
Posted: Tue Jun 29, 2010 4:11 pm Post subject: |
|
|
| i coded that on the spot, and thanks. I actually got it now and its freaking fast on 0 scans O_O
|
|
| Back to top |
|
 |
tombana Master Cheater
Reputation: 2
Joined: 14 Jun 2007 Posts: 456 Location: The Netherlands
|
Posted: Tue Jun 29, 2010 4:41 pm Post subject: |
|
|
How is that faster?
| Code: |
char Memory = 5;
char Buffer[1];
memcpy(Buffer, Memory, 1)
if( Buffer[0] == 5 ) herp();
else derp();
|
|
|
| Back to top |
|
 |
Flyte Peanuts!!!!
Reputation: 6
Joined: 19 Apr 2006 Posts: 1887 Location: Canada
|
Posted: Tue Jun 29, 2010 4:43 pm Post subject: |
|
|
That will only make it faster if you are reading memory in another process. If you're already in the process it will make it slower (and in your case, cause the program to crash because of the gigantic memory leak).
Store results in an STL container, and then do your work on the container when scanning is complete.
|
|
| Back to top |
|
 |
iPromise Grandmaster Cheater
Reputation: -1
Joined: 27 Jun 2009 Posts: 529 Location: Canada
|
Posted: Tue Jun 29, 2010 5:07 pm Post subject: |
|
|
@tombana
your only copying 1 char from the memory variable. i'm copying all the chars from the memory variable, and then comparing. even if it is slow, it still is faster then the original method of checking each address one by one.
|
|
| Back to top |
|
 |
Flyte Peanuts!!!!
Reputation: 6
Joined: 19 Apr 2006 Posts: 1887 Location: Canada
|
Posted: Tue Jun 29, 2010 5:48 pm Post subject: |
|
|
| iPromise wrote: | @tombana
your only copying 1 char from the memory variable. i'm copying all the chars from the memory variable, and then comparing. even if it is slow, it still is faster then the original method of checking each address one by one. |
You clearly do not understand how pointers work.
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Wed Jun 30, 2010 1:36 am Post subject: |
|
|
you should have read my post here more carefully :
http://forum.cheatengine.org/viewtopic.php?p=4989592#4989592
also @ the last poster in that thread who is learning by rce'ing your code. looooolllll
what i meant to reply to this thread was :
'yes this is faster than mem_cpy'ing smaller chunks at a time but it's still retarded and pointless. as i did say previously though, this is fine, since it just keeps consistency with the rest of the project'
|
|
| Back to top |
|
 |
|