Tuesday 1 March 2016

Megadrive/Genesis, Master System, MegaCD/SegaCD, 32x emulation: Picodrive

I love old Sega systems! I know, Nintendo had Mario, Zelda, etc. are awesome, but one cannot fight childhood memories!

Picodrive is an awesome emulator: it emulates the Megadrive ecosystem, and even the Master System (which can be considered as part of the Megadrive ecosystem, as there was actually a Master System in each Megadrive). 32x emulation is way too slow on my setup, but it works. I remember seeing people running it on other, roughly equivalent systems, so I may have missed something.

I have put on my github account my modified version of Picodrive. The "pixbox.patch" file at the root of the folder is the difference with the original repository. It has been a long time since I last checked it out, and there must have been some evolutions, but I do not want to risk breaking what works perfectly on my system.

So, here are my main changes anyway:

  • I have forced "6 button" input on all the controllers. This was to fix what I supposed was a bug (some buttons not working), but which was a wrong soldering of my buttons! I suppose you can feel free to ignore this patch. I recall that I did not intend to share my modifications at first!
  • I have hard-coded the path to the system roms to /root/.picodrive. Otherwise, it looked for them in the current directory, which made little sense for an application which I intended to start from a service.
  • The most important change: starting the application with the environment variable NO_MENU set removes the menu when quitting a game. Which allows returning to my custom launcher.
Make sure the following environment variables are set, and gcc/g++ are the 4.9.1 versions (not sure this is very important in practice):
 CC = gcc  
 CXX = g++  
 AS = as  
 CFLAGS += -O3 -march=armv7-a -mtune=cortex-a8 -mfloat-abi=hard -mfpu=vfpv3-d16   
 LD_LIBRARY_PATH=/media/BBB/lib  

/media/BBB/lib is the path where the SDL libraries have been installed. And then, just compile, in the classical Linux way:
 ./configure --sound-drivers=sdl  
 make  

Once compiled, you can move the executable wherever you want (I put mine in /media/BBB/bin and set my PATH environment variable accordingly).

My typical command line to start the emulator is:
 SDL_VIDEO_YUV_DIRECT=1 SDL_VIDEO_YUV_HWACCEL=1 SDL_ACCEL=1 LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/media/BBB/lib NO_MENU=1 /media/BBB/sources/picodrive/picodrive/PicoDrive -config /root/.picodrive/config2.cfg   

Yes, that's a lot of environment variables! But this is necessary to have a proper display on SDL. Feel free to tweak your own config2.cfg file, it is quite self-explanatory (or you can start the emulator without NO_MENU set to configure it once and for all).

No comments:

Post a Comment