Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Advice with offsets and variables

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
theboy181
Advanced Cheater
Reputation: 0

Joined: 26 Jan 2018
Posts: 89

PostPosted: Fri Jun 18, 2021 9:07 am    Post subject: Advice with offsets and variables Reply with quote

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
View user's profile Send private message
theboy181
Advanced Cheater
Reputation: 0

Joined: 26 Jan 2018
Posts: 89

PostPosted: Sun Jul 11, 2021 9:49 am    Post subject: Reply with quote

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
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Sun Jul 11, 2021 12:30 pm    Post subject: Reply with quote

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
View user's profile Send private message
theboy181
Advanced Cheater
Reputation: 0

Joined: 26 Jan 2018
Posts: 89

PostPosted: Sun Oct 24, 2021 8:19 am    Post subject: Reply with quote

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
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Sun Oct 24, 2021 11:21 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites