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 


keep track of changed addresses and restoring their values

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
aitboss
Newbie cheater
Reputation: 0

Joined: 30 Sep 2017
Posts: 17

PostPosted: Sat May 19, 2018 9:58 pm    Post subject: keep track of changed addresses and restoring their values Reply with quote

Hello!

I have a code that searchs for and replaces some AOBs:

Code:

function replace(searchV, replaceV)
  if type(searchV) ~= "table" then
    searchV = {(assert(tonumber(searchV),"Could not convert first argument to number"))}
  end
 
  for i,v in ipairs(searchV) do
    local res = AOBScan(v, "+W-C", 1, 4)
    if res then
      for j=0, res.Count-1, 1 do
        writeBytes(res[j], replaceV)
      end
      res.destroy()
    end
  end
end

local aobs = {
'F4 01 00 00 D0 07 00 00 F4 01',
'20 03 00 00 F4 01 00 00 20 03',
'E8 03 00 00 DC 05 00 00 20 03',
'FA 00 00 00 00 00 00 00 26 02',
'78 05 00 00 00 00 00 00 58 02',
'C8 00 00 00 00 00 00 00 78 05',
'C8 00 00 00 00 00 00 00 08 07',
'F4 01 00 00 00 00 00 00 F4 01',
'20 03 00 00 E8 03 00 00 20 03',
'03 00 00 E8 03 00 00 20 03',
'20 03 00 00 00 00 00 00 20 03'
}

-- pass a table of bytes rather than a string that are parsed into bytes
replace(aobs, {01,00,00,00,00,00,00,00,01,00})


I want to restore the values to its original values after they have been replaced.

I can't figure a correct way to keep track of changed addresses.
I will be glad if someone give me a code example for it.

Many thanks in advance!
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Sat May 19, 2018 10:14 pm    Post subject: Reply with quote

You asked this just the other day, and FreeER gave you an example.
https://forum.cheatengine.org/viewtopic.php?t=607558

_________________
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting 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