View previous topic :: View next topic |
Author |
Message |
theboy181 Advanced Cheater Reputation: 0
Joined: 26 Jan 2018 Posts: 89
|
Posted: Fri Jun 18, 2021 9:07 am Post subject: Advice with offsets and variables |
|
|
Is there an easy way to figure out the offsets between two memory locations in CE?
I have set a script that will search and set an AOB to a variable. I wanted to use " current offset - float " but if always equates a ? I have to use a calculator to subtract the difference, and I figure there must be a more efficient way.
Code: | [ENABLE]
{$lua}
if syntaxcheck then return end
function aob_register(sym, pat)
instr = AOBScan(pat, "+r+w")
addy = instr[0]
instr.destroy()
addy = tonumber(addy, 16)
unregisterSymbol(sym)
registerSymbol(sym, addy)
end
aob_register("floats","BD 37 86 35 00 00 48 43 00 80 BB 44 9A 99 99 3E")
{$asm}
[DISABLE]
unregistersymbol(floats) |
Would be great if there was a way to click and memory location, choose one of the variables you set revealing the offset from your selected base variable.
Anyone with solutions would be appreciated. [/code]
|
|
Back to top |
|
|
theboy181 Advanced Cheater Reputation: 0
Joined: 26 Jan 2018 Posts: 89
|
Posted: Sun Jul 11, 2021 9:49 am Post subject: |
|
|
Anyone able to point me in the right direction? I noticed that I am trying to take the value of a set variable, and what I think I would need to do is take the variable and get its offset, to be able to subtract the current offset from that AOB's defined variable.
Is there a command that can set a named variable offset in memory to be able to do what I need it to do, or is there a better way?
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 138
Joined: 06 Jul 2014 Posts: 4275
|
Posted: Sun Jul 11, 2021 12:30 pm Post subject: |
|
|
I have no idea what you're talking about. What are you trying to do?
If the aobpattern doesn't start at the value you want, just add or subtract something from the result.
Code: | [ENABLE]
{$lua}
if syntaxcheck then return "define(floats,0)" end
local result = assert(AOBScan("BD 37 86 35 00 00 48 43 00 80 BB 44 9A 99 99 3E", "+r+w"))
local address = getAddress(result[0])
result.destroy()
-- offset value of registered symbol by 5
return ("define(floats,%08X)"):format(address + 5)
{$asm}
registersymbol(floats)
[DISABLE]
unregistersymbol(floats) | You should probably be using AOBScanUnique if it's unique as well as alignmenttype and alignmentparam if the result is aligned at all, but those are just optimizations.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
theboy181 Advanced Cheater Reputation: 0
Joined: 26 Jan 2018 Posts: 89
|
Posted: Sun Oct 24, 2021 8:19 am Post subject: |
|
|
Thanks for the reply.
What I am trying to do is use a unique AOB, and set it as a variable.
With that variable I would like to use it as a BASE ADDRESS so that I can find the offset difference between other areas in memory.
Example
I search for AOB and name it BASE (0x10000000)
I want to take an offset like 0x10000040 - BASE = 0x40
This way I can quickly find other areas in memory from the base and add them to my lists of address.
Being able to right click a value in the MEMORY VIEWER and have it add to the list as BASE+40 would be useful when trying to capture a new address.
Right now I am searching for the AOB, then writing the address down, then doing the math on a calculator for each time I want to add a new value to my CT list.
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 138
Joined: 06 Jul 2014 Posts: 4275
|
Posted: Sun Oct 24, 2021 11:21 am Post subject: |
|
|
My first thought would be to add the addresses to the address list first. Then write a small Lua script to loop over all the memory records and convert relevant addresses (i.e. within a certain displacement from BASE) to BASE+offset.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
|