50 lines
1.5 KiB
Bash
Executable File
50 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
# Rebuild custom UI files using patches
|
|
# -u, --update to update the patch set with new changes
|
|
|
|
GAME_PATH=/mnt/d/EverQuest
|
|
UI_NAME=isuldor
|
|
|
|
if [[ ! -d "${GAME_PATH}/uifiles/default" ]]
|
|
then
|
|
echo "Notice: Game path not set, searching for EverQuest..."
|
|
GAME_LOCATION=$(find /mnt -type f -name eqgame.exe ! -path '*RECYCLE.BIN*' 2>/dev/null | head -n1)
|
|
if [[ ${GAME_LOCATION} ]]
|
|
then
|
|
GAME_PATH=$(dirname ${GAME_LOCATION})
|
|
echo "Setting GAME_PATH=${GAME_PATH}"
|
|
else
|
|
echo "Error: EverQuest was not found!"
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
SCRIPT_PATH=$(dirname ${0})
|
|
UI_FOLDER="${GAME_PATH}/uifiles/${UI_NAME}"
|
|
|
|
# We can update our patch set with changes
|
|
if [[ "-u" == ${1} || "--update" == ${1} ]]
|
|
then
|
|
echo "Updating patch set!"
|
|
# rm -v "${SCRIPT_PATH}/EQUI_*.diff"
|
|
UI_FILES=( $( find "${UI_FOLDER}" -name '*.xml' -exec basename {} .xml \; ))
|
|
for UI_FILE in "${UI_FILES[@]}"
|
|
do
|
|
diff -u "${GAME_PATH}/uifiles/default/${UI_FILE}.xml" \
|
|
"${UI_FOLDER}/${UI_FILE}.xml" > ${SCRIPT_PATH}/${UI_FILE}.diff
|
|
done
|
|
exit 0
|
|
fi
|
|
|
|
# Build custom UI directory
|
|
mkdir -vp "${UI_FOLDER}"
|
|
cp ${SCRIPT_PATH}/*.tga "${UI_FOLDER}/"
|
|
|
|
# Build an array of all diffs to patch, stripping the extension
|
|
UI_FILES=( $( find "${SCRIPT_PATH}" -name '*.diff' -exec basename {} .diff \; ))
|
|
|
|
for UI_FILE in "${UI_FILES[@]}"
|
|
do
|
|
patch -o "${UI_FOLDER}/${UI_FILE}.xml" "${GAME_PATH}/uifiles/default/${UI_FILE}.xml" < ${SCRIPT_PATH}/${UI_FILE}.diff
|
|
done
|