Emulation on Mac

Emulating classic video game consoles on Mac OS X

Category Archives: PS2

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

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.