how do i save memorylocation from instruction to table?

Anything Cheat Engine related, bugs, suggestions, helping others, etc..
Post Reply
User avatar
bazarach
Noobzor
Noobzor
Posts: 6
Joined: Thu Oct 14, 2021 9:08 pm
Reputation: 1

how do i save memorylocation from instruction to table?

Post by bazarach »

as per title. below is the instruction that updates the minutes passed in the game im making a table for. how do i save the address of ecx+10 to my table?

Code: Select all

mov [ecx+10],eax
i tried doing it using LEA and using MOV to store it into a symbol, but im getting the address for the allocated memory for _minutes and not for ecx+10. what am i doing wrong? is there another way to get the address?

Code: Select all

[ENABLE]
aobscan(minAddy,89 41 10 8D 45 D4) // should be unique
alloc(_minutes,04)
alloc(newmem,$1000)
registersymbol(_minutes)

label(code)
label(return)

newmem:
  lea eax,[ecx+10]  //calculate address
  mov [_minutes],eax  //store in symbol

code:
  mov [ecx+10],eax
  lea eax,[ebp-2C]
  jmp return

minAddy:
  jmp newmem
  nop
return:
registersymbol(minAddy)

[DISABLE]

minAddy:
  db 89 41 10 8D 45 D4

dealloc(_minutes)
unregistersymbol(_minutes)
unregistersymbol(minAddy)
dealloc(newmem)


aSwedishMagyar
Table Makers
Table Makers
Posts: 670
Joined: Mon Jul 06, 2020 3:19 am
Reputation: 1192

Re: how do i save memorylocation from instruction to table?

Post by aSwedishMagyar »

_minutes is a pointer. You need to setup your memory record as a pointer or de-reference it in the address bar (use brackets i.e. [_minutes])

Think of it this way:
_minutes is the address
when you do mov [_minutes],eax you are storing the value in eax at the memory location _minutes.

User avatar
bazarach
Noobzor
Noobzor
Posts: 6
Joined: Thu Oct 14, 2021 9:08 pm
Reputation: 1

Re: how do i save memorylocation from instruction to table?

Post by bazarach »

aSwedishMagyar wrote:
Fri Sep 23, 2022 2:59 am
You need to setup your memory record as a pointer
how do i do this?

haven't modified the script yet, but i tried changing the address to include brackets but i got zeroes instead. the address im looking for is the 25B93FFC or whatever it is for each run of the game.
cheat off
Image

cheat on
Image

aSwedishMagyar
Table Makers
Table Makers
Posts: 670
Joined: Mon Jul 06, 2020 3:19 am
Reputation: 1192

Re: how do i save memorylocation from instruction to table?

Post by aSwedishMagyar »

mov [ecx+10],eax should be before you overwrite eax with the effective address of ecx+10.

You can also try just writing ecx to _minutes and then setting the memory record as a pointer with an offset.
To do that, double-click on the address of your record and tick the checkbox for 'pointer'. Set the address to '_minutes' and the offset to '10'.

User avatar
bazarach
Noobzor
Noobzor
Posts: 6
Joined: Thu Oct 14, 2021 9:08 pm
Reputation: 1

Re: how do i save memorylocation from instruction to table?

Post by bazarach »

aSwedishMagyar wrote:
Fri Sep 23, 2022 4:54 am
You can also try just writing ecx to _minutes and then setting the memory record as a pointer with an offset.
To do that, double-click on the address of your record and tick the checkbox for 'pointer'. Set the address to '_minutes' and the offset to '10'.
somehow the value of ecx isnt being stored in _minutes. changed this part of the script and made the memory record a pointer with an offset of 10 and im getting 10 as an address. the timer in the game still works tho so the mov [ecx+10], eax still works.

Code: Select all

newmem:
  //lea eax,[ecx+10]
  mov [_minutes],ecx
  
code:
  mov [ecx+10],eax
  lea eax,[ebp-2C]
  jmp return
Image
Last edited by bazarach on Fri Sep 23, 2022 5:31 am, edited 2 times in total.

aSwedishMagyar
Table Makers
Table Makers
Posts: 670
Joined: Mon Jul 06, 2020 3:19 am
Reputation: 1192

Re: how do i save memorylocation from instruction to table?

Post by aSwedishMagyar »

I guess my last questions are:

When does that instruction get run?
Can you set a break point on it?

User avatar
bazarach
Noobzor
Noobzor
Posts: 6
Joined: Thu Oct 14, 2021 9:08 pm
Reputation: 1

Re: how do i save memorylocation from instruction to table?

Post by bazarach »

aSwedishMagyar wrote:
Fri Sep 23, 2022 5:47 am
I guess my last questions are:

When does that instruction get run?
Can you set a break point on it?
ecx is written to _minutes just before the game updates the minutes passed. anyway, i added a break and trace on the mov [_minutes],ecx instruction in the disassembler to check the value of ecx and it started working after that. i have a feeling it's just me being an idiot and not letting the game run unpaused long enough for the values to be updated properly.

Post Reply

Who is online

Users browsing this forum: No registered users