Skip to content

Instantly share code, notes, and snippets.

@reckenrode
Last active December 5, 2021 23:34
Show Gist options
  • Save reckenrode/20dd7523309bfaa981fea9b6ec3aa687 to your computer and use it in GitHub Desktop.
Save reckenrode/20dd7523309bfaa981fea9b6ec3aa687 to your computer and use it in GitHub Desktop.
Copies the Bink-encoded movies from the FF XIV Mac client into a CrossOver bottle
#!/bin/dash
# Copyright © 2021 Randy Eckenrode
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
set -eu
FFXIV_BOTTLE=${1:-$HOME/Library/Application Support/CrossOver/Bottles/Final Fantasy XIV}
FFXIV_MOVIE_PATH="drive_c/Program Files (x86)/SquareEnix/FINAL FANTASY XIV - A Realm Reborn/game/movie/ffxiv"
FFXIV_CLIENT_MOVIES="FINAL FANTASY XIV ONLINE.app/Contents/SharedSupport/finalfantasyxiv/support/published_Final_Fantasy/$FFXIV_MOVIE_PATH"
FFXIV_BOTTLE_MOVIES=$FFXIV_BOTTLE/$FFXIV_MOVIE_PATH
MOVIES="00000.bk2 00001.bk2 00002.bk2 00003.bk2"
version=1.0.5
download_client() {
echo "Downloading the official Mac client" > /dev/tty
curl -L https://mac-dl.ffxiv.com/cw/finalfantasyxiv-${version}.zip \
-o $zipdir/finalfantasyxiv-$version.zip > /dev/tty
echo "Extracting the movies from the Mac client" > /dev/tty
for movie in $MOVIES; do
unzip $zipdir/finalfantasyxiv-$version.zip "$FFXIV_CLIENT_MOVIES/$movie" \
-d $zipdir | grep bk2 > /dev/tty
done
}
copy_movies() {
zipdir=$1
echo "Copying the movies into the bottle" > /dev/tty
mkdir -p "$FFXIV_BOTTLE_MOVIES"
for movie in $MOVIES; do
cp -v "$zipdir/$FFXIV_CLIENT_MOVIES/$movie" "$FFXIV_BOTTLE_MOVIES"
done
}
echo "This script will download the official Mac client of FF XIV and copy the movies"
echo "from it to the CrossOver bottle indicated below, fixing certain broken cutscenes."
echo "Bottle path: $FFXIV_BOTTLE"
if [ ! -x "$FFXIV_BOTTLE" ]; then
echo "FF XIV bottle not found. Either create a bottle at the above path or specify"
echo "an alternate location on the command-line: ffxiv-movies <bottle path>."
exit 1
fi
zipdir=$(mktemp -d)
for signal in EXIT INT QUIT TERM; do
trap \
"printf 'Cleaning up temporary files ...' > /dev/tty && rm -rf $zipdir && echo ' done'" \
$signal
done
download_client $zipdir
copy_movies $zipdir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment