-
Notifications
You must be signed in to change notification settings - Fork 2
/
build_mpq.sh
executable file
·43 lines (31 loc) · 933 Bytes
/
build_mpq.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
#!/usr/bin/env bash
SCRIPTDIR="$(readlink -f $0)"
SCRIPTDIR="$(dirname "${SCRIPTDIR}")"
PSXDIR=$SCRIPTDIR/ps1_assets
DSTREAM=$SCRIPTDIR/dstream.bin
DBANK=$SCRIPTDIR/dbank.bin
VAG2WAV=$SCRIPTDIR/vag2wav.bin
TEMPDIR=$(mktemp -d)
#trap "rm -rf $TEMPDIR" EXIT
cd $TEMPDIR
for DIR in $PSXDIR/*.dir; do
TMP=$(basename $DIR)
mkdir -p $TMP
(cd $TMP; $DSTREAM $DIR ${DIR::-4}.bin > /dev/null)
for VAG in $TMP/*.VAG; do
$VAG2WAV $VAG ${VAG::-4}.WAV > /dev/null
done
# for BOF in $TEMPDIR/$TMP/*.BOF; do
# (cd $TMP; $DBANK $BOF ${BOF::-4}.BNK > /dev/null)
# done
done
for STREAM in stream*; do
mkdir -p $STREAM/mpq
while read -r SRC DST; do
mkdir -p $(dirname $STREAM/mpq/$DST)
cp $STREAM/$SRC $STREAM/mpq/$DST
done < $SCRIPTDIR/${STREAM::-4}.map
MPQ=$SCRIPTDIR/${STREAM::-4}.mpq
smpq -M 1 -C none -c $MPQ
(cd $STREAM/mpq; find * -type f -exec smpq -a -C none $MPQ "{}" \;)
done