Making an iOS Powered MAME Arcade Machine

Standard

One of the “perks” of being an iPhone application developer has always been an excellent excuse to upgrade to the latest and greatest iPhone. As I write this on Friday I am actually waiting for my iPhone 5 to be delivered. Getting every device is useful and almost a requirement in order to test your applications on it.

But what you do with these devices as time goes on and they become increasingly obsolete? Some people sell them, others hand them down to family, but I typically keep them around for testing as well as nostalgia. They have come in handy over the years for various different things as well, like when I used them for time lapse cameras for the big Chicago snow storm of 2011. But they start to pile up and collect now after five years.


Yes… I may have a problem

Early this year I bought a new CRT monitor for my dedicated Mortal Kombat 2 arcade machine. It needed to be done because of bad burn in, and arcade CRTs are becoming increasingly rarer by the day. The monitor I bought is a Tri-mode monitor that not only supports the standard arcade resolutions (CGA and EGA) but it also supports VGA and comes with a standard VGA connector and adapter for JAMMA pins as well. This got me thinking, maybe I’ll build a MAME machine instead of running all the hardware required to run the five games switchable that I run in it today.

So, when starting to plan the MAME machine my initial plans were to use an older Mac Mini. But when I was putting together what turned out to be a pretty extensive parts list, I got to thinking: “Why can’t I just repurpose an old iOS device for this?”

It turns out, I can and I did…

How did I do it, you may ask? Here’s a breakdown of what I did if you too want to try to do the same with your arcade cabinet.

WHAT YOU’LL NEED

Here is a list of parts you’ll need and some price estimates.

Basically if you have an arcade cabinet with a monitor that’ll display VGA+ signals and an old iPhone like I did, then you can likely do this project for as little as $100.

PART 1: VIDEO

I decided the optimal way to connect the video is to use the Apple iPad VGA adapter which works with any device with an A4 or higher processor. So that means I can use an iPhone 4, iPhone 4S, any iPad and the newest iPod Touch models. You can also use the Apple HDMI cable if your monitor has an HDMI input.


Choose Your Destiny

The video is the most important part, because without it you can’t do the rest of it. So before I did anything I built a simple app to test video modes on my arcade monitor. I found it returns that it supports more resolutions beyond VGA, but in fact it doesn’t. But it successfully works at 640×480 as I found in my testing.


It’s Resolution Baby

For my purposes this solution is more than adequate. A proper MAME setup can also get to the lower CGA or EGA resolutions, but for my monitor being analog it’s best to keep it on one resolution so this is not ideal and still looks great to me.

PART 2: CONTROLS

As far as controls go, this was the one I thought about the most. There are a few options, but even less for non jailbroken iOS devices. So I settled on going with the iCade method of making the iOS software think it’s a Bluetooth keyboard. I did this by… using an iCade.


iCade – The key to this project

I owned an iCade from the first day they were available, it makes for a great iPad stand and also a fun way to play some classic games which are making their way to the platform more and more. But I didn’t want to open it up and ruin it. So I searched online to see what the wiring system looked like, and I was pleasantly surprised to see it uses standard arcade control cherry switches. Which meant, transplanting it’s guts into my arcade machine would be fairly easy.

I opted to buy a second iCade to use for this, because I’d like to make it a permanent fixture in my home. I found one used on eBay for $40 shipped and jumped on it. I’ve also seen others go for as low as $20 at times as well.

So once I got it home I began to pull it apart to take what I needed to transplant to make the iCade work with my existing arcade control panel. Below are a few photos, it’s fairly straight forward and took a matter of minutes so I wont waste words explaining how to take it apart. Keep in mind I did find you’d need a security torx bit to get it open, but these are fairly commonly found at hardware stores now.


iCade Inside Out

Standard Quick Disconnects

No Quick Disconnects, Easily Resolved

iCade’s PCB

PCB plus wiring ready to go

Here is the end result of the iCade transplanted into my arcade control panel.

One downfall with using an iCade is that it’s a one player only device. So my two player capable arcade machine is not being used optimally, no going head to head in Mortal Kombat and no teaming up together in The Simpsons Arcade Game. I am going to look into building a custom Bluetooth controller using an Arduino, or similar, that would work similarly to the iCade but also support two or more players.

PART 3: AUDIO

At first I wasn’t going to do anything for audio. My iPad 3 which I was initially using in the process was quite loud enough that it was as loud as the arcade machine. But when I moved back to the iPhone 4 which will likely be the sole device I use for this, I found it’s speaker quite limiting.

The arcade cabinet is only mono so only had two connections for one speaker to hook up to the iPhone. So I grabbed a few spare headphone and RCA cables I had around, did some cutting and then hooked on two alligator clips which I use to connect to the speaker. Here’s the finished cable.


Made cable long to reach the cabinet speaker wire in the back

It’s all rather simple, if you can hook up arcade controls you can also hook up a speaker.

PART 4: POWER

Power is one of the things that is really an unique to this setup. An iPhone device has very little drain compared to a desktop computer or even the five arcade PCBs that took two PC power supplies to run that had in there. Also the iCade runs off of two AA batteries as well, or an optional power brick. The way I set it all up today actually has no direct power draw from the wall at all. I ripped out the iCade’s battery compartment to keep things simple for now.


Couldn’t find my Dremel, so I used a drill.

The only major issue I have right now is that the VGA adapter blocks the power connector of the iPhone. So when I’m not playing, I keep the iPhone plugged into power. In my testing, iMAME can run for about 2.5 hours on my iPhone 4 without interruption so this is adequate for my purposes but not ideal.


Carefully chosen case for matching red trim

In the future I’ll be researching a way to keep the iPhone powered without blocking the VGA port. Apple’s own HDMI output solved this issue, so it’s possible, but I need to build or hack the existing cable to solve this problem.

PART 5: SOFTWARE

As I said earlier, no jailbreaking is required for my solution. But for others this may be difficult without jailbreaking. The MAME project, and by extension the iMAME4All projects by Seleuco, are all open source so any developer can build them with little work and without jailbreaking.

iOS developers are best to start with lesbird’s iMAME for Xcode, much easier to get up and running from there. I have notice some performance problems with my builds, and I’m looking into that and readying the project for iOS 6. I will likely be releasing that update on this Github project sometime soon now that iOS 6 has been released.

Also if you are not a developer and happened to download the iMAME that was availble on the AppStore like I did, then you don’t need to jailbreak your device. Otherwise if you are jailbroken, both iMAME4All and newer iMAME4iOS are available on Cydia.

It’s important to note that the MAME4All that iMAME4All is based off of a source fork of MAME that is around 10 years old now. It’s done like this because it runs things much faster on older hardware, but suffers because of a lack of compatibility and accuracy. But for most games, it works perfectly fine. Seleuco also ported a newer source build of MAME into the iMAME4iOS project. It needs much beefier hardware to run the games, but has a much greater compatibility. I’ll likely be moving to this build in the future.

THE END RESULT

TO THE FUTURE

I’m also not 100% happy with how iMAME works with the arcade cabinet and the iCade, and this is something I am looking forward to improving since it is open source. I haven’t had the time yet but I have a few ideas. One idea I had is to make a whole new interface, here is a mockup below:

Besides some software, power and possible control enhancements I’ve been wanting to do, there was another idea that was sprung from this project. What if you were to take a third party console arcade stick, toss in an iCade and an iPhone dock. Then using AirPlay Mirroring or the HDMI adapter, you could then turn that arcade stick into a portable arcade machine that hooks up to any modern TV. Why settle for playing these games on your iPad with an iCade, when you can hook it up to your 55" HDTV in your living room?

Now to find some spare time to make a proof of concept of this idea. Lucky for me this is another project where I have all the parts required to see it through.

If you have any questions you can contact me via email or Tumblr’s “Ask me a question” via the links on the right side of the page. I’ll try to get to them in a timely manner to get you on your way.

iOS Wireless App Distribution Talk

Standard

Tonight I am giving a talk on iOS Wireless App Distribution at Chicago Cocoaheads. If you missed it or want to follow along you can download the Keynote file.

Here is a list of links referenced in my talk:

As part of my talk I created a new PHP script that I am calling Manifest Destiny. It automates a step of the process by creating the required manifest property list files on your server. In addition to that it also gives a customizable HTML listing for devices to install said ipa files from their iOS devices. This is currently available as a Gist over on Github.

In the future I may branch it out to be it’s own project, as I have lots of ideas on how to make things better for my workflow. Also let me know via the link on the left if you port it to Ruby or any other server side languages, and I’ll include a link to it.

Three Years of iPhone Development

Standard

Three years ago I released my first iPhone application to the public, here is the story of how I got started.

Before I started dabbling in native iPhone development, I had started making iPhone games using web technologies. I had made a really simple web-based iPhone Blackjack game using AJAX, a few JavaScript frameworks and PHP. It was at one point going to be part of an online “Kombat Kasino” for my Mortal Kombat fansite The Realm of Mortal Kombat. But the web interface for the game just wasn’t cutting it for me. It didn’t feel right on the iPhone touch screen. It was then that a friend made a comment that stuck with me: “why doesn’t the game react to gestures like a real casino?” I figured it was perfect time to make it do just that using the recently released iPhone development toolchain.

My first steps in development were to draw an image onto the screen. I then had to figure out how to move them and respond to touching the screen. All this was being new to the platform and the language, I learned many things the hard way. Remember, this was all before Apple allowed us to write apps for the device. We only had framework header files and some shared Mac documentation. The OS that the iPhone was running on then was also far from ready for third party developers as it was an amalgamation of the new UIKit Framework and beta version of OS X Leopard. For instance CoreAnimation was still called Layer Kit. At that point I hadn’t done development for the Mac either, so both Cocoa and Objective-C was all foreign to me. Learning to do all this was the most rewarding programming I had ever done in my life. After a weeks or so of tinkering, I had a tech demo of playing cards moving around the screen randomly. It was cool, but it wasn’t a game.

It wasn’t until Lights Off! for the iPhone was released that I was fully inspired me to make this tech demo into a real game. Every evening for about two weeks I spent countless hours after work at coffee shops, book stores and my home office just trying to get the game into a playable shape. After lots of work and learning I eventually released the first alpha build of the game on August 28th, 2007 at just after midnight. I posted it up on my website and a few other places, and went to sleep.

Screenshot of iBlackjack Alpha 1

The release day was also the same day I was supposed to attend to the iPhone Tech Talks in Chicago. I was pretty tired when I arrived at the Tech Talks because of how late I was up. But the funny part was the entire day was dedicated to Apple developers showing showing us how to make web-apps for the iPhone, and by that time I had a native game. I eventually gathered enough guts to show the game to an evangelist there. He couldn’t tell me anything to help me out, but he pointed me to a great Chicago developer community CAWUG that I should connect with. He also told me more about the great C4 conference that Jonathan Rentzsch had held just a few weeks earlier. These resources I wouldn’t have discovered easily on my own especially when I was so heads down in development.

All versions of my game went on to get a combined total of close to a half million downloads via Installer.app over the next few months. At one point it even got featured on G4’s Attack of the Show in September of 2007 during a segment about third party applications:
http://www.youtube.com/v/tengcnNOpu0?fs=1&hl=en_US&rel=0&color1=0x234900&color2=0x4e9e00

From that point on iPhone development was a very exciting ride. In early 2008 I was hired away from my corporate day job to create iPhone apps full time for mobileAge. For them I have produced a bunch of great applications, and even more in the pipe. iBlackjack eventually was renamed Blackjack 21 and released on the first day the iTunes AppStore.

Blackjack 21 Screenshot

It honestly doesn’t feel like it’s been three years, as it’s been such a roller coaster ride watching the iPhone platform evolve. Since becoming an iPhone developer I have become friends with many fellow developers throughout this great community. There is lots of daily inspiration from the other great people also working on Apple’s platforms. I can’t begin to think what I would be doing if I didn’t take this career path, but I guarantee it wouldn’t have been as much fun as this journey has been.

Movie Reviews? There’s an app for that!

Standard

Today marks the release of my latest iPhone application, Leonard Maltin’s Movie Guide (Direct AppStore Link) by mobileAge. Since I have been bad about blogging recently, I felt it was a good time to put together a post detailing it’s creation.

Since the release of mobileAge’s last major update to Wine Enthusiast Guide it was time to start up our the next project, a iPhone application combination of Leonard Maltin’s 2010 Movie Guide and Leonard Maltin’s Classic Movie Guide. MobileAge’s sister company Landware has actually produced mobile versions of the Leonard Maltin Movie Guide book series in the past, so we still had rights to the content.  The two guides combined is over 2300 pages, so it is no easy feat to do it right and keep the iPhone application under the 10MB ceiling that ensures wireless over the air download.

The first working prototypes were put together during my flights to/from Apple’s World Wide Developers Conference back in June. Thanks to WWDC we were able to learn how to properly leverage some new iPhone OS 3.0 features like Core Data and the new unified UISearchDisplayController. I will write a technical post at another date with some things that I learned while developing this application.

The design of the application took many forms over time, as you can see below in this picture of one of the earliest builds.  We intially wanted to color it similar to the 2009 book cover, as the 2010 cover wasn’t finalized yet, but it didn’t ever look quite right, as this early draft shows. We also were not entirely sure what content would be first shown at launch.

Sometimes the entire look of one section of the application would change entirely through the course of a day.  This constant iteration we felt helped build us a better product in the end.  After many design iterations since June, this is what the main screen looks like today:

The main screen of the application shows more recent movies that Leonard has reviewed and sent over to us, his “Current Picks” as he calls them. These reviews are a bit more in depth than the rest of the book content, but should give you a good idea if a recently released movie is worth the cost of admission.  This section automatically updates itself once a day “over the air” as new reviews become available. It is a great advantage that having an internet connected device like the iPhone and iPod Touch gives us.

Since we at mobileAge are all heavy Netflix users, we knew from the start we wanted to have some Netflix integration in the application. So after QUITE A BIT of data manipulation we got the Netflix identifiers into our database. We could then tie a movie to it’s Netflix API counter part, thus allowing you to quickly add the movie to your Netflix Disc/Instant Queues after reading Leonard’s thoughts on the movie.

One feature we had in the Wine Enthusiast Guide is custom user lists with remote backups. This was also another “MUST HAVE” feature for the Movie Guide as people love to categorize their movies for many various reasons.  So we ported the feature over to this application, with a few tweaks for Movies of course. It’s a simple feature, that we hope users find many uses for. We start everyone out with two default groups, but they can create and edit these lists to their heart’s content.

We are already working on many more features for future updates, so we hope to continue to build onto this great app and give movie buffs even more power. We are also starting up our next project which we are all very excited about.

Two Years as iPhone Developer

Standard

Two years ago today I released my first iPhone application. I had spent the week leading up to it’s release learning how to code on the iPhone OS 1.0 Toolchain and it was my first experience using Cocoa and Objective C.  I didn’t know what to work on, so I chose to do a quick port an AJAX powered Blackjack game I had written previously. The result of this hard work was the first alpha build of iBlackjack, which as a VERY basic proof of concept Blackjack game for the iPhone touch screen to issue casino-like commands.

iBlackjack Alpha 1 Gameplay

I continued to maintain the game over the next few months in my spare time when I wasn’t working late already at my day job.  It generated over 500k downloads in it’s time via the Pre-appstore Installer application. It was a fun hobby that I enjoyed tremendously more and more as time went on.

After six months, I found a great opportunity to turn this hobby of mine into a job.  So I went to work with an established mobile development company on their new offshoot company just for iPhone software, mobileAge. Together we grew a little demo game iBlackjack into a full fledged Blackjack simulator called Blackjack 21 for the official iPhone SDK. Blackjack 21 was released on July 10th, 2008 for sale on the iTunes AppStore.

Blackjack 21

It even got as high as the number 5 app in the store at one point!

I’ve since made other iPhone products for mobileAge; namely Shanghai Mahjong and the Wine Enthusiast Guide.  Both apps have gotten plenty of acclaim as well. For instance Shanghai was runner up for best Phone Game of 2008 from iLounge and is seen on Apple Store fronts worldwide. We were even lucky enough to have Wine Enthusiast Guide be selected by Apple for as in-store demo application.

One of the best things about iPhone development is all the great people I’ve met over the years at local meetups, Apple special events like WWDC and just finding others via Twitter.  It’s a great community with a lot of great people all learning from each other as this new iPhone development community has grown over the years.  Never met a better group of people in my years developing for other platforms.

Our current project is an yet unannounced application that is coming very soon, actually the first wide Beta release of that Application is being sent out to our testers next week. For fun, I just took a teaser shot of the source and destination of the next application.

Next App Teaser Image

I hope to show more of our new product off soon, so stay tuned to this space!

Also if you are interested in snagging a free copy of Blackjack 21, the great Just Another iPhone Blog is having a contest giving away a few copies.  They will likely be giving away copies of Shanghai Mahjong sometime next week too!