?How can i write to certain address if a condition is met?

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
User avatar
megaman_exe
Posts: 39
Joined: Mon Nov 05, 2007 2:12 am

?How can i write to certain address if a condition is met?

Post by megaman_exe »

Hi. I was wondering if it's possible to write in one-shot mode to a given address only if another address has a certain value. For example, write to address 0xffb374 and ffb384 the value 00000000 in 32 bits only if address 0xffb324 in 8 bits has the value 14. As it's one-shot, the cheat should be disabled immediately.

I know there's the "write if match" mode:

-------- ----1--- -------- ---00---

The problem with that mode is that one is forced to write to the same address that is being poked (0xffb374). Could this be made by using linked cheats? (0x62000000 mode?)

What i want to do is to reset the score in cadillacs and dinosaurs if one loses. In the example above, 0xffb374 and 0xffb384 are the addresses of the score for player 1. The address 0xffb324 is the address of a "continue game" counter drawn in the screen which shows the amount of seconds before game is over for PL1. Basically, when this address has the value 0x14, it means the player has lost all his lives, so I want to penalize this by setting his/her score to 0.

I've check that the same counter is used to give a time for the player to choose any of the 4 characters, but it starts in 10 rather than 20, so choosing 0x14 (20) as the condition value this wouldn't trigger again setting the score to 0. Moreover, the counter freezes upon the player starts playing, but it can't be frozen in 0x14 because the counter value is overwritten by 0xa (10) in the character selection menu in the top of the screen.

If someone can help me with this task, I'd be very grateful! ;)

PD: All these addresses belong to CPU 0
User avatar
Pugsy
Posts: 3638
Joined: Fri Aug 17, 2001 12:59 am
Location: North Wales, UK.
Has thanked: 1 time
Been thanked: 12 times
Contact:

Post by Pugsy »

It's not possible with the old cheat engine, such cheats are one offs so the only way to do this would be to make it a ROM cheat - which is actually not that difficult if you know 68000.

It will be possible with the new cheat engine which is debugger based. However, creating such cheats will require an understanding of the debugger and the new cheat format (even if the 68000 knowledge is no longer required).

This may or may not work when Aaron's replacement cheat engine is added:

Code: Select all

<cheat description="Penalise Players">
	<script state="run">
		<action execute="p0d@ffb374=0" condition="p0b@104729==14"/>
		<action execute="p0d@ffb384=0" condition="p0b@104729==14"/>
	</script>
</cheat>

If and when it's released add that to the cheat xml file for that game.
Pugsy

Servicing your cheating needs since 1985 8)

Grab the latest cheat collection:
MAME 0.259 XML cheat collection (6 OCTOBER 2023) from http://www.mamecheat.co.uk or direct from:-
https://mega.nz/file/q4dHGZ6K#i-EUiqIjH ... KMz7hnbTfw (ZIP Archive 3.76MB)
Post Reply