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 


Cheat Engine Forum Index
PostGo back to topic
FreeER
Grandmaster Cheater Supreme
Reputation: 42
Joined: 09 Aug 2013
Posts: 1089

PostPosted: Mon Jan 08, 2018 12:09 pm    Post subject:

I know this has come up before, not sure if there was a simple solution mentioned at the time however...

AA has aobscanregion so you might be able to use autoassemble to do the job

(disclaimer, untested code)
Code:
-- returns first result or nil
function AOBScanRegion(aob, start, end)
  -- temporary symbol name to register (should be unique of course)
  local aobscanregionSymbol = 'aobscanregionSymbol'
  local script = [[aobscanregion(%s, %s, %s, %s)
  registerSymbol(%s)]]

  if type(start) == 'number' then start = ('%X'):format(start) end
  if type(end) == 'number' then end = ('%X'):format(end) end
  script = script:format(aobscanregionSymbol, start, end, aob)

  local result = autoAssemble(script)

  if not result return nil end

  local address = getAddress(aobscanregionSymbol)
  unregisterSymbol(aobscanregionSymbol)

  return address
end


otherwise you'd probably need to make use of the memscan class

Code:
-- returns stringlist of results or nil
function AOBScanRegion(aob, start, end)
  local ms = createMemscan()
  ms.firstScan(soExactValue, vtByteArray, '', aob, '', start,end,'',fsmNotAligned,
    '' ,true,true, false, false)
  local sl
  ms.OnScanDone(function(ms)
    local fl = createFoundList(ms)
    fl.initialize()
    if fl.Count > 0 then
      sl = createStringList()
      for i=0, fl.Count-1 do
        sl.add(fl.Address[i])
      end
    end
    fl.deinitialize()
    fl.destroy()
    ms.destroy()
  end)
  ms.WaitTillDone()
  return sl
end
Back to top
View user's profile Send private message
Post reviews:   Approve 1
Author Review
zxuiji
Review: Approve
Post reference:
ReviewPosted: Wed Feb 07, 2018 5:21 pm

Shoulda done this review earlier, VERY helpful this was, not experienced any issues beyond what was mentioned in the thread.
Back to top
View user's profile Send private message
Display:  
Cheat Engine Forum Index


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites