Arcade Cabinet


Valid XHTML 1.0!

Valid CSS!


News

CAESAR

Forum

Dats

Tools

DatFAQs

HowTo

Links


X-Arcade

X-Arcade


Compiling RAINE32

3rd September 2005

Tested with RAINE32 v0.43.0

1. Introduction

This guide describes how to enhance a MinGW environment (set up using my MAME guide) so that it can compile RAINE32. It is written in the same style as the document I wrote explaining how to create the MinGW environment for MAME. With the help of this guide any proficient PC user should be able to set up MinGW for RAINE32 in around 15 to 20 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.

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

First things first, you must follow the guide for compiling MAME. You cannot continue with this guide until you have done that!


2. Installing Allegro

Allegro (A Low Level Game Routines Library) is used by RAINE32 for graphics handling, sound and input handling.

File Description
all420rc2.zip Source code for Allegro 4.2.0rc2

You can get the latest version of Allegro from the Demon link above. Just download the latest source code in DOS/Windows friendly format. Although the latest 'stable' release is supposed to be 4.0.3, it is over two years old and is actually quite buggy. The latest development branch is a better bet!

Firstly, if you didn't install the DirectX 7.0 headers then do it now!

  1. Extract all420rc2.zip to D:\ (a directory called ALLEGRO will be created automatically).
  2. Open a command prompt (n.b. NOT MSYS) and change directory to D:\ALLEGRO
  3. Type 'fix mingw32' and press return.
  4. Open an MSYS window and change directory to D:/ALLEGRO (note the forward slash since you are using MSYS).
  5. Type 'export MINGDIR=/mingw' and press return (note the forward slash and no drive letter since you are using MSYS).
  6. Type 'make lib' and press return. A decent computer will only take a couple of minutes to compile Allegro.

After compiling Allegro, install it as follows (from the MSYS window that you compiled under) :

  1. Type 'make install'. This will install the relevant Allegro files into you MinGW directory.

Tip: You can create your Allegro directory anywhere that you wish (I only used the D: drive for simplicity). You will also notice that the first make command was 'make lib'. If you wish to do a full Allegro build (which includes example programs and is about 40MB bigger than the library alone) you can use 'make' instead of 'make lib'. However, only the library is required to compile RAINE32 so it is fairly useless doing a full build just for RAINE32.


3. Installing SDL

SDL (Simple DirectMedia Layer) is used by RAINE32 for sound handling. You need the following archive:

File Description
SDL-devel-1.2.9-mingw32.tar.gz SDL 1.2.9 development libraries for MinGW.

You can get the latest version of the SDL development libraries from the link above. Just download the latest tar.gz file for MinGW.

Note: I can't get SDL 1.2.8 to work yet!

To install SDL:

  1. Extract SDL-devel-1.2.9-mingw32.tar.gz to D:\ (a directory called SDL-1.2.9 will be created automatically).
  2. Open an MSYS window and change directory to D:/SDL-1.2.9 (note the forward slash since you are using MSYS).
  3. Type 'mv install install.txt' (having a file called 'install' prevents the next step working).
  4. Type 'make install prefix=/mingw' (note the forward slash since you are using MSYS). The last part will fail (creating a symbolic link) and must be done by hand (next step).
  5. Change directory to /mingw/bin (note the forward slash since you are using MSYS).
  6. Type 'ln -s i386-mingw32msvc-sdl-config sdl-config' (i.e. creates a soft-link).

SDL is now installed in your MinGW environment. Once installed in the MinGW environment, you can delete the SDL-1.2.9 directory.


4. Installing zlib

zlib (ZIP library) is used by RAINE32 for loading zipped ROMs.

To compile zlib from the source:

File Description
zlib123.zip Source code for zlib 1.2.3

You can get the latest version of zlib from the gzip link above.

  1. Create a directory called D:\zlib and extract zlib123.zip into it using WinZip (or similar).
  2. Open an MSYS window and change directory to D:/zlib (note the forward slash since you are using MSYS).
  3. Type 'make -f win32/makefile.gcc' and press return.

After compiling zlib, install it for MinGW as follows (from the MSYS window):

  1. Type 'cp -p libz.a /mingw/lib' and press return (note the forward slash and no drive letter since you are using MSYS).
  2. Type 'cp -p zlib.h zconf.h /mingw/include' and press return (note the forward slash and no drive letter since you are using MSYS).

Once you have installed the required files you can delete D:\ZLIB if you wish. Programmers may wish to keep it for reference purposes but other than that you won't need it any longer.

Tip: As with Allegro it is not necessary that you use the D: drive for compiling zlib, it can be done anywhere on your machine.


5. Installing libpng

libpng (PNG library) is used by RAINE32 for loading and saving PNG images.

To compile libpng from the source:

File Description
lpng128.zip Source code for libpng 1.2.8

You can get the latest version of libpng from the link above.

  1. Extract lpng128.zip to D:\ (a directory called lpng128 will be created automatically).
  2. Open an MSYS window and change directory to D:/lpng128 (note the forward slash since you are using MSYS).
  3. Type 'cp -p scripts/pngw32.def scripts/png32ms.def' (note the forward slash since you are using MSYS).
  4. Type 'make -f scripts/makefile.cygwin prefix=/mingw' (note the forward slash since you are using MSYS).

After compiling libpng, install it for MinGW as follows (from the MSYS window):

  1. Type 'cp -p libpng.a /mingw/lib/libpng12.a' and press return (note the forward slash and no drive letter since you are using MSYS).
  2. Type 'cp -p png.h pngconf.h /mingw/include' and press return (note the forward slash and no drive letter since you are using MSYS).
  3. Type 'cp -p libpng-config /mingw/bin' and press return (note the forward slash and no drive letter since you are using MSYS).

Once you have installed the required files you can delete D:\lpng128 if you wish. Programmers may wish to keep it for reference purposes but other than that you won't need it any longer.

Tip: As with Allegro it is not necessary that you use the D: drive for compiling libpng, it can be done anywhere on your machine.


6. Installing NASM

You should have already installed NASM within the MAME guide but RAINE needs it to have a different name!

  1. Open an MSYS window and change directory to /mingw/bin (note the forward slash since you are using MSYS).
  2. Type 'cp -p nasmw.exe nasm.exe' and press return.

NASM is now installed.


7. Installing EXEDAT (optional)

EXEDAT is used to append RAINE.dat onto RAINE.EXE. It is part of Allegro so you don't need to download anything extra.

Compile EXEDAT as follows:

  1. Open an MSYS window and change to the Allegro directory (i.e. D:/ALLEGRO).
  2. Type 'make exedat' and press return. This will now create exedat.exe in the tools directory of Allegro.

After compiling EXEDAT, install it for MinGW as follows:

  1. Type 'cp -p tools/exedat.exe /mingw/bin' and press return.

EXEDAT is now installed. Once you have installed Allegro and EXEDAT, you can delete the Allegro directory if you wish.


8. Installing UPX (optional)

UPX (Ultimate Packer for eXecutables) is used to reduce the size of the RAINE32 executable. You will need the following archive:

File Description
upx125w.zip UPX 1.25 for Win32

To install UPX:

  1. Open the archive using WinZip and extract UPX.EXE into D:\MINGW\BIN.

UPX is now installed and you can use it to compress any .EXE file that you wish (not just MAME and RAINE32).


9. Compiling RAINE32

To compile RAINE32 follow these steps:

  1. Create a directory called D:\RAINE and extract the RAINE source into it (acquiring the source is described in this document).
  2. Open an MSYS window and change directory to D:/RAINE (note the forward slash since you are using MSYS).
  3. Type 'make' and press return. If it fails straight away, try it again!
  4. Type 'make compress' to attach RAINE.DAT (uses EXEDAT) and run UPX. This last step is only possible if the optional components (EXEDAT and UPX) have been installed.

A decent computer will take about 5 minutes to compile RAINE32 and compress it.