Thursday 30 June 2011

Just an idea

Maybe if we bought an Android device for one of the MAME developers, they might get interested in porting it.  The more I look into matter, the more it seems that the project requires someone who is familiar with the source code.  Another easier option on the personal level would be to just forget Andorid and buy another device that uses an OS that is more MAME friendly.  I really wish I could run a different OS on my gtab, but the options are limited.

I need to go through many more tutorials before I'll be ready to successfully program things together. Seeing as this may take years, I continue to explore other options.

Sunday 26 June 2011

My brain hurts

I've managed to create a library (a .so file) of the MAME source code with Cygwin and the Android NDK.  For this build I used an older source version (.067).  This may not be the right approach, but my reasoning is - less code, less chance of problems.  Anyhow, after modifying my app to call the native code and running the emulator, the app crashed at the point the call was made.  No idea why, but apparently there is a debugger addon for Eclipse/Android SDK native code which I will attempt to use next.

I wonder if it is safe to assume ndk-build will make a library of c/c++ source code, even if the code doesn't execute properly in Android?  There is also the possibility I'm not making a proper call in my java code.  I may drop MAME temporarily and try some source code for a simpler application.

Btw, even if you can't help on technical level, leave a comment below to show you want an Android port of Mame!

Saturday 25 June 2011

Progress report

Not much to report really.   I have been able to use the Android SDK to produce a simple frontend for MAME (basically just a command line prompt), but tackling the NDK is a different matter.  Without much experience compiling, I decided to try a normal compile of MAME on my vista machine first.  To do this successfully I had to use a repackaged version of MinGW called mingw-w64.  The Android NDK on the other hand uses it's own specialized toolchain, and I don't know if it's possible to incorporate mingw-w64, or if it is necessary.  I didn't even know what a toolchain was a couple of days ago.


A recent post by R. Belmont suggests there may also be other issues with porting MAME to Android.

I'm still not sure MAME's SDL backend could be used in any way.   Perhaps there's a modded Android system I could install on my pc that would give me a more open lynx environment.   It's just not possible to "build" anything from within my gtab.  But even if I could find an Android mod to compile in, what would I do with the binary? 

Another method that's always open is translating all the C++ code to Java, and writing all new sub routines to make up for tools found in mingw-w64.  Do we have any takers for this option?  Anyone?


My money is still on the Andorid NDK.  Until an answer is found (or someone builds a MAME for Android), I plan on exploring possibilities using of using older source code for MAME, or even the source from ports of MAME.  Something that compiles with a standard MinGW toolchain (if there is such a thing...).


Anyhow, thanks for reading and please spread the word!  Perhaps if someone who knows what their doing looks into this, we can get MAME on Android soon, rather than never!

Saturday 18 June 2011

It's a working MAME on Android...

... but it runs too slow to be playable on my gtab.

To try it on your Android device, you will need

- aDOSBox (available here)
- The DOS port of MAME found at Adroid@home(tm) (I used v0.63)
- CWSDPMI.EXE (I found one here in the csdpmi5b.zip package)
- patience

The rest is pretty easy.  Create a folder for dmame on  /sdcard and dump the contents of mame063b_dos.zip into it.  Copy CWSDPMI.EXE into the same folder.  Copy the game ROM(s) you want to test into the /roms sub folder.  I believe a MAME.CFG file is created after the first time dmame is run.  I edited mine to get rid of the scan lines.

Install and start up aDOSBox on your droid, and you will be presented with a C:> prompt.  Navigate (ex. cd dmame) to your dmame folder and start dmame with regular command line options.  I used:

dmame pacman -nosound

I disabled sound just to squeeze out whatever speed I could.  Sound might work with other DOS games, but I haven't tried it.

After you launch dmame be prepared to wait.  A good few minutes anyhow.  I thought the system was hung up, but after a bit I was presented with a menu for sound.  0 for none, and the game was launched!

It's far from perfect, but it's a promising start.  There are other problems as well, but I don't want to discourage you from trying it, so I won't mention them in this post.  Not sure what is happening with aDOSBox's development as Google killed their discussion group for some reason, and the homepage is in French.  Please post your experience in the comments section!

Here are some images I grabbed with Screenshot ER:



Wednesday 15 June 2011

More information

The "problems" I was having with Ctrl+Shift+O in Eclipse was not a problem at all.  There was nothing happening, because there was nothing to import.  This was the response given to my post at the Eclipse Community Forums when I asked for a sample to test the hotkeys shorcut:

> Thanks for your reply. Could you or someone provide some sample code I
> could paste into a new java project that would show me Ctrl+Shift+O in
> action?

List list = new ArrayList();

Ctrl+Shift+O should add these two lines near the top of the class:

import java.util.ArrayList;
import java.util.List;
 Sure enough.  It worked as advertised. Now I can continue with the Android SDK tutorials.

Also today, an encouraging email came in from Cesare Falco who runs the website SDLMAME for Ubuntu.

SDLMAME has evolved into the SDL backend now included in the main
MAME *source* archive (i.e. mamexxxxs.zip).

The packages on my site are *binaries* compiled against that SDL backend
and are Ubuntu-specific. Those named "source packages" on my site are
sets of archives in a specific format to enable build from source on
Ubuntu with the standard development tools.

In short: to try a build for Android, forget about my site. :p
Download the source .zip from the MAME site and have a peek at the
makefile: a lot of platform-specific options are now auto-detected.
I guess Android can be considered a flavour of Linux, so
make all
could work out of the box.

For further help, don't forget to check the SDLMAME forum:
http://forums.bannister.org/ubbthreads.php?ubb=postlist&Board=8&page=1

Cheers,
Cesare.
I've previously compiled MAME on Debian through the terminal, but had to install missing libraries using apt-get.  I haven't had much luck getting apt-get to work in Android's terminal though.  Of course the last time I tried, my gtab wasn't rooted, so perhaps it's still possible.

The quest continues...

Tuesday 14 June 2011

A slow start

In my effort to bring MAME to Android, I must first learn how to use Eclipse.  So I'm going through the tutorials at the Adroid Developers website.  Unfortunately I've already hit a snag with one of the tips:

Tip: After you have pasted sample code into an Eclipse project, press Ctrl (or Cmd) + Shift + O to import the required packages.
But when I press those hotkeys I don't see anything happening in Eclipse and I'm not sure if that's normal or not.  So I posted the question at the Eclipse community forums and hopefully I'll get an answer soon so I can continue.   By reading other users comments on Eclipse, Ctrl+Shift+O seems to be a important feature.  I must be sure it's working as it should.

Speaking of forum posts, I've also made a post seeking help on compiling MAME on Android at the MAMEWorld Compiling Board.  As expected, no response yet, but at least that also means there isn't anyone so far that says it isn't possible.

Monday 13 June 2011

Let's do this!

Welcome!  This blog is to chronicle my efforts in bringing MAME (Multiple Arcade Machine Emulator) to the Android OS, and maybe encourage others to join the cause.

No MAME app for Android??

Currently, nothing I could find.  However, some limited alternatives have appeared.


What about TigerArcade(MAME)?

Whereas MAME emulates over a thousand gaming boards, TigerArcade only emulates CPS1,CPS2, and Neogeo game boards, and definitely nothing from the classic 80s era.  But kudos to the creator(s)!  3 boards is better than none.  It's also free, so give it a try.


What about Jrioni Arcade (or Jarcade)?

Though this app appears in the Market, when I try to purchase it, I get a server error.  The homepage blog has not been updated since 2009, so this project is (at the very least) on hiatus.  There also seems to have be the matter of having to convert roms to a certain set.  No idea why, but whatever works, right?  Other problems reported in the reviews.


What about Android Arcade Emulator?

Not currently available on the market.  At any rate, it didn't emulate many more game boards than TigerArcade(MAME), and maybe less.


Nothing else?

Well, there was another project called JAPE.  While not an Android app, it is written in Java, which is the programming language most apps for Android use.  If it supported any games, it may be worth compiling it for Android.  But after 5 years without an update, this project is probably abandoned.


So the only two options that are left to the wouldbe Android MAME players is to wait, or create the app themselves.  After some investigation, I'm confident that the major components needed to do the latter are available, and there is access to all the tools needed to create the rest.


So what needs to be done?

Mame is written in C++ mainly for Window/DOS based systems, but reportedly the current version of the source code has an SDL capability for compiling on non-windows based systems.  For instance, I've compiled an SDL version of MAME on my Debian notebook.  Android apps are written in java, but can have embedded native C code by using the Android NDK.

From SDL wiki:


Simple DirectMedia Layer for Android

Requirements:

Android SDK
http://developer.android.com/sdk/index.html

Android NDK r4 or later
http://developer.android.com/sdk/ndk/index.html

How the port works

- Android applications are Java-based, optionally with parts written in C
- As SDL apps are C-based, we use a small Java shim that uses JNI to talk to
the SDL library
- This means that your application C code must be placed inside an android
Java project, along with some C support code that communicates with Java
- This eventually produces a standard Android .apk package.

So the since main project needs to be written in Java, I think the first task is to create the menu skeleton of what will be the frontend / GUI to MAME.  I can worry about plugging in the C++ code later.  If it works, when MAME gets updated, the new code can be used to compile a new Android app version, without porting everything to Java each time.

To create the menu skeleton, I've installed Eclipse, the Android SDK, the Java Runtime Environment, plus all other addons and available packages (just be thorough).  This is my very first project however, so before I can start coding, I'm learning the system and currently going through the tutorials.  So far, I've created the obligatory "Hello World" program, with lots left to learn.  I'm optimistic though, and should have a basic menu soon.

Of course, if this is something you can do easily and want to help, please let me know!