166 lines
6.7 KiB
Bash
166 lines
6.7 KiB
Bash
documentation() {
|
|
if [[ "$2" == "Become a Patron" ]]; then
|
|
return
|
|
fi
|
|
if [[ "$2" == "Donate" ]]; then
|
|
return
|
|
fi
|
|
|
|
# Extract architecture from first parameter (format: "win64|path")
|
|
local wineArch="${1%%|*}"
|
|
get_bottle "$wineArch"
|
|
|
|
echo "Loading documentation, please wait..."
|
|
|
|
# Try to find documentation based on common naming conventions.
|
|
local gamePath
|
|
gamePath="$(winepath -u "$2" 2> /dev/null)"
|
|
gamePath="${gamePath%/*}"
|
|
local gameDoc=""
|
|
local isUrl="false"
|
|
|
|
gameDoc="$(find "$gamePath" -type f -iname 'user_manual.htm*' -or -iname 'user manual.htm*' -or -iname '*user guide.htm*' | head -1)"
|
|
# Game name specific docs, add the name to the for loop.
|
|
if [[ -z "$gameDoc" ]]; then
|
|
for i in "troopanum.txt" "superdeekout.txt" scw.html ; do
|
|
gameDoc="$(find "$gamePath" -type f -iname "$i" -or -iname 'manual.htm' | head -1)"
|
|
done
|
|
fi
|
|
if [[ -z "$gameDoc" ]]; then
|
|
gameDoc="$(find "$gamePath" -type f -path '*/Manual/index.html' | head -1)"
|
|
fi
|
|
if [[ -z "$gameDoc" ]]; then
|
|
gameDoc="$(find "$gamePath" -type f -iname '[A-Z]*Help.htm' -or -iname '[A-Z]*Help.html' | head -1)"
|
|
fi
|
|
if [[ -z "$gameDoc" ]]; then
|
|
gameDoc="$(find "$gamePath" -type f -iname 'manual.html' -or -iname 'manual.htm' | head -1)"
|
|
fi
|
|
if [[ -z "$gameDoc" ]]; then
|
|
gameDoc="$(find "$gamePath" -type f -iname 'en.html' -or -iname 'en.htm' | head -1)"
|
|
fi
|
|
if [[ -z "$gameDoc" ]]; then
|
|
gameDoc="$(find "$gamePath" -type f -iname 'readme.html' -or -iname 'readme.htm' | 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' -or -iname 'help.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:]]/}"
|
|
[[ -n "$gameDoc" ]] && isUrl="true"
|
|
fi
|
|
|
|
# Display documentation if available
|
|
if [[ -n "$gameDoc" ]]; then
|
|
if [[ "$isUrl" == "true" ]]; then
|
|
# URL extracted from .url file - open in browser
|
|
open_url "$gameDoc"
|
|
elif [[ "$dialogType" == "yad" ]]; then
|
|
# GUI mode: use appropriate viewer
|
|
if [[ "${gameDoc,,}" =~ \.(html?)$ ]]; then
|
|
# HTML files: use xdg-open for default browser
|
|
xdg-open "$gameDoc" 2>/dev/null &
|
|
else
|
|
# Text files: use yad text-info for accessibility
|
|
yad --text-info \
|
|
--title="Game Documentation" \
|
|
--filename="$gameDoc" \
|
|
--width=800 \
|
|
--height=600 \
|
|
--button="Close:0"
|
|
fi
|
|
else
|
|
# Console mode: use w3m or fallback
|
|
if command -v w3m &> /dev/null; then
|
|
w3m "$gameDoc"
|
|
elif [[ "${gameDoc,,}" =~ \.(html?)$ ]]; then
|
|
echo "Install w3m to view HTML documentation in console mode."
|
|
echo "Documentation location: $gameDoc"
|
|
read -rp "Press Enter to continue..."
|
|
else
|
|
less "$gameDoc"
|
|
fi
|
|
fi
|
|
else
|
|
if [[ "$dialogType" == "yad" ]]; then
|
|
agm_msgbox "Documentation" "" "No documentation found for this game."
|
|
else
|
|
echo "No documentation found."
|
|
read -rp "Press Enter to continue..."
|
|
fi
|
|
fi
|
|
exit 0
|
|
}
|
|
|
|
help() {
|
|
echo "${0##*/}"
|
|
echo "Released under the terms of the Common Public Attribution License Version 1.0"
|
|
echo -e "This is a Stormux project: https://stormux.org\n"
|
|
echo -e "Usage:\n"
|
|
echo "With no arguments, open the game launcher."
|
|
for i in "${!command[@]}" ; do
|
|
echo "-${i/:/ <parameter>}: ${command[${i}]}"
|
|
done | sort
|
|
echo
|
|
echo "Some settings that are often used can be stored in a settings.conf file."
|
|
echo "If wanted, place it at the following location:"
|
|
echo "${configFile%/*}/settings.conf"
|
|
echo "The syntax is variable=\"value\""
|
|
echo
|
|
echo "ipfsGateway=\"https://ipfs.stormux.org\" # Gateway to be used for ipfs downloads."
|
|
echo "noCache=\"true\" # Do not keep downloaded items in the cache."
|
|
echo "noqjoypad=\"true\" # Do not launch qjoypad."
|
|
echo "norh=\"true\" # Do not install RHVoice."
|
|
echo "redownload=\"true\" # Redownload sources, do not use the version stored in cache."
|
|
echo "voiceName=\"voicename\" # Select the voice to be installed (default Bdl)."
|
|
echo "defaultVoice=\"voicename\" # Select the default voice to use for the bottle, e.g. MSMike or RHVoice."
|
|
echo "defaultRate=\"Default voice rate for the bottle, default 7, may not work in all games. Values 1-9 or A."
|
|
echo "winedebug=\"flag(s)\" # Set wine debug flags, useful for development."
|
|
exit 0
|
|
}
|
|
|
|
license() {
|
|
cat << EOF
|
|
■The contents of this file are subject to the Common Public Attribution
|
|
License Version 1.0 (the ■License■); you may not use this file except in
|
|
compliance with the License. You may obtain a copy of the License at
|
|
https://opensource.org/licenses/CPAL-1.0. The License is based on the Mozilla Public License Version
|
|
1.1 but Sections 14 and 15 have been added to cover use of software over a
|
|
computer network and provide for limited attribution for the Original
|
|
Developer. In addition, Exhibit A has been modified to be consistent with
|
|
Exhibit B.
|
|
|
|
Software distributed under the License is distributed on an ■AS IS■ basis,
|
|
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
for the specific language governing rights and limitations under the
|
|
License.
|
|
|
|
The Original Code is audiogame manager.
|
|
|
|
The Original Developer is not the Initial Developer and is . If
|
|
left blank, the Original Developer is the Initial Developer.
|
|
|
|
The Initial Developer of the Original Code is Billy "Storm Dragon" Wolfe. All portions of
|
|
the code written by Billy Wolfe are Copyright (c) 2020, 2024. All Rights
|
|
Reserved.
|
|
|
|
Contributor Michael Taboada.
|
|
|
|
Attribution Copyright Notice: Audiogame manager copyright 2020 Storm Dragon. All rights reserved.
|
|
|
|
Attribution Phrase (not exceeding 10 words): A Stormux project
|
|
|
|
Attribution URL: https://stormgames.wolfe.casa
|
|
|
|
Graphic Image as provided in the Covered Code, if any.
|
|
|
|
Display of Attribution Information is required in Larger
|
|
Works which are defined in the CPAL as a work which combines Covered Code
|
|
or portions thereof with code not governed by the terms of the CPAL.
|
|
EOF
|
|
}
|