From ab1e89fd6b44b09249ec890354b62c3403bf8138 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Tue, 27 Apr 2021 20:32:08 -0400 Subject: [PATCH 1/5] Added a documentation button that will hopefully load the game's documentation in w3m. This is the first attempt but it seems to be working pretty well so far. --- audiogame-manager.sh | 52 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/audiogame-manager.sh b/audiogame-manager.sh index 940d9c2..1ee449c 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -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,43 @@ 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')" + if [[ -z "$gameDoc" ]]; then + gameDoc="$(find "$gamePath" -type f -iname 'manual.html')" + fi + if [[ -z "$gameDoc" ]]; then + gameDoc="$(find "$gamePath" -type f -iname 'readme.html')" + fi + if [[ -z "$gameDoc" ]]; then + gameDoc="$(find "$gamePath" -type f -iname 'manual.txt')" + fi + if [[ -z "$gameDoc" ]]; then + gameDoc="$(find "$gamePath" -type f -iname 'readme.txt')" + 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 +463,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%|*}" From 143790910f7feda9547aeb3fc08e82b841cd4b41 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Tue, 27 Apr 2021 20:55:06 -0400 Subject: [PATCH 2/5] Added another check for game documentation. --- audiogame-manager.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/audiogame-manager.sh b/audiogame-manager.sh index 1ee449c..46874d8 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -299,6 +299,11 @@ echo "Loading documentation, please wait..." if [[ -z "$gameDoc" ]]; then gameDoc="$(find "$gamePath" -type f -iname 'readme.txt')" fi + if [[ -z "$gameDoc" ]]; then + gameDoc="$(find "$gamePath" -type f -iname '*.url' -exec grep -i 'url=' {} \;)" + gameDoc="${gameDoc#*=}" + gameDoc="${gameDoc//[[:cntrl:]]/}" + fi # Display documentation if available. if [[ -n "$gameDoc" ]]; then w3m "$gameDoc" From 023fc8de32921dc75ac1f49d0efd602ed9806ee9 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Tue, 27 Apr 2021 21:39:15 -0400 Subject: [PATCH 3/5] A few more tweaks to the documentation functionality. --- audiogame-manager.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/audiogame-manager.sh b/audiogame-manager.sh index 46874d8..90efaa6 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -286,21 +286,21 @@ 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')" + local gameDoc="$(find "$gamePath" -type f -iname 'user_manual.html' | head -1)" if [[ -z "$gameDoc" ]]; then - gameDoc="$(find "$gamePath" -type f -iname 'manual.html')" + gameDoc="$(find "$gamePath" -type f -iname 'manual.html' | head -1)" fi if [[ -z "$gameDoc" ]]; then - gameDoc="$(find "$gamePath" -type f -iname 'readme.html')" + gameDoc="$(find "$gamePath" -type f -iname 'readme.html' | head -1)" fi if [[ -z "$gameDoc" ]]; then - gameDoc="$(find "$gamePath" -type f -iname 'manual.txt')" + gameDoc="$(find "$gamePath" -type f -iname 'manual.txt' | head -1)" fi if [[ -z "$gameDoc" ]]; then - gameDoc="$(find "$gamePath" -type f -iname 'readme.txt')" + 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=' {} \;)" + gameDoc="$(find "$gamePath" -type f -iname '*.url' -exec grep -i 'url=' {} \; | grep -iv 'score' | head -1)" gameDoc="${gameDoc#*=}" gameDoc="${gameDoc//[[:cntrl:]]/}" fi From 1f0bf714f9aaf029028eb4332e8f9e6dba449ce5 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Wed, 28 Apr 2021 00:34:40 -0400 Subject: [PATCH 4/5] Added game Top Speed 2. --- audiogame-manager.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/audiogame-manager.sh b/audiogame-manager.sh index 90efaa6..242ce1d 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -658,6 +658,7 @@ gameList=( "The Great Toy Robbery" "Thief" #"Three D velocity" + "Top Speed 2" "Top Speed 3" "Triple Triad" "Tube Sim" @@ -1336,6 +1337,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" From 5a815c21273fd7d8f0a634df6d0f52186f9a7e39 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Wed, 28 Apr 2021 18:08:15 -0400 Subject: [PATCH 5/5] One more small tweak to documentation before binary release. --- audiogame-manager.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/audiogame-manager.sh b/audiogame-manager.sh index 242ce1d..0921f3a 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -290,6 +290,9 @@ echo "Loading documentation, please wait..." 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