| View previous topic :: View next topic |
| Author |
Message |
AmyGrrl Cheater
Reputation: 0
Joined: 15 Dec 2016 Posts: 31
|
Posted: Thu Sep 27, 2018 11:12 pm Post subject: Learning AOBScan, Need help with adding offset. |
|
|
| Code: | AWOKChapter1Items=AOBScan("07 00 4? 01 00 00 00 00 ?? 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ?? ?? ?? 44 ?? ?? ?? 44")
AWOKChapter1ItemsTotal=AWOKChapter1Items.getCount()
AWOKChapter1ItemsCount=0
print("Found " .. AWOKChapter1ItemsTotal .. " Address Locations!")
print(" ")
AWOKChapter1=createTimer()
AWOKChapter1.Interval=1000
AWOKChapter1.OnTimer=function(AWOKChapter1)
if AWOKChapter1ItemsTotal == 0 then
AWOKChapter1.Enabled=false
else
print("Address " .. AWOKChapter1ItemsCount .. " Is " .. AWOKChapter1Items[AWOKChapter1ItemsCount] .. " With A Value Of " .. readBytes(AWOKChapter1Items[AWOKChapter1ItemsCount]))
AWOKChapter1ItemsCount=AWOKChapter1ItemsCount+1
AWOKChapter1ItemsTotal=AWOKChapter1ItemsTotal-1
end
end
AWOKChapter1.Enabled=true |
I'm new to learning AOBScan and trying to learn it. Been searching for hours trying to figure this out with no luck. The code about is just to help me understand how it functions. I know the AOBSan your searching for should start with the address/value you want. But it was returning too many results. I so started the scan before the actual address/value I need. Which returns the 6 results I need. But now I need to offset all the found addresses by the same amount. So for example the first result returns 152FDE42. But I really need 152FDE4A. Thanks for any help given!
|
|
| Back to top |
|
 |
TheyCallMeTim13 Wiki Contributor
Reputation: 51
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Thu Sep 27, 2018 11:56 pm Post subject: |
|
|
"aobScan" and "aobScanModule" returns addresses as numbers, so you can just add the offset to it.
| Code: | | AWOKChapter1Items[AWOKChapter1ItemsCount] + 0x1F |
| Code: | | AWOKChapter1Items[AWOKChapter1ItemsCount] - 0xF |
And based off the addresses you mentioned, the "readBytes" call would be like this.
| Code: | | readBytes(AWOKChapter1Items[AWOKChapter1ItemsCount] + 8) |
You can also use "getAddress" or "getAddressSafe" to get the address of any symbol so you can add offsets to them.
_________________
|
|
| Back to top |
|
 |
AmyGrrl Cheater
Reputation: 0
Joined: 15 Dec 2016 Posts: 31
|
Posted: Fri Sep 28, 2018 12:02 am Post subject: |
|
|
I did find a solution on my own that works. I just converted the hex address to a number added 8 then converted back to hex. Works perfectly.
| Code: | | print("Address " .. AWOKChapter1ItemsCount .. " Is " .. string.format('%X', tonumber(AWOKChapter1Items[AWOKChapter1ItemsCount], 16) + 8) .. " With A Value Of " .. readBytes(string.format('%X', tonumber(AWOKChapter1Items[AWOKChapter1ItemsCount], 16) + 8))) |
But I will give your solution a try. Seems a little cleaner. Thanks!
|
|
| Back to top |
|
 |
TheyCallMeTim13 Wiki Contributor
Reputation: 51
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Fri Sep 28, 2018 12:11 am Post subject: |
|
|
No, you're right. I was thinking wrong. "aobScan" returns a string, so yeah "tonumber(..., 16)" to convert it to a number or the "getAddress" and "getAddressSafe" will also return a number.
| Code: | | readBytes(getAddress(AWOKChapter1Items[AWOKChapter1ItemsCount]) + 8) |
EDIT:
But, I'm willing to bet that "tonumber" will be faster.
_________________
|
|
| Back to top |
|
 |
AmyGrrl Cheater
Reputation: 0
Joined: 15 Dec 2016 Posts: 31
|
Posted: Fri Sep 28, 2018 12:25 am Post subject: |
|
|
I did try the same thing before you posted that. It works as well.
| Code: | | print("Address " .. AWOKChapter1ItemsCount .. " Is " .. string.format('%X', getAddress(AWOKChapter1Items[AWOKChapter1ItemsCount]) + 8) .. " With A Value Of " .. readBytes(getAddress(AWOKChapter1Items[AWOKChapter1ItemsCount]) + 8)) |
So I can use both. How can I test which solution is faster? Would it really make a big difference over the other. But I do get that converting to a number and back might be faster than looking up an address.
|
|
| Back to top |
|
 |
TheyCallMeTim13 Wiki Contributor
Reputation: 51
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Fri Sep 28, 2018 1:22 am Post subject: |
|
|
you can, read the time and store it then run a loop of say 100; with "getAddress" being called. Then read the time again a see what the difference is, then do the same thing with "tonumber".
But this will only really matter if you have this in a loop or something, if it's just called every now and again I wouldn't worry about it.
_________________
|
|
| Back to top |
|
 |
|