Emulation on Mac

Emulating classic video game consoles on Mac OS X

Category Archives: Saturn

Revisiting multi-console emulation with OpenEmu, getting PS1 emulation to work

In my last post about OpenEmu I mentioned the “experimental” build that adds support for many more systems than the official release of the program. Over the weekend I tried out the experimental version’s Playstation 1 emulation. Wow, it’s actually better than PCSX-Reloaded!

The official release version of OpenEmu supports:

  • Game Boy Advance
  • Game Boy Color
  • NeoGeo Pocket Color
  • Nintendo (NES)/Famicom
  • Nintendo DS
  • Sega 32X
  • Sega Game Gear
  • Sega Genesis/Mega Drive
  • Sega Master System
  • Super Nintendo (SNES)
  • TurboGrafx-16/PC Engine
  • Virtual Boy

The experimental build version adds support for:

  • Atari 2600
  • Atari 5200
  • Atari 7800
  • Atari Lynx
  • ColecoVision
  • Commodore 64
  • Famicom Disk System
  • MAME
  • Nintendo 64
  • PC-FX
  • PlayStation
  • PSP
  • Sega CD
  • Sega Saturn
  • SG-1000
  • TurboGrafx-CD/PC Engine CD
  • Vectrex
  • WonderSwan

I tested out PlayStation support, and ran into a few obstacles before getting things to work.

  1. The UI does nothing to explain how to provide the PlayStation BIOS file. Searching around, I learned that you add the BIOS file(s) by dragging and dropping the *.bin files (BIOS ROM images) like you would a game ROM. But, after I found a set of BIOS ROM images online, adding them this way still didn’t work. It turns out the filenames were also important, and that I had to rename the files I had to be the expected filenames:
    scph5500.bin (JP) (sha1 sum: b05def971d8ec59f346f2d9ac21fb742e3eb6917) …matched what I had in the download pack I found.
    scph5501.bin (NA) (sha1 sum: 0555c6fae8906f3f09baf5988f00e55f88e9f30b) … for me, this file was SCPH7003.BIN, and had to be renamed.
    scph5502.bin (EU) (sha1 sum: f6bc2d1f5eb6593de7d089c425ac681d6fffd3f0) … for me, this file was SCPH5552.bin, and had to be renamed.
    After renaming these BIOS images, it was possible to drag them into OpenEmu and have them be recognized as PS1 BIOS ROM image files. The UI doesn’t make it clear that it has done anything with the files, but the lack of warning is your indicator that they have been accepted.
  2. OpenEmu’s “emulator core” for PS1 emulation is Mednafen, and this emulator requires all games be provided in cuesheet format. I had only ISO images, so I had to re-rip a game in cuesheet format in order to successfully add it to my OpenEmu game library.

Preserving CD and DVD-based Console Games (Pt. 3): the .bin/.cue format

This post is part of a series:
Preserving CD and DVD-based Console Games
Preserving CD and DVD-based Console Games (Pt. 2)

In a previous post, I mentioned that two command-line utilities for making optical disc images on Mac OS X were dd and cdrdao, but I recommended dd because it was simpler to use. Well there’s actually a case where cdrdao is needed, and that is when your emulator wants game images in the “cuesheet” format (a pair of files with the file extensions .bin and .cue, rather than a single .iso or image file).

Why do we need the cuesheet format?

I mentioned in my first post in this series that many old games use “mixed-mode discs” (audio and data as separate tracks). You can rip all of their data, but without metadata to indicate the track boundaries, it seems that multi-track disc images can’t be properly handled (?). Most 16-bit era CD games were this kind of disc, and sometimes it was used in the early games of the PS1/Saturn generation.

I realized the need for cuesheet format when I tried to use the Mednafen emulator to play a Playstation 1 game I backed up in ISO format. It would fail with weird errors unless I provided the game in cuesheet format.

Almost any cuesheet file can be found at Redump.org. In fact, you can just download every cuesheet for a given system all at once, which is nice. Maybe it will preclude you from having to create your own, if you ripped your games as ISO. Note that your binary image file has to be named consistently with what is in each CUE file.

Installing cdrdao

First, you need to install the “cdrdao” package from either MacPorts (recommended), Fink, or from source. If you have MacPorts, the command is as follows:

$ sudo port install cdrdao

Backing up a PS1 disc in cuesheet format, using cdrdao

Find and unmount the disc filesystem. Observe which drive is the disc drive with the first command, and use that path in the second command:

$ diskutil list
$ diskutil unmountDisk /dev/disk3

Then rip the disc and convert its TOC to a CUE with these two commands:

$ cdrdao read-cd --datafile image.bin --driver generic-mmc:0x20000 --read-raw image.toc
$ toc2cue image.toc image.cue

Saturn Emulation on Mac OS X

The SEGA Saturn was long said to be impossible to emulate, because of its unusual (ridiculous) architecture that incorporated eight processors (two Hitachi SuperH SH-2 processors, one Hitachi SH-1 processor just for streaming and decompressing from the disc in realtime, two “video display processors” from SEGA, a Motorola 68EC000 for sound, another custom SEGA DSP chip for sound built by Yamaha, and finally something called the System Control Unit). Before the days of multi-core processors, parallelism meant having multiple chips. It was expensive, hard to program for, and its graphical abilities were best suited to 2D.

There were a string of Windows-only closed-source emulators, including SSF, Giri Giri, Satourne, etc. They have all been abandoned (or in the case of Giri Giri, sold to SEGA).

The Yabause emulator carries the torch now. It’s open-source. It builds on Mac OS X and even ships an OS X binary, in an app bundle too! You won’t need much help getting it to work. With a game ISO (original disc in your system, or disc image – see my earlier post on imaging your original discs), and a Sega Saturn BIOS file, you are good to go.


The first thing to do is to open Preferences, and point it to the location of your Sega Saturn BIOS file. Also uncheck the box for “Enable BIOS emulation” unless you were unable to find a copy of this BIOS file anywhere.

Next, go to the Audio/Video tab. Audio just works, and there’s nothing to change. Graphics are another story. With the current version (0.9.13) the OpenGL graphics renderer shows no graphics at all (just a black screen with audio). Then if you go to fullscreen, it crashes the emulator. The software graphics renderer is not fast enough to be playable; with frameskip turned on, the game is playable, but you wouldn’t want to. The third option is the “Grand Central Dispatch” graphics driver, and this actually works well. Not 100% speed but close. But the real fix is downloading Yabause version 0.9.12, which had a working OpenGL mode on OS X. They appear to be aware of this bug and it might get fixed in the next version. Also, if your system is fast enough, it will actually cause issues with emulation speed unless you check the option in the menu bar: Emulation -> Enable Frameskip. The emulation speed is not perfect all the time, but this keeps it on target as much as possible.

There is no support for controllers at the moment, so you have to play with the keyboard. That may be okay for some games, but I hope that controller support comes quickly in a future version. The work-around for now is to run a tool that maps keyboard keys to a controller’s inputs. On Mac OS X, your choices are ControllerMate ($25) or Enjoy2 (free, open source). Download and run Enjoy2.app, and then get your PS3 controller to Bluetooth pair with your Mac. Now it should automatically show up in Enjoy2. If you press a button on the controller, it will jump to a place in the list with an auto-generated button name (up on the d-pad will be “Button 5 (null)” but don’t worry about that). For each key you want to assign to a controller input, just set it to “Press a key” and then in the field next to it, hit a key on the keyboard. When done configuring, hit the “Start” in Enjoy2. You can test your mapping using a text editor; you should be able to type with the PS3 controller. Now, over in Yabause, configure the emulator with keyboard keys matching the ones you set in Enjoy2. This should work great unless you need analog, which few Saturn games supported anyway (and none required, to my knowledge). Also, at some future point it would be great if mouse input could emulate the light gun, or two sticks could be used for Virtual On. But now I’m just dreaming.

In order to save games (Yabause doesn’t support the emulator concept of “save states”) you have to go to Preferences, Memory, and then under “Internal Memory”, enter a pathname to somewhere on your system where you want the Saturn’s internal battery-backed RAM to be stored. It can be anywhere and named whatever, as long as you have write permissions to that location. You can do the same thing to create a file-backed emulation of a Saturn expansion cartridge. Yabause will write the files when it quits.

Getting in and out of full screen is janky; you can get into full screen mode using the menu bar, but to get out, the usual keys like ESC don’t work. You have to hit Cmd-F to toggle out of full screen. Or Cmd-Q to quit, that also works.

Lastly, if you are looking for where Yabause stores its program preferences:

~/Library/Saved Application State/org.yabause.yabause.cocoa.savedState

Preserving CD and DVD-based Console Games (Pt. 2)

In the last post, I mentioned the use of a disk imaging command called dd. One of the shortcomings of dd is that it doesn’t provide any kind of progress information while it is working, and doesn’t integrity check the resulting output. Sometimes it has an error during the imaging process and just stops prematurely without an explanation. After going through 100 or so Playstation 1 games and trying to backup all of them using dd, I started looking for a better way.

One alternative I found was an improved version of dd called dcfldd, a tool by Nick Harbour when he worked at the Department of Defense’s Computer Forensic Laboratory (DCFL). To use it, you need to download the source and compile (no binary love for Mac OS X users). The steps are the same standard ones for GNU open source projects: extract the source code archive (should be just a double click in Finder after it downloads); open Terminal; cd to the directory of the source code; ./configure; make; sudo make install. Then you should be able to run dcfldd using the same parameters as with dd, except now you will get to see the progress. It also may have just been a coincidence, but dcfldd ripped my copy of MDK whereas dd was not getting the job done (it kept erroring out).

Preserving CD and DVD-based Console Games

In order to preserve a copy of a game that you own, you must make an “image” of the full CD. Many Playstation game discs (especially earlier games) have a data track and one or more audio tracks such as the kind that play in a standard CD player. This makes them a little trickier than straight data discs which are fairly simple to image using the GUI application Disk Utility.

You may be familiar with the term “ISO”, a kind of disk image that is often used for software distribution. However, you cannot make an ISO out of a multi-session disc or a disc with audio tracks; the format doesn’t allow for it. At best, you will lose the audio tracks; at worst, you have an image that doesn’t contain all of the game code. We need a byte-for-byte copy of the original disc with all of its tracks. There is no one file extension associated with a disc image like this, as far as I can tell. I just call it an image file and the file extension is arbitrary, but some emulators want the “.iso” extension, and you might have to rename it to that. Various commercial ripping tools have their own file extensions, and maybe even their own image formats. I don’t see a point in using any of these proprietary formats or tools.

Most directions on how to image Playstation game discs start with “download this shitty Windows software…” or “launch your $70 copy of some professional-grade Mac OS X disc authoring software.” I wanted to accomplish this task without using any shady crapware or expensive commercial software. That left me with the command line tools for direct CD/DVD access.

The command-line tools I am aware of for doing direct-access imaging of storage devices on a Mac are hdiutil, dd, and cdrdao. The latter is not part of the default OS X tool set, but you can install it with Mac Ports (or build it yourself from source, but it’s easier to use Mac Ports). I was able to create a playable disc image using hdiutil, but only when the disc had only data. When it had both data and audio tracks, hdiutil would fail during the copy with an unhelpful “input/output error” message. The dd utility, however, seems to work just fine. So does cdrdao, but since dd comes with OS X, we’ll just use that.

Step 1: insert the game disc. It will show up on your desktop as one volume if it’s just a data track, or two volumes if it also has data. Annoyingly, iTunes will jump up and ask to import the audio tracks. I don’t know if there’s anything you can do about that, except say “don’t ask me again.” It will still pop to the front every time the disc is inserted, though.

Step 2: because we need exclusive access to the CD/DVD drive, we have to take access away from Finder by unmounting the volume(s) on the CD/DVD device. To do so, first we need to know the UNIX filename of the CD/DVD drive device. The command “drutil status” will show us a name in the form of “/dev/disk2” (yours may be different). We take that name and use it in the command “diskutil unmountdisk disk2”, which unmounts all volumes associated with this device.

Step 3: ripping the game disc. The command we want to use is “dd if=/dev/disk2 of=~/Desktop/Title\ Of\ Game.iso bs=2048”. I don’t know if the last parameter, which is specifying a block size of 2KB, is necessary or not. But one source I read claimed that it is necessary to prevent Mac OS X from changing the block size of the data on a CD from 2KB to 4KB, which is the default behavior.

To recap:

drutil status
diskutil unmount disk4
dd if=/dev/disk4 of=~/Desktop/Title\ Of\ Game.iso bs=2048

That’s it. It takes dd about six minutes or so to rip the game, and then you should have a single file containing all of the tracks of the original disc. PS1 emulators can load this file to play the game directly from your hard disk.

I’ve tested, and everything I’ve said above also applies to PlayStation 2 and Sega Saturn discs.