Page 1 of 1

how do i save memorylocation from instruction to table?

Posted: Fri Sep 23, 2022 12:48 am
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)


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

Posted: Fri Sep 23, 2022 2:59 am
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.

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

Posted: Fri Sep 23, 2022 4:41 am
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

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

Posted: Fri Sep 23, 2022 4:54 am
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'.

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

Posted: Fri Sep 23, 2022 5:16 am
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

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

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

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

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

Posted: Fri Sep 23, 2022 5:54 am
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.