Ticket #13248: extract-loom-pce.sh

File extract-loom-pce.sh, 1.6 KB (added by eriktorbjorn, 3 years ago)
Line 
1#! /bin/sh -e
2
3# This is a proof-of-concept script. I'm at best a bumbling amateur
4# when it comes to shell scripting. # Use this script from an empty
5# directory. Required packages (Debian):
6#
7# - cdrdao
8# - bchunk
9# - flac
10
11destination=./loom-pce
12
13# Rip the CD to hard disk. The cdrdao command has a bewildering number
14# of options, but apparently none for extracting single tracks. Oh
15# well, most of the tracks are interesting in some way. These options
16# worked for me. If all else fails, try a graphical front end.
17#
18# This step is time-consuming, so only do it if there isn't already an
19# extracted loom.bin file there. It may be possible to generate a CUE
20# file instead of a TOC file here, but I didn't manage to.
21
22if [ ! -e loom.bin ] ; then
23 cdrdao read-cd --read-raw --datafile loom.bin loom.toc
24fi
25
26# If there isn't a CUE file, convert the TOC file into something other
27# programs can work with.
28
29if [ ! -e loom.cue ] ; then
30 toc2cue loom.toc loom.cue
31fi
32
33# Split the BIN/CUE files into individual tracks.
34
35bchunk -w -s loom.bin loom.cue track
36
37# Create an new directory for the final game
38
39mkdir -p $destination
40
41# Compress the audio tracks. Note that there is a gap in the numbering
42# because of the data track.
43
44flac -8 *.wav
45
46mv track01.flac $destination
47
48previous=02
49
50for tracknr in `seq -w 3 22` ; do
51 mv track$tracknr.flac $destination/track$previous.flac
52 previous=$tracknr
53done
54
55# Finally, use scummvm-tools-cli to extract the oh-so-juicy data files.
56
57scummvm-tools-cli --tool extract_loom_tg16 -o $destination track02.iso
58
59# Cleanup
60
61rm -f loom.toc track02.iso track23.iso track??.wav