September 2010
M T W T F S S
« Aug    
 12345
6789101112
13141516171819
20212223242526
27282930  

Good old google

Building a better MAME part 2

Beardy

Beardy

I’ve got a wishlist as long as your arm, but where do I start?

Well, there won’t be much to look at for a while yet – most coding projects are like icebergs; 90% of the action goes on under the surface where no-one can see it, and it’s the 10% above the water that attracts all the glory. Ahem, anyway, back to where to start. I’ll be doing this in VB.Net and I’m afraid I’m going to be dipping into coding jargon a bit here, but bear with me and we’ll see how we get on…

Looking back at the wishlist, points 2, 3 and 4 are all about the look and feel of the thing – that’s the easiest bit from a coding perspective and the hardest bit from a User Experience one, but without a solid framework there’s very little I can do about for now. For the time being, I’ll make do with a sneaky download of an “arcade” font from the internet and a quick cludge to shove a simple VB form into full screen mode. Point 1 – the controls – should be relatively trivial if I use DirectX for input – I’ll come back to this in a later installment, but essentially it’ll be a case of setting up a connection to the Joystick and then setting up some kind of timer to keep asking the joystick what buttons are being pushed.

Which brings us to the meat of the problem, from a technical perspective – how to interface to MAME (or, thanks Matt, any other emulator). We have two major problems to overcome here:

1. How to launch MAME, and keep track of what it’s doing?

2. How to get an idea of what games MAME supports and what features they have?

The first of these seems, on the surface, utterly trivial – launching another program is a fairly basic task. Spying on it to see what’s going on is somewhat more problematical – instead of a single command, you have to use a small spying process to keep an eye on it. For scrobbling purposes, I just need to know when it finishes but trying to get an idea of score tables and so on is slightly more complicated. MAME, officially, stopped supporting high score saves some time ago, so I have two options left to me (well, three, if you include forgetting about it). I can either patch hi-score support back in again, which is relatively trivial but stops it being an out-of-the-box MAME install, or I can try and implement by using MAME’s autosave function. Either way, I’d have to hack into the files more or less on a game by game basis, so for now, this is going to have to go into the ‘too hard’ basket.

Fortunately, the other problem has a much simpler, and more elegant, solution. The MAME team have thought all of this through and there’s a wealth of command line options you can use to find out what’s what. For my purposes, I’m using -listxml, which, essentially, dumps the entire MAME database to a file. Four hours with a copy of the schema (kindly embedded in the XML output by those nice MAME boys and girls) and I’ve got a functioning copy of the entire MAME database embedded within my app. Still not got anything much of anything to actually show, but I can step through it in the debugger.

Next step is to bring these two threads together – some form of simple list interface and allowing the user to launch the selected game will do for starters. I’ll upload when I get to that stage – be warned though, there’s still a lot to do to enable searching of the MAME database and filtering games on your own criteria. I’m not convinced that keeping the whole damn lot in memory is a good plan, so might fall back on loading it into a database of some form – SQL Server Express is still free right?

4 comments to Building a better MAME part 2

  • mugsy

    Go Johnny Go Go Go Go!

  • Ahchay

    If any emulator authors are listening, then please take note of the dump to XML option. It really is very useful.

    Saying that, there’s probably not so much sheer variation on offer with most home systems.

  • Hmmm, it’s a shame MAME’s ditched the high score support. Still, sounds like you’ve got the big picture sorted. I’m happy to do some beta testing. When I’m no longer homeless and have a computer, that is.

  • OnePunchMickey

    Regarding the db, yes SQL Server Express is free. Possibly a bit heavyweight though – something like Firebird or SQLite. The latter is a zero-configuration option, just one file.

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>