mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Fri Jan 31, 2014 4:02 pm Post subject: AOBSwap function |
|
|
Code: | function AOBSwap(aobIn,aobOut)
aobOut = aobOut:gsub('[^%w]','') -- remove all spaces
local _aobOut=''
for i=1,#aobOut,2 do
_aobOut = _aobOut..aobOut:sub(i,i+1)..' ' -- add spaces (only the needed ones)
end
local address = 0
--AOBScan("aobstring", protectionflags OPTIONAL, alignmenttype OPTIONAL, alignmentparam HALFOPTIONAL)
local aobs = AOBScan(aobIn, '+W*X-C', 1, '4') -- you can change here: protection flags and alignment (e.g. writable, addresses dividable by 4)
if(aobs ~= nil) then
for i = 0,aobs.Count-1 do
address = aobs.String[i]
autoAssemble(address..[[:
db ]].._aobOut)
end
aobs.destroy()
end
end |
Usage:
Code: | AOBSwap('00 01 01 02 FE FF 02 01 00', '00 01 01 02 AA BB 02 01 00') |
Will change this
00 01 01 02 FE FF 02 01 00
to this
00 01 01 02 AA BB 02 01 00
_________________
|
|