#!/usr/bin/env bash if [[ "$LD_PRELOAD" =~ "gameoverlayrenderer" ]] then LD_PRELOAD="" fi [[ $0 == $BASH_SOURCE ]] && cd "$( dirname "$0")" scriptDir="$(cd "$( dirname "$BASH_SOURCE")" && pwd)" [ $# -gt 0 ] && parameterone="$1" [ $# -gt 1 ] && parametertwo="$2" [ $# -gt 2 ] && parameterthree="$3" [ $# -gt 3 ] && parameterfour="$4" if [[ "$OSTYPE" == "linux-gnu"* ]] then if [ `ps -o sid= -p "$$" | xargs ps -o ppid= -p | xargs ps -o comm= -p` = "konsole" ] then cd eXo/util source "$scriptDir/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")" exit 0 elif [ `ps -o sid= -p "$$" | xargs ps -o ppid= -p | xargs ps -o comm= -p` = "gnome-terminal-" ] then cd eXo/util source "$scriptDir/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")" exit 0 elif [ `ps -o sid= -p "$$" | xargs ps -o ppid= -p | xargs ps -o comm= -p` = "xfce4-terminal" ] then cd eXo/util source "$scriptDir/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")" exit 0 elif [ `ps -o sid= -p "$$" | xargs ps -o ppid= -p | xargs ps -o comm= -p` = "kgx" ] then cd eXo/util source "$scriptDir/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")" exit 0 elif [ `ps -o sid= -p "$$" | xargs ps -o ppid= -p | xargs ps -o comm= -p` = "xterm" ] then cd eXo/util source "$scriptDir/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")" exit 0 elif [ `ps -o sid= -p "$$" | xargs ps -o ppid= -p | xargs ps -o comm= -p` = "Eterm" ] then cd eXo/util source "$scriptDir/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")" exit 0 elif [ `ps -o sid= -p "$$" | xargs ps -o ppid= -p | xargs ps -o comm= -p` = "x-terminal-emul" ] then cd eXo/util source "$scriptDir/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")" exit 0 elif [ `ps -o sid= -p "$$" | xargs ps -o ppid= -p | xargs ps -o comm= -p` = "mate-terminal" ] then cd eXo/util source "$scriptDir/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")" exit 0 elif [ `ps -o sid= -p "$$" | xargs ps -o ppid= -p | xargs ps -o comm= -p` = "terminator" ] then cd eXo/util source "$scriptDir/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")" exit 0 elif [ `ps -o sid= -p "$$" | xargs ps -o ppid= -p | xargs ps -o comm= -p` = "urxvt" ] then cd eXo/util source "$scriptDir/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")" exit 0 elif [ `ps -o sid= -p "$$" | xargs ps -o ppid= -p | xargs ps -o comm= -p` = "rxvt" ] then cd eXo/util source "$scriptDir/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")" exit 0 elif [ `ps -o sid= -p "$$" | xargs ps -o ppid= -p | xargs ps -o comm= -p` = "termit" ] then cd eXo/util source "$scriptDir/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")" exit 0 elif [ `ps -o sid= -p "$$" | xargs ps -o ppid= -p | xargs ps -o comm= -p` = "terminology" ] then cd eXo/util source "$scriptDir/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")" exit 0 elif [ `ps -o sid= -p "$$" | xargs ps -o ppid= -p | xargs ps -o comm= -p` = "tilix" ] then cd eXo/util source "$scriptDir/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")" exit 0 elif [ `ps -o sid= -p "$$" | xargs ps -o ppid= -p | xargs ps -o comm= -p` = "kitty" ] then cd eXo/util source "$scriptDir/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")" exit 0 elif [ `ps -o sid= -p "$$" | xargs ps -o ppid= -p | xargs ps -o comm= -p` = "aterm" ] then cd eXo/util source "$scriptDir/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")" exit 0 elif [ `which konsole` ] then konsole -e /usr/bin/env bash "$PWD/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")" "$@" & exit 0 elif [ `which gnome-terminal` ] then gnome-terminal -- /usr/bin/env bash "$PWD/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")" "$@" & exit 0 elif [ `which xfce4-terminal` ] then xfce4-terminal -x /usr/bin/env bash "$PWD/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")" "$@" & exit 0 elif [ `which kgx` ] then kgx -e "/usr/bin/env bash \"$PWD/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")\" $@" & exit 0 elif [ `which xterm` ] then xterm -e /usr/bin/env bash "$PWD/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")" "$@" & exit 0 elif [ `which uxterm` ] then uxterm -e /usr/bin/env bash "$PWD/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")" "$@" & exit 0 elif [ `which eterm` ] then Eterm -e /usr/bin/env bash "$PWD/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")" "$@" & exit 0 elif [ `which x-terminal-emulator` ] then x-terminal-emulator -e /usr/bin/env bash "$PWD/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")" "$@" & exit 0 elif [ `which mate-terminal` ] then eval mate-terminal -e \"/usr/bin/env bash \\\"$PWD/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")\\\" $@\" "$@" & exit 0 elif [ `which terminator` ] then terminator -x /usr/bin/env bash "$PWD/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")" "$@" & exit 0 elif [ `which urxvt` ] then urxvt -e /usr/bin/env bash "$PWD/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")" "$@" & exit 0 elif [ `which rxvt` ] then rxvt -e /usr/bin/env bash "$PWD/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")" "$@" & exit 0 elif [ `which termit` ] then termit -e /usr/bin/env bash "$PWD/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")" "$@" & exit 0 elif [ `which lxterm` ] then lxterm -e /usr/bin/env bash "$PWD/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")" "$@" & exit 0 elif [ `which terminology` ] then terminology -e "/usr/bin/env bash \"$PWD/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")\" $@" & exit 0 elif [ `which tilix` ] then tilix -e /usr/bin/env bash "$PWD/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")" "$@" & exit 0 elif [ `which kitty` ] then kitty -e /usr/bin/env bash "$PWD/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")" "$@" & exit 0 elif [ `which aterm` ] then aterm -e /usr/bin/env bash "$PWD/eXo/util/$(basename -- "${BASH_SOURCE%.command}.bsh")" "$@" & exit 0 else exit ERRCODE "Weird system achievement unlocked: None of the 18 supported terminal emulators are installed." fi exit 0 fi if [ "${BASH_VERSINFO:-0}" -lt 5 ] then printf "\n\e[1;31;47mThe version of bash currently running is too old.\e[0m\n\n" printf "Please run the \e[1;33;40minstall_dependencies.command\e[0m script.\n" printf "Then, follow the instructions to install the required dependencies.\n" read -s -n 1 -p "Press any key to abort." printf "\n\n" exit 0 fi function goto { shortcutName=$1 newPosition=$(gsed -n -e "/: $shortcutName$/{:a;n;p;ba};" "$scriptDir/$(basename -- "$BASH_SOURCE")" ) eval "$newPosition" exit } alias :="goto" function dynchoice { local choices="$1" local textpmt="$2" local numofchoices="${#choices}" local choicesu="${choices^^}" local choicesl="${choices,,}" if [ "$numofchoices" -eq 10 ] then while true do read -p "$textpmt " choice case $choice in [${choicesu:0:1}${choicesl:0:1}]* ) errorlevel=1 break;; [${choicesu:1:1}${choicesl:1:1}]* ) errorlevel=2 break;; [${choicesu:2:1}${choicesl:2:1}]* ) errorlevel=3 break;; [${choicesu:3:1}${choicesl:3:1}]* ) errorlevel=4 break;; [${choicesu:4:1}${choicesl:4:1}]* ) errorlevel=5 break;; [${choicesu:5:1}${choicesl:5:1}]* ) errorlevel=6 break;; [${choicesu:6:1}${choicesl:6:1}]* ) errorlevel=7 break;; [${choicesu:7:1}${choicesl:7:1}]* ) errorlevel=8 break;; [${choicesu:8:1}${choicesl:8:1}]* ) errorlevel=9 break;; [${choicesu:9:1}${choicesl:9:1}]* ) errorlevel=10 break;; * ) printf "Invalid input.\n";; esac done elif [ "$numofchoices" -eq 9 ] then while true do read -p "$textpmt " choice case $choice in [${choicesu:0:1}${choicesl:0:1}]* ) errorlevel=1 break;; [${choicesu:1:1}${choicesl:1:1}]* ) errorlevel=2 break;; [${choicesu:2:1}${choicesl:2:1}]* ) errorlevel=3 break;; [${choicesu:3:1}${choicesl:3:1}]* ) errorlevel=4 break;; [${choicesu:4:1}${choicesl:4:1}]* ) errorlevel=5 break;; [${choicesu:5:1}${choicesl:5:1}]* ) errorlevel=6 break;; [${choicesu:6:1}${choicesl:6:1}]* ) errorlevel=7 break;; [${choicesu:7:1}${choicesl:7:1}]* ) errorlevel=8 break;; [${choicesu:8:1}${choicesl:8:1}]* ) errorlevel=9 break;; * ) printf "Invalid input.\n";; esac done elif [ "$numofchoices" -eq 8 ] then while true do read -p "$textpmt " choice case $choice in [${choicesu:0:1}${choicesl:0:1}]* ) errorlevel=1 break;; [${choicesu:1:1}${choicesl:1:1}]* ) errorlevel=2 break;; [${choicesu:2:1}${choicesl:2:1}]* ) errorlevel=3 break;; [${choicesu:3:1}${choicesl:3:1}]* ) errorlevel=4 break;; [${choicesu:4:1}${choicesl:4:1}]* ) errorlevel=5 break;; [${choicesu:5:1}${choicesl:5:1}]* ) errorlevel=6 break;; [${choicesu:6:1}${choicesl:6:1}]* ) errorlevel=7 break;; [${choicesu:7:1}${choicesl:7:1}]* ) errorlevel=8 break;; * ) printf "Invalid input.\n";; esac done elif [ "$numofchoices" -eq 7 ] then while true do read -p "$textpmt " choice case $choice in [${choicesu:0:1}${choicesl:0:1}]* ) errorlevel=1 break;; [${choicesu:1:1}${choicesl:1:1}]* ) errorlevel=2 break;; [${choicesu:2:1}${choicesl:2:1}]* ) errorlevel=3 break;; [${choicesu:3:1}${choicesl:3:1}]* ) errorlevel=4 break;; [${choicesu:4:1}${choicesl:4:1}]* ) errorlevel=5 break;; [${choicesu:5:1}${choicesl:5:1}]* ) errorlevel=6 break;; [${choicesu:6:1}${choicesl:6:1}]* ) errorlevel=7 break;; * ) printf "Invalid input.\n";; esac done elif [ "$numofchoices" -eq 6 ] then while true do read -p "$textpmt " choice case $choice in [${choicesu:0:1}${choicesl:0:1}]* ) errorlevel=1 break;; [${choicesu:1:1}${choicesl:1:1}]* ) errorlevel=2 break;; [${choicesu:2:1}${choicesl:2:1}]* ) errorlevel=3 break;; [${choicesu:3:1}${choicesl:3:1}]* ) errorlevel=4 break;; [${choicesu:4:1}${choicesl:4:1}]* ) errorlevel=5 break;; [${choicesu:5:1}${choicesl:5:1}]* ) errorlevel=6 break;; * ) printf "Invalid input.\n";; esac done elif [ "$numofchoices" -eq 5 ] then while true do read -p "$textpmt " choice case $choice in [${choicesu:0:1}${choicesl:0:1}]* ) errorlevel=1 break;; [${choicesu:1:1}${choicesl:1:1}]* ) errorlevel=2 break;; [${choicesu:2:1}${choicesl:2:1}]* ) errorlevel=3 break;; [${choicesu:3:1}${choicesl:3:1}]* ) errorlevel=4 break;; [${choicesu:4:1}${choicesl:4:1}]* ) errorlevel=5 break;; * ) printf "Invalid input.\n";; esac done elif [ "$numofchoices" -eq 4 ] then while true do read -p "$textpmt " choice case $choice in [${choicesu:0:1}${choicesl:0:1}]* ) errorlevel=1 break;; [${choicesu:1:1}${choicesl:1:1}]* ) errorlevel=2 break;; [${choicesu:2:1}${choicesl:2:1}]* ) errorlevel=3 break;; [${choicesu:3:1}${choicesl:3:1}]* ) errorlevel=4 break;; * ) printf "Invalid input.\n";; esac done elif [ "$numofchoices" -eq 3 ] then while true do read -p "$textpmt " choice case $choice in [${choicesu:0:1}${choicesl:0:1}]* ) errorlevel=1 break;; [${choicesu:1:1}${choicesl:1:1}]* ) errorlevel=2 break;; [${choicesu:2:1}${choicesl:2:1}]* ) errorlevel=3 break;; * ) printf "Invalid input.\n";; esac done elif [ "$numofchoices" -eq 2 ] then while true do read -p "$textpmt " choice case $choice in [${choicesu:0:1}${choicesl:0:1}]* ) errorlevel=1 break;; [${choicesu:1:1}${choicesl:1:1}]* ) errorlevel=2 break;; * ) printf "Invalid input.\n";; esac done else printf "\n\e[1;31;47mError in dynamic case statement\041\041\041\e[0m" printf "\n\e[1;31;47mPlease report this to the team.\e[0m\n\n" read -s -n 1 -p "Press any key to abort." printf "\n\n" exit 0 fi return } missingDependencies=no ! [[ `which brew` ]] && missingDependencies=yes ! [[ `which aria2c` ]] && missingDependencies=yes ! [[ `spctl --status | grep disabled` ]] && missingDependencies=yes ! [[ `which curl` ]] && missingDependencies=yes ! [[ `which python3` ]] && missingDependencies=yes ! [[ `which sed` ]] && missingDependencies=yes ! [[ `which unzip` ]] && missingDependencies=yes ! [[ `which wget` ]] && missingDependencies=yes if [ $missingDependencies == "yes" ] then printf "\n\e[1;31;47mOne or more dependencies are missing.\e[0m\n\n" printf "Please run the \e[1;33;40minstall_dependencies.command\e[0m script.\n" printf "Then, follow the instructions to install the required dependencies.\n" read -s -n 1 -p "Press any key to abort." printf "\n\n" exit 0 fi cnt=0 multi=false for f in ./Content/\!*.zip do name2="${f}" done for a in ./Content/\!*.zip do cnt="$(( $cnt + 1 ))" done clear name="${name2:11:-12}" [ "${cnt}" -gt 1 ] && multi=true var="${PWD}" merge=false exist=false freespace="$(df -P -B 1 . | awk 'NR==2 {print $4}')" clear [ ! -e LaunchBox.exe ] && goto a1 && [[ $0 != $BASH_SOURCE ]] && return exist=true cd eXo/util [ ! -e util.zip ] && unzip -o \*.zip CHOICE.EXE unzip -o util.zip CHOICE.EXE cd .. cd .. clear echo "" echo "An eXo project or previous LaunchBox install has previously been setup in this folder." echo "" [ "${multi}" == true ] && echo "More than one eXo pack has been detected in this folder." [ "${multi}" == true ] && echo "This installer does not support merging. Please follow the manual merge instructions or use the eXoDOS v6 Setup file" [ "${multi}" == true ] && echo "You should exit now if you are trying to merge." [ "${multi}" == true ] && echo "" [ "${multi}" == false ] && echo "Continuing will reinstall the pack." [ "${multi}" == false ] && echo "" while true do read -p "[C]ontinue or [E]xit " choice case $choice in [Cc]* ) errorlevel=1 break;; [Ee]* ) errorlevel=2 break;; * ) printf "Invalid input.\n";; esac done [ $errorlevel == '2' ] && goto end && [[ $0 != $BASH_SOURCE ]] && return [ $errorlevel == '1' ] && goto a1 && [[ $0 != $BASH_SOURCE ]] && return : a1 cd eXo/util [ ! -e util.zip ] && unzip -o \*.zip CHOICE.EXE [ ! -e CHOICE.EXE ] && unzip -o util.zip CHOICE.EXE cd .. cd .. clear echo "" [ "${multi}" == false ] && echo " -=[WELCOME to eXo${name}]=-" [ "${multi}" == true ] && echo " -=[WELCOME to eXoMerge]=-" echo "" [ "${multi}" == true ] && echo "This setup will install all eXo projects whose files are in this folder. The following packs have been" [ "${multi}" == true ] && echo "detected:" if [ "${multi}" == true ] then for f in ./Content/\!*.zip do pack2="$( tr -d "\!" <<<"${f}" )" pack="${pack2:10:-12}" echo "eXo${pack}" done fi [ "${multi}" == true ] && echo "" [ "${multi}" == true ] && echo "If you do not see a pack listed that you wish to merge, please ensure it has been copied to this folder." [ "${multi}" == false ] && echo "This setup will install eXo${name}." [ "${multi}" == false ] && echo "" [ "${multi}" == false ] && echo "However, if you wish to merge\\combine, you should follow the manual merge instructions or run the" [ "${multi}" == false ] && echo "eXoDOS v6 Setup file." echo "" while true do read -p "[C]ontinue, [E]xit, or [M]erge Instructions " choice case $choice in [Cc]* ) errorlevel=1 break;; [Ee]* ) errorlevel=2 break;; [Mm]* ) errorlevel=3 break;; * ) printf "Invalid input.\n";; esac done [ $errorlevel == '3' ] && goto mergei && [[ $0 != $BASH_SOURCE ]] && return [ $errorlevel == '2' ] && goto end && [[ $0 != $BASH_SOURCE ]] && return [ $errorlevel == '1' ] && goto checks && [[ $0 != $BASH_SOURCE ]] && return : mergei clear echo "" echo " To merge eXo packs together, you will need to copy the files of all packs you wish to merge into the same folder." echo "Specifically, you need to copy the following files and subfolders:" echo " .\\Content\\ <-FOLDER " echo " .\\eXo\\ <-FOLDER " echo " Setup.msh file <-FILE " echo "Then run setup and it will install all of the detected projects" echo "" echo " ------------------====================IMPORTANT====================------------------" echo " The above instructions only work with newer eXo packs. Use the following if you have difficulty with this method." echo "" echo "Install each eXo project separatly." echo "Ensure LaunchBox is not running" echo "Go to the project you wish to merge and select the following folders & files:" echo "--Data" echo "--eXo" echo "--Images" echo "--Manuals" echo "--Music" echo "--Videos" echo "Paste these folders into your master folder (the project you are merging INTO)" echo "Say YES you want to merge folders (if prompted)" echo "Say NO when asked if you ant to overwrite any files with the same name" echo "Repeat this process for every other pack you wish to merge" echo "Start LaunchBox once this is done." echo "If you do not see all of the platforms you merged, then close LaunchBox. Wait at least 15 seconds. Restart LaunchBox." echo "" read -s -n 1 -p "Press any key to continue..." printf "\n\n" goto a1 && [[ $0 != $BASH_SOURCE ]] && return : checks if [[ "$(ls -1 ./eXo/util/util*.zip 2>/dev/null | wc -l)" -eq 0 ]] then clear echo "" echo "ERROR" echo "" echo "You are missing the util file. This file contains the emulators, along with several" echo "utilities required to run the games included with this pack." echo "" echo "The file resides in the .\\eXo\\util\\ folder" echo "Please make sure this file has been downloaded before proceeding with setup." echo "" echo "Exiting setup" read -s -n 1 -p "Press any key to continue..." printf "\n\n" goto end && [[ $0 != $BASH_SOURCE ]] && return fi : metadata [[ "$(ls -1 ./Content/\!*metadata.zip 2>/dev/null | wc -l)" -eq 0 ]] && goto merror && [[ $0 != $BASH_SOURCE ]] && return goto lbcheck && [[ $0 != $BASH_SOURCE ]] && return : merror clear echo "" echo "ERROR" echo "" echo "You are missing the "'!'"metadata file ("'!'"metadata.zip)." echo "Without this, the entire pack is unplayable." echo "This file contains the actual launch files and configuration files need to play the games." echo "Please download this file and then re-run setup." echo "" echo "This file should be in your .\\Content\\ folder." echo "" echo "Exiting setup" read -s -n 1 -p "Press any key to continue..." printf "\n\n" goto end && [[ $0 != $BASH_SOURCE ]] && return : lbcheck if [ ! -e ./Content/LaunchBox.zip ] then clear echo "" echo "ERROR" echo "" echo "You are missing the LaunchBox.zip file." echo "Without this, you will have no front end." echo "" echo "This file should be in your .\\Content\\ folder." echo "" echo "If you plan to use a different front end or no front end at all, you can choose" echo "to continue." echo "" goto check && [[ $0 != $BASH_SOURCE ]] && return fi if [ "${multi}" == true ] then [[ "$(ls -1 ./Content/XO*Metadata.zip 2>/dev/null | wc -l)" -eq 0 ]] && goto m2error && [[ $0 != $BASH_SOURCE ]] && return fi if [ "${multi}" == false ] then [ ! -e ./Content/XO"${name}"Metadata.zip ] && goto m2error && [[ $0 != $BASH_SOURCE ]] && return fi goto verified && [[ $0 != $BASH_SOURCE ]] && return : m2error clear echo "" echo "ERROR" echo "You are missing the XOMetadata file (XOMetadata.zip)." echo "Without this LaunchBox will not run properly." echo "This file contains the manuals, xml, and image data LaunchBox needs." echo "" echo "This file should be in your .\\Content\\ folder." echo "" echo "If you plan to use a different front end or no front end at all, you can choose" echo "to continue." echo "" goto check && [[ $0 != $BASH_SOURCE ]] && return done : check echo "" echo "Do you want to continue setup without support for LaunchBox?" echo "" echo "Note: Launchbox is the front end. Without it, you will simply have a collection" [ "${multi}" == false ] && echo "of ${name} zip files and a "'!'"${name} folder full of config files and game launch files." [ "${multi}" == true ] && echo "of zip files and a folder full of config files and game launch files." echo "Do not use this method if you aren't 100%% sure of what you are doing." echo "" while true do read -p "(Y)es or (N)o " choice case $choice in [Yy]* ) errorlevel=1 break;; [Nn]* ) errorlevel=2 break;; * ) printf "Invalid input.\n";; esac done [ $errorlevel == '2' ] && goto end && [[ $0 != $BASH_SOURCE ]] && return [ $errorlevel == '1' ] && goto skip && [[ $0 != $BASH_SOURCE ]] && return : verified clear x64=false # wmic os get osarchitecture > oscheck.txt # echo "x$(getconf LONG_BIT)" > oscheck.txt echo "AMD$(getconf LONG_BIT)" > oscheck.txt for a in $(grep "AMD64" "oscheck.txt") do x64=true done rm oscheck.txt [ "${x64}" == false ] && echo "" [ "${x64}" == false ] && echo "This machine is not reporting itself as 64 bit. LaunchBox, the front end," [ "${x64}" == false ] && echo "will only run on a 64 bit machine." [ "${x64}" == false ] && echo "" [ "${x64}" == false ] && read -s -n 1 -p "Press any key to continue..." printf "\n\n" [ "${x64}" == false ] && goto skip_lb && [[ $0 != $BASH_SOURCE ]] && return clear echo "" echo "All files verified." echo "" echo "Beginning setup" echo "" echo "Step 1 of 3" echo "Extracting LaunchBox files" echo "Estimated Time: 1-2 minutes." echo "" read -s -n 1 -p "Press any key to continue..." printf "\n\n" echo "EXTRACTING..." unzip -o ./Content/LaunchBox.zip -d ./ goto continue && [[ $0 != $BASH_SOURCE ]] && return : skip_lb echo "" echo "Installation will now continue, but please be aware that the front-end will not" echo "be functional on this machine. You may still run the games manually by navigating" echo "to the games launch folder and running the launch file manually. These can be found" echo "in:" [ "${multi}" == false ] && echo "./eXo/eXo${name}/"'!'"${name}/" [ "${multi}" == true ] && echo "./eXo/eXoPACK/"'!'"PACK/" [ "${multi}" == true ] && echo " *each PACK will have it's own name" echo "" echo "Apart from launching the games, the front end also contains metadata, screenshots," echo "manuals, box scans, game music, strategy guides, code wheels, and lots of other" echo "interesting things for each game. It is highly recommended that you take the necessary" echo "steps to get the frontend working." echo "" read -s -n 1 -p "Press any key to continue..." printf "\n\n" goto continue && [[ $0 != $BASH_SOURCE ]] && return : continue clear echo "" echo "Step 2 of 3" echo "Extracting LaunchBox Metadata" echo "Estimated Time: 1-2 minutes." echo "" read -s -n 1 -p "Press any key to continue..." printf "\n\n" unzip -o ./Content/XO\*Metadata.zip -d ./ : step3 clear echo "" echo "Step 3 of 3" echo "Extracting Game Configuration Files" echo "Estimated Time: 10-15 minutes." echo "" read -s -n 1 -p "Press any key to continue..." printf "\n\n" while read -d $'\0' a do unzip -o ./Content/GameData/"${a}"/\*.zip -d ./ done < <(gfind ./Content/GameData -mindepth 1 -maxdepth 1 -type d -printf "%P\n\0" | sort -z) unzip -o ./Content/\!\*metadata.zip -d ./ [ "${exist}" == false ] && goto skip && [[ $0 != $BASH_SOURCE ]] && return : cleanup cd eXo cd util cp unzip.exe .. while read -d $'\0' f do rm "${f}" done < <(gfind . -maxdepth 1 -not -iname "*.zip" -not -iname "*.bsh" -not -iname "*.msh" -not -iname "*.bash" -not -iname "*.command" -not -iname "*.bat" -type f -print0) for h in */ do rm -rf "${h}" done cp ../unzip.exe ./ rm ../unzip.exe cd .. cd .. : skip cd eXo unzip -o ./util/util\*.zip -d ./util [[ "$(ls -1 ./util/OPT*.zip 2>/dev/null | wc -l)" -gt 0 ]] && unzip -o ./util/OPT\*.zip -d ./util/ [[ "$(ls -1 ./util/EXT*.zip 2>/dev/null | wc -l)" -gt 0 ]] && unzip -o ./util/EXT\*.zip rm ./util/OPT*.zip rm ./util/EXT*.zip unzip -o ./util/util.zip ssr.exe -d ./util/ cd .. goto xml && [[ $0 != $BASH_SOURCE ]] && return : skipxtract goto xml && [[ $0 != $BASH_SOURCE ]] && return : xml goto noa && [[ $0 != $BASH_SOURCE ]] && return clear echo "" echo "Would you like to remove access to Adult games from LaunchBox?" echo "" echo "Please read carefully: \"Adult\" refers to games with nudity rather than violence. Choosing YES" echo "will remove them from the front end, but not remove them from your hard drive." echo "" echo "If they have previously been removed, choosing NO here will restore them in the front end." echo "" while true do read -p "(Y)es or (N)o " choice case $choice in [Nn]* ) errorlevel=1 break;; [Yy]* ) errorlevel=2 break;; * ) printf "Invalid input.\n";; esac done [ $errorlevel == '2' ] && goto yesa && [[ $0 != $BASH_SOURCE ]] && return [ $errorlevel == '1' ] && goto noa && [[ $0 != $BASH_SOURCE ]] && return : noa [[ "$(ls -1 ./xml/all/*.xml 2>/dev/null | wc -l)" -gt 0 ]] && cp ./xml/all/*.xml ./Data/Platforms/ cp ./xml/Playlists/*.* ./Data/Playlists/ cd xml scriptDirStack["${#scriptDirStack[@]}"]="$scriptDir" eval source merge_parents.msh scriptDir="${scriptDirStack["${#scriptDirStack[@]}"-1]}" unset scriptDirStack["${#scriptDirStack[@]}"-1] function goto { shortcutName=$1 newPosition=$(gsed -n -e "/: $shortcutName$/{:a;n;p;ba};" "$scriptDir/$(basename -- "$BASH_SOURCE")" ) eval "$newPosition" exit } scriptDirStack["${#scriptDirStack[@]}"]="$scriptDir" eval source merge_platforms.msh scriptDir="${scriptDirStack["${#scriptDirStack[@]}"-1]}" unset scriptDirStack["${#scriptDirStack[@]}"-1] function goto { shortcutName=$1 newPosition=$(gsed -n -e "/: $shortcutName$/{:a;n;p;ba};" "$scriptDir/$(basename -- "$BASH_SOURCE")" ) eval "$newPosition" exit } cd .. cp ./xml/Platforms.xml ./Data/ cp ./xml/Parents.xml ./Data/ [ -e ./xml/MS-DOS.xml ] && rm ./xml/MS-DOS.xml goto screen && [[ $0 != $BASH_SOURCE ]] && return : yesa [[ "$(ls -1 ./xml/family/*.xml 2>/dev/null | wc -l)" -gt 0 ]] && cp ./xml/family/*.xml ./Data/Platforms/ cp ./xml/Playlists/*.* ./Data/Playlists/ cd xml scriptDirStack["${#scriptDirStack[@]}"]="$scriptDir" eval source merge_parents.msh scriptDir="${scriptDirStack["${#scriptDirStack[@]}"-1]}" unset scriptDirStack["${#scriptDirStack[@]}"-1] function goto { shortcutName=$1 newPosition=$(gsed -n -e "/: $shortcutName$/{:a;n;p;ba};" "$scriptDir/$(basename -- "$BASH_SOURCE")" ) eval "$newPosition" exit } scriptDirStack["${#scriptDirStack[@]}"]="$scriptDir" eval source merge_platforms.msh scriptDir="${scriptDirStack["${#scriptDirStack[@]}"-1]}" unset scriptDirStack["${#scriptDirStack[@]}"-1] function goto { shortcutName=$1 newPosition=$(gsed -n -e "/: $shortcutName$/{:a;n;p;ba};" "$scriptDir/$(basename -- "$BASH_SOURCE")" ) eval "$newPosition" exit } cd .. cp ./xml/Platforms.xml ./Data/ cp ./xml/Parents.xml ./Data/ [ -e ./xml/MS-DOS.xml ] && rm ./xml/MS-DOS.xml goto screen && [[ $0 != $BASH_SOURCE ]] && return : screen clear echo "" echo "Would you like [F]ullscreen or [W]indowed mode to be the default setting?" echo "" while true do read -p "Please choose (F/W): " choice case $choice in [Ff]* ) errorlevel=1 break;; [Ww]* ) errorlevel=2 break;; * ) printf "Invalid input.\n";; esac done [ $errorlevel == '2' ] && goto win && [[ $0 != $BASH_SOURCE ]] && return [ $errorlevel == '1' ] && goto full && [[ $0 != $BASH_SOURCE ]] && return : full cd eXo clear [ -e ./emulators/dosbox/options_linux.conf ] && gsed -i -e "s|fullscreen=false|fullscreen=true|g" ./emulators/dosbox/options_linux.conf [ -e ./util/WIN.SEL ] && rm ./util/WIN.SEL echo "" > "./util/FULL.SEL" cd .. goto ratio && [[ $0 != $BASH_SOURCE ]] && return : win cd eXo clear [ -e ./emulators/dosbox/options_linux.conf ] && gsed -i -e "s|fullscreen=true|fullscreen=false|g" ./emulators/dosbox/options_linux.conf [ -e ./util/FULL.SEL ] && rm ./util/FULL.SEL echo "" > "./util/WIN.SEL" cd .. goto ratio && [[ $0 != $BASH_SOURCE ]] && return : ratio cd eXo clear echo "" echo "Would you like to enable Aspect Correction for all games?" echo "" echo "Choosing Yes will attempt to preserve the game's original format. In fullscreen" echo "mode this will introduce black bars on the sides." echo "" echo "Choosing No will stretch the image to fit your monitor." echo "" echo "Choosing Yes is useful for widescreen monitors which cause stretching or distortion." echo "" while true do read -p "[Y]es or [N]o " choice case $choice in [Yy]* ) errorlevel=1 break;; [Nn]* ) errorlevel=2 break;; * ) printf "Invalid input.\n";; esac done [ $errorlevel == '2' ] && goto aspectn && [[ $0 != $BASH_SOURCE ]] && return [ $errorlevel == '1' ] && goto aspecty && [[ $0 != $BASH_SOURCE ]] && return : aspecty clear [ -e ./emulators/dosbox/options_linux.conf ] && gsed -i -e "s|aspect=false|aspect=true|g" ./emulators/dosbox/options_linux.conf [ -e ./util/ANO.SEL ] && rm ./util/ANO.SEL echo "" > "./util/AYES.SEL" goto ini && [[ $0 != $BASH_SOURCE ]] && return : aspectn clear [ -e ./emulators/dosbox/options_linux.conf ] && gsed -i -e "s|aspect=true|aspect=false|g" ./emulators/dosbox/options_linux.conf [ -e ./util/AYES.SEL ] && rm ./util/AYES.SEL echo "" > "./util/ANO.SEL" goto ini && [[ $0 != $BASH_SOURCE ]] && return : ini cd .. clear echo "" [ "${multi}" == false ] && echo "eXo${name} is now setup. Enjoy"'!'"" [ "${multi}" == true ] && echo "Your eXoPacks are now setup. Enjoy"'!'"" echo "" echo "Would you like to create an icon on your desktop?" echo "" while true do read -p "[Y]es or [N]o " choice case $choice in [Yy]* ) errorlevel=1 break;; [Nn]* ) errorlevel=2 break;; * ) printf "Invalid input.\n";; esac done [ $errorlevel == '2' ] && goto end && [[ $0 != $BASH_SOURCE ]] && return [ $errorlevel == '1' ] && goto shortcut && [[ $0 != $BASH_SOURCE ]] && return : shortcut osascript <