Skip to content

Instantly share code, notes, and snippets.

@jasenmichael
Last active March 4, 2023 11:07
Show Gist options
  • Save jasenmichael/0b2d8a7a6b33fb43ba9c6fa21ff97e71 to your computer and use it in GitHub Desktop.
Save jasenmichael/0b2d8a7a6b33fb43ba9c6fa21ff97e71 to your computer and use it in GitHub Desktop.
how to rip/backup playstation (psx) games to iso for use with retropie emulationstation retroarch pcsx and other emulators

how to rip/backup playstation (psx) games to iso for use with retropie emulationstation retroarch pcsx and other emulators

I had recently been setting up retropie on one of my raspberrypi3's. I found all the psx .iso's I had made years ago ran perfect on the pi3 with retropie. It had been years since I backed up some of my old playstation games, and recently found some more lying around, I decided to add them to my retropie. After searching the internet, I rememberd I used achohol in windoze xp years ago, but now strickly a linux user.

At the time of this writing I am running UbuntuGnome 16.10 on my desktop so I found this method using cdrdao, bchunk, and a bash script

add main universe repo, edit /etc/apt/sources.list and add this line save and exit: deb http://us.archive.ubuntu.com/ubuntu yakkety main universe

update repositories sudo apt-get update

install cdrdao sudo apt-get install cdrdao

install bchunk sudo apt-get install bchunk

get the script from here, or below wget https://gist.githubusercontent.com/jasenmichael/0b2d8a7a6b33fb43ba9c6fa21ff97e71/raw/8c6c160cb2ce2d7ff583ec80c5c8d74221985201/psx2iso.sh

make it exacutable chmod +x psx2iso.sh

you are all set, now put the playstation cd in drive , then unmount it with sudo umount /dev/sr0

and rip it with: ./psx2iso NAME_OF_GAME

#!/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=~/psx/roms
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
echo "ripping the disc complete,.. I think"
echo "starting convert to iso"
bchunk $PSXDIR/$IMAGENAME.bin $PSXDIR/$IMAGENAME.cue $PSXDIR/$IMAGENAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment