Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


How to access memscan results? (writing AOBSCAN AA template)

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Source
View previous topic :: View next topic  
Author Message
jgoemat
Master Cheater
Reputation: 22

Joined: 25 Sep 2011
Posts: 252

PostPosted: Sat Jul 13, 2013 9:17 pm    Post subject: How to access memscan results? (writing AOBSCAN AA template) Reply with quote

I'm working on an AA template but I can't figure out how to get the results from my memory scan. If I evaluate the Tmemscan object the private member FOUND is 2 which is correct, but there aren't any addresses. Do I need to use TFoundList somewhere? I tried GetOnlyOneResults which would seem to return an address list, but it only returns if I set onlyOne to true and doesn't seem to work right, although GetOnlyOneResult then does return a single address... Is there somewhere in CE that someone could point me to so I can see how to use it? I've tried looking through the main form code but there is too much there and I can't process it all...

Here's the code I have so far, lots of debugging stuff in there from trying different things...

Code:
    //ms.FastScanDigitCount := 1;
    ms.OnlyOne := false;
    //    fl := TFoundlist.create(foundlist: tlistview; memscan: TMemScan; listname: string='')
    fl := TFoundlist.create(nil, ms, '');
    ms.FirstScan(soExactValue, vtByteArray, rtTruncated, aob, '', minaddress, maxaddress, true, false, false, true, fsmAligned, '1');
    ms.WaitTillReallyDone; //wait till it's finished scanning
    afl := ms.attachedFoundlist;
    assemblescreen.Lines.Add('GetUniqueAOB: Found Count: ' + inttostr(ms.GetFoundCount));
    //assemblescreen.Lines.Add('ms.FOUND is: ' + inttostr(ms.FOUND));

    if ms.GetOnlyOneResults(addresses) then
    begin
      assemblescreen.Lines.Add('GetUniqueAOB: Multiple addresses found: ' + IntToStr(Length(addresses)));
      exit;
    end;
    if ms.GetOnlyOneResult(foundAddress) then
    begin
      assemblescreen.Lines.Add('GetUniqueAOB: GetOnlyOneResult() true, address $' + inttohex(foundAddress, 8));
      result := aob; // original AOB is good enough
      exit;
    end;           


The fl and afl don't have any addresses and have different scan parameters than I passed to memscan...

Thanks

***** EDIT *****
Nevermind, I found it. I just had to call Initialize() on the FoundList after the memscan and that returned the count, then I could use GetAddress(index):


Code:
    fl := TFoundlist.create(nil, ms, '');
    ms.FirstScan(soExactValue, vtByteArray, rtTruncated, aob, '', minaddress, maxaddress, true, false, false, true, fsmAligned, '1');
    ms.WaitTillReallyDone; //wait till it's finished scanning
    count := fl.Initialize(vtByteArray, nil);
    assemblescreen.Lines.Add('GetUniqueAOB: Found ' + IntToStr(count) + ' addresses');
    for i := 0 to count - 1 do
    begin
      SetLength(addresses, i + 1);
      addresses[i] := fl.GetAddress(i);
      assemblescreen.Lines.Add('GetUniqueAOB: addresses[' + IntToStr(i) + ']: $' + IntToHex(addresses[i], 8));
    end;
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Source All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites