Arcade Cabinet


Valid XHTML 1.0!

Valid CSS!


News

CAESAR

Forum

Dats

Tools

DatFAQs

HowTo

Links


X-Arcade

X-Arcade


Compiling MAME & RAINE

4th March 2006

Tested with MAME v0.104u4 and RAINE32 v0.43.0

1. Introduction

This guide describes how to set up a MinGW environment that is suitable for compiling MAME and RAINE32. It is written in the same style as the document I wrote explaining how to create a DJGPP environment suitable for DMAME and RAINE. With the help of this guide any proficient PC user should be able to set up MinGW for MAME and RAINE32 in around 10 to 15 minutes (assuming the required files are downloaded beforehand). The guide has been written with the intention that the user will gain an understanding of what they are doing rather than just downloading a ready prepared distribution. It will not tell you how to do basic tasks such as creating a directory or extracting files from a ZIP, it will tell you where to create a directory or where to extract a ZIP. So long as you have those basic skills then you should have no problems.

One of the big advantages of explaining things in this manner is that you can update your own environment to use newer versions of the tools as they come out, without being dependant on someone else doing it for you or waiting for me to update my guide.

The guide will explain how to install MinGW onto the D: drive but you can choose any drive and location that you wish (so long as you think about what you are doing!).


2. Installing MinGW (Minimalist GNU for Windows)

MinGW comes as separate downloadable components and you will need the following to compile MAME and RAINE32:

File Description
gcc-core-3.4.2-20040916-1.tar.gz GCC 3.4.2 (GNU C Compiler).
binutils-2.15.91-20040904-1.tar.gz Binutils 2.15.91 (binary and object handling)
mingw-runtime-3.9.tar.gz MinGW Runtime 3.9 (stdio etc)
w32api-3.6.tar.gz Windows API 3.6 (needed during linking)

Note that the above files have the extension '.tar.gz'. This format originates from the Unix community and the files are actually created using two tools ('tar' creates a single archive of all the files and 'gzip' is used to compress the tar file). However, recent versions of WinZip support this compression format so you don't need any additional tools.

To install MinGW:

  1. Create a directory called D:\MinGW
  2. Unzip the binutils, gcc, mingw-runtime and w32api archives into D:\MinGW (using WinZip or similar). Ensure that you unzip the files in order that I just described (which may not be the same as the order in the above table). This is important because some files exist in more than one archive (notably GCC and binutils) so you should use the most up to date version. Say 'yes' to overwrite prompts, but only do so if you are replacing an older file with a newer one!

3. Installing MSYS (Minimal SYStem for MinGW):

To simplify the usage of MinGW, you need to install MSYS. It is simplest to describe it as a command prompt from which you can compile MAME and RAINE but the reality it provides far more than just that. It is a minimal POSIX system for MinGW and includes the various Unix commands that are required when compiling MAME as well as a fully functional version of GNU make. It also means that you don't need to configure your Windows PATH variable to get MinGW working and PATH conflicts should also be impossible.

File Description
MSYS-1.0.10.exe MSYS 1.0.10

To install MSYS:

  1. Run MSYS-1.0.10.exe which is a standard Windows style installer.
  2. When asked where you would like to install MSYS, choose a location of your own choice (e.g. D:\MSYS).
  3. After the installation, a command window opens up and asks if you wish to continue with the post install. Answer 'y'.
  4. When asked if you have MinGW installed, answer 'y'.
  5. When asked where your MinGW installation is, type in the path of your MinGW directory using forward slashes (e.g. D:/MinGW).
  6. Installation of MSYS should now be complete and it will be available on your start menu.

4. Installing DirectX 7.0

MAME uses DirectX 7.0 and although RAINE32 uses Allegro (not DirectX directly), Allegro needs DirectX 7.0 when it is compiled. In other words, whether you intend to compile MAME or RAINE32 you need DirectX 7.0 installed.

File Description
dx70_mgw.zip DirectX 7.0 libraries and headers for MinGW

To install DirectX 7.0:

  1. Open dx70_mgw.zip with WinZip and extract into D:\MINGW.

Note: You will be asked if you want to overwrite some existing files (probably just the 9 files in the 'lib' directory with a '.a' extension). You should answer 'yes' to any questions asking if you wish to overwrite existing files.


5. Installing NASM

NASM (Netwide Assembler) is used by MAME and RAINE32 as an x86 assembler. You require the following archive:

File Description
nasm-0.98.39-win32.zip NASM 0.98.39 for Win32

You can get the latest version of NASM from the SourceForge link above. Click the 'Download' link then go to the 'Win32 binaries' right at the bottom of the page.

To install NASM:

  1. Open nasm-0.98.39-win32.zip using WinZip then extract NASMW.EXE and NDISASMW.EXE into D:\MINGW\BIN.

NASM is now installed.


6. Compiling MAME

The MAME source comes as a ZIP inside a ZIP to gain the greatest compression possible. To compile MAME, follow these steps:

  1. Create a directory called D:\MAME and extract the MAME source into it.
  2. Open an MSYS window and change directory to D:/MAME (note the forward slash since you are using MSYS).
  3. Type 'make' and press return.

Tips:

  • To compile a Pentium Pro optimised version of MAME, type 'make I686=1'.
  • When compiling a new version of MAME, always run 'make clean' first (or 'make clean I686=1' if you are building a Pentium Pro optimised version). Failing to do the 'clean' first might result in a dysfunctional build!

A decent computer will take about 30 minutes to compile MAME but a low-spec machine could take a couple of hours or more!


7. Compiling MAME Updates

The MAME updates come as '.diff' files, distributed inside a ZIP. To compile the MAME update, follow these steps:

  1. Extract the '.diff' file into D:\MAME (assuming that's where you extracted the MAME source).
  2. Open an MSYS window and change directory to D:/MAME (note the forward slash since you are using MSYS).
  3. Type 'patch -p0 -E <whatever.diff' and press return.
    Use this procedure for all of the updates that you wish to apply.
    Note: Be sure to apply all updates in the correct sequence and do not miss any out!
  4. Type 'make clean' and press return.
  5. Type 'make' and press return.

Tips (as above):

  • To compile a Pentium Pro optimised version of MAME, type 'make I686=1'.
  • When compiling a new version of MAME, always run 'make clean' first (or 'make clean I686=1' if you are building a Pentium Pro optimised version). Failing to do the 'clean' first might result in a dysfunctional build!