Linux + PS3: Emulation Paradise

Having seen a lot of people recently talk about running emulators on their PlayStation 3s under Linux, I thought I’d give it a try.  Quite frankly, I’m not sure how so many people can be happy with how their setups work when I see their list of things that aren’t working properly.  From wireless controllers which don’t work without a wire to full screen displays that aren’t full screen, most of the pages I found talked about all the little bits that weren’t working, while also mentioning all the things that worked great.  So for some unknown reason, I decided to try it myself; at the very least, I thought I could probably live with some of the caveats, and at most I might get everything working perfectly.  Well, I’m quite happy with the result, so I figured it would be good to share my experience and what worked.  Not so much that anyone reading this through normal means of reading my website would find it interesting, but Google Knows All.

In The Beginning

I started by figuring out what hardware and software I might need.  In order to install to the PS3’s hard drive, you must repartition the drive through the built-in XMB – the menu system which shows up when you power the system on, or hit the PS button on a controller while it’s running.  Since this means a complete loss of data, I wanted to back everything up first and started this process by looking at what SATA hard drive I could get with combined gift cards I had not yet spent.  The only problem is that I’d still need to have something separate to do everything, since a backup disk needs to be formatted FAT32 and the PS3 will reformat it when installed.  Combine that with the fact that I’m only using barely half of the 80GB drive in there, I decided my money was better spent getting a Logitech Mediaboard.  This little sucker is nice to have, even without a Linux setup, since it lets you use a full size keyboard on the built-in web browser, in games, or in Home.  Especially with a 15-month-old son running around the living room, “wireless” is a wonderful feature to have in a device – when I’m done with the keyboard, I can flick the power switch, tuck it behind the end table, and it’s out of the way but still handy when it’s needed.

The next thing to figure out was what OS to install.  I started by using Ubuntu, but had a lot of problems with it which I’ll explain later.  I ended up using Yellow Dog Linux, which was the original Linux distribution to support the PS3 natively.  They’re also based on Red Hat Enterprise (or CentOS) and therefore very familiar to me on the backend – that’s what I run at work and at home.  So before you get started, you’ll want to grab whatever ISO image you need for your install, and burn it to a disc (in my case, YDL 6.1 burned to a DVD).  You will also need to have a USB keyboard, even if you plan on using Bluetooth when all is said and done – you’ll have to use USB for the install process, and until you get the Bluetooth keyboard configured.  On to the install!

RAM Disk Is Not An Install Procedure

Since my TV is standard definition and the PS3 won’t use a higher resolution than your monitor is capable of displaying, I was forced to use the text installer.  This wasn’t much of a problem for me since I would’ve taken longer to find everything through a GUI installer – I use the text-based one all the time anyway.  This also means that the end result will be a 640×480 display.  Technically, close to it: 576×384 is what xorg.conf says, which is a bit painful for a lot of programs but still not impossible to deal with.  As I mentioned above, I started with Ubuntu, first using a live CD to see if the idea was even feasible.  Since it seemed to work well, I had to take the plunge and install to the hard drive, which means formatting the internal disk and repartitioning it.  This is made easy in the XMB interface, but it’s still a scary thing to do when all your save states are about to be erased and you’re relying on a backup.  I made two; one to a USB key, and one to my iPod which I reformatted as a plain FAT32 hard drive for the evening since I needed about 30GB of storage space, and the iPod is easy enough to return to its normal state and let iTunes repopulate it with my music while I’m asleep.  The iPod got the result of using the backup utility in the XMB’s “System Settings” and should have been a full backup of the PS3, while the USB key was filled by going through my save data and copying each save file to the key one at a time.  Note that I said the backup “should have been” full.  When I got to the restore process, much later that evening, I found that the backup was somehow corrupted.  Much of the data wasn’t actually restored at all, though it looked like all my saves which could be copied were; the save data for the Hong Kong beta for Namco was copy protected, as was the save information for High Velocity Bowling – I guess I’ll have to re-earn that Lucite bowling ball with the skull inside.  Having the manual copy to the key was good, even though it seems I didn’t need it, just in case.  And some quick searches on Google seem to agree that there’s a lot of people who have had similar backup problems; unfortunately there also seems to be no way to verify your backup is good before you do anything with it.

I’ll go over the Ubuntu install quickly.  The install process went fine, though I expected to be given a list of packages I could select and never was.  Instead, it just started installing things without asking me about them first.  When everything was finished, the PS3 rebooted into Linux, and everything was working as I expected.  However, I started running into the problems with this distribution before long:

  • There was no intuitive way to configure a Bluetooth keyboard.  I finally found a way to do this with some command line tools; while I’m no stranger to the command line, I did expect that I’d be able to click on something to get somewhere with this.
  • Pairing the Dualshock 3 controller was completely unintuitive.  First I had to install an older Bluetooth daemon and tools, then shut down the current one, run the daemon, pair the controller, kill the daemon and then run another daemon.  Oh yeah, and now my Bluetooth keyboard didn’t work anymore.  And I pretty much had to do this every boot.
  • Most of the applications have windows which automatically start larger than a 640×480 screen, and “maximize” does not work to shrink them down to the screen’s borders.  Since this was also a new distribution to me, some of the tools which I needed to be able to see were unfamiliar, so I had to do a lot of flying in the dark with counting how many times I pressed “Tab” and what button I might be sitting on now.
  • Not being a Debian fanatic, and not having used it much in the course of work, I’m not a big fan of apt or .deb files.  Installing software was a bit more challenging for me, though I’m sure I’d have figured it all out in time if that was the only hurdle.

All in all, I decided that perhaps Yellow Dog Linux would be a better option, and after installing it I found it was definitely the case.  The latest release (6.1) installed without a hitch, and a HOWTO on their website described the process for pairing a Dualshock 3 controller nicely.  At the same time, I turned on my keyboard and put it in pairing mode, which subsequently worked fine and never needed further configuration.  After that initial pairing, I never had a problem with the controller, and only once had an issue with the keyboard preventing me from accessing the console – I was able to SSH in and restart the Bluetooth daemons, which fixed the problem though, and I’m pretty sure I caused the problem in the first place so I’m not blaming anything but me.

[root@ps3 ~]#

Now that Linux was installed, I played with the configuration of things a bit and made the machine more comfortable to me.  This included some things like setting up networking, adding SSH keys in the right places so I could login to my PlayStation and login to other machines from it, copying over .bashrc and .bash_profile from other accounts, all the kinds of things I usually do on a fresh Linux install anyway.  I have heard there might be some WLAN problems on PS3s in Linux, but I have a wired network in my house anyway so I didn’t really pay attention.  I’m not going to get into all of the details of an initial Linux configuration, because they vary per person and per your tastes – also, some of them are more involved than others, and as much as I’d love to teach everyone how to use Linux, I don’t have the time (or patience).  So once the machine was in a happy state for me, my attention turned to installing software.

My first download was an Atari 8-bit emulator called Atari800.  I don’t recall having to install any other programs to support it, and the compile went quite well.  Before long I had Blue Max running full screen on my TV, and was using my Dualshock 3 controller to fire upon countless tanks and enemy aircraft.  I copied over my extensive collection of ROMs, game disks and cassette dumps and ticked off the check box next to “Atari 8-Bit” on my list.

Next was Stella, an emulator for the Atari 2600 system.  This too installed without a hitch, and with only a couple tweaks to the configuration I was transported back to my childhood, sitting in front of a TV that was probably proportional to the one in my memories and playing Asteroids with the daunting “dum dah dum dah dum dah” thumping through the speakers.  I still haven’t got Stella to go completely full screen on the TV – there’s a sizable black box around the entire display – but it’s not terrible, and I doubt it would look that good blown up to full size anyway.  Might play with that more later, but it may require OpenGL which is mostly out of the question.

I wanted to get a Nintendo Entertainment System emulator running, and turned first to Nestopia which I run on my Mac as well.  While it did work, and it played games fine, the display got to me – the only way it seemed I could get full screen was to use OpenGL, which since hardware graphics acceleration isn’t currently available on the PS3 in Linux meant games were unplayable.  I could play fine, if I wanted a postage stamp sized window in the middle of a black screen, but I didn’t like that idea.  So instead, I grabbed a copy of Mednafen and installed it.  I think it took a little more work – there were a few dependencies I had to install as well – but the end result was worth it.  The Legend of Zelda was quickly filling my TV screen, and again I was transported back in time (though not as far back).  As an added benefit, I was able to configure the controller so that cross and circle were B and A, and square and triangle B turbo and A turbo.  Look out, Commando and Track And Field!

Finally, an emulator for the Super Nintendo was required, and I went no further than snes9x.  That seems to be the only PPC option – ZSNES won’t compile on anything but an Intel machine (x86 architecture).  However this is where I started to run into problems.  While the program would run and run the ROMs just fine, sound was very choppy and distorted.  I found some people complaining of the same thing online, while others said they fixed it with one command line flag or another.  None of the flags worked for me, but what finally did was to download version 1.50 instead of 1.51 (the most recent release).  Now, I don’t know what else might have changed between the versions, but version 1.50 works just fine for me, and the sound is working flawlessly as well.  It was as I was figuring out a button layout for snes9x that I thought of another idea, and now have it and Mednafen configured to do a save state when I press L2 and a load state when I press R2.  I wouldn’t need those buttons for games anyway, and now I have a quick load/save feature that doesn’t even involve touching the keyboard.

In the future, I’d like to get MAME setup, and hopefully some kind of nice front end for it all (one that I already looked at, which was quite promising, requires libraries that require other libraries which require newer libraries than I have installed.. that one might not happen).  All in all, I’m enjoying the PS3 even more, and it’s becoming more of a general-purpose gaming machine which is even better.  If they can figure out OpenGL through hardware 3D acceleration, I’ll be compiling PCSX2 as well, and putting all those PS2 games to good use too.

Final Thoughts

Running Linux on my PS3 isn’t just for a status thing, or because I’m a geek and I can do it.  I now have a gaming system setup that appeals to many in other ways than just flashy graphics.  In fact, shortly after I finished getting everything done, Stephanie asked me if she could play Super Mario Bros while I showered.

Pros:

  • The controller works fine, and switching back to the PS3 OS is made easier if I tell it to power off at the same time.  The Dualshock 3 then doesn’t forget that it was paired with the PS3, and after the system powers off I can power it on with the PS button again instead of having to plug the controller in and pair it with the system again.  There’s some comments around that you absolutely must re-pair your controller after you’ve used it in Linux, but I haven’t found this to be true.  Only that it doesn’t auto-poweroff, so you have to hold the PS button for ~12s to shut it down, and it doesn’t get feedback from the PS3 to know which controller number it is, so the four lights flash constantly.  The motion sensors aren’t working either, but for my needs that’s a big “meh.”
  • The keyboard and mouse combination makes using everything nice and easy, though I would love to have an auto-logged-in user and a nice graphical frontend to all the emulators eventually.

Cons:

  • Being able to choose the size of my Linux partition would be nice.  I was all set to buy a bigger drive until I realized I could either choose 10GB for the PS3 side, or 10GB for Linux, giving the remainder to the other OS.  Since I was only using around 37GB thus far (out of 80), I didn’t see much reason to get a larger drive when I couldn’t allocate, say, 20GB to Linux and 140 to the PS3.  Side note, you don’t realize that you have almost 4GB of ROMs for various systems until you try to fit them all on a fixed-size disk.  On the upside of this, most emulators can read ROMs compressed with gzip, so a quick script on the command line later and I have another 2GB free and a lot of .gz files.
  • Some way to verify that your backup is valid and correct, and will correctly restore, would be great.  Or a more robust restore procedure that might fail on a file, but keep trying to restore everything else (I know it didn’t do this, as it only got to maybe 20% before it failed and stopped).
  • The ability to run at a higher resolution than my display is “capable” of displaying – such as faking a 1024×768 display or something – would be wonderful.  It’s a pain when a large dialog box comes up to have to alt-click and drag it around to see the whole thing, though I could also create a larger “Virtual desktop” which would let me scroll the screen for a bit when approaching the sides with the mouse.

2 comments

Leave a Reply