Fake One Shot Cheats: In This Thread I Brag

General Chit-Chat about MAME and other emulators.
Post Reply
User avatar
NotAGoodName
Posts: 331
Joined: Wed Feb 18, 2009 7:09 am
Location: MO, USA
Contact:

Fake One Shot Cheats: In This Thread I Brag

Post by NotAGoodName »

And this is why I like XML. Why stare at some 68K ASM that I'll never understand when I can practically write programs in XML to manipulate the RAM?

This example demonstrates the ability to build a fake one shot cheat. That is...I push a button and something only happens once. The cheat is actually always running, but with temporary variables and conditions, I can create scenarios where effects only happen once per condition. In this case for Gunstar Heroes, I push the A button as usual to change weapons, but I've reprogrammed the change function with XML and now implemented the ability to switch to fists without the use of alternate button pushing methods (like up+A).

Code: Select all

	<cheat desc="Enable Full Weapon Cycling"> <comment>Push A to cycle through all weapons including fists.</comment>
		<script state="run">
			<action condition="maincpu.pb@FFA469 == (00|maincpu.pb@FFA469 BAND ~40)">temp0=00</action>
			<action condition="maincpu.pb@FFA669 == (00|maincpu.pb@FFA669 BAND ~40)">temp1=00</action>
			<action>temp3=maincpu.pb@FFA472</action>
			<action>temp4=maincpu.pb@FFA672</action>
			<action condition="maincpu.pb@FFA400 NE 00 and maincpu.pb@FFA472 == 00">maincpu.pb@FFA472=03</action>
			<action condition="maincpu.pb@FFA600 NE 00 and maincpu.pb@FFA672 == 00">maincpu.pb@FFA672=03</action>
			<action condition="maincpu.pb@FFA469 == (40|maincpu.pb@FFA469 BAND ~40) and temp0 == 00 and maincpu.pb@FFA472==03 and maincpu.pb@FFA400 == 00">maincpu.pb@FFA472=00, temp0=01</action>
			<action condition="maincpu.pb@FFA469 == (40|maincpu.pb@FFA469 BAND ~40) and temp0 == 00 and maincpu.pb@FFA472==03 and maincpu.pb@FFA400 NE 00">maincpu.pb@FFA472=01, temp0=01</action>
			<action condition="maincpu.pb@FFA469 == (40|maincpu.pb@FFA469 BAND ~40) and temp0 == 00 and maincpu.pb@FFA472 LT 03 and maincpu.pb@FFA471 GT 00">maincpu.pb@FFA472=(temp3)+1, temp0=01</action>
			<action condition="maincpu.pb@FFA469 == (40|maincpu.pb@FFA469 BAND ~40) and temp0 == 00 and maincpu.pb@FFA472==00 and maincpu.pb@FFA471 == 00">maincpu.pb@FFA472=01, temp0=01</action>
			<action condition="maincpu.pb@FFA469 == (40|maincpu.pb@FFA469 BAND ~40) and temp0 == 00 and maincpu.pb@FFA472==01 and maincpu.pb@FFA471 == 00">maincpu.pb@FFA472=03, temp0=01</action>
			<action condition="maincpu.pb@FFA669 == (40|maincpu.pb@FFA669 BAND ~40) and temp1 == 00 and maincpu.pb@FFA672==03 and maincpu.pb@FFA600 == 00">maincpu.pb@FFA672=00, temp1=01</action>
			<action condition="maincpu.pb@FFA669 == (40|maincpu.pb@FFA669 BAND ~40) and temp1 == 00 and maincpu.pb@FFA672==03 and maincpu.pb@FFA600 NE 00">maincpu.pb@FFA672=01, temp1=01</action>
			<action condition="maincpu.pb@FFA669 == (40|maincpu.pb@FFA669 BAND ~40) and temp1 == 00 and maincpu.pb@FFA672 LT 03 and maincpu.pb@FFA671 GT 00">maincpu.pb@FFA672=(temp4)+1, temp1=01</action>
			<action condition="maincpu.pb@FFA669 == (40|maincpu.pb@FFA669 BAND ~40) and temp1 == 00 and maincpu.pb@FFA672==00 and maincpu.pb@FFA671 == 00">maincpu.pb@FFA672=01, temp1=01</action>
			<action condition="maincpu.pb@FFA669 == (40|maincpu.pb@FFA669 BAND ~40) and temp1 == 00 and maincpu.pb@FFA672==01 and maincpu.pb@FFA671 == 00">maincpu.pb@FFA672=03, temp1=01</action>
		</script>
	</cheat>
What this does:
Line 3&4 : If I'm not pushing A, make temp0/1 = 00. temp0 for PL1, temp1 for PL2
Line 5&6 : Store the current players' weapon selections. temp3 for PL1, temp4 for PL2
Line 6&7 : Crash prevention. If I'm not the normal player, then don't let me have punch selected. Just in case.
Line 8 : If I push A, A was not previously pushed, PL1 current weapon is 1+2, and PL1 is normal player, then select punching and say I pushed A.
Line 9 : If I push A, A was not previously pushed, PL1 current weapon is 1+2, and PL1 is not normal player, then select first weapon and say I pushed A.
Line 10 : If I push A, A was not previously pushed, PL1 current weapon is punch/1/2, and PL1 has a second weapon, then go to next weapon and say I pushed A.
Line 11 : If I push A, A was not previously pushed, PL1 current weapon is punch, and PL1 does not have a second weapon, then skip to 1+2 and say I pushed A. (Crash prevention, player cannot use punch in the second slot)
Line 12 : If I push A, A was not previously pushed, PL1 current weapon is 1, and PL1 does not have a second weapon, then skip to 1+2 and say I pushed A. (Crash prevention, player cannot use punch in the second slot)
Line 13-17 : PL2 versions of Lines 8-12.

So in summary...
Normal game play, 2 weapons = 3,1,2 loop
Normal game play, 1 weapon = 3
Now, 2 weapons = 3,[0],1,2 loop
Now, 1 weapons = 0/1,3 loop

I can now select punching when it won't crash the game. I can now switch from punching which normally isn't possible. I can now hold the A button without any further cheat effect and not rely on frame delays!
Aww yeah. AMD A10-7850K givin' MAME and MESS systems what for.
Post Reply