Merge branch 'testing' in preparation for new binary release.

This commit is contained in:
Storm Dragon 2021-04-28 18:09:25 -04:00
commit 6b9428d2e4

View File

@ -197,6 +197,11 @@ checklist() {
else
errorList+=("Warning: unix2dos is not installed. Some games need a configuration file in dos format before they will run.")
fi
if command -v w3m &> /dev/null ; then
echo "W3m is installed."
else
errorList+=("Warning: w3m is not installed. W3m is used to view game documentation.")
fi
if command -v xclip &> /dev/null ; then
echo "Xclip is installed."
else
@ -266,6 +271,51 @@ help() {
exit 0
}
documentation() {
if [[ "$2" == "Become a Patron" ]]; then
return
fi
if [[ "$2" == "Donate" ]]; then
return
fi
if ! command -v w3m &> /dev/null ; then
echo "This feature of audiogame-manager requires w3m. Please install it before continuing."
fi
export WINEPREFIX="$1"
echo "Loading documentation, please wait..."
# Try to find documentation based on common naming conventions.
local gamePath="$(winepath -u "$2" 2> /dev/null)"
gamePath="${gamePath%/*}"
local gameDoc="$(find "$gamePath" -type f -iname 'user_manual.html' | head -1)"
if [[ -z "$gameDoc" ]]; then
gameDoc="$(find "$gamePath" -type f -iname 'manual.html' | head -1)"
fi
if [[ -z "$gameDoc" ]]; then
gameDoc="$(find "$gamePath" -type f -iname 'en.html' | head -1)"
fi
if [[ -z "$gameDoc" ]]; then
gameDoc="$(find "$gamePath" -type f -iname 'readme.html' | head -1)"
fi
if [[ -z "$gameDoc" ]]; then
gameDoc="$(find "$gamePath" -type f -iname 'manual.txt' | head -1)"
fi
if [[ -z "$gameDoc" ]]; then
gameDoc="$(find "$gamePath" -type f -iname 'readme.txt' | head -1)"
fi
if [[ -z "$gameDoc" ]]; then
gameDoc="$(find "$gamePath" -type f -iname '*.url' -exec grep -i 'url=' {} \; | grep -iv 'score' | head -1)"
gameDoc="${gameDoc#*=}"
gameDoc="${gameDoc//[[:cntrl:]]/}"
fi
# Display documentation if available.
if [[ -n "$gameDoc" ]]; then
w3m "$gameDoc"
else
echo "No documentation found."
fi
exit 0
}
install_wine_bottle() {
# 32 bit installations work best and are the default here, if you need to override it, do it in the game specific installation steps.
export WINEARCH="${WINEARCH:-win32}"
@ -421,10 +471,18 @@ game_launcher() {
done
menuList+=("Donate" "Donate")
menuList+=("Become a Patron" "Become a Patron")
local game="$(dialog --backtitle "Audio Game Launcher" \
game="$(dialog --backtitle "Audio Game Launcher" \
--clear \
--extra-button \
--extra-label "Documentation" \
--no-tags \
--menu "Please select a game to play" 0 0 0 "${menuList[@]}" --stdout)"
local menuCode=$?
if [[ $menuCode -eq 1 ]]; then
exit 0
elif [[ $menuCode -eq 3 ]]; then
documentation "${HOME}/.local/wine/${game%|*}" "$(echo "$game" | cut -d '|' -f2)"
fi
else
local game="$(grep "^${1}|" "${configFile}" 2> /dev/null)"
game="${game%|*}"
@ -603,6 +661,7 @@ gameList=(
"The Great Toy Robbery"
"Thief"
#"Three D velocity"
"Top Speed 2"
"Top Speed 3"
"Triple Triad"
"Tube Sim"
@ -1281,6 +1340,12 @@ EOF
find "${WINEPREFIX}" -type f -name 'nvdaControllerClient32.dll' -exec cp -v "${cache}/nvdaControllerClient32.dll" "{}" \;
add_launcher "c:\Program Files\Three-D-Velocity-Binaries-master\tdv.exe"
;;
"Top Speed 2")
install_wine_bottle
download "http://users.pandora.be/playinginthedark/downloads/Tspeed_2.00.exe"
wine "${cache}/Tspeed_2.00.exe" /silent
add_launcher "c:\Program Files\Playing in the dark\Top Speed 2\TopSpeed.exe"
;;
"Top Speed 3")
install_wine_bottle directplay
download "https://github.com/PlayingintheDark/TopSpeed/releases/download/h/Tspeed_3.0.3.exe"