Raspberry Pi Arcade

03Aug12

I grew up in the dawn of arcade games, and living at the coast meant that I had access to a couple of decent arcades where I could play all the classics as they came out – Space Invaders, Galaxian, Defender, Moon Cresta, Galaga, Phoenix, Star Wars, Tron and Tempest all stick in my mind, but Mr Do! and Bubble Bobble were my all time favourites.

The Multiple Arcade Machine Emulator (MAME) has been around for years now, and has found its way into all sorts of places (a version was even available in the Apple Appstore just before last Christmas just in time for me to get an iCade). Of course the Raspberry Pi is quite capable of running many of the older games, which should include all the true classics. In this post I’m going to run through how I got MAME going on my RPi.

Dependencies

I’m using Raspbian now, and though it comes with sound working, it lacks some of the libraries that MAME needs to output sound. We also need a specific version of the compiler so:

sudo apt-get install alsa-tools libasound2-dev gcc-4.7
export CC=gcc-4.7
export GCC=g++-4.7

AdvanceMAME

There are quite a few flavours of MAME out there, and the main development has concentrated on WinTel. MAME4All has found its way onto ARM based smartphones and tablets, but it seems that AdvanceMAME is the way to go on the RPi. First download and extract the archive[1]:

wget http://is.gd/AdvMAME
mv AdvMAME advancemame-0.106.1.tar.gz
tar -xvf advancemame-0.106.1.tar.gz

Then run the configuration and build process:

cd advancemame-0.106.1
./configure
make

The build takes hours – so probably best to kick it off at a time when you’re not going to be using your RPi for a while – this isn’t a grab a cuppa situation. Once everything’s done it can be installed:

sudo make install

You should now be able to run advmame. On first time it will create default configuration files. You’ll need to edit one of these to get things working properly with the RPi display. Open up ~/.advance/advmame.rc and add a line:

device_video_clock 5 -50 / 15.62 / 50; 5 - 50 / 15.73 / 60

For HDMI or for an NTSC TV:

device_video_clock 5 - 50 / 15.73 / 60

ROMs

This is where things get tricky. MAME provides a software version of the hardware that used to be in the game cabinet, but the software is covered by copyright, and most of the classics will be locked away for many years yet. Some olders games have found their way into the public domain, but many others are still locked away. There are of course plenty of sites on the Internet designed to help those with broken arcade machines give their intellectual property a new lease of life (and if you happen to come across some old arcade machine ROMs then they can be dumped out using an Arduino).

Once you have some ROMs (in a zip file) they can be placed in /usr/local/share/advance/rom/ or ~/.advance/rom/ and you can then run the game with advmame romname.

Other emulators

MAME isn’t the only show in town, there are loads of other gaming platforms out there, and many have emulators. I’d recommend a visit to Shea Silverman’s blog – the work he’s done on MAME helped me a lot in getting my own setup working, and he hosts ready built binaries for MAME and other emulators.

Todo

I quite fancy getting my games going with a proper joystick, interfaced via GPIO. There’s already some code to do this, but it seems that I let go of my trusty (and highly modded) Competition Pro 5000 joystick when I sold my Amiga – time for some eBay shopping.

Update

Some ROMs are available for download from the official MAME site.

Notes

[1] I’ve used a URL shortener here to keep stuff from spilling off the end of the screen. The original link is http://downloads.sourceforge.net/project/advancemame/advancemame/0.106.1/advancemame-0.106.1.tar.gz



19 Responses to “Raspberry Pi Arcade”

  1. Outstanding – thanks again Chris! This is one of the reasons I ordered my RPi’s. I’m hoping to get my Utrastik 360 working on it, and locate a MAME front-end GUI that’ll compile on RPi… if I find one, I’ll let you know.

  2. 4 tonyflynn

    Thanks very much for this Chris. I’ll definitely put this to use when my Pi (finally) arrives. I’m using a Windows PC for my cabinet at the moment, but it would be great to pull that out and replace it with a new, shiny, tiny box! Hopefully the J-PAC will handle it OK…

    Thanks again.

    • 5 Jerry

      One thing to consider, if using an old Windows PC, MAME comes in DOS flavor, and runs GREAT! under DOS even on the old 486SX machines. DOS 7.1 is available for free download, and there is a nice frontend for DOS MAME or MAME as it has been known since it’s first release. I have been considering using an old itx board that I have for just that purpose but I am now looking at using my Raspberry pi for that instead, not sure which way I will go, I guess it depends on how well the pi works with some of the larger ROMS as I know the itx will run them well, and I want to be able to use most of my 14 CD collection of ROMS that I have had for many years now.

  3. 6 Rob Beard

    This is really interesting, I wonder if it’s possible to attach console controllers too (I vaguely remember hacking together SNES, Megadrive and NES parallel port adaptors in the mid to late 90’s).

    Personally I’m trying something a little different (due to my bad soldering skills and I’ve purchased a Keyrah which is a USB keyboard adaptor for old Commodore computers. It’s been transplanted into my old broken C64 and looks fairly authentic and even has 2 joystick ports on it (which convert to cursor keys and the numeric keypad).

  4. Hi,
    I receive this error. Why? :-(

    gcc-4.7: internal compiler error: Killed (program cc1)
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See for instructions.
    make: *** [obj/mame/linux/blend/advance/blit/hq4x.o] Error 4

  5. 11 Francesco

    Hi,

    When I type:

    ./configure

    I get:

    sudo: ./configure: command not found

    ???

    What am I doing wrong?

    • 12 Francesco

      Ok, looks like I have found the reason why:

      I moved the mame folder to a 14 GB partition and since the partition is
      drwx—— I was unable to ./configure it

      I moved than the mame folder into the root folder and now the command ./configure works fine!

      Hope this can help somebody out there ;)

      Cheers.

  6. I used RetroPie Arcade to install Mame4all and it’s so easey

    http://petrockblog.wordpress.com/retropie/

  7. I was able to compile and install advmame without any issues. I did run into a problem where the env variable DISPLAY was being set, and advmame didn’t like it, so I unset it and set my TERM=’linux’ and now I get this error:

    Error enabling the event keyboard driver. Function ioctl(KDGKBMODE) failed.
    video_init failed

  8. 15 semi

    Isn´t this version of MAME a bit old?

  9. Here’s a project I just finished:
    http://www.desta.co.uk/?p=1657

    This goes some way to explaining hope to code Advmame, Advmenu and the Raspberry Pi.


Leave a reply to Quill Pen Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.