4. Go go gadget cheat! <script>
Attributes:
state - How/when to use the contained actions (on, off, change, run)
This is where the real action takes place.
About states:
on = Now! cheats. Also called one shot cheats. You push enter, the cheat does its action. That's it.
change = Now! cheats with parameters. Select a parameter and push enter. This is commonly used for crash prevention.
run = Where enabled means always enabled (unless frame is used or a loop is instated)
off = Something to do when the cheat is disabled. Pugsy often uses this to restore ROM when disabling ROM cheats.
You cannot mix change and run, but you can mix the others.
Pugsy places 4 spaces before <script>
4b. Lights, Camera, <action>?
Attributes:
Optional
condition - Defines a condition at which the action is executed. Absurdly useful.
This is the most important part of making a cheat, so knowing how it works is important.
Pugsy places 6 spaces before <action>.
Cheat Break Down
At this point, we need to break down how cheats actually work.
* Standard Cheats *
Usually, you just want to plug a value into something and make it stay there. Set it and forget it.
Example from mk3ghw.xml
Code: Select all
<cheat desc="Infinite Lives in Galaga">
<script state="run">
<action>maincpu.pb@FF022F=99</action>
</script>
</cheat>
This is a cheat that when enabled, always puts the value 99 in the RAM address FF022F. You should understand that from the things described so far.
maincpu . p b @ FF022F = 99
maincpu = The address space that the address exists in. "maincpu" is the most commonly wanted, but as seen above, not always.
p = Type of memory. p=RAM, m=ROM, o=ROM ??? ROM cheats aren't my thing, but p is usually what you want.
b = Width of value being plugged. b=byte (0x00), w=word (0x0000), d=double (0x00000000), q=quad (0x0000000000000000)
FF022F = Address. Have fun with Midway machines. They use a very unusual system which I don't like much.
99 = The value being plugged in. (Hexidecimal)
* Bit Cheats *
There's 8 bits in a byte. That is... 01,02,04,08,10,20,40,80. You add those up and you get various values which indicate which bits are active and inactive. Pretty simple. Just think of it as toggle switches. 03 would mean that the first two toggle switches are active. 00 means none active. Etc.
Example from pc_wcup.xml:
Code: Select all
<cheat desc="Press SELECT+A for Sliding Tackle P2 (friend)"><comment>Alternate pass function allows you to always tackle opposing team members.</comment>
<script state="run">
<action condition="cart.pb@0001==(A0|(cart.pb@0001 BAND ~A0))">cart.pb@03FC=9B</action>
</script>
</cheat>
Here I've built a cheat which uses a bit value in a condition. Ooh...scary! Here's an English description of what happens: "If the 6th and 8th bits at 0001 (in the cart address space of RAM) are active, then make 03FC's value equal 9B." It works because the NES (and probably every other system EVER) stores what buttons are held on the controller as bits in some addresses.
(A0|(cart.pb@0001 BAND ~A0))
A0 = value being plugged in
cart.pb@0001 = the relevant address and space
BAND ~A0 = Bit width of the address being poked or tested
These cheats are admittedly complicated and iffy to play with, but you have to be creative and just see what you can do with it.
* Using frames *
I admit I don't know entirely how to use the frame variable, but here's a nice application of it.
Example from pc_smb3.xml:
Code: Select all
<cheat desc="Moon Jump"> <comment>Hold A to jump forever.</comment>
<script state="run">
<action condition="(frame % 7 == 0) and cart.pb@0017==(80|(cart.pb@0017 BAND ~80))">cart.pb@00CF=CD</action>
</script>
</cheat>
This tells the cheat engine that if I'm holding the jump button, make 00CF's value equal CD every 7 frames. This is a well tuned value derived to ensure that Mario won't jump through ceilings. There's surely other uses for "frame" but oh well. Maybe Pugsy can describe it better somewhere.
* ROM cheats *
ROM hacking isn't really my forté so I'll let Pugsy's art better demonstrate a ROM cheat.
Code: Select all
<cheat desc="Invincibility">
<script state="on">
<action>temp0 =maincpu.ob@157E</action>
</script>
<script state="run">
<action>maincpu.ob@157E=60</action>
</script>
<script state="off">
<action>maincpu.ob@157E=temp0 </action>
</script>
</cheat>
This is a nice example which also demonstrates the usage of temporary variables. Never seen o before as memory type, but whatever. You can see here that Pugsy stores the original ROM value in a temporary variable and then restores it when the cheat is disabled. I'm not sure how necessary this is, but it's good practice and I figure anything Pugsy does must be correct. He's a hell of a lot smarter than I am.
* Conditions and Settings and Stuff *
I'm not going to explain all of this because I don't even know all of it. Basically, you need to know = for setting cheats. For conditions, == (equals), != (not equals), LT (less than), GT (greater than).
Just look at
this.
Aww yeah. AMD A10-7850K givin' MAME and MESS systems what for.