Added the ability to set the default voice for the wine bottle when the game is installed. This can be done with flags at the time of install, see -h for instructions, or in the configuration file which is also covered with the -h flag.

This commit is contained in:
stormdragon2976 2023-05-01 00:08:22 -04:00
parent 8626ad9964
commit 8161157aef

View File

@ -422,6 +422,8 @@ help() {
echo "norh=\"true\" # Do not install RHVoice." echo "norh=\"true\" # Do not install RHVoice."
echo "redownload=\"true\" # Redownload sources, do not use the version stored in cache." echo "redownload=\"true\" # Redownload sources, do not use the version stored in cache."
echo "rhvoice=\"voicename\" # Select the voice to be installed (default Bdl)." echo "rhvoice=\"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." echo "winedebug=\"flag(s)\" # Set wine debug flags, useful for development."
exit 0 exit 0
} }
@ -537,6 +539,11 @@ install_rhvoice() {
return return
fi fi
if [[ "$norh" == "true" ]]; then if [[ "$norh" == "true" ]]; then
# Try to prevent the user from breaking speech
# Also useful for games that do not work with RHVoice
if [[ "${defaultVoice}" == "RHVoice" ]]; then
unset defaultVoice
fi
return return
fi fi
declare -A RHVoice=( declare -A RHVoice=(
@ -609,6 +616,11 @@ install_wine_bottle() {
# make it easy for game scripts to know which version of wine to use. # make it easy for game scripts to know which version of wine to use.
echo "WINE=\"${WINE}\"" > "$HOME/.local/wine/${bottle}/agm.conf" echo "WINE=\"${WINE}\"" > "$HOME/.local/wine/${bottle}/agm.conf"
echo "WINESERVER=\"${WINESERVER}\"" >> "$HOME/.local/wine/${bottle}/agm.conf" echo "WINESERVER=\"${WINESERVER}\"" >> "$HOME/.local/wine/${bottle}/agm.conf"
# If default voice is set, change it for the bottle
if [[ -n "${defaultVoice}" ]]; then
echo "Setting default voice for bottle \"${bottle}\" to \"${defaultVoice}\"."
"${0%/*}/speech/set-voice.sh" -b "${bottle}" -r "${defaultRate:-7}" -v "${defaultVoice}"
fi
} }
@ -1206,8 +1218,10 @@ declare -A command=(
[q]="No qjoypad. Does not launch qjoypad if it is detected." [q]="No qjoypad. Does not launch qjoypad if it is detected."
[R]="Redownload. Removes old versions of packages from cache before installing." [R]="Redownload. Removes old versions of packages from cache before installing."
[r]="Remove a game. This will delete all game data." [r]="Remove a game. This will delete all game data."
[S:]="Speech rate. Requires -V voice name, the default is 7. Values 0-9 or A."
[t]="Total games. Show how many games are currently available." [t]="Total games. Show how many games are currently available."
[v:]="Select the voice to be installed, default is Bdl." [v:]="Select the voice to be installed, default is Bdl."
[V:]="Select the default voice for a bottle."
) )
# Convert the keys of the associative array to a format usable by getopts # Convert the keys of the associative array to a format usable by getopts
@ -1238,12 +1252,14 @@ while getopts "${args}" i ; do
game_launcher;; game_launcher;;
R) redownload="true";; R) redownload="true";;
r) game_removal;; r) game_removal;;
S) defaultRate="${OPTARG}";;
t) t)
dialog --backtitle "Audiogame Manager" \ dialog --backtitle "Audiogame Manager" \
--infobox "There are currently ${#gameList[@]} games available." -1 -1 --infobox "There are currently ${#gameList[@]} games available." -1 -1
exit 0 exit 0
;; ;;
v) voiceName="${OPTARG}";; v) voiceName="${OPTARG}";;
V) defaultVoice="${OPTARG}";;
esac esac
done done