Paul Leaman, MAMEDEV, has been working with emulators for almost twoyears now. He has contributed a good number of drivers the likes of youhave to know about. 1942, Speed Rumbler and more recently, Strider andthe Street Fighter 2 games. In this InterView we get to know Paul andhis views regarding stand alone emulation vs. MAME and also the latesthappenings related to IDSA. Enjoy!
|EV talks to Paul Leaman - November 16,1998 by JoseQ
1) Typical starter question. Can you introduce yourself and tell us how youfound Emulation, and how you ended up in MAMEDEV?
OK. I'm a 29 year old Visual C++ programmer and make my living writingWindows NT applications. I graduated with a BSc. in Computer Science aboutsix or seven years ago and spent five years in my first job writing aWindows application. I left there about a year ago and am now workingfreelance.My first brush with emulation was when someone showed me a ZX spectrumemulator about six years ago. I was very impressed.Although I had a spectrum for a couple of years the machine I grew up withwas a C64, so what I really wanted to see was a C64 emulator. I even made astart on writing one but gave up because my little 386sx just wasn't up toit.I forgot about it for a while and one day tried looking for a C64 emulator.On the way, I heard a lot of talk about Sparcade. When it was released I wasamazed.Up to that point, I never really thought about arcade machines. I alwaysassumed that they ran on some magic custom processor since they were so muchbetter than home computers. When I found out how simple the hardware was Iwas very surprised. It's the extra graphics hardware that made themspecial.We went through a phase at work trying to find other emulators. A couple ofmonths later, we discovered Gyruss and then an early version of MAME. Wedownloaded the source and the compiler and had a play around.I chose to look at 1942 and found some basic information on the game. Ipinched some of the MAME graphics code, Marat's Z80 core and Mike Cuddy'ssound chip code. These were all the components needed for the game. I justhad to glue them together (so I thought).It took a lot of work to get it running. When the logo appeared it wasfantastic feeling of achievement. The whole project became an obsession fromthat point onwards. I don't think that anything since has matched thatfeeling of initial discovery.The game advanced in steps. I seemed to hit a wall and remember feelingsuitably pleased whenever I got over it. I had a lot of problems withcolours in the early days. I didn't realise that I was missing the palettedata and so started to put in colours by hand. It was a nightmare.If it wasn't for MAME I wouldn't have started in the first place. It wouldhave been selfish to keep everything to myself so I sent Nicola the sourcecode and a technical document. I don't know what he thought of the source...it was terrible.In the meantime, I worked on stand-alone Ghosts and Goblins and Diamond Runemulators.The original intention was to make my own multi-arcade emulator. It soonbecame obvious that I was going to have to start from scratch and redesignit all with the benefit of hindsight. It was becoming a monster and wasgetting out of control. Then I thought... what's the point? Why botherre-developing all the graphics routines? It's all been done so many timesbefore.So I converted all work in progress to MAME drivers and submitted them toNicola. This was still a fairly fleeting arrangement. It was like "here yougo here's some drivers... goodbye".I suppose that I only properly joined the team when I added Speed Rumblerand joined the mailing list last Christmas.
2) Do you think developing stand-alone emulators is worth it, or would yourather just work on MAME?
I definitely prefer developing in MAME. I like having everything in oneplace and a library of routines to fall back on.I am always complaining about how little time I get to do anything. It issometimes difficult to balance work / social / entertainment / relaxing /emulation work.When you have limited time, you tend to only do the things that you enjoydoing. For me, the discovery is much more fun than the implementation. Ireckon that 90% of the time was spent on reverse engineering the game andonly 10% spent on the code. As a result, the stand-alone emulators I wrotewere never really finished.The stand-alone emulators are far too much work to be fun. For example, if Ineeded a new sound chip. I would have to write one from scratch.You have to bear in mind that I program all day at work. I still sometimesthink that it is a little sad to come home and do more of what you have beendoing all day.
3) How would you describe the flexibility of working on a stand-aloneEmulator vs. a MAME driver, is one any easier than the other?
Once you know what you are doing, a MAME driver is definitely easier towrite. All the fundamental things such as graphic conversion routines arealready there.It frees you up to concentrate on the task in hand. I personally don't findthe framework limiting in any way.However, for the uninitiated MAME can be rather daunting. It is a largeproject and there is a lot going on.When I started, it was early days. I didn't think that MAME could do what Ineeded to do at the time. More to the point, I didn't know what I had to do.In the end, I needed twin processor support, bank switching and scrolling.I had no idea at the start how and whether or not it would work, let alonehow to add it all to MAME.Initially, I wanted the flexibility to experiment a little. If it's your owncode, you can do what you want to it.This approach works very well if you only have one game. This was myoriginal intention… 1942 and that's it! When I started adding extra gameswhilst still sharing common source code I began to cause myself problems. Iwas often tweaking something and breaking something else. What I ended upwith was a version control nightmare.Flexibility has it's problems and it was tempting to hack game specificstuff into the core. In the end, I was moving towards a multiple gamearchitecture anyway.This freedom to hack around did have advantages. I found it easier toprototype Gunsmoke, 1943, Legendary Wings, SectionZ, Black Tiger andSidearms in my stand-alone emulators because I had a debugger.When the debugger was added to MAME the stand-alone stuff had no furtherreason to exist so I dropped it.
4) Are there some things that you would change on the MAME architecture ifyou had the power to do so?
A little power is probably dangerous in the wrong hands.I haven't really looked much at the MAME architecture. I try to avoid doingany core changes. I am often a release behind and I would cause too muchchaos.
5) You have a long list of Capcom games in your list of projects, is thereany particular reason for this?
1942 was the reason that I started. It was a game that I remembered and Ifigured that it would be about the right complexity. I wanted something thatwasn't too easy. It's always good to do something you care about.Capcom's games are among my favourite arcade games (1942, Commando, Ghosts'n' Goblins, Strider, Pang).Once I got going, it was the easiest path to follow. I suppose that youadopt some of the design philosophy and start thinking like the originaldesigners.
6) How would you categorize the Capcom system hardware in comparison toother platforms being emulated?
The basic design hasn't changed much since 1984. The CPS1 system is not thatfar removed from 1942. It's just that there's so much more of it. I stillthink that these are among the simplest systems in MAME.Around 1987 they started to put copy protection in games which made things alittle more tricky. Fortunately they didn't include it in the CPS1 games.I think that I have had a fairly easy life in comparison to something likethe vector games.
7) Could you comment on the CPS speed performance differences between MAMEand Callus? Would being a CPS only emulator allow for more optimisation andflexibility, thus achieving better performance?
Callus is an awesome piece of work. It is very well polished and is builtfor speed. I believe that a large portion is written in assembly language.The hardware is also more completely emulated than the MAME drivers.A well written CPS only emulator will always have an advantage over amulti-purpose emulator.That doesn't mean that if you remove all the games from MAME the CPS gameswill run faster because they won't. To make any improvements, the whole lotwould need to be re-written from scratch with speed in mind.There is further scope for optimisation, however the display code isn'tcomplete yet. I still don't know how the high priority layer system works.Until that is 100% there is no point optimising the graphics drawingfurther.
8) You have been lately working a lot on the CPS1 system. What CPS games doyou plan to tackle on next?
I don't plan on adding any more new CPS drivers (other than finishing thehidden ones that are in the driver source code and finishing those thatdon't work yet).Quite a few of the non-working drivers in MAME are my fault. If I doanything, I ought to get these games going first.However, I might not even get that far.
9) What do you think about the CPS2 being emulated? Is there any light forthis becoming playable soon? Can you mention the major barriers and whatwould be a good (if any) approach to break them?
CPS2 emulation is certainly possible although it is going to take some time.I have had a brief look at Street Fighter Alpha out of interest.I certainly wouldn't expect to see CPS2 games in MAME in the near future.The biggest barrier is the encryption. The game program is encrypted. If youlook, you can make out the text, but all the machine code instructions andinstruction data are scrambled. Until the code can be unscrambled, the game just won't work.Rockman and SF Alpha seem to have similar startup code. It may be possible(though unlikely) to compare pieces of the two and work out some pattern.If it sounds simple, it's not. There are also other issues that would involve more work.Anything else that is different
I am assuming that CPS2 is similar to CPS1. Until the code is running thereis no way of telling how similar they are. Some or all of the graphicshardware may have changed.Different sound system
A whole new sound system needs to be implemented. All the instruments areplayed as samples as opposed to using an FM generator.Age of the games
I'm a little worried about the age of these games. The CPS2 system was beingused right up to August 1996. That's only just over two years old! The gamesmay still be in circulation.CPS2 emulation will likely the final straw for Capcom. There has to be acut-off date. I can see CPS2 emulation becoming a test case and emulatingCPS2 games could be legal suicide.
10) What is your opinion on the recent IDSA happenings and the future ofEmulation in general?
I suppose that it was inevitable. It looks like we are about to see someclarification about the whole issue of emulation :(Emulation has been gathering increasing press and popularity. When itreaches a stage that mainstream magazines start covering it then people arebound to sit up and take notice.I hate it when albums or films get deleted just because they are deemed tohave had their day. All these games (even the bad ones) are a little pieceof history and culture. I grew up with some of these games and I think thatit will be a real shame to lose them forever.Although companies are starting to release commercial emulators, they arehardly likely to release some of their more embarrassing or less successfulcreations. As far as they are concerned, it would be a waste of developmenttime, money and effort. If they didn't sell the first time what's the pointof re-releasing them?What I'd love to see is companies selling collections of their ROM imagesfor use on emulators. If the price is reasonable in today's terms, then I amsure that there will be more than enough interest to make it viable. I thinkthat it is unreasonable (though it would be nice) to expect them to donatethem to the public domain.Unless there is a guaranteed market and there are clear financial benefitsfor doing it, I doubt that we will see ROMS for sale. In cases wherecompanies have folded or the rights have been sold on, it may be difficultfinding the copyright owner.Unfortunately, it has reached a stage where I think that it would bedangerous for me to carry on developing emulators. I have always believedthat the creation of black-box emulators is perfectly legal but there is asmall grey area. There is bound to be a test case at some point and the lastthing that I need is for it to be me. I haven't got the time or money tofight any legal battles.Anyway, it's now approaching two years since I started writing emulators.It's been fun along the way, but it's time I had my life back.
11) What would you say to someone wanting to join MAMEDEV and help with theMAME evolution?
If I haven't put you off (that's just me being paranoid) then go for it. Itis very rewarding.Emulating games isn't easy. If it was then it wouldn't be fun. You will needa reasonable general knowledge of Computer Science principles, a broadunderstanding of how hardware works and a lot of time and patience. Unlessyou are only making minor changes, you will also need to know how to programin C. Although you can learn how to program C from the MAME source a goodbook would be a lot easier.If you want to contribute then first read the FAQ on compiling MAME. If youunderstand that then download and build the source code. There is quite alot to get. Once you have built the source you can then make a start atexamining what is going on.Pick a game and enable the debugger. Step into it to get a good feel forwhat is going on. Look at the driver source code and work out what is what.There are quite a few structures and macros to get to grips with.
Here are some broad hints for adding a new driver:If you are going to add a new driver, you need to at least get a feel forthe system you are trying to emulate. How many processors does it have? Whatare the processors? What sound chips does it use? Is it likely to be relatedto another game?You can pick a game with a similar configuration and use that as a start.Copy the vidhrdw and driver code to a new file and trim it down to thebasics. Make sure that you change all references to the old game.You will have a number of ROM files that contain seemingly random numbers.Then you need to look at these and identify roughly what's what. You willhave to identify code, graphic and possibly music code and sample data.There are a number of utilities you can use to help. There are graphicviewers to identify the graphics. You may be able to see text (such as "GAMEOVER") in the game code. Try loading files as raw PCM files into a soundeditor. You should be able to identify sound samples in this way.People on the MAME team are very friendly and helpful. Please bear in mindthat they are also very busy. It would be helpful to get as far as you canpast the initial stages of writing a driver before as you can before askingfor help.
12) Any words for the public, or for any Emulator author 'wannabe'?
Perhaps that should be any last words. Oh well, it was fun while it lasted…There you can see folks. Could thisbe the beginning of a very sad trend? Are emulator authorsbeing pushed away by the IDSA? We can honestly say thatthings like this shouldn't happen, and that this Emulationlegality case should be put to rest once and for all. Onlytime will tell what will happen in the emulation world.
One Article Up: MAME News & fixed vMAME
One Article Down: Retrogames joins Emu World