etioplmld Advanced Cheater Reputation: 0
Joined: 09 Feb 2021 Posts: 72
|
Posted: Tue Dec 14, 2021 5:10 am Post subject: A script to add consecutive addresses in batches |
|
|
If there is no offset, it will continue to add 4 bytes of address to the filled base address,If there is an offset, it will change the top offset and add continuously.
Code: |
f = createForm(true)
f.Position=poDesktopCenter
f.Width=300
f.Height=115
f.Caption = 'Add addresses '
local b1=createButton(f)
b1.Left=180
b1.Top=10
b1.caption="add address"
b1.Width=100
local b2=createButton(f)
b2.Left=180
b2.Top=40
b2.caption="add offset"
b2.Width=100
local b3=createButton(f)
b3.Left=180
b3.Top=70
b3.caption="remove offset"
b3.Width=100
local eb=createEdit(f)
eb.Left=10
eb.Top=10
eb.Width=130
eb.TextHint='base address'
local eb1 =createEdit(f)
eb1.Left=10
eb1.Top=40
eb1.Width=130
eb1.Text= 1
bn = 1
local jn = {}
b2.OnClick=function()
jn[bn] = string.format("ex%d", bn)
jn[bn]=createEdit(f)
jn[bn].Left=10
jn[bn].Top= 70 + 25*bn
jn[bn].TextHint=string.format("offset%d", bn)
bn = bn + 1
f.Height=f.Height + 25
end
b3.OnClick=function()
bn= bn -1
jn[bn].destroy()
jn[bn]=nil
f.Height=f.Height - 25
end
b1.OnClick=function()
if( bn == 1)
then
gn=tonumber(eb1.Text,16)
for n=0,gn-1 do
local al = getAddressList()
local rec = al.createMemoryRecord()
fl=tonumber(eb.Text)+n*4
kl = tostring(fl)
rec.setAddress(kl)
end
elseif( bn == 2 )
then
gn=tonumber(eb1.Text)
for n = 0,gn-1 do
local al = getAddressList()
local rec = al.createMemoryRecord()
fofst = tonumber(jn[1].Text,16)+ n*4
rec.setAddress(eb.Text)
rec.setOffsetCount(1)
rec.setOffset(0,fofst)
end
elseif( bn > 2 )
then
gn=tonumber(eb1.Text)
for n = 0,gn-1 do
local al = getAddressList()
local rec = al.createMemoryRecord()
fofst = tonumber(jn[1].Text,16)+ n*4
rec.setAddress(eb.Text)
rec.setOffsetCount(bn-1)
rec.setOffset(0,fofst)
for p = 1 ,bn-2 do
s = tonumber(jn[p+1].Text,16)
rec.setOffset(p,s)
end
end
else
print("error")
end
end
|
Description: |
|
Filesize: |
36.97 KB |
Viewed: |
716 Time(s) |
|
|
|