[ssf2t] how to make a Breakpoint debug cheat work with xml?

If you are having problems finding or using cheats for an Emulator (particularly MAME/MESS) or have found a trick that you wish to share this is the place to do it. But please read the Cheat FAQ first.
Post Reply
rabbyzero
Posts: 24
Joined: Thu Nov 16, 2017 3:20 am
Been thanked: 9 times

[ssf2t] how to make a Breakpoint debug cheat work with xml?

Post by rabbyzero »

I have following breakpoint code.

Code: Select all

bp 470e,,{b@ff84b6=2;b@ff84b8=1;g}
Which means I will change 0xFF84B6 and 0xFF84B8 value when code at 0x470E (PC = 0x470E) will be excuted.

If it is made as a regular "run" cheat.

Code: Select all

<cheat desc="P1 Infinite throw range"><comment>bp 470e,,{b@ff84b6=2;b@ff84b8=1;g}</comment>
    <script state="run">
      <action>maincpu.pb@FF84b6=2</action>
      <action>maincpu.pb@FF84b8=1</action>
    </script>
  </cheat>
It will not work. because mame cheat engine will update the data every frame and the data is reloaded and evaluated before frame update.

I know I can modify the code near 0x470E to achieve this. But are there any easier way to go?
rabbyzero
Posts: 24
Joined: Thu Nov 16, 2017 3:20 am
Been thanked: 9 times

Re: [ssf2t] how to make a Breakpoint debug cheat work with xml?

Post by rabbyzero »

To make the question more general, is there any way to make a cheat work if the data will be modified and used in same frame? Or how to prevent data change?
crazyc
Posts: 31
Joined: Sat Apr 30, 2016 4:49 pm

Re: [ssf2t] how to make a Breakpoint debug cheat work with xml?

Post by crazyc »

The lua cheat engine supports breakpoints (https://github.com/mamedev/mame/blob/b2 ... it.lua#L63 https://github.com/mamedev/mame/blob/b2 ... t.lua#L295) with 2 caveats 1. the debugger must be enabled, even "-debug -debugger none" good enough 2. it's mostly unused so far so I can't guarantee it'll work in your case (bug reports and code fixes welcome).
rabbyzero
Posts: 24
Joined: Thu Nov 16, 2017 3:20 am
Been thanked: 9 times

Re: [ssf2t] how to make a Breakpoint debug cheat work with xml?

Post by rabbyzero »

This is insane. Do you have an example? What is the syntax?
For example. How to set "bp 470e,,{b@ff84b6=2;b@ff84b8=1;g}" ?
crazyc
Posts: 31
Joined: Sat Apr 30, 2016 4:49 pm

Re: [ssf2t] how to make a Breakpoint debug cheat work with xml?

Post by crazyc »

Code: Select all

[{
    "script":{
      "on":"maincpu.bpset(0x470e, function() cpup:write_u8(0xff84b6, 2) cpup:write_u8(0xff84b8, 1) end)"
      "off":""
    },
    "desc":"P1 Infinite throw range",
    "space":{
      "cpup":{
        "type":"program",
        "tag":":maincpu"
      }
    },
    "cpu":{
      "maincpu":":maincpu"
    }
}]
rabbyzero
Posts: 24
Joined: Thu Nov 16, 2017 3:20 am
Been thanked: 9 times

Re: [ssf2t] how to make a Breakpoint debug cheat work with xml?

Post by rabbyzero »

wooo!
It is crazy. Thanks. I will make good use of it. It is much easier than asm code modification.
Post Reply