Cheats In MAME ============== What Is This? ============= I know that using cheats will probably spoil a game, but I did this because there are many games that I want to see the endings of, but never will if I have to play several weeks to finish them. It is also very useful for driver writers, like me, because it allows me to see all the levels of a game without having to play them. It is very frustrating to play a game you do not really like, all night, just to pass the first level because someone tells you that there is a bug in your driver that appears on the second level. The cheat system in MAME operates much like the Pro Action Replay. You can use cheats found by others, or you can try to find new cheats yourself. The file CHEAT.DAT contains cheats that I, and others, have found. This file is in standard text format, so you can see or edit it with a standard text editor like Notepad. You might want to read the file just to have an idea of what cheats are available. That is a lot faster than trying all the games one after another. Operation ========= - Start a game in MAME, passing the "-cheat" parameter on the command line. - After the game's self test has completed (and you have started playing), press to go to the menu. Note: it is important that you do not enable any cheats before the self tests have completed, otherwise the tests will probably fail and the game will not start. (The tests are the garbage you see when most games start up.) - Select "CHEAT" on the menu. - You should see: Load And/Or Enable A Cheat Start A New Cheat Search Continue Search Memory Watch Return To Main Menu Active Cheats: --- None --- - The first line allows you to select and enable a cheat. The other three lines are used when searching for new cheats. The "Return To Main Menu" is obvious. Below that, you have a list of the currently active cheats. The first time you bring up this menu there will be no cheats active and it will show "--- None ---" to indicate that. - Select "Load And/Or Enable A Cheat". - The upper part of the screen lists the cheats that are currently available. This is where you can select the cheat you want to enable. - The lower part is a list of the currently enabled cheats. - If nothing appears between the lines "Select a Cheat" and "Active Cheats", then no cheats are available for the current game. - To enable a cheat, select it using the arrow keys, and use to enable it. The name of the cheat should now appear in the "Active Cheats" list. - Pressing on a cheat that is already in the "Active Cheats" list will remove it from the "Active Cheats" list (disables the cheat). - , , and are used when you are searching for your own cheats, or editing a cheat. Note: pressing does not delete that cheat from the CHEAT.DAT file, it just deletes it from the list in memory. Pressing on a cheat will save it to the CHEAT.DAT file. Pressing on a cheat that is already in the file will save it again (it will be duplicated in the file). Pressing will insert an new "empty" Cheat into the Cheat List. To remove a cheat from the file, you will have to edit the CHEAT.DAT file and remove it. - Press to see a view the Help. - Press or three times to return to the game. - Start a game, you should see the cheat's effects. - During the game, if you have to temporarilly disable all cheats, press . (See the MAME docs, as this key might have been changed.) *NOTE*: Enabling a cheat, *even for a short time*, will disable the hi-score saving for that MAME session. If you want to reenable hi-score saving, you will have to restart MAME. The "Memory Watch" option is described below. How To Search For New Cheats ============================ What can you search for? You can search for anything that happens during a game. The idea of a cheat is to replace a value, at a specific location in memory, with a different value. (Using cheat function #0, explained later) the game will not be able to change that value while the cheat is active. So, if you know the memory location where the "lives remaining" are kept, placing a value of "3" at that location will make the game think that you always have 3 lives remaining. You now, in effect, have unlimited lives. The easiest cheats (values) to find are lives or other numbers that you can see on the screen. You can also search for values that determine how you have a certain ability, and lengthen (or shorten!) the time you have the ability. In 1942, when you perform a loop, you are invincible during the time you are in the loop. So you can search to have that invincibility during the entire game. In Pacman, you can search for a code that keeps the ghosts blue during the entire game. Here is how you start searching for cheat codes. (More later on what to do with them.) There are 5 methods available to search for cheat codes. Each of them has specific advantages, and with practice you will learn which one to use depending on what it is you are searching for. Also, from the "Start A New Cheat Search" menu, you can bring up help to detail the search methods available. Here is a description of the methods and an example of how to use them. - Method #1 is used to search for a known number and follow its value. It is good for lives or other numbers. Here are the steps to find the lives value in (Namco) Dig Dug. - Start MAME. - Start a game. - Go to the cheat menu, and select "Start A New Cheat Search". - Select "Lives or other number". - With the arrow keys, enter the number of lives you had at the bottom of the screen while in the game. (Normally 2, but that depends on the DIP Switch settings.) Then press . - Return to the game. - Die. - Go to the cheat menu, and select "Continue Search". - Enter the number of lives you now have left. (Normally 1.) - The program will display all the locations that match your search criteria. If you have performed the search properly,and starting with 2 lives, you should see 2 entrys: 840A = 02 840C = 02 It means that the locations $840A and $840C had the value of 2 in them when you started the search, and have the value of 1 in them now. (We will try to narrow the list down to 1 entry.) - Return to the game - Die again. - Go to the cheat menu, and select "Continue Search" again. - Enter the number of lives you have left. (Normally 0.) - The list is the same, so now we will try to find which is the good one. - Press to copy all entries into the "Loaded Cheat" list, Or press on each of them to add them one by one. - Press or . - Select "Load And/Or Enable A Cheat". - You should see your 2 entries in the upper list. - Select the first entry (840A) press to copy it to the "Active Cheat list". - Return to the game. - Die. Since it was your last life your game should end, but it does not end: it is a good code. (What was the other code for? Let's try it and see.) - Go to the cheat menu, and select "Load And/Or Enable A Cheat". - Press on the 840A entry to remove it from the "Active Cheat List". - Press on the 840C entry to copy it into the "Active Cheat List". - Return to the game. - Die. It does the same thing of the other cheat code. It just so happens that in this game, there are 2 locations in memory that contain the lives remaining. So either one should good. - Return to the "Load And/Or Enable A Cheat" menu - Select the 840A or 840C entry, and press to save it in the CHEAT.DAT file. It will be saved with a cheat name of "840A = 02" (or "840C = 02). - Although the cheat system can edit cheat information, I will ask you to edit the CHEAT.DAT file and give the cheat a more meaningful description. (See below "How To Use The Cheat Editor") The last line of the file should be: digdugnm:0:840A:2:0:840A = 02 (While you are there, you can change the 2, in the fourth field, to a "6" so you will see 5 or 6 lives at the bottom of the screen when you will activate this cheat.) Give the cheat a more meaningful description (30 characters max). When you are finished, the line should look something like: digdugnm:0:840A:6:0:Infinite Lives - From now on when you will start (Namco) Dig Dug you will have "Infinite Lives" in the list of cheats available for that game. Note: With lives remaining, you can have 3 values: the number of lives displayed or the number displayed + 1 which is the real number of lives you have, or possibly the number of lives displayed - 1! Because of that, the method #1 will search for the number you enter and the number - 1. - Method #2 looks for locations that have changed by a specific value since the last time you checked. This method is good for timers, lives, energy, money, and level searches. Note that this search is not performed in reference to a start value like the other methods. I did it this way because I think it is easier to tell the cheat system that you lose a life, and another one, or that a value has incremented by 1 or 2 since the last time instead of telling it in reference to a start value that you lost 1 life, then 2, then 3. Here is an example: - Start a game with 3 lives. - Go to the cheat menu, and initialize the search. This will save a copy of the game's memory. - Go back to the game, and lose a life. - Go to the cheat menu, and search for a value that has changed by -1 since the search was initialized. - Go back to the game, and lose another life. - Go to the cheat menu, and search for a value that has changed again by -1 since the last search. Each time you do this, the cheat system will save the game's memory, and display the memory locations that match your search criteria. - Method #3 is used to search for an "energy bar" or any other value that you can tell has changed, or has not changed. Therefore, you search for values that are greater than, less than, or equal to the last value. Note that this search is not performed relative to a starting value, but relative to the last time you continued the search. (The first time uses the starting value, of course.) For example, we will try to find the "energy bar" in the game "Kung Fu Master": - Start a game in Kung Fu Master. (Wait a little bit for the game to actually start. When you can start to move, your "Energy Bar" will be full.) - Go to the cheat menu, and select "Start A New Cheat Search". - Select "Energy (Greater Or Less)". (This will initialize the search.) - Return to the game, and wait for an enemy to "grab" you. This will cause your "energy bar" to decrease. - Go the the cheat menu, and select "Continue Search". - Select "New value is smaller". (Because your "energy bar" as decreased in value.) - Return to the game for just a little bit so that your "energy bar" decreases a little more. - Go the the cheat menu, and select "Continue Search". - Select "New value is smaller". (Because your "energy bar" as decreased in value again.) - Return to the game for just a little bit so that your "energy bar" decreases a little more. - Go the the cheat menu, and select "Continue Search". - Select "New value is smaller". (Because your "energy bar" as decreased in value yet again.) - At this point, you should have less than 10 entries. But we are are going to try to narrow it down even more. - Return to the game, and let your player die (or get killed). When you player restarts, you will now have a full "energy bar". - Go the the cheat menu, and select "Continue Search". - Select "New value is greater". (Because your "energy bar" is now full.) - Return to the game, briefly. Do not let your player lose any energy! - Go the the cheat menu, and select "Continue Search". - Select "New value is equal". (Because your "energy bar" is the same as before.) - Aha! At this point, you should have 2 entries left. Press to register them in the list. - After a little more experimentation, you will see that the first address (E709) is the good one (where your energy is stored), while the second address (E81A) is used for displaying the "energy bar". Try it! If you set the wrong address, your "energy bar" will show full, but you will still die! - Method #4 is used to search for a status bit (or flag). This method is good to search for temporary invincibility and weapon status. In 1942 you are invincible when you perform a looping, we will try to search for that state. Here is an example (using 1942): - Start a game. - Perform a loop. - While looping, go to the cheat menu, and select "START NEW SEARCH". - Return to the game. - When the loop is finished, wait a little while... - Go to the cheat menu, and select "CONTINUE SEARCH". - Select "Opposite from start". - Return to the game. - Perform a loop. - While in the loop, go to the cheat menu, and select "CONTINUE SEARCH". - Select "Same as start". - Repeat as many times as required to narrow the list down. (After about 10 times I had 6 entries.) Follow the procedure above and you should find that E0A5 = 02 (memory location E0A5, set to a value of 2) is the cheat for invincibility. - Method #5 is used as last resort. The cheat system will search for a byte that is the same or different from when you first started (initialized the search). It is very much like method #4 but since it will search for a whole byte, you will get different results with this method. How To Use The Memory Watch =========================== The memory watch allows you to "keep an eye on" specific memory locations. The memory watch will display (at the top of the game screen) the contents of up to 10 memory locations that you specify. After selecting the cheat menu, and selecting "Memory Watch", you can select up to ten addresses to watch. If the address reads "FFFF", it is disabled, and no value will be shown for that address. Using the up and down Arrow keys, select which watch you want to activate. Using the right and left arrow keys, and <+> and <-> on the keypad, select the address that you wish to watch. You can use the <1>, <2>, <3> and <4> keys to increment the value in the first, second, third, and fourth columns. Hitting will copy the value from the previous entry. Hitting will disable the value (set it to FFFF). The , , and keys are used to change the location of where the watches are shown. You must have at least one watch enabled in order to see this effect. The watches take effect as soon as you enable them. You can also enable a watch from the "Load And/Or Enable A Cheat" Cheat List. Watches do NOT modify any memory. They only show it to you. Therefore, you can have watches enabled while a game is running it's self-test without affecting the self-test. (Watches can also be enabled from the "Load And/Or Enable A Cheat" screen. This way, you can observe what value that a potential cheat will modify, to see if it is the one that you are looking for.) As as example, suppose that you have found 6 locations that could contain "lives remaining". Rather than patching each location one at a time, you could just put a watches on the 6 locations, and see which one changes. How To Use The Cheat Editor =========================== The Cheat editor allows you to modify the properties of any cheat that is loaded into the Cheat List. Once in the editor, you can change the Name, CPU, Address, Value and Type of the cheat. This prevents you from having to go into the CHEAT.DAT file to change any settings. The Cheat Editor, coupled with the ability to insert a new cheat into the Cheat List, and the Memory Watcher, greatly simplifies searching for and creating new cheats. The Cheat Editor uses right and left arrow keys, and <+> and <-> on the keypad to change the values of the cheat. You can also use the <1>, <2>, <3> and <4> keys to increment the value in the first, second, third, and fourth columns, if available. Help is available for the Cheat Editor, and can be brought up by hitting . The help system will explain all of the features. Tips ==== When searching for lives, after telling the cheat system the number of lives you have remaining a few times, progressing the search, you will probably have a list of 1 or 2 entries. But when searching for a Status bit, you will probably be stuck with a list of more than 10 or 20 entries. When you see that you cannot narrow down the list any more, try the following: - When you have the list on the screen, press to copy them all to the "Loaded List". (The limit of the "Loaded List" is 100 entries.) - Back up, and select "Load And/Or Enable A Cheat". - You see your list there. Enable some of them (5 to 10). (You cannot have more than 10 cheats enabled at the same time.) - Go back to the game to see what effect this has. - If there is no noticeable effect, or if the effect is not what you where searching for: - Return to the "Load And/Or Enable A Cheat" screen. - Delete the entries that you previously enabled using . (Deleting a code from the upper list also deletes it from the "Active List". Remember, deleting a cheat from the upper list does not affect the CHEAT.DAT file, so you may delete existing cheat codes to have more space.) - Enable some other codes, and return to the game to see what happens. - When you have the effect you want in the game, you can be sure that the cheat code is one of the ones that you enabled, so enable them one at the time to find the correct code. - When you have found a code that you want to keep, select it in the "Loaded List", and press to save it in the CHEAT.DAT file. When looking for cheats, be aware that a game may keep the same value in two locations. The Kung Fu Master example above shows this. It is possible for a game to keep the number if lives remaining in one location in its RAM, but use the same value on screen someplace. For example, if you are working with a game that shows a "3" on the screen when you have 3 lives remaining, you might find two different memory locations that both change (and are the same value) whenever you gain and lose a life. If you are using a type of "infinite to disable cheats at this time, and then reenable them after the next level begins. If you have any special knowledge about a game, like its Memory Map, you can automatically throw out any locations that you know are not in the games RAM area(s). Examining the source code to the MAME drivers can help get you this information. Notes ===== While in the game, press <~> (might be the <`> key) to go directly to the "Continue Cheat" page. (See the MAME docs, as this key might have been changed.) To find a certain cheat, you may want to reset the emulation with . This will not affect the state of the current search and may be useful if you want to start a new game and retry the same actions with a few slight changes. (Note that a game might fail it's self test if the self test is performed while a cheat is active.) Normally, for cheats like Infinite Lives, Put a larger-than-usual number so that the player will see an abnormal number of lives. This will remind him/her that he/she has a cheat enabled. CHEAT.DAT file description ========================== Lines that start with a semicolon (;) are comments. A cheat code consists of a line of 5 fields separated by a colon (:), in this format: digdugnm:0:840A:6:0:Infinite Lives ::::: : The (short) name of the game. This is the same as the name of the game that you use on the MAME command line. : Which CPU (for games with multiple CPUs). Always "0" in this version of the cheat system. : The memory location to apply the value at, in Hexadecimal. : The data to put at the memory location, in Hexadecimal. : Type Of Cheat. Usually "0". Here is a list of the types: 0: Write cheat data into RAM each video frames. 1: Write cheat data into RAM once, and then delete cheat from the "Active List". 2: Wait one second between writes of cheat data to RAM. 3: Wait two seconds between writes of cheat data to RAM. 4: Wait five seconds between writes of cheat data to RAM. 5: When the original value in RAM is not like the cheat data, wait one second then write cheat data to RAM. (Used by Tempest for the Super Zapper cheat.) 6: When the original value in RAM is not like the cheat data, wait two seconds then write cheat data to RAM. 7: When the original value in RAM is not like the cheat data, wait five seconds then write cheat data to RAM. 8: If the original value in RAM is being decremented by 1 each frame, do not write the cheat data to RAM. Otherwise, write the cheat data to RAM. (This cheat type, and the next 3 that follow, are used to prevent games, that countdown values at a certain point, from counting down forever. Kung Fu Master is one example. Note what happens at the end of a level.) 9: If the original value in RAM is being decremented by 2 each frame, do not write the cheat data to RAM. Otherwise, write the cheat data to RAM. 10:If the original value in RAM is being decremented by 3 each frame, do not write the cheat data to RAM. Otherwise, write the cheat data to RAM. 11:If the original value in RAM is being decremented by 4 each frame, do not write the cheat data to RAM. Otherwise, write the cheat data to RAM. (I do not know if types 8 - 11 will be useful. I hope so. It works for some games, like Kung Fu Master, but not for others, like Rally X. More research is being done to fix this problem.) : The description (30 characters max). Have fun! Marc Lafontaine marclaf@sympatico.ca http://www3.sympatico.ca/marclaf (Edited by James R. Twine, jtwine@bettynet.com)