Difference between revisions of "Creating images of PSX games using Linux"

From Pandora Wiki
Jump to: navigation, search
(cat)
 
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
This pages describes a rather simple way for creating images for usage with an emulator like [[PSX4Pandora]]. Everything listed here does require the program ''cdrdao'' which is often already installed in common Linux distributions once some burner software is installed.
+
You have two options to do this kind of operation. Either you use your Pandora directly (by attaching a USB CD-reader to it), or you can do it via the command line in a Linux Desktop environment.  
  
== Single command ==
+
== Directly from your Pandora ==
This command creates a dump of your disc. It does also extract subchannel data which is required for the copy protection of some of the games to work correctly. It does save the image in .bin format and also does create a .cue file.
+
In order to rip everything directly using your Pandora, see this see [http://pandoralive.info/?p=1089 this tutorial for ripping psx games directly on pandora]. You can also check the associated [http://boards.openpandora.org/index.php/topic/12532-cdrdao-rip-psx-cd-directly-on-the-pandora/ forum thread on the boards]. You can download the appropriate tool, CDRDAO for Pandora, [http://repo.openpandora.org/?page=detail&app=cdrdao-ptitseb on the repo].
  
Assuming that your optical drive is called ''/dev/sr0'' and you want to name the image ''GAME_NAME'', this is the command you can use to create the image in the current dir:
+
The following describes another method on a Desktop PC.
  cdrdao read-cd --read-raw --read-subchan rw_raw --datafile GAME_NAME.bin --device /dev/sr0 --driver generic-mmc-raw GAME_NAME.cue
+
Everything listed here does require the program ''cdrdao'' which is often already installed in common Linux distributions once some burner software is installed.
 +
 
 +
== From the command line ==
 +
This command creates a dump of your disc. It also extracts subchannel data which is required for the copy protection of some of the games to work correctly. It saves the image in .bin format and also creates a .toc file.
 +
 
 +
First, you must know what device name to use for you optical drive. If you are not sure what your drive's Linux device name is, then you can run this command to find out:
 +
cdrdao scanbus
 +
The result should look something like this:
 +
Cdrdao version 1.2.3 - (C) Andreas Mueller <andreas@daneb.de>
 +
/dev/sr0 : hp      , DVD RW AD-7581S , 4H73
 +
The first part of the second line, ''/dev/sr0'', is the device name of the only optical drive that cdrdao recognizes on this machine. If you have multiple optical drives, they will each show up here. You can distinguish between them by the description following the colon after the device name. The device here is an HP DVD RW Model AD-7581S.
 +
 
 +
 
 +
Next, make sure that your disc is in the drive but not mounted. Assuming that your optical drive is called ''/dev/sr0'', to unmount the drive from the command line you can do this:
 +
umount /dev/sr0
 +
(Of course you should substitute whatever device name you got from previous command.)
 +
 
 +
 
 +
Assuming again that your optical drive is called ''/dev/sr0'' and you want to name the image ''GAME_NAME'', this is the command you can use to create the image in the current dir:
 +
  cdrdao read-cd --read-raw --read-subchan rw_raw --datafile GAME_NAME.bin --device /dev/sr0 --driver generic-mmc-raw GAME_NAME.toc
 
Of course you have to adjust the parameters according to your desires and your system setup.
 
Of course you have to adjust the parameters according to your desires and your system setup.
 +
 +
 +
Some emulators are finicky and don't like .toc files, or seem to work with some bin/toc file combinations, but not others. Usually .cue files work, so you may want to create a .cue file from the .toc file that cdrdao just made with this command:
 +
toc2cue GAME_NAME.toc GAME_NAME.cue
 +
That will leave both a .toc file and a .cue file in the directory you are working from.
  
 
== Useful script ==
 
== Useful script ==
Line 134: Line 158:
 
  # final commandline for reading the disc and creating the image
 
  # final commandline for reading the disc and creating the image
 
  if [ "$NOSUBCHAN" = "true" ]; then
 
  if [ "$NOSUBCHAN" = "true" ]; then
  cdrdao read-cd --read-raw --datafile $PSXDIR/$IMAGENAME.bin --device $DRIVE --driver generic-mmc-raw $PSXDIR/$IMAGENAME.cue
+
  cdrdao read-cd --read-raw --datafile $PSXDIR/$IMAGENAME.bin --device $DRIVE --driver generic-mmc-raw $PSXDIR/$IMAGENAME.toc
 
  else
 
  else
  cdrdao read-cd --read-raw --read-subchan rw_raw --datafile $PSXDIR/$IMAGENAME.bin --device $DRIVE --driver generic-mmc-raw $PSXDIR/$IMAGENAME.cue
+
  cdrdao read-cd --read-raw --read-subchan rw_raw --datafile $PSXDIR/$IMAGENAME.bin --device $DRIVE --driver generic-mmc-raw $PSXDIR/$IMAGENAME.toc
 
  fi
 
  fi
 +
toc2cue $PSXDIR/$IMAGENAME.toc $PSXDIR/$IMAGENAME.cue
  
 
== Compressing the images ==
 
== Compressing the images ==

Latest revision as of 05:53, 18 November 2013

You have two options to do this kind of operation. Either you use your Pandora directly (by attaching a USB CD-reader to it), or you can do it via the command line in a Linux Desktop environment.

Directly from your Pandora

In order to rip everything directly using your Pandora, see this see this tutorial for ripping psx games directly on pandora. You can also check the associated forum thread on the boards. You can download the appropriate tool, CDRDAO for Pandora, on the repo.

The following describes another method on a Desktop PC. Everything listed here does require the program cdrdao which is often already installed in common Linux distributions once some burner software is installed.

From the command line

This command creates a dump of your disc. It also extracts subchannel data which is required for the copy protection of some of the games to work correctly. It saves the image in .bin format and also creates a .toc file.

First, you must know what device name to use for you optical drive. If you are not sure what your drive's Linux device name is, then you can run this command to find out:

cdrdao scanbus

The result should look something like this:

Cdrdao version 1.2.3 - (C) Andreas Mueller <andreas@daneb.de>
/dev/sr0 : hp      , DVD RW AD-7581S , 4H73

The first part of the second line, /dev/sr0, is the device name of the only optical drive that cdrdao recognizes on this machine. If you have multiple optical drives, they will each show up here. You can distinguish between them by the description following the colon after the device name. The device here is an HP DVD RW Model AD-7581S.


Next, make sure that your disc is in the drive but not mounted. Assuming that your optical drive is called /dev/sr0, to unmount the drive from the command line you can do this:

umount /dev/sr0

(Of course you should substitute whatever device name you got from previous command.)


Assuming again that your optical drive is called /dev/sr0 and you want to name the image GAME_NAME, this is the command you can use to create the image in the current dir:

cdrdao read-cd --read-raw --read-subchan rw_raw --datafile GAME_NAME.bin --device /dev/sr0 --driver generic-mmc-raw GAME_NAME.toc

Of course you have to adjust the parameters according to your desires and your system setup.


Some emulators are finicky and don't like .toc files, or seem to work with some bin/toc file combinations, but not others. Usually .cue files work, so you may want to create a .cue file from the .toc file that cdrdao just made with this command:

toc2cue GAME_NAME.toc GAME_NAME.cue

That will leave both a .toc file and a .cue file in the directory you are working from.

Useful script

Following is a script doing some useful stuff. It does by default rip the current disc in your drive /dev/sr0 into the folder ~/psxrip/ with the name you give as parameter. If the folder does not exist, it is created. It does extract subchannel data by default, saves the image as .bin and creates a .cue.

You can also copy the following code into a text file and make it executable. To do so, lets assume you named the text file psxrip, then run chmod +x psxrip. For usage information just type ./psxrip --help. The script does check if you got the required program installed, if you provided the parameters and all the likes. If you do something that you are not supposed to do, it will print an error message as well as some (hopefully) helpful output.

Here is the script:

#!/bin/bash
#
#  This is a script to create a .bin image with corresponding .cue out of your
#  PSX game discs as backup and/or for usage with emulators.
#
#  Run-time requirements: cdrdao
#
#  This script is partly based upon the "wesnoth-optipng" script from the
#  Battle for Wesnoth team.
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License version 2 or,
#  at your option any later version. This program is distributed in the
#  hope that it will be useful, but WITHOUT ANY WARRANTY.

PSXDIR=$HOME/psxrip
DRIVE=/dev/sr0

report_absent_tool()
{
	echo "$1 is not present in PATH. $(basename ${0}) requires it in order to work properly."
	if [ -n "$2" ]; then
		echo "You can obtain $1 at <${2}>."
	fi
	exit -1
}

print_help()
{
cat << EOSTREAM
Script for ripping PSX game discs into .bin files with corresponding .cue files.

Usage:
  $(basename ${0}) [{--outputdir} <value>] [{--drive} <value>] [{--no-subchan] [{--help|-h}] [filename]

The parameter [filename] is mandatory. Without it, the script will abort. Plain
spaces in the filename are prohibited!

Available switches:
  --drive       Define the device to be used. If this parameter is not
                provided, /dev/sr0 will be used.

  --help / -h   Displays this help text.

  --no-subchan  Don't extract subchannel data. Subchannel data might be
                required for some PSX copy protection though it *could* create
                problems. Retry with this parameter set if any problems occur
                when trying to use the resulting image.

  --outputdir   Define the folder in which the resulting image should be saved.
                If the folder does not exist, it will be created. If no
                --outputdir parameter is given, the folder ~/psxrip will be
                used.

This tool requires cdrdao (http://cdrdao.sourceforge.net/) to be installed and
available in PATH.
EOSTREAM
}

# go through provided parameters
while [ "${1}" != "" ]; do
	if [ "${1}" = "--drive" ]; then
		DRIVE=$2
		shift 2
	elif [ "${1}" = "--outputdir" ]; then
		PSXDIR=$2
		shift 2
	elif [ "${1}" = "--nosubchan" ]; then
		NOSUBCHAN="true"
		shift 2
	elif [ "${1}" = "--help" ] || [ "${1}" = "-h" ]; then
		print_help
		exit 0
	elif [ "${2}" != "" ] ; then
		echo "ERROR: Inval id usage. Displaying help:"
		echo ""
		print_help
		exit -1
	else
		IMAGENAME=$1
		shift
	fi
done

# check for required dependencies
which cdrdao &> /dev/null ||
	report_absent_tool cdrdao 'http://cdrdao.sourceforge.net/'

# output recognized parameters
echo "Program "$(basename ${0})" called. The following parameters will be used for"
echo "creating an image of a PSX disc:"
echo "Folder for saving images: "$PSXDIR
echo "Drive used for reading the image: "$DRIVE
echo "Resulting filenames: "$PSXDIR"/"$IMAGENAME"[.bin|.cue]"
if [ "$NOSUBCHAN" = "true" ]; then
	echo "Not extracting subchan data."
else
	echo "Extracting subchan data."
fi
echo ""

# check if imagename is defined
if [ "$IMAGENAME" = "" ]; then
	echo "ERROR: Invalid usage. Found no name for resulting image. Displaying help:"
	echo ""
	print_help
	exit -1
fi

# create dir for resulting image if it does not exist yet
if ! [ -d "$PSXDIR" ]; then
	echo "outputdir not found, creating folder: "$PSXDIR
	echo ""
	mkdir -p $PSXDIR
fi

echo "starting ripping the disc"
echo ""
# final commandline for reading the disc and creating the image
if [ "$NOSUBCHAN" = "true" ]; then
	cdrdao read-cd --read-raw --datafile $PSXDIR/$IMAGENAME.bin --device $DRIVE --driver generic-mmc-raw $PSXDIR/$IMAGENAME.toc
else
	cdrdao read-cd --read-raw --read-subchan rw_raw --datafile $PSXDIR/$IMAGENAME.bin --device $DRIVE --driver generic-mmc-raw $PSXDIR/$IMAGENAME.toc
fi
toc2cue $PSXDIR/$IMAGENAME.toc $PSXDIR/$IMAGENAME.cue

Compressing the images

If you want to compress the images you can try to use the program PocketISO via wine. There seems to be no native program doing this task in a nice way.