Help/Bug: Change not respected in combination with run

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
NotAGoodName
Posts: 331
Joined: Wed Feb 18, 2009 7:09 am
Location: MO, USA
Contact:

Help/Bug: Change not respected in combination with run

Post by NotAGoodName »

Ok. I want to set up a cheat that does the following:

1) It doesn't run until I push enter.
2) It stays running until I deliberately disable it by pushing enter.
3) It works in the form of a list.

Ok. I've come to the conclusion that the following should work...

Code: Select all

	<cheat desc="Super Mode Enabled..."><comment>Sprite and stats only.</comment>
		<parameter>
			<item value="00">Disabled</item>
			<item value="04">S1K (hack)</item>
			<item value="02">S2</item>
			<item value="01">S3+K (Super)</item>
			<item value="03">S3+K (Hyper)</item>
		</parameter>
		<script state="change">
			<action>temp1=param</action>
			<action condition="param==00">maincpu.pb@FFFE19=00</action>
			<action condition="param GT 00">maincpu.pb@FFFE19=FF</action>
			<action condition="param==01">maincpu.pb@FFFE19=01</action>
			<action condition="param==01 and maincpu.pd@FFB000==00010A94 and maincpu.pw@FFB020 GT 0000">maincpu.pw@FFB00E=6816</action>
			<action condition="param==01 and maincpu.pd@FFB000==00011BB8 and maincpu.pw@FFB020 GT 0000">maincpu.pw@FFB00E=1194</action>
			<action condition="param==03 and maincpu.pd@FFB000==00010A94 and maincpu.pw@FFB020 GT 0000">maincpu.pw@FFB00E=6816</action>
			<action condition="param==03 and maincpu.pd@FFB000==00011BB8 and maincpu.pw@FFB020 GT 0000">maincpu.pw@FFB00E=1194</action>
			<action condition="param==03 and maincpu.pd@FFB000==00010A94 and maincpu.pw@FFB020 GT 0000">maincpu.pd@FFCD7C=000193CA</action>
		</script>
		<script state="run">
			<action condition="temp1==00">maincpu.pb@FFFE19=00</action>
			<action condition="temp1 GT 00">maincpu.pb@FFFE19=FF</action>
			<action condition="temp1==01">maincpu.pb@FFFE19=01</action>
			<action condition="temp1==01 and maincpu.pd@FFB000==00010A94 and maincpu.pw@FFB020 GT 0000">maincpu.pw@FFB00E=6816</action>
			<action condition="temp1==01 and maincpu.pd@FFB000==00011BB8 and maincpu.pw@FFB020 GT 0000">maincpu.pw@FFB00E=1194</action>
			<action condition="temp1==03 and maincpu.pd@FFB000==00010A94 and maincpu.pw@FFB020 GT 0000">maincpu.pw@FFB00E=6816</action>
			<action condition="temp1==03 and maincpu.pd@FFB000==00011BB8 and maincpu.pw@FFB020 GT 0000">maincpu.pw@FFB00E=1194</action>
			<action condition="temp1==03 and maincpu.pd@FFB000==00010A94 and maincpu.pw@FFB020 GT 0000">maincpu.pd@FFCD7C=000193CA</action>
		</script>
	</cheat>
That seems logical to me. I push enter, temp1 is changed to the parameter, and thus the run part of the cheat doesn't function until then.

Problem:
The engine completely ignores the function of state="change" and decides that cycling the options is the same as pushing enter. This is obviously wrong. There are cheats which can cause games to crash when cycling through options, thus a manual option is needed.

Result exactly as above:
Cycling goes through the values as if it were a state="run" cheat. The requirement of pushing the enter key is completely ignored thus making state="change" useless.

Result without temp1=param:
Enter key function is totally ignored again. Temp1 is locked at 0 so FFFE19 never changes. Other values continue to cycle again making state="change" useless.

Result without entire state="run" portion:
Cheat finally operates as predicted, but since it's only temporary, who cares? The intended function is lost.


I'm really at a loss for what to do. I assume this is a bug because it's absolutely not working properly. Cycling an option is not pushing enter, thus the temp1 should never be able to change without my permission and it is.
Aww yeah. AMD A10-7850K givin' MAME and MESS systems what for.
User avatar
Pugsy
Posts: 3675
Joined: Fri Aug 17, 2001 12:59 am
Location: North Wales, UK.
Has thanked: 1 time
Been thanked: 15 times
Contact:

Re: Help/Bug: Change not respected in combination with run

Post by Pugsy »

From what I recall you can not use "change" and "run" in the same cheat in that way, I'd never use them together in the same cheat as "change" was meant for one shot list cheats only.

Only way I can think of without making rather big changes to the cheat engine is to have two cheats, one uses the change part put stores the variable in a SAFE unchanged memory address rather than a temp variable. The other part uses the run part but reads from the SAFE memory address.
Pugsy

Servicing your cheating needs since 1985 8)

Grab the latest cheat collection:
MAME 0.264 XML cheat collection (3 APRIL 2024) from http://www.mamecheat.co.uk or direct from:-
https://mega.nz/file/SxsQUJoT#jBdz6GLm_ ... QzFGSMms2c (ZIP Archive 3.8 MB)
User avatar
NotAGoodName
Posts: 331
Joined: Wed Feb 18, 2009 7:09 am
Location: MO, USA
Contact:

Re: Help/Bug: Change not respected in combination with run

Post by NotAGoodName »

Sounds a bit convoluted, but I think it'll do for this. Sonic engine has at least 4 bytes at the end that I can use. Plenty for what I'm trying to do and a better option than resetting.
Aww yeah. AMD A10-7850K givin' MAME and MESS systems what for.
User avatar
NotAGoodName
Posts: 331
Joined: Wed Feb 18, 2009 7:09 am
Location: MO, USA
Contact:

Re: Help/Bug: Change not respected in combination with run

Post by NotAGoodName »

For the sake of sharing knowledge, here's the solution to this conundrum in reference to the cheat I did above. This works perfectly. Note that I'm not using 0 through 9 because there are placeholder values in the addresses that I'm using to store information and I should avoid using those values, obviously.

Code: Select all

	<cheat desc="Become Super Mode NOW!..."><comment>Sprite and stats only.  Pick game, push enter.</comment>
		<parameter>
			<item value="0x99">Disable</item>
			<item value="0x14">S1K (hack)</item>	
			<item value="0x12">S2</item>
			<item value="0x11">S3+K (Super)</item>	
			<item value="0x13">S3+K (Hyper)</item>
		</parameter>
		<script state="change">
			<action>maincpu.pb@FFFFFC=param</action>
			<action condition="param==99">maincpu.pb@FFFE19=00</action>
			<action condition="param==99 and maincpu.pd@FFB000==00010A94 and maincpu.pw@FFB020 GT 0000">maincpu.pw@FFB00E=6629</action>
			<action condition="param==99 and maincpu.pd@FFB000==00011BB8 and maincpu.pw@FFB020 GT 0000">maincpu.pw@FFB00E=0FE0</action>
			<action condition="param==12">maincpu.pb@FFFE19=FF</action>
			<action condition="param==14">maincpu.pb@FFFE19=FF</action>
			<action condition="param==13">maincpu.pb@FFFE19=FF</action>	
			<action condition="param==11">maincpu.pb@FFFE19=01</action>
			<action condition="param==11 and maincpu.pd@FFB000==00010A94 and maincpu.pw@FFB020 GT 0000">maincpu.pw@FFB00E=6816</action>
			<action condition="param==11 and maincpu.pd@FFB000==00011BB8 and maincpu.pw@FFB020 GT 0000">maincpu.pw@FFB00E=1194</action>
			<action condition="param==13 and maincpu.pd@FFB000==00010A94 and maincpu.pw@FFB020 GT 0000">maincpu.pw@FFB00E=6816</action>
			<action condition="param==13 and maincpu.pd@FFB000==00011BB8 and maincpu.pw@FFB020 GT 0000">maincpu.pw@FFB00E=1194</action>
			<action condition="param==13 and maincpu.pd@FFB000==00010A94 and maincpu.pw@FFB020 GT 0000">maincpu.pd@FFCD7C=000193CA</action>
		</script>
	</cheat>
	<cheat desc="... Make Cheat Permanent"><comment>Enable First.  Must redo prior cheat on reset.</comment>
		<script state="run">
			<action condition="maincpu.pb@FFFFFC==99">maincpu.pb@FFFE19=00</action>
			<action condition="maincpu.pb@FFFFFC==99 and maincpu.pd@FFB000==00010A94 and maincpu.pw@FFB020 GT 0000">maincpu.pw@FFB00E=6629</action>
			<action condition="maincpu.pb@FFFFFC==99 and maincpu.pd@FFB000==00011BB8 and maincpu.pw@FFB020 GT 0000">maincpu.pw@FFB00E=0FE0</action>
			<action condition="maincpu.pb@FFFFFC==12">maincpu.pb@FFFE19=FF</action>
			<action condition="maincpu.pb@FFFFFC==14">maincpu.pb@FFFE19=FF</action>
			<action condition="maincpu.pb@FFFFFC==11">maincpu.pb@FFFE19=01</action>
			<action condition="maincpu.pb@FFFFFC==13">maincpu.pb@FFFE19=FF</action>
			<action condition="maincpu.pb@FFFFFC==11 and maincpu.pd@FFB000==00010A94 and maincpu.pw@FFB020 GT 0000">maincpu.pw@FFB00E=6816</action>
			<action condition="maincpu.pb@FFFFFC==11 and maincpu.pd@FFB000==00011BB8 and maincpu.pw@FFB020 GT 0000">maincpu.pw@FFB00E=1194</action>
			<action condition="maincpu.pb@FFFFFC==13 and maincpu.pd@FFB000==00010A94 and maincpu.pw@FFB020 GT 0000">maincpu.pw@FFB00E=6816</action>
			<action condition="maincpu.pb@FFFFFC==13 and maincpu.pd@FFB000==00011BB8 and maincpu.pw@FFB020 GT 0000">maincpu.pw@FFB00E=1194</action>
			<action condition="maincpu.pb@FFFFFC==13 and maincpu.pd@FFB000==00010A94 and maincpu.pw@FFB020 GT 0000">maincpu.pd@FFCD7C=000193CA</action>
		</script>
	</cheat>
Aww yeah. AMD A10-7850K givin' MAME and MESS systems what for.
Post Reply