XML Cheat Documentation
Posted: Tue Sep 28, 2010 7:21 pm
As there is a rather minimal amount of documentation in existence for the XML format, I'm going to do my best to document the entire thing.
From Cheat.C
Never fear. I'm not mailing it in. I'm going to describe all of this in as much detail as I know how. If it looks complicated, it shouldn't. It's pretty easy for most of what you'll ever want to do.
Quick Intro to XML
For the most part, if you've learned HTML, you should conceptually know how MAME's XML cheat system works. The only difference is that XML is much more finicky. All tags in XML must be closed off at some point. All quotations must be closed. Any errors in XML files can cause MAME to crash. Be cautious and avoid doing anything that increases the chance of making a mistake. Even misplaced tags and typographical errors are potentially fatal.
If you're using a tag as a container, then it must have have an appropriate closing tag.
Example: <tag>stuff</tag>
If a tag is only being used for its attributes, then it must be closed immediately.
Example: <tag attribute="stuff" />
Avoid using < and > for anything. If you want them as characters, use < and > (same as HTML). As comparisons, use LT and GT.
Using and editing XML files
All of MAME's XML cheats are packed in a file called cheat.zip which goes in the root MAME directory (such as C:\MAME). Cheats can be extracted to the cheat directory (C:\MAME\cheat) but you should only extract files that you wish to modify. You do not need to place your modified cheat files in cheat.zip. Files in the cheat directory override cheat.zip.
There is no reason for the editing process to seem complicated. It is simple.
1) Open cheat.zip
2) Find the file you wish to edit
3) Place said file in cheat folder
4) Edit file
That's it. MAME includes a reload cheats feature. It will load the file in the cheat folder if there is one. If there's an error, MAME will probably crash with a random error. Don't make mistakes. lol
From Cheat.C
Code: Select all
<mamecheat version="1">
<cheat desc="blah">
<parameter min="minval(0)" max="maxval(numitems)" step="stepval(1)">
<item value="itemval(previtemval|minval+stepval)">text</item>
...
</parameter>
<script state="on|off|run|change(run)">
<action condition="condexpr(1)">expression</action>
...
<output condition="condexpr(1)" format="format(required)" line="line(0)" align="left|center|right(left)">
<argument count="count(1)">expression</argument>
</output>
...
</script>
...
<comment>
... text ...
</comment>
</cheat>
...
</mamecheat>
Quick Intro to XML
For the most part, if you've learned HTML, you should conceptually know how MAME's XML cheat system works. The only difference is that XML is much more finicky. All tags in XML must be closed off at some point. All quotations must be closed. Any errors in XML files can cause MAME to crash. Be cautious and avoid doing anything that increases the chance of making a mistake. Even misplaced tags and typographical errors are potentially fatal.
If you're using a tag as a container, then it must have have an appropriate closing tag.
Example: <tag>stuff</tag>
If a tag is only being used for its attributes, then it must be closed immediately.
Example: <tag attribute="stuff" />
Avoid using < and > for anything. If you want them as characters, use < and > (same as HTML). As comparisons, use LT and GT.
Using and editing XML files
All of MAME's XML cheats are packed in a file called cheat.zip which goes in the root MAME directory (such as C:\MAME). Cheats can be extracted to the cheat directory (C:\MAME\cheat) but you should only extract files that you wish to modify. You do not need to place your modified cheat files in cheat.zip. Files in the cheat directory override cheat.zip.
There is no reason for the editing process to seem complicated. It is simple.
1) Open cheat.zip
2) Find the file you wish to edit
3) Place said file in cheat folder
4) Edit file
That's it. MAME includes a reload cheats feature. It will load the file in the cheat folder if there is one. If there's an error, MAME will probably crash with a random error. Don't make mistakes. lol