iMame4All for iPad
The Xcode Project
for non-jailbroken iPads

See the original iMame4All Google Code project for jailbroken devices

UPDATE 10-9-2012:
Updated the project to build with Xcode 4.5 and later.

UPDATE 12-27-2011:
Please apply the iMAME-fix.zip from Seleuco to fix the splash/main screen, cheats and other stuff
Just copy the folders in the zip to the Documents folder for the app

Looking for iDOS for non-jailbroken iOS devices? click here.
10.17.2012: Looking for iAmiga for non-jailbroken iOS devices? click here.

Did you download iMAME from the App Store? Click here

This project works with Xcode 4.5 and iOS 6

(see notes at bottom of page for Xcode 3 and iOS 4)

click here to download the Xcode project
9.28.2011: Current iMame4All base version: 1.10.0
10.18.2011: Code corrections for iOS 5 SDK and Xcode 4.2
10.20.2011: Click here for a solution to the CoreVideo error when building
10.23.2011: Fixed iCade pop-up window when exiting Options menu
12.26.2011: Click here for the iDOS project for non-jailbroken iPads
12.28.2011: Updated the project with iMAME-fix.zip files

Where do the ROMs go?

click here to see more of my iOS apps

Follow me on Twitter for updates to the iMame4All Xcode project
Follow lesbird65 on Twitter



This is the homepage for the iMame4All Xcode project. The goal is to take the iMame4All source and get it to compile and build using Xcode for non-jailbroken iPads.

A few changes were needed to get iMame4All to work with non-jailbroken iPads.

On a non-jailbroken device you do not have full access to the file system so I had to make sure all files were loaded from the documents directory. This posed a couple of problems.

First, you can't copy folders to the documents directory via iTunes File Sharing so how to handle the audio samples? My solution was to include the audio samples (samples.zip) in the app bundle and access them from the resources folder. The samples.zip file is included in the project.

See helper.m function getSamplePath

Second, all roms are copied to the documents folder using iTunes File Sharing. New folders are created here for saving game states and configuration settings. I check to see if the roms folder is being referenced in code and strip "roms" from the name then forward the request to the documents folder.

See shared.c function get_documents_path

Third, all the art resources for the frontend were extracted from the res/Applications/iMAME4all bundle and copied into the Xcode resources folder.

Other changes:

Several hard coded paths had to be changed in order for it to work on a non-jailbroken iPad. This was solved by writing three functions in helper.m:

get_iOS_RomPath()
get_iOS_SamplePath()
get_iOS_BundlePath()

These functions in turn called the equivalent Objective-C functions to return the appropriate paths. I then replaced all hard coded paths with these functions as needed.

CoreSurface for some reason was giving me errors when compiling with Xcode 3.2.6 and iOS 4.3 SDK (even when including the framework) so I removed all references to it in the code (see ScreenView.m). Instead the safe_render_path is used and from what I was able to determine by stepping through the code, this is the method that was used anyways. So no problems here - performance is still excellent.

The hardest part of the whole task was setting up the Xcode files needed for the build process. Not all MAME files are supposed to be compiled as many of them are included by other files, which caused thousands of duplicate reference error messages when linking. This was a long process which involved compiling, looking at all the errors, and turning off files that didn't need to be part of the build process. Eventually after a few days I was able to get the error count down to only 11 which were all CoreSurface undefined symbols and easily fixed.

iControlPad

 Support for the iControlPad has been added to v1.8.1b and later. To use the iControlPad it needs to be put into KEYBOARD (SPECIAL PACKET MODE) so that the analog sticks can be used (Robotron!!). See EmulatorController.m function interpretControlPadInputs and insertText.

Special note for iControlPad: When using KEYBOARD (SPECIAL PACKET MODE) the iControlPad sends a lot of data when the nubs are moved. This in turn causes some games to slow down which is not ideal. My recommendation is to only use this mode for games that need it like Robotron. All other games should use the iCade compatibility mode which is much faster. When iMame4All prompts you for the device you want to use just pick iCade if the iControlPad is in iCade compatibility mode.



BTstack and WiiMote controller

Sorry, can't find a good solution for the BTstack and WiiMote controller for non-jailbroken devices. The problem is the BTstack Daemon needs to be low-level installed but on a non-jailbroken device you don't have access to the full file system. Also, you need chip level access to the Bluetooth chipset which can't be done on a non-jailbroken device. The solution here is to use the iCade arcade cabinet or the iControlPad controller in iCade emulation mode.

  The BTstack code is still compiled in but the library is weak-linked which means if the low-level daemon is not installed the functions are ignored (update: actually the app will crash if you try to connect to the WiiMote).

UPDATE: I've now implemented native iControlPad support into the current version of iMame4All. To take advantage of this you need to put your iControlPad into KEYBOARD (SPECIAL PACKET MODE) (A + X). Doing this will allow you to use the analog sticks on the iControlPad for games like Robotron 2084. This seems to be the best alternative to using the WiiMote with the Wii Classic controller.



iMame4All project for non-jailbroken iPads

The full project based on the latest (as of 9/28/2011 V1.10.0) iMame4All code can be downloaded here:

iMame4All source code for Xcode v1.10.0f
(includes iMAME-fix.zip files so no need to copy them to Documents with the 1.10.0c build)

Notes to build for your environment:

I'm using Xcode 4.2 and building for iOS 5 (device only - no simulator).
(IMPORTANT: see notes below for Xcode 3 and iOS 4)

Check your build target. This project will only work for a device, not a simulator. The BTstack library file is compiled for ARM hardware and therefore will generate linker errors if you try to build the project for the simulator.

Before building be sure to change the bundle identifier in iMAME-info.plist to match your provisioning file. Otherwise you'll get code sign errors when compiling.

Change the header include paths to match your project folder. I put the project in "/Projects/mame/iMame4All-iOS4" on my hard drive so if you use the same path you shouldn't need to change anything. So the full path to the Xcode project file will be:
/Projects/mame/iMame4All-iOS4/Xcode/iMAME/iMAME.xcodeproj

Files modified for no-jailbreak (search for Les Bird):

Classes/Bootstrapper.m
Classes/ScreenView.m
Classes/Helper.h
Classes/Helper.m
Classes/EmulatorController.m

src/iOS/config.cpp
src/iOS/wiimote.h
src/iOS/iOS_frontend.cpp
src/iOS/shared.c
src/iOS/fileio.cpp

This is an Arm7 iPad build but has also been tested on an iPhone 3GS. To build for the iPhone change the target device to iPad/iPhone in the project settings.

Where do I put the ROMs?
Copy all your zip'd ROMs to the File Sharing folder for iMAME. Do this by connecting your iPad or iPhone to your computer and loading up iTunes. Click on your iPad or iPhone on the left panel then select the Apps tab for your device. Now scroll down to the bottom of the page where it says File Sharing. Click on the iMAME app then click ADD and copy all your ROMs to that folder.

iOS 4 SDK and Xcode 3
This archive has been modified to build with the latest Xcode 4.2 and iOS 5 SDK. There are some important changes that were made for this to work. If you are building using Xcode 3.2.6 and iOS 4 then you'll need to replace all references of "presentingViewController" with "parentViewController" in all source files.

With the 1.10.0c build this change should no longer be necessary. It should build and work with both iOS 4 SDK and iOS 5 SDK.

iOS 5 and Xcode 4 CoreVideo Error
To fix the CoreVideo compile errors when building the project with Xcode 4 for iOS 5 edit the project settings and remove the Framework Search Paths except for $(inherited). The paths are setup for my development environment but most likely will not match what you have on your Mac.



iMAME on the App Store

If you downloaded iMAME from the App Store here are the main differences:

First, you can't copy your ROMs to iMAME using iTunes File Sharing. That feature had to be disabled in order to comply with App Store guidelines. Instead you should use iExplorer and copy the ROMs to the Documents folder for the iMAME application.

Second, the readme help file talks about using WiiMotes with iMAME. This is not possible. WiiMotes require low level access to the Bluetooth chipset which can only be done on a jailbroken device. However, as an alternative you can use the iControlPad which is a good handheld controller.

See the notes here about using the iControlPad controller.

Make sure you are using the correct ROM set. You need ROMs for iMame4All for GP32X which are based on the 0.37b5 version of MAME. Somewhere out there in internet land is a complete set of iMame4All ROMs so just do some research to find it.

iMAME on the App Store is based on the iMame4All for Xcode project with a few changes by Jim VanDeventer to make it App Store compliant.




October 17, 2012

back to The Game Projects page

email


Real Time Web Analytics