Created
February 4, 2023 02:18
-
-
Save T00fy/efe2dd0b7442f17cc0e65a0956ffa16e to your computer and use it in GitHub Desktop.
Adapted from a powershell script to install FFXIV patches with XIVLauncher
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#------------------------------------------------------------------ | |
# FINAL FANTASY XIV - A Realm Reborn Makeshift Patcher | |
# Applies locally stored patches to the game. Requires you to | |
# install the base game from a physical disk. | |
#------------------------------------------------------------------ | |
# --- Configuration ------------------------------------------------- | |
# Directory containing the XIVLauncher.PatchInstaller.exe | |
xivLauncherPatcherExecutable="/home/youruser/Games/ffxiv-launcher/drive_c/users/youruser/AppData/Local/XIVLauncher/app-6.3.1/XIVLauncher.PatchInstaller.exe" | |
# Root directory of the FINAL FANTASY XIV - A Realm Reborn in wine | |
gameDirectory="/home/youruser/Games/ffxiv/drive_c/Program\ Files\ \(x86\)/SquareEnix/FINAL\ FANTASY\ XIV\ -\ A\ Realm\ Reborn" | |
# Directory containing the subdirectories for all the patches | |
patchDirectory="/home/youruser/Games/ffxiv-launcher/drive_c/users/youruser/AppData/Roaming/XIVLauncher/patches" | |
# Final patch date to install | |
# Notes: | |
patchUpTo="2016.07.05" | |
#This needs to point to a 32 bit wine prefix for the patcher to work properly. | |
winePrefix="/home/youruser/.local/share/wineprefixes/wine_32" | |
# check if winepath is installed | |
if ! [ -x "$(command -v winepath)" ]; then | |
echo "Error: winepath is not installed. Please install winepath and try again." >&2 | |
exit 1 | |
fi | |
#------------------------------------------------------------------- | |
# Processing | |
#------------------------------------------------------------------- | |
gameDirectoryBoot="$gameDirectory/boot" | |
gameDirectoryGame="$gameDirectory/game" | |
for patch in $(find "$patchDirectory" -name "D*" -type f | sort -n); do | |
patchDate=$(echo $patch | grep -oP '(?<=D)[0-9]{4}\.[0-9]{2}\.[0-9]{2}') | |
patchExpan=$(echo $patch | awk -F'/' '{print $(NF-2)}') | |
patchVer=$(echo $patch | grep -oP '[0-9]{4}\.[0-9]{2}\.[0-9]{2}\.[0-9]{4}\.[0-9]{4}') | |
#--------------------------------------------------------------- | |
# Current patch in file list too new? | |
#--------------------------------------------------------------- | |
if [[ $patchDate > $patchUpTo ]]; then | |
continue | |
fi | |
#--------------------------------------------------------------- | |
# Check current game/ex patch level and skip if possible | |
#--------------------------------------------------------------- | |
versionFile="$gameDirectoryGame/ffxivgame.ver" | |
targetGameDir="$gameDirectoryGame" | |
clientVersion="0" | |
if [[ $patchExpan = "boot" ]]; then | |
versionFile="$gameDirectoryBoot/ffxivboot.ver" | |
targetGameDir="$gameDirectoryBoot" | |
fi | |
if [[ $patchExpan = "ex1" ]]; then | |
versionFile="$gameDirectoryGame/sqpack/ex1/ex1.ver" | |
targetGameDir="$gameDirectoryGame/ex1" | |
fi | |
if [[ -e "${versionFile//\\/}" ]]; then | |
clientVersion=$(cat "${versionFile//\\/}") | |
fi | |
if [[ "$clientVersion" == "$patchVer" ]] || [[ "$clientVersion" > "$patchVer" ]]; then | |
echo "Current version [${clientVersion}] was greater than or equal to [${patchVer}], skipping" | |
continue | |
fi | |
test=$(echo "$targetGameDir" | tr -d '\\') | |
# replace spaces with a placeholder | |
temp_path=$(echo $test | sed 's/ /_SPACE_/g') | |
win_path=$(winepath -w "$temp_path") | |
# replace the placeholder with spaces | |
new_path=$(echo $win_path | sed 's/_SPACE_/ /g') | |
echo "Installing patch $patch to $new_path" | |
WINEPREFIX="$winePrefix" wine "$xivLauncherPatcherExecutable" "install" "$(winepath -w $patch)" "$new_path" | |
versionFile2="${versionFile//\\/}" | |
echo "$patchVer" >"$versionFile2" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment