Tuesday, March 20, 2012

Compiling xmame .106 on the Rasberry Pi

How to get mame on the rasberry pi.

Full size screen shot

Please note that it is easier to get advmame up and running. check out my guide here.
First you will need to have some sort of rasberry pi simulator I went with this method.
RPi on Virtual Box
Here are my pre patched files
makefile.unix
unix.mak

Lets get started.
Use the following command to ensure your running on the arm kernal

uname -a

here is my output.

Linux rasberry-pi 3.0.4 #2 mon oct 17 17:39:42 ict 2011 armv61 GNU/Linux
If you dont have X set up install it by using the command

apt-get install lxde xorg python geany

Now we need to install some dependencies to build xmame.

apt-get install build-essential libgtk2.0-dev libgnome2-dev libsdl1.2-dev
apt-get install libxv-dev libxv1


Download and extract xmame .106


wget  http://caltaxcn.googlecode.com/files/xmame-0.106.tar.bz2
tar xvjf xmame-0.106.tar.bz2
cd xmame-0.106

We need to edit the make file so it will compile correctly.

nano makefile.unix

Under reset flags comment out the line
CFLAG =
to
#CFLAG =

Under Choose from some preset CFLAGS. comment out the folowing
# GCC on x86
CFLAGS = -O2
to
# GCC on x86
#CFLAGS = -O2

Under general optimizations uncomment
#CFLAGS += -fno-merge-constantsto
CFLAGS += -fno-merge-constants

and uncomment
# CFLAGS += -fstrict-aliasingto
CFLAGS += -fstrict-aliasing

Under Architecture change
MY_CPU = i386
to
MY_CPU = arm

Save the modified makefile.
now open up the following file.

nano src/unix/unix.mak

and Change the line
CFLAGS.risc_lsb   = -DALIGN_INTS -DALIGN_SHORTS -DLSB_FIRST
to
CFLAGS.arm   = -DALIGN_INTS -DALIGN_SHORTS -DLSB_FIRST
then close and save the file.


At this point you can finally compile xmame. simply type in make

make

on my laptop this takes about 6hrs to compile. once done you can run xmame from this directory.

chmod -x xmame.x11
./xmame.x11 

I hope this gets the ball rolling. I know there is more optimizations to be had.

11 comments:

  1. This is a fantastic start any idea how it will perform on the actual hardware when it finnaly arrives.

    ReplyDelete
  2. No idea. I have had great success with running mame on pII in the past so the rpi should run thing just fine. I never really played anything that took to much power though. galaga pacman stuff like that.

    ReplyDelete
  3. Great work! I was excited to try this out but ran into some problems. I tried running the official Debian Squeeze image with qemu in windows. Unfortunately, there was only 1gb of space left in the image. It seems that pyhton, geany, lxde xorg are already in the image so I skipped that step. The next step:
    "apt-get install build-essential libgtk2.0-dev libgnome2-dev libsdl1.2-dev"
    filled the rest of the space. I couldn't go any further with your steps. I also tried the VMware image and ran into the same space issue. Is the VirtualBox version different? Do I need to use that one? or have I fundamentally missed something?

    ReplyDelete
    Replies
    1. I check the my virtual box image. seems like the system has 3gb instead of 2? Here is a guide I found to expand the virtual hard disks. harddhttp://itsignals.cascadia.com.au/?p=28rive.

      Delete
  4. I have a question ... I have a mame cabinet using an old Celeron board (it's actually a cocktail style cabinet) and I was thinking about replacing the motherboard with a R.Pi ... the problem is it uses a VGA monitor. I don't want to replace the monitor, it's custom fit to the cabinet. Do you have a suggestion on an inexpensive Pi to VGA/HD15 converter?

    ReplyDelete
    Replies
    1. at the moment there is no good way to do this. Some people are looking into dedicated chips that convert dvi into vga but the companies require orders of a thousand units.

      Delete
    2. Amazon sells a device that does this, just search for "HDMI Input to VGA Adapter Converter For PC / Laptop"

      Delete
  5. I just tested this process on my pandaboard (ARMv7) and it seems to be working great. well done Nick, keep up the good work.

    ReplyDelete
  6. Thanks, I managed to compile xmame and load a pair of roms but there is no sound right?

    ReplyDelete
  7. I'm new to Linux so have probably missed something simple, but I get the following error when running the final command (./xmame.x11)

    bash: ./xmame.x11: Permission denied

    Any ideas?

    ReplyDelete
    Replies
    1. Did you skip this step?

      chmod -x xmame.x11

      ls -l xmame.x11 should return
      ... -rwxr--r-- ...

      or something similar, the above example has the permissions set to read/write/execute for the file owner, and read for the owning group and others

      Delete