Lua and Memory Access Troubles

Ask questions about DraStic or discuss compatibility issues here.
Post Reply
User avatar
jan
Posts: 1
Joined: Sun Oct 14, 2018 5:44 am

Lua and Memory Access Troubles

Post by jan » Sun Oct 14, 2018 7:19 am

Hey guys,

I recently purchased the emulator and love it. I am interested in writing some Lua scripts to add some functionality to Animal Crossing: Wild World. However, I am running into an issue with memory access. I simply want to change the item value in one of my inventory slots, but nothing happens.
  • I am not exactly sure how to use drastic.set_ds_memory_<cpu>_<size>(address, value)
  • What should I use for CPU and size? Right now, the values I want to change are in hexadecimal.
  • I have the address 021D8E80, which I got from DeSmuME, and value 137F; how do I enter that into the functions arguments? Is it like (0x021D8E80, 4991)?
  • When I get the address and write it to my log, it gives me a totally different value than anticipated.
It works fine when I use 121D8E80 0000137F with Action Replay.

Thanks!

Exophase
Posts: 1709
Joined: Mon Aug 05, 2013 9:08 pm

Re: Lua and Memory Access Troubles

Post by Exophase » Sun Oct 28, 2018 9:36 pm

CPU should refers to the two processors on the DS and should be "arm7" or "arm9". If in doubt you most likely want to use arm9. If it's to main memory as your access is it shouldn't make a difference though.

Size is the width of the memory access, which can be 8, 16, or 32 for 8-bit, 16-bit, or 32-bit accesses.

So if you want to do a 32-bit of write 0x137F to 0x021D8E80 you would do:

drastic.set_ds_memory_arm9_32(0x021D8E80, 0x137F)

Post Reply