MAMEWorld >> Programming
View all threads Index   Flat Mode Flat  

Jfarro
MAME Fan
Reged: 02/24/14
Posts: 13
Send PM
Trouble understanding reading memory addresses in debugger/lua/cheat system
01/04/18 01:43 PM


hi, I'm working on my lua extensibility plugin still.

I'm testing MKII version 3.1. I used the cheatfinder plugin to create a chat, and the file states:

mk2,:maincpu,20C050,b,9,Test cheat at addr 0020C050

The xml file looks like (modified so it'll show):

mamecheat version=1
cheat desc="Test cheat at addr 0020C050"
sript state="run"
action>maincpu.ppb@20C050=9
/script
/cheat

From what I'm understanding, that's setting 0x0020C050 to a value of 9...I want to read this value to see what it's set at, as I believe it will tell me which character the user has selected.

In the debug/memory window, I select MainCPU from the dropdown, then type in 0x0020c050 and I don't see the value of 9 at all...the values all look to be zeros.

I also tried, via lua, to do:
cpu = manager:machine().devices[":maincpu"]
mem = cpu.spaces["program"]
print(mem:read_u8(0x0020c050))

I did that from the console, and get back 0, which lines up with what I'm seeing in the memory window of the debugger. Yet the 'cheat' seems to imply that 0x0020c050 is the magical address I should be querying.

I'm very much a newb in this area, so asking..am I going about this the right way? Or is there a translation between the cheat memory addesss and what I'm trying to query that I'm just missing? Or something else?

Edited by Jfarro (01/04/18 01:46 PM)







Entire thread
Subject Posted by Posted on
* Trouble understanding reading memory addresses in debugger/lua/cheat system Jfarro 01/04/18 01:43 PM
. * Re: Trouble understanding reading memory addresses in debugger/lua/cheat system crazyc  01/05/18 02:10 AM
. * Re: Trouble understanding reading memory addresses in debugger/lua/cheat system Jfarro  01/05/18 09:06 AM

Extra information Permissions
Moderator:  Pi 
0 registered and 4 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 779