aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2020-04-28 03:00:19 -0400
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2020-05-03 08:48:50 +0700
commit7d970586c2bc09735f9214288c86d24ff687df87 (patch)
tree3b2c8817d9fec48ae59e504fb5f88bf9242df779
parent0cb1f29dbb533193ec76e27ed16c4fa63ef990a5 (diff)
games/jfsw_registered_data: Use CD image as source.
Signed-off-by: B. Watson <yalhcru@gmail.com> Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r--games/jfsw_registered_data/README13
-rw-r--r--games/jfsw_registered_data/extract-shadow-warrior.sh71
-rw-r--r--games/jfsw_registered_data/jfsw_registered_data.SlackBuild71
-rw-r--r--games/jfsw_registered_data/jfsw_registered_data.info8
4 files changed, 134 insertions, 29 deletions
diff --git a/games/jfsw_registered_data/README b/games/jfsw_registered_data/README
index 67e0da1b9d43..30a92edcd10c 100644
--- a/games/jfsw_registered_data/README
+++ b/games/jfsw_registered_data/README
@@ -1,7 +1,9 @@
jfsw_registered_data (game data from full version of Shadow Warrior)
-This is the full/registered version of Shadow Warrior, for use with the
-jfsw game engine.
+This is the full/registered version of Shadow Warrior, for use with
+the jfsw game engine. The package includes the resource file (sw.grp)
+and the audio tracks from the original CD, converted to .ogg for use
+with the jfsw engine.
Shadow Warrior is a first-person shooter video game developed by 3D
Realms and published by GT Interactive Software. The shareware version
@@ -14,8 +16,7 @@ full version (jfsw_registered_data). Since the full version includes the
levels from the demo version (as Episode 1), there's no need to install
both on the same system, although this is supported.
-If you get '403 Forbidden' when downloading the source file, either
-use a browser to visit the homepage and click on 'Download Full', or
-else use a custom User-Agent header. Example:
+While the package is being built, up to 1GB of space in /tmp (or $TMP)
+will be used.
-( source jfsw_registered_data.info ; wget --user-agent Firefox $DOWNLOAD )
+See also: games/jfsw_wanton_destruction
diff --git a/games/jfsw_registered_data/extract-shadow-warrior.sh b/games/jfsw_registered_data/extract-shadow-warrior.sh
new file mode 100644
index 000000000000..40d161fe84da
--- /dev/null
+++ b/games/jfsw_registered_data/extract-shadow-warrior.sh
@@ -0,0 +1,71 @@
+#!/bin/sh
+
+# extract-shadow-warrior.sh, by B. Watson (yalhcru@gmail.com).
+
+# Licensed under the WTFPL: Do WTF you want with this. See
+# http://www.wtfpl.net/txt/copying/ for details.
+
+# This file is part of the SlackBuilds.org jfsw_registered_data build,
+# but you're welcome to use it for any other purpose (that's why I made
+# it a standalone script).
+
+# Extracts the game data from bin/cue of Shadow Warrior for DOS, as found
+# in the zip file from https://archive.org/details/ShadowWarriorUSA. The
+# tool that handles bin/cue files is bchunk, but sadly it doesn't properly
+# handle bin/cue where each track is in a separate bin file... so we
+# help it along by chopping up the .cue file.
+
+# We expect a single argument: the name of the .cue file. Output will be
+# a set of .iso and .wav files in the current directory, named track01.iso
+# and track02.wav through track14.wav, plus a set of converted track02.ogg
+# through track14.ogg, if the oggenc command is found on $PATH.
+
+# When we're finished, the files will take up around 900MB of space,
+# so plan accordingly.
+
+# Note: converting the same wav file to ogg with oggenc multiple times,
+# does not give identical ogg files. It *does* however give the same
+# sized file every time (down to the byte). Really only matters if you're
+# debugging this script, I guess.
+
+if [ "$*" = "" ] || [ ! -e "$1" ]; then
+ echo "Usage: $( basename $0 ) cue-file.cue" 1>&2
+ exit 1
+fi
+
+# need this to let "read" read the initial spaces in the .cue file lines
+IFS=""
+
+# save old stdout
+exec 3>&1
+
+# clean up any turds from previous runs
+rm -f tmpcue??.cue
+
+# split up each track entry in the input .cue file into a separate .cue
+# file containing only that track.
+count=1
+cat "$1" | while read line; do
+ case "$line" in
+ FILE*) cue_out="tmpcue$( printf '%02d' $count ).cue"
+ exec > "$cue_out"
+ count="$( expr $count + 1 )"
+ ;;
+ esac
+ echo "$line"
+done
+
+# restore old stdout
+exec 1>&3
+
+# now convert each file to .iso or .wav (bchunk is smart enough
+# to know which is which). if a file is a .wav, we'll convert it
+# to .ogg and delete it, so we don't end up chewing up 1.3GB of
+# disk space all at once.
+for cue_out in tmpcue??.cue; do
+ rm -f track??.wav
+ binfile="$( head -1 "$cue_out" | cut -d\" -f2 )"
+ bchunk -w "$binfile" "$cue_out" track
+ [ -e track??.wav ] && oggenc -q 7 track??.wav && rm -f track??.wav
+ rm -f $cue_out
+done
diff --git a/games/jfsw_registered_data/jfsw_registered_data.SlackBuild b/games/jfsw_registered_data/jfsw_registered_data.SlackBuild
index 756d31d89caf..7dca1ca21075 100644
--- a/games/jfsw_registered_data/jfsw_registered_data.SlackBuild
+++ b/games/jfsw_registered_data/jfsw_registered_data.SlackBuild
@@ -6,14 +6,26 @@
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
-# This game is offered as a free download on both Steam and GoG.
-# It's also been available from www.oldpcgaming.net since 2014.
+# This game is offered as a free download on both Steam and GoG. It also
+# was available from www.oldpcgaming.net from 2014 to late 2019, and
+# has been available on archive.org since late 2018.
+
+# 20200428 bkw: the old .7z from oldpcgaming.net has vanished along
+# with the site. Switched to a CD image from archive.org, in bin/cue
+# format. More work for this script to do, but as a nice bonus, we get
+# the CD audio tracks installed too.
PRGNAM=jfsw_registered_data
VERSION=${VERSION:-1.2}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
+# Depending on what was used to do the download, the %XX hex escapes
+# might get interpreted or not, handle either name.
+SRCNAM="Shadow Warrior (USA)"
+ZIPNAME1="$SRCNAM.zip"
+ZIPNAME2="Shadow%20Warrior%20%28USA%29.zip"
+
ARCH=noarch
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
@@ -28,26 +40,47 @@ cd $TMP
rm -rf $PRGNAM-$VERSION
mkdir -p $PRGNAM-$VERSION
cd $PRGNAM-$VERSION
-7za x $CWD/shadow.7z '*/*.GRP' '*/*.TXT' '*/*.ICO'
-cd shadow
+
+[ -e "$CWD/$ZIPNAME1" ] && ZIPNAME="$ZIPNAME1" || ZIPNAME="$ZIPNAME2"
+unzip "$CWD/$ZIPNAME"
chown -R root:root .
-find -L . \
- \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
- -o -perm 511 \) -exec chmod 755 {} \+ -o \
- \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
- -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \+
+chmod 644 *
-mkdir -p $PKG/usr/share/games/jfsw
-install -m0644 SW.GRP $PKG/usr/share/games/jfsw/sw_registered.grp
+# The "source" file is a bin/cue cdrom image with multiple .bin files.
+# It took some effort to get bchunk to extract this correctly, and I've
+# moved the code into a separate script so that users of other distros
+# can possibly make use of it. In fact it's been tested on MacOSX :)
+sh $CWD/extract-shadow-warrior.sh "$SRCNAM.cue"
+
+# Loop mount the iso to extract the stuff we need from it.
+# N.B. sandbox wrappers like sbrun or slackrepo might complain that
+# /etc/mtab has been modified. We could prevent this by using the
+# --no-mtab option with the mount and umount commands below, but
+# if something makes the script die before it's finished, we would
+# have left behind an invisible mount that could cause confusion and
+# irritation later...
+MNTPNT="$( mktemp -d cdmount.XXXXXX )"
+mount -o loop track01.iso $MNTPNT
-# This stuff's not very relevant to a source port.
-rm -f INSTALL.TXT ORDERFRM.TXT
+cd $MNTPNT/swinst
+ mkdir -p $PKG/usr/share/games/jfsw
+ install -m0644 SW.GRP $PKG/usr/share/games/jfsw/sw_registered.grp
+
+ mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+ for i in CREDITS.TXT license.txt; do
+ sed 's,\r,,' < $i > $PKG/usr/doc/$PRGNAM-$VERSION/$( echo $i | tr A-Z a-z )
+ done
+cd -
+
+cat $MNTPNT/sw.ico > $PKG/usr/doc/$PRGNAM-$VERSION/sw.ico
+umount $MNTPNT
+rmdir $MNTPNT
+
+# Done with the iso, now for the audio tracks (which have already been
+# converted to ogg).
+mkdir -p $PKG/usr/share/games/jfsw
+cp track??.ogg $PKG/usr/share/games/jfsw
-mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
-for i in *.TXT; do
- sed 's,\r,,' < $i > $PKG/usr/doc/$PRGNAM-$VERSION/$( echo $i | tr A-Z a-z )
-done
-cat SW.ICO > $PKG/usr/doc/$PRGNAM-$VERSION/sw.ico
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
diff --git a/games/jfsw_registered_data/jfsw_registered_data.info b/games/jfsw_registered_data/jfsw_registered_data.info
index a5153d153a8e..ede16fa8e55e 100644
--- a/games/jfsw_registered_data/jfsw_registered_data.info
+++ b/games/jfsw_registered_data/jfsw_registered_data.info
@@ -1,10 +1,10 @@
PRGNAM="jfsw_registered_data"
VERSION="1.2"
-HOMEPAGE="http://www.oldpcgaming.net/shadow-warrior-review/"
-DOWNLOAD="http://www.oldpcgaming.net/demo/shadow.7z"
-MD5SUM="b1dff182c5760710c2e31e9f4e728eb1"
+HOMEPAGE="https://archive.org/details/ShadowWarriorUSA"
+DOWNLOAD="https://archive.org/download/ShadowWarriorUSA/Shadow%20Warrior%20%28USA%29.zip"
+MD5SUM="b301a2f6929cdd7642b308b13d4bc69c"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
-REQUIRES="jfsw p7zip"
+REQUIRES="jfsw bchunk"
MAINTAINER="B. Watson"
EMAIL="yalhcru@gmail.com"