jitty-scripts/d2-setup.sh

208 lines
4.0 KiB
Bash
Raw Normal View History

#!/bin/bash
2021-09-29 16:28:30 -07:00
2021-10-07 11:06:38 -07:00
# Colors
RED='\033[0;31m'
LRED="\033[1;31m"
BLUE="\033[0;34m"
LBLUE="\033[1;34m"
GREEN="\033[0;32m"
LGREEN="\033[1;32m"
YELLOW="\033[1;33m"
CYAN="\033[0;36m"
LCYAN="\033[1;36m"
PURPLE="\033[0;35m"
LPURPLE="\033[1;35m"
BWHITE="\e[1m"
NC='\033[0m' # No Color
2021-09-29 16:28:30 -07:00
# Wine Prefix Environment
PREFIX="/home/$USER/diablo"
ARCH="win32"
2021-10-07 11:06:38 -07:00
notice(){
echo -e "${YELLOW}NOTICE: Currently you must move & rename the installer directories to the following: ${NC}\n"
echo -e "${LCYAN}Base Game: ${HOME}/D2${NC}"
echo -e "${LCYAN}Expansion: ${HOME}/LOD${NC}"
echo -e "${YELLOW}\nThen run this script with the following option:${NC}"
echo -e "${LCYAN}${0} -a${NC}"
echo -e "${YELLOW}\nThe script will then kick off the process of grabbing debs, setting the prefix and installing the game.${NC}"
echo -e "${YELLOW}User intervention is required to click through the installer setups${NC}"
}
installD2(){
2021-10-07 11:06:38 -07:00
notice
read -n 1 -p "~~~~~~ Press enter to continue ~~~~~~"
D2_INSTALLER_PATH="/home/$USER/D2"
2021-10-07 11:06:38 -07:00
echo -e "\n${LGREEN}Installing Diablo II...${NC}\n"
if [ ! -d "${D2_INSTALLER_PATH}" ];then
echo -e "${D2_INSTALLER_PATH} not found, edit script and set correct path\n"
exit 0;
fi
2021-09-29 16:57:14 -07:00
cd "${D2_INSTALLER_PATH}" || exit 1
WINEPREFIX="${PREFIX}" WINEARCH="${ARCH}" wine Installer.exe
}
installLOD(){
2021-10-07 11:06:38 -07:00
notice
read -n 1 -p "~~~~~~ Press enter to continue ~~~~~~"
LOD_INSTALLER_PATH="/home/$USER/LOD"
echo -e "\nInstalling Diablo II: Lord of Destruction...\n"
if [ ! -d "${LOD_INSTALLER_PATH}" ];then
echo -e "${LOD_INSTALLER_PATH} not found, edit script and set correct path\n"
exit 0;
fi
2021-09-29 16:57:14 -07:00
cd "${LOD_INSTALLER_PATH}" || exit 1
WINEPREFIX="${PREFIX}" WINEARCH="${ARCH}" wine Installer.exe
}
getDeps(){
if [ ! -f /usr/bin/wine ];then
echo -e "\nInstall wine\n"
exit 0;
fi
if [ ! -f /usr/bin/winetricks ];then
echo -e "\n Install winetricks\n"
exit 0;
fi
}
getTricks(){
2021-01-25 15:13:07 -07:00
WINEPREFIX="${PREFIX}" WINEARCH="${ARCH}" winetricks directx9 directplay comctl32ocx
echo -e "\nGetting Glide for D2\n"
}
getGlide(){
if [ ! -f /tmp/gl32ogl14e.zip ];then
2021-09-29 16:57:14 -07:00
cd /tmp || exit 1
wget http://www.svenswrapper.de/gl32ogl14e.zip
unzip gl32ogl14e.zip
echo -e "\nCopying Files to Diablo game directory...\n"
2021-09-29 16:57:14 -07:00
cp -v {glide-init.exe,glide3x.dll} "${PREFIX}/drive_c/Program Files/Diablo II/"
echo -e "\nCleaning up temp files...\n"
rm {glide-readme.txt,glide-liesmich.txt,glide-init.exe,glide3x.dll,gl32ogl14e.zip}
2021-09-29 16:57:14 -07:00
cd "${PREFIX}/drive_c/"Program Files"/"Diablo II"/" || exit 1
WINEPREFIX="${PREFIX}" WINEARCH="${ARCH}" wine glide-init.exe
echo -e "\nDone!\n"
fi
}
runGame(){
2021-10-07 11:06:38 -07:00
cd "${PREFIX}/drive_c/Program Files/Diablo II/" || exit 1
2021-10-07 11:06:38 -07:00
echo -n -e "\n${LGREEN}Run game now?(Y/n): ${NC}"
read -r choice
if [ "${choice}" = "n" ];then
exit 0;
fi
2021-01-25 15:13:07 -07:00
WINEPREFIX="${PREFIX}" WINEARCH="${ARCH}" wine "Diablo II.exe" " -3dfx"
}
2021-01-22 13:40:34 -07:00
run_glide(){
2021-10-07 11:06:38 -07:00
cd "${PREFIX}/drive_c/Program Files/Diablo II/" || exit 1
2021-01-22 13:40:34 -07:00
WINEPREFIX="${PREFIX}" WINEARCH="${ARCH}" wine "glide-init.exe"
}
run_tricks(){
WINEPREFIX="${PREFIX}" WINEARCH="${ARCH}" winetricks "${1}" "${2}"
}
runWinecfg(){
WINEPREFIX="${PREFIX}" WINEARCH="${ARCH}" winecfg
}
case "${1}" in
play|-p)
runGame
;;
getdeps|-gd)
getDeps
;;
gettricks|-gt)
getTricks
;;
getglide| -gg)
getGlide
;;
id2|--install-d2)
installD2
;;
ilod|--install-lod)
installLOD
;;
cfg|-c)
runWinecfg
;;
2021-01-22 13:40:34 -07:00
rg| --run-glide)
run_glide
;;
tricks)
run_tricks "${1}" "${2}"
;;
all|-a)
getDeps
installD2
installLOD
getTricks
2021-01-25 15:13:07 -07:00
getGlide
runGame
;;
*)
echo -e "\nUsage: $0 [-a] [all] [-p] [play] [-gt] [gettricks] [-gd] [getdeps] [getglide] [-gg] [id2] [--install-d2] [ilod] [--install-lod]\n"
;;
2021-01-25 15:13:07 -07:00
esac