Wednesday, November 20, 2013

RaspberryPi: few dollars to go back in time

Dynamite Dux on Raspberry Pi using PiMame / mame4all
I don't know how much money I spent in arcade machine videogames. How many coins I've inserted in the hole just to have a bit of fun. Was 80's and each boy/girl (even if just a kid) wanted to play with that fantastic machine. And so, Double Dragon, Bubble Bobble, Dynamite Dux, World Cup 90, Golden Axe and many other titles have made the history of ( public arcade machine ) videogames.

Now, just for fun, I've transformed my little Raspberry Pi in a MAME (Multiple Arcade Machine Emulator) console and I've gone back in time in the end of 80's when I was 10 years old.

What you need are just few things:
  • A Raspberry Pi (model B) (you can find it for less than 40 euros on Element14 website ( here )
  • A miniUSB to USB cable (same as the one you use to charge your phone)
  • An HDMI cable to connect to TV/Monitor
  • A monitor or a TV with an HDMI input (or if you want you can connect your Pi to the TV A/V input using the "yellow" connector on your RaspberryPI and of course connecting the audio output of Raspberry to White/Red input audio connectors of your TV)
  • An SD memory card (I've used a 8GB SD)
  • PiMame linux distribution image (you can find it here )
  • An ( USB ) SD card reader to write OS image to the SD
  • A software to write your image on SD card (for Windows I used Win32DiskImager )
  • An USB keyboard to setup your Raspberry
  • At least one (I've two) USB Joypad for PC (mine are very cheap and are working very well)
  • An ethernet cable to connect your Raspberry to your network when you need to upload new roms
There are a lot of guides showing how to setup your Raspberry PI.

I can tell you that is very simple and it just works.

So the main steps to setup your Raspberry are the following:
  • Download latest PiMame image and Win32DiskImager software
  • Unzip the PiMame image (you will find a .img file)
  • Insert your SD card in the card reader and format it using FAT32
  • Launch Win32DiskImager and select the SD card drive letter (check it double because you can do a disaster selecting the wrong drive letter!!! Be aware!!)
  • Click on "Write" and wait Win32DiskImager to complete
  • Eject the SD using safe ejection (in order to properly unmount the drive)
  • Put the SD in your Raspberry Pi, connect all the necessary wires (HDMI, USB Keyboard, at least one Joypad, power adapter)
  • Plug the power adapter in your wall plug

RaspberryPi with PiMame up&running
To put your favorite roms on PiMame just use your browser and connect to the IP of the raspberry, you should see the web interface of PiMame. Login using "pi" as username and "raspberry" as password. Once logged in, use the roms uploader to upload your files. 
Remember to put the roms in the appropriate directory (for example I'm using "mame4all" so I've uploaded my roms in "roms" directory of mame4all emulator).

If you have a lot of roms to upload you can use even an FTP client (like FileZilla for example) to upload all the roms rapidly. 

The system is now "up&running" but if you want to start immediately with your MAME emulator when you turn one the RaspberryPi, without having to choose the emulator using the initial menu, you can edit your ".profile" file in "pi" user's home directory. You will find the last line like this:

"python /home/pi/pimame_files/menu.py"

just replace this with

"/home/pi/emulators/mame4all-pi/mame"

The last step is to configure properly your joypad(s) to work with MAME without the need of a keyboard. So, reboot the RaspberryPi and start "mame4all" emulator. Launch a game and press TAB key on your keyboard. Select "Input (global)" and setup key bindings for your joypad. Remember to choose the "exit game" button to have the possibility to change game when your keyboard is not present. It's the function mapped with the keyboard's "Esc" key. You should replace it with one of the (unused) buttons of your joypad. Remember to map the "menu" key too… it is important to edit MAME preferences without a keyboard.

So you have to map all the buttons required to play (directions, 1-2-3-4 buttons, player coin insertion button, start button, menu button and exit button).

If you have done all the above steps, you are done and your Raspberry is now a Mame console.

I got it work and my children was happy to play with it… for me was a pleasure to see that older games were so appreciated by today's kids.
I'm now planning to build my special ( real ) arcade machine using wood, plexyglass and some cheap components (such as arcade buttons, arcade ballsticks, some older LCD display, etc.).

A jump in the past!