cdi

cdi

Recipe

Here's a quick recipe for the impatient.

$ cdirip ECH.CDI

$ cdrecord -dao -v -multi -audio taudio01.wav

$ cdrecord -tao -v -xa tdata02.iso

Introduction

CD-R disk images for the SEGA Dreamcast are often stored in a non-standard, proprietary format called ".cdi". This format was created for the Disc Juggler program in the late 1990s. The .cdi format was adopted by the Dreamcast community because it was the only format at the time which could contain a multisession CD image in a single file.

Being a proprietary format, .cdi files are not well supported by programs other than Disc Juggler. While it is still possible to purchase Disc Juggler for Microsoft Windows, there is no support for other operating systems.

cdirip and cdrecord

Fortunately, Disc Juggler is not needed to burn .cdi files. It is possible to use the the free software tools cdirip and cdrecord to burn CD-Rs for the Dreamcast. Because of inadequate and outdated documentation, however, it has been difficult to make these programs work correctly. In the past, the usual result has been a pile of CD-R "coasters" in the trash.

That's where this document comes in. This is an archive of information on how to burn .cdi files to CD-R and have them actually boot on the Dreamcast.

How to invoke cdirip and cdrecord

The best way to understand how to use these tools is by seeing them in action and analyzing how they work.

Sample run

(1) $ cdirip ECH.CDI -info

CDIrip - (C) 2004 by DeXT/Lawrence Williams

Searching file: 'ECH.CDI'

Found image file. Opening...

This is a v3.0 image

Analyzing image...

Found 2 session(s)

Session 1 has 1 track(s)

Track: 1 Type: Audio/2352 Size: 300 LBA: 0

Session 2 has 1 track(s)

Track: 2 Type: Mode2/2336 Size: 319125 LBA: 11700

All done!

(2) $ cdirip ECH.CDI

CDIrip - (C) 2004 by DeXT/Lawrence Williams

Searching file: 'ECH.CDI'

Found image file. Opening...

This is a v3.0 image

Analyzing image...

Found 2 session(s)

Ripping image... (Press Ctrl-C at any time to exit)

All done!

Good burnin'...

(3) $ cdrecord -dao -v -multi -audio taudio01.wav

(4) $ cdrecord -tao -v -xa tdata02.iso

(5) $ cdrecord -toc

track: 1 lba: 0 ( 0) 00:02:00 adr: 1 control: 0 mode: -1

track: 2 lba: 11700 ( 46800) 02:38:00 adr: 1 control: 4 mode: 2

track:lout lba: 330827 ( 1323308) 73:33:02 adr: 1 control: 4 mode: -1

Analysis of sample run

Line (1) shows the table of contents of the .cdi file.

Line (2) breaks the .cdi file into its component parts: an audio track and an ISO9660 data track.

Line (3) burns the first session to the disc. Note that -dao and -multi are necessary. The first session must be burned in disk-at-once mode (see below for discussion). The CD-R is left open for writing multiple sessions by using -multi.

Line (4) burns the second session to the disc. Note that -xa and -tao are necessary. The -xa option specifies that the track is to be written in CD-ROM XA mode 2 form 1, in which the data is a multiple of 2048 bytes. We use track-at-once write mode for this session, since TAO is required for multi session recording.

Line (5) shows the table of contents on the finished CD-R.

Why is -dao necessary for the first session?

I am not completely sure why -dao is necessary, but I have a guess.

The -dao option puts cdrecord in "disk-at-once" mode, which writes the track verbatim to the disk. Using cdrecord's default "track-at-once" mode adds two extra "run-out" blocks at the end of the track. These two extra blocks move the location of the data track. Unfortunately, when the ISO9660 filesystem for a CD-Extra disk is created, the exact location of the filesystem on the disk is encoded in the iso image. (See the -C option of mkisofs and -msinfo of cdrecord).

Run-out blocks

According to wikipedia:

Track At Once or TAO is a recording mode where the recording laser stops after each track is finished and two run-out blocks are written. One link block and four run-in blocks are written when the next track is recorded. TAO discs can have both data and audio at the same time. [...] DAO mode, unlike TAO mode, allows any amount of audio data (or no data at all) to be written in the "pre-gaps" between tracks.

Why not use -cut?

Do not use the -cut option to cdirip. It is a kludge that is no longer necessary.

cdirip was written before cdrecord had the -dao option. Ignore any documentation you find that says that you need to "cut" the last two blocks from the first track in order to get the CD to burn correctly with cdrecord. The author of cdirip included the -cut option as a kludge; it simply throws away the last two blocks of data so that, when the run-out blocks are added during burning, the data session is in the right place. Besides the dubious integrity of throwing away two blocks of data, burning the kludged tracks requires a special version of cdrecord.

Notes

Software used

cdrecord -version

Cdrecord-Clone 2.01.01a03 (i686-pc-linux-gnu) Copyright (C) 1995-2005 Joerg Schilling

NOTE: this version of cdrecord is an inofficial (modified) release of cdrecord

and thus may have bugs that are not present in the original version.

Please send bug reports and support requests to <cdrtools@packages.debian.org>.

The original author should not be bothered with problems of this version.

cdirip version

Cdirip-0.6.3, downloaded from packages.debian.org.

Operating system version

Debian GNU/Linux Etch ("testing", current as of March 2006)

uname -a

Linux cerise 2.6.12 #1 Tue Jan 24 07:31:42 PST 2006 i686 GNU/Linux

Burning speed

I use cdrecord at full speed and have had no problems. I've heard rumors that some people need to use -speed=8, but it's never helped me. I am using a cheap 52x LITE-ON IDE cd burner.

Two data sessions

I'm not sure why, but it seems that some .cdi disk images have two data sessions instead of an audio and a data session. I've found that using -tao mode for both seems to work fine.

For two data session disks, cdirip will default to using -cut on the first data track, even if you did not request it. However, cutting does not appear to be necessary and might be harmful. To disable cutting, you can use the -full option. Here is an example:

$ cdirip 2DATA.cdi -full

$ cdrecord -tao -v -multi -xa tdata01.iso

$ cdrecord -tao -v -multi -xa tdata02.iso