This is a tutorial on how to compile your own version of MAME.EXE with high score support
and "State successfully loaded" message boxes removed.
I'd like to thank Mr. Do for most of the information presented below, and an anonymous friend
who provided the information about how to remove Save State message boxes.
DISCLAIMER: If you do not follow these instructions and mess up your system, please don't
insult me by blaming me. All we are doing here is creating a custom MAME.EXE which will not
affect any other part of whatever system you have, it is a replacement for your
existing MAME.EXE. Please back up or move your existing MAME.EXE and
your MAME.INI config file to a safe place before you begin.
Version 141 was mentioned in an post below... so we will be using version 141
for the demonstration. We are also going to assume the 32-bit version is
going to be created. We are going to start by getting the source
code directly from MAME. All previous releases (older than the latest release)
can be obtained directly from the MAME website at the following page:
http://mamedev.org/oldrel.html
- Select Version 0.141 from the "Source" column (not the "Binary" column) and
download it to a location on your computer. You should now have a ZIP file
which is about 16mb in size
- Create a folder down at the root of C: drive (the short path name minimizes glitches)
called "mamesrc"... so this new folder is now at the location C:\mamesrc
Open the downloaded ZIP file and extract the package inside (another ZIP folder called "mame.zip")
to any location of your choice on your computer. Open mame.zip and you should see the following
folders and files:
docs (folder)
src (folder)
makefile (file)
whatsnew (file)
Extract these 4 items to "C:\mamesrc" folder you created earlier.
The entire C:\mamesrc folder will now be approximately 93mb in size.
- Browse to the following page at the MAME website:
http://mamedev.org/tools
We are going to need the tools to compile the source code we have stashed in C:\mamesrc.
If you look partway down the page under section 2, in the "Binaries" column, download
"mingw-mame-20110519.exe" (the latest version as of the date this post was made)...
we want that. It is usable for both 32 and 64-bit builds, and in my opinion works
great for what we are doing.
So as that's downloading, let's go back to C: drive and create a folder called "mingw"...
This is the folder we are going to extract the new package to. Open your downloaded
"mingw-mame-20110519.exe" file and make sure C:\mingw is displayed in the "Extract to" box
which appears, and press OK. This will auto-extract the contents of the package into C:\mingw.
You should see two folders in C:\mingw: mingw64-w32 and mingw64-w64
Now, on C: drive, we have two folders like this:
mamesrc
mingw
And we are almost ready to work on this!
We now need a few tools to make patching easy.
- Browse to the following page at Mr. Do's MAME page:
http://mameworld.info/mrdo/compile.html
...and download a file called "compile_extras.zip" from the "DIFFs, Extra Files, and Stuff"
category which is partway down the page. Unpack the contents of "compile_extras.zip" into
your "C:\mamesrc" folder.
- Browse to the following page at Arcadecontrols.com:
http://forum.arcadecontrols.com/index.php?topic=64298.0
...and under the "DIFF TO DOWNLOAD" column, right-click "Save as" on version 141...
where it asks for a file-name, change the extension from .txt to .diff (important!)
and point it to your C:\mamesrc folder (it should look like C:\mamesrc\hi_141.diff when it is in there).
Now we are going to tweak our helper tools we got from Mr. Do... open your C:\mamesrc folder
and right-click on "MakeMAME.bat". Select "Edit" from the menu... notepad should open up and
display the following:
set path=c:mingw\bin
mingw32-make
This needs to be changed to reflect the actual path, so change the first line to:
set path=c:mingw\mingw64-w32\bin
...save the file then close it.
At this point, we are 100% ready to patch in the HI_141.DIFF file which includes high score support...
This, by default, also removes the message windows that say "loading" and the other ones that display
"This game may not run correctly..." etc...
Please note that anything described in the section below is not officially supported by MAME
and would be frowned upon, so PLEASE do not bug them with any support questions at all... they
will not be honored there. If you want to compile a regular version of MAME, skip the following section
and start again down at "Compiling".
- Open "!Command Prompt" in your C:\mamesrc folder, a CMD window will appear.
- type the following:
patchmame hi_141
and press ENTER. You will see a list of files displayed as it alters them... close the window once it is finished.
This has patched necessary source files, and has included the high score support we discussed earlier.
I want to take you the extra mile. We are also going to manually remove the message boxes
which display "State successfully loaded." when a game is opened. There is no patch for this,
it must be done manually. Hey I could write a short script that removes these automatically! I just thought
of that lol, I will get to that soon.
You may skip this step if you are ok with seeing those message windows every time a saved state is loaded,
but I personally cannot stand them after a few hundred times of moving the joystick back and forth.
We need to alter a specific file, located in "C:\mamesrc\src\emu", called "machine.c" so find that,
and just for safety purposes, copy that file and place the copy somewhere safe, in case we mess up.
Right-click "machine.c" and choose "Edit" from the menu that appears.
The file should open in notepad. We need to find the following lines:
case STATERR_NONE:
if (!(m_game.flags & GAME_SUPPORTS_SAVE))
popmessage("State successfully %s.\nWarning: Save states are not officially supported for this game.", opnamed);
else
popmessage("State successfully %s.", opnamed);
break;
They are located about 2/3 of the way down... or choose "Edit/Find" from the menu
and search for "case STATERR_NONE:" (without the quotes).
Let's remove everything after "case STATERR_NONE:" and before "break;"... place your cursor
just to the left of the word "if" (located on the line under "case STATERR_NONE:") click and hold, and drag your mouse down to highlight
everything down to the left side of "break;", and delete it.
Now you should have something that looks like this:
case STATERR_NONE:
break;
If you do not have the above two lines instead of what was there before... please make sure you
try again until you get it right. "break;" needs to be on the line UNDER "case STATERR_NONE:"
or it may cause a massive malfunction.
OK! Once you are confident it has been altered correctly, save and exit "machine.c" and return to
your C:\mamesrc folder.
Compiling:
- Open your C:\mamesrc folder and open "!Command Prompt", a CMD window will appear.
- type makemame
- press ENTER
- go make a cheeseburger, the compile will take probably half and hour.
You should end up with "mame.exe" in your C:\mamesrc folder, after it is finished.
Try it out!!! Move it into your working MAME folder and open your system as usual.
For safety purposes, maybe back up your existing MAME.EXE somewhere.
NOTE: for hiscore support to work, you need the version of HISCORE.DAT which matches your
version of MAME, in this case 0.141 so browse to the following page:
http://www.mameworld.info/highscore/download.htm
and click the top red button to download the latest Hiscore.dat file... you should now have
a ZIP folder called "hiscoredat.zip". Open this and extract Hiscore.dat to your working MAME folder
where you should now have your new MAME.EXE file located.
You also need to create a new folder called "hi" (without the quotes) in your working MAME folder...
so Hiscore.dat can save high score files in it. It will not work otherwise.
You can right-click "Create Shortcut" on your new MAME.EXE and if you right-click on the shortcut
and select "properties" you can then add " -cc" to the Target line (without quotes, note the space!).
Now run this shortcut and it will create a "MAME.INI" configuration file with the new high-score options listed in it.
It also lists other options which you probably normally configure, but I'll go through them here so you are clear.
Change the following options in "MAME.INI" to what shows here:
Under # CORE STATE/PLAYBACK OPTIONS
set AUTOSAVEto 1 (for automatic game state saving support)
Under # CORE PERFORMANCE OPTIONS
set autoframeskip to 1 (will keep timing of game more accurate)
Under # CORE MISC OPTIONS
set skip_gameinfo to 1 (removes info message box)
set confirm_quit to 0 (removes confirmation dialog box when exiting)
Under # CORE ARTWORK OPTIONS
set artwork_crop to 1 (crops your artwork files to show game maximum size)
Under # WINDOWS VIDEO OPTIONS
set waitvsync to 1 (should remove "tearing" effect on graphics)
If you make a copy of MAME.INI and place it into your INI folder, and rename it the same name as a ROM,
MAME.EXE will refer to that new INI file whenever you open that particular game. For example, if I copy
MAME.INI into the INI folder and then rename it to 1942.INI, and if I open that and set "autosave" to 0,
MAME.EXE will not attempt to open any saved state files for the game 1942, ever again. I can change
configuration details for 1942 in 1942.INI and they won't affect any other games but 1942.
I'll make any corrections or field any questions that may arise... just leave your questions and comments here and I will do whatever I can
to get you with the answers you need. I hope each and every one of you finds use for this information... it is handy for arcade cabinets.
Without Mr.Do's tutorials and MkChamp's contributions, the ability to do this would not exist
so I would like to thank them for making this tutorial possible.
I will add information for x64 builds soon

just so everything is verified before I pass that information along.