About Les Bird

Game programmer since 1993, always learning new stuff... Notable game releases: Corridor 7: Alien Invasion (Capstone 1994), William Shatner's TekWar ( Capstone 1995), Witchaven I and II (Capstone 1996), Star Trek TNG: Klingon Honor Guard (Microprose 1998), Hot Wheels Mechanix Racing (AweGames 2001), Levitar (Indie 2007), iBots (iOS 2010), X vs O Football (iOS 2011)

Adventures in porting MAME to the iPad

Originally posted on November 11, 2012

This post will cover my quest to port a recent version of the MAME arcade emulator (v147 v139) to my non-jailbroken iPad using a modified MAME makefile and the Xcode command line utilities. The modifications will include setting the compiler to compile and link for the iOS environment, adding a rule to build the application bundle, code signing the executable and a very basic OpenGL ES renderer.
2012.11.12 update:

(Note: see updates below for the complete v139 project) Here’s a link to a zip file that contains the modified makefile, pre-built tools and data files for the application bundle. This will build the MAME project for iOS and create an app bundle but it will not run because there’s no OSD for the iPad yet. Just copy these files to the mame0147s folder then run the make command to build the project.

Here’s the makefile if you want to view it and see what I added: makefile

About the makefile changes: I added rules to build the project using the Xcode command line utilities. I added rules to build an application bundle. I added a rule to build Objective-C source files. I pre-built all the supplemental make tools, such as the 68000 source code generator, by first running the unmodified makefile (except I changed the OSD to osdmini). This built a MacOS version of the MAME executable and it also built all the supplemental tools. I copied the supplemental tools to a separate folder called iOS-data/mameSupport/build and modified the makefile to point to this folder for the pre-built tools.

One more thing, you will need to download this file and copy it to the src/osd/osdmini folder: osinline.h

2012.11.17 update:

So after several attempts (to get v147 to work) I’ve discovered that for some reason any version of MAME later than 139 (140?) does not seem to work on the iPad. The issues are not clear yet and due to the difficulties in debugging this I’ve decided to just stick with getting v139 to work on the iPad. The problem occurs somewhere deep inside MAME. After a game is launched it will crash before any display updates and before any of the warning and info screens. The furthest I got was with v142 which would display the warning screen but when dismissed it would crash out. I may revisit this sometime in the future but for now you can use the link below to download a complete v139 project directory with a very minimal OSD – you can pick from the available ROMs that you copy to the documents folder, it will launch the game but is currently not playable due to no virtual buttons existing yet. Tap the screen to return back to the ROM selection screen.

Grab the complete v139 project here: MAME v139 project for iPad

The “makefile” project above will do the following:

  1. build a complete executable for the iPad
  2. code sign the executable
  3. create an app bundle
  4. sync the app to your connected device using “fruitstrap

What the app will not do right now:

  1. Can’t play the games yet but you can watch the attract mode
  2. No sound yet
  3. Can’t exit the currently launched game (close the app and relaunch)
  4. Vector games don’t seem to work well right now

What good is this project if you can’t play the games? It’s a good starting point for your own MAME project and a good learning experience if you’re trying to figure out how to (a) create an app bundle, (b) code sign and (c) sync your own apps to your device from the command line. Also, I will continue to improve and update the project as time permits. If you’re looking for a complete MAME solution for your non-jailbroken iOS device I would suggest downloading my iMAME4All Xcode project from this link:

iMAME4All for Xcode (v037b)

2012-11-22 update:

Now supports the original MAME artwork. Download the complete artwork file here (1.3GB) and unzip this file to a folder called artwork. Copy the resulting folder with the included game zip files to the iOS-data/mameData folder (resulting path is iOS-data/mameData/artwork). This complete folder gets copied over to the app bundle before it is sync’d to your iPad.

The future:

  1. Get sound to work
  2. Improve performance
  3. Add toggle to turn off artwork (bezels)
  4. Try to get the latest version of MAME to work
  5. Add control options (iCade, virtual buttons, etc)
  6. Maybe get the SDL OSD to work

Stay tuned for more…