Tuesday, February 9, 2010

XBMC Emulation Station

Last month I wrote a couple of posts about setting up XBMC on an Ubuntu Linux-based system as my Media Center/HTPC computer. After living with it for a while now I'm lovin' it! It's similar to - actually better - than when I had digital cable TV and "on demand" service. However, it remains a work in progress.

I also previously wrote about getting my favorite old Windows 95/98 driving game, BreakNeck, running in WINE so I could launch it from XBMC. I also got the ol' DOS "Tie Fighter" game running too. I probably started with the more difficult way to launch games by picking PC programs that require a CD-ROM in the drive - especially when I wanted to simplify my life by not having to swap the discs and just have the software swap iso images of the CDs. That, as I found out, required writing a custom executable script to do what you would normally type into a terminal window.

My "Launcher" screen in XBMC

I've heard all this stuff about MAME, the Multi-Arcade Machine Emulator, and thought I'd check it out. So I installed "mame-sdl" from the repositories and "kxmame" as a front-end to make it easier to configure and launch games. I also noted that KXMAME can act as a front-end for MESS, so I added that too. I'd read tons of comments about "xmame" being terribly outdated, and that the SDL version was the way to go. I actually had some success with mame-sdl from the repositories, but when I ran into some issues and really started looking online for solutions I discovered that - for whatever reasons - the MAME stuff in the Ubuntu repositories is positively ancient and no longer being updated!! That led me to this web site: http://journalxtra.com/2009/11/how-to-install-sdlmame-and-sdlmess-onto-ubuntu/ with instructions on how to get the current SDL version of MAME and a slightly less current version of MESS (the Multi-Emulator Super System) to go with it.

Get SDL MAME here: http://sdlmame.wallyweek.org/
Get SDL MESS here: http://apt.ludomatic.fr/

Ah! But in order to install "sdlmame" (the newer, but not newest one) I had to uninstall "mame-sdl" which also took "kxmame" with it. Which had me thinking I needed a more current alternative to KXMAME that would (ideally) run both MAME and MESS. And I found it without too much trouble, it's called "Wah!cade" and you can find out how to get it at: http://www.anti-particle.com/wahcade.shtml. It is a linux version of "MAMEwah" written in python. Setting up MAME with it is really easy. Setting up MESS is a little less obvious, but I eventually figured it out.

But then I ran into some problems with MESS. While I could get various emulations to run, I couldn't get any of them to actually run a program. I think there's something to be said for focusing on one thing and doing it well, rather than trying to do everything and accomplishing nothing. After messing with MESS for most of an afternoon I decided it wasn't worth the effort to try and figure out why it refused to run perfectly good programs. A second problem was that nothing I did would make the XBMC Launcher plugin actually launch the Wah!cade front-end. I suspect it's because there is no compiled binary for it, it's a Python script - and XBMC is powered by Python scripts. I didn't look at the crash logs, but I'm guessing XBMC mistook "Wah!cade" as a script it was supposed to run and then couldn't figure out what to do with it.

Well, then it occurred to me that I really don't NEED something like "Wah!cade" anyway because XBMC can be my front-end for emulated retro gaming.

I had no problem setting up the XBMC Launcher plugin for running MAME. In fact, now that I think of it, the first screenshot I saw of the Launcher plugin in use had a thumbnail for MAME right there. D'oh! I suspect if I'd been able to get MESS to function correctly it would have similarly been easy to configure for use via XBMC, but I decided to use dedicated emulators for Commodore and Atari that are known to be very, very good at what they do.

So, next I set up the Commodore 64 emulator VICE too. The "Launcher" plugin for XBMC was actually intended more for programs like VICE as the plugin has two options - to either launch an application binary OR to launch a file in another program (i.e., a ROM file in an emulator). So that's super easy to set up once you get it pointing to the actual binary file (which is "etc/bin/x64" btw).

Then I downloaded the great Atari 2600 emulator "Stella" and set that up in a similar fashion. For both VICE and Stella it populates a sub-directory where you have all your games. Then, if you want, you can fiew them as "Thumbnails" and use the "Get Thumb" option from the Right+Click menu to find a suitable image for the game (such as box art, a screen shot, or a scan of the cartridge). That makes XBMC a really slick, unified front-end application for any number of emulator programs.
"Atari" section with customized thumbnails showing cartridge images

The next issue was that when VICE launches it would cover the screen, and with the right video settings I could hit "ALT+D" and get it to pop out of the window frame at full screen size - but it wasn't TRUE fullscreen because the menu bar and status bar were still there! On a Windows system popping VICE fullscreen is really, truly full screen (no menu bar, no status). Looking around online I found that this is a long-standing issue with VICE on Linux, and (surprise, surprise) the version in the official Ubuntu repositories is outdated. I learned there is a new SDL version that will actually solve the fullscreen problem - but you have to build it from source. That had me scared because:
a) I've had limited success building programs from source
b) I've read pages of forum posts by people who couldn't get VICE to compile

But I decided to risk it if the potential payoff was working fullscreen. First of all you need to GET the correct source files for VICE 2.2 then you need to follow the instructions in this post: http://ubuntuforums.org/showthread.php?t=278022 and where it talks about adding options to the "./configure" command you will need to include "--enable-sdlui" (if you select contradictory options it will warn you so you can choose. For example, you can't select both --enable-sdlui and --enable-gnomeui). Oh, and make sure you install the SDL dev stuff from the Ubuntu repositories or it won't compile (it will error out telling you it can't find any of the SDL stuff it needs). It will take you 15 minutes or so to configure, make, and install it, so be patient. Much to my pleasant surprise I compiled it without any problems!

Interestingly, when you run the install it doesn't put all the files in the same places as the older version from the repos - which meant I had TWO versions of VICE installed and could choose to run either (one puts binaries in /usr/bin and the other were in /usr/local/bin). The moment of truth was running it. At first it opens VERY, VERY small. There is no menu bar and, unlike the default user interface (by which I mean if you compile without any custom options) you can't just right+click to get menus. Nope, this SDL one is a different animal. Hit F12 and you'll be taken into the options. Navigate with the arrow keys and the "backspace" key. Because it was so tiny on my screen, and I was looking at it on a low-res TV screen, I had to sort of squint and guess I was selecting the options to "double" the size (which allowed me to actually READ the options) and then I enabled "fullscreen" and bingo! True full screen, with no window frames, menu bars, or status.

XBMC needs to be pointed to the new VICE 2.2 binary file or it will continue launching the old version. You could go in and "remove" the existing Launcher item and add the new one, but that will force you to re-import your C64 software library, and if you spent any time making things pretty with thumbnails you'll need to re-do all of them. So, I'd recommend you just go edit the XML file: ~/.xbmc/user data/plugin data/programs/launcher/launchers.xml and open it in gedit (Text Editor) scroll down until you find the entry for VICE and edit the path so it points at the newer version's binary file. Incidentally, the Launcher plugin doesn't always find great thumbnail images for you - it only gives you a maximum of 10 options from a Yahoo image search and a lot of them probably suck. This XML file is also where you can point the Launcher item thumbnails to any image you have stored anywhere on your computer (the default location for Launcher thumbnail images is ~/.xbmc/user data/User Data/Thumbnails/Programs/ (which you may notice is NOT the more obvious "Thumbnails" folder a level higher up).

So, there you have it. XBMC as a slick front-end to WINE, MAME, VICE, and Stella - and can be for other emulators as well.

EDIT: Screenshots added

4 comments:

Markus said...

Hey, just stumbled into your blog, interesting post btw.

Do you still like your solution?
And would you mind making a screenshot? (:

OffWorld Girl said...

@M,

Just edited the post to include a couple of screen shots.

Yes, I still like this solution. It's convenient to have all my games in one place and just have it launch the appropriate emulator - and the "10 foot interface" of XBMC means I can easily launch them on my TV from across the room.

Unknown said...

Hey Off World Girl!
great write up, im sure it will be useful to me when i re-build my htpc this month.
a few questions however, have you looked into the newest (10.10) of ubuntu, and the newest of XBMC for your setup? do they/will they work the same as your setup for mame?
have you had any issues with "finding" media (music movies or pictures) from installed hard drives?
also, its been 9 months since you posted that you still like it, still enamored or are you looking at something else like mythbuntu?

OffWorld Girl said...

Wow, I need to check this blog more often. Sorry Prez.

Yes, I've looked at both the latest Ubuntu (actually decide to go with the 10.04 LTS version though), and the 10.1 "Dharma" release of XBMC. My biggest issue with Dharma is that they completely changed how plugins work so none of the older plugins are compatible. If you either can't rewrite them for the new architecture yourself or the original dev doesn't release an update, you have to forget that plugin (pretty much every Anime plugin it seems). It all seems to work ok, though. I have had more issues with Ubuntu itself and having to manually install graphics drivers. Annoying but not a deal breaker.

I actually looked at Mythbuntu FIRST (as I hadn't yet heard of XBMC at the time). I absolutely HATED it. It was a configuration nightmare that I ultimately gave up trying to fix, and just felt very clunky and unprofessional - not at all like how slick XBMC's interface is.