Skip to content

Instantly share code, notes, and snippets.

@Kaiede

Kaiede/scdRip.sh Secret

Last active August 17, 2019 17:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kaiede/4954e02a3340f8d13b4bbe26b77413ca to your computer and use it in GitHub Desktop.
Save Kaiede/4954e02a3340f8d13b4bbe26b77413ca to your computer and use it in GitHub Desktop.
SegaCD Rip Script using CDRDAO
# !/bin/bash
#
# Quick-Rip of Sega CD Discs
#
# scdRip.sh <disk device> <game name>
#
# Disk Device does not need to include '/dev/'. An example on macOS would be something like "disk5".
# Game name doesn't need to be quoted, but it can be. All arguments past the first will be treated as the name.
#
# Both of these Work:
# scdRip.sh disk5 Sonic CD
# scdRip.sh disk5 "Sonic CD"
#
# cdrdao is required to be installed.
# On Debian-based Linux distros, you can run:
# sudo apt-get install cdrdao
# On macOS, you can use homebrew (install that first):
# brew install cdrdao
diskDevice="/dev/$1"
shift 1
gameName="$@"
tocFile="$gameName.toc"
cueFile="$gameName.cue"
binFile="$gameName.bin"
# Comment me out if you aren't running on macOS. TODO: What's the Linux equivilent?
echo "Unmounting $diskDevice..."
diskutil unmountDisk "$diskDevice"
# Mac has issues here specifying the drive to read doesn't actually work. Linux may need it specified?
echo "Ripping '$gameName' to '$binFile'..."
cdrdao read-cd --read-raw --datafile "$binFile" --driver generic-mmc-raw:0x20000 "$tocFile"
# toc2cue is included with cdrdao via homebrew on macOS. What about Linux?
echo "Converting TOC to CUE..."
toc2cue "$tocFile" "$cueFile"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment