aitboss Newbie cheater Reputation: 0
Joined: 30 Sep 2017 Posts: 17
|
Posted: Sat May 19, 2018 9:58 pm Post subject: keep track of changed addresses and restoring their values |
|
|
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! |
|