-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpsone_rip.sh
66 lines (52 loc) · 2.05 KB
/
psone_rip.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
## Dump a Playstation 1 disc into .bin, .cue, and .iso files with linux
#
## Requires cdrdao, bchunk & mame-tools packages
#
## You can use something like https://github.com/m35/jpsxdec with jar to
## inspect media on the disc afterwards, and dump it to a file. After that,
## run "binwalk *" on the files and work from there.
export DIR=$HOME/Documents/psx
if [ "$1" == "--help" ]; then
echo "Preserve your Playstation 1 disks!
Usage:
$(basename ${0}) [{--no-subchannel] [{--help}] [filename]
The [filename] is mandatory.
Available parameters:
--help Displays the info here (helps)
--no-subchannel Don't extract any subchannel data. Subchannel data is used for copy protection
on certain games. This looks for it to work correctly, but it may fail if there is none
present, so you can retry and pass this param if you run into any initial issues against a disc.
NOTE: Please check some of the variables in the script/feel free to change them according to your needs.
ANOTHER NOTE: This script requires the following packages:
- cdrdao
- bchunk"
exit 0
fi
if [ $1 -z -o $2 -n ]; then
echo "\nERROR: Invalid usage.\n"
echo "\n USAGE: ./psone_rip.sh [filename]\n"
echo "\n where filename is the desired name (without extensions).\n"
fi
while [ "${1}" != "" ]; do
if [[ ! -e $DIR ]]; then
mkdir $DIR
elif [ "${1}" = "--no-subchannel" ]; then
NOSUBCHAN="true"
shift 2
else
FILE=$1
shift
fi
done
# Ripping:
cd /usr/bin
if [ "$NOSUBCHAN" = "true" ]; then
./cdrdao read-cd --read-raw --datafile $DIR/$FILE.bin --device /dev/sr0 --driver generic-mmc-raw $DIR/$FILE.toc # without subchannel data
else
./cdrdao read-cd --read-raw --read-subchan rw_raw --datafile $DIR/$FILE.bin --device /dev/sr0 --driver generic-mmc-raw $DIR/$FILE.toc # with subchannel data
fi
toc2cue $DIR/$FILE.toc $DIR/$FILE.cue
bchunk -s -w $DIR/$FILE.bin $DIR/$FILE.cue $DIR/$FILE
# Create a CHD lossy image as well
for i in $DIR/*.cue; do chdman createcd -i "$i" -o "${i%.*}.chd"; done