Merged latest audiogame-manager to master, added voice configuration utility.

This commit is contained in:
Storm Dragon 2020-09-20 16:07:37 -04:00
parent 14093c80ca
commit 9532eef142
2 changed files with 188 additions and 6 deletions

View File

@ -271,12 +271,14 @@ unset manualInstall
# Use menu friendly names.
gameList=(
"Adrian's Doom"
"Battle Zone"
"Bloodshed"
"Crazy Party"
"Easter Quest"
"Kitchensinc Games"
"Light Cars"
"Lockpick"
"Oh Shit!"
"Shades of Doom"
"Super Egg Hunt"
"Super Liam"
@ -286,6 +288,8 @@ gameList=(
"Technoshock"
"Top Speed 3"
"Q9"
"RS Games"
"Undead Assault"
)
# With no arguments, open the game launcher.
@ -325,6 +329,14 @@ case "${game}" in
wine "${cache}/adrian's doom.exe" /silent
add_launcher "c:\Program Files\Two Caring Citizens\Adrian's Doom!\adrian.exe"
;;
"Battle Zone")
export winVer="win7"
install_wine_bottle speechsdk
download "https://www.agarchive.net/games/gameMadnessInteractive/battle%20zone%2013.5%20setup.exe"
wine "${cache}/battle zone 13.5 setup.exe" /silent
add_launcher "c:\Program Files\Battle Zone\ss.exe"
rm -fv "${WINEPREFIX}/drive_c/Program Files/Battle Zone/nvdaControllerClient32.dll"
;;
"Bloodshed")
install_wine_bottle speechsdk
download "http://www.samtupy.com/games/bloodshed.exe"
@ -335,8 +347,8 @@ case "${game}" in
install_wine_bottle speechsdk
download "http://pragmapragma.free.fr/crazy-party/Crazy-Party-beta73.zip"
unzip -d "$WINEPREFIX/drive_c/Program Files" "${cache}/Crazy-Party-beta73.zip"
rm -f "$WINEPREFIX/drive_c/Program Files/Crazy-Party-beta73/nvdaControllerClient32.dll"
add_launcher "c:\Program Files\Crazy-Party-beta73\Crazy Party.exe"
rm -f "${WINEPREFIX}/drive_c/Program Files/Crazy-Party-beta73/nvdaControllerClient32.dll"
;;
"Easter Quest")
install_wine_bottle
@ -370,6 +382,13 @@ case "${game}" in
wine "${cache}/lockpicksetup.exe" /silent
add_launcher "c:\Program Files\lWorks\Lockpick\lockpick.exe"
;;
"Oh Shit!")
export winVer="win7"
install_wine_bottle msvcrt40 speechsdk
download "http://samtupy.com/stevend/oh_shit.zip"
unzip -d "$WINEPREFIX/drive_c/Program Files" "${cache}/oh_shit.zip"
add_launcher "c:\Program Files\oh_shit\OhShit.exe"
;;
"Shades of Doom")
install_wine_bottle vcrun6
download "http://www.gmagames.com/sod20022.exe"
@ -440,12 +459,13 @@ case "${game}" in
wine "${cache}/q9_english_installer.exe" /silent
add_launcher "c:\Program Files\Q9 Action Game\q9.exe"
;;
"Undead Assault")
"RS Games")
# Does not speak with sapi.
install_wine_bottle speechsdk vcrun6sp6
download "http://undead-assault.com/static/files/public/undead_assault.zip"
unzip -d "$WINEPREFIX/drive_c/Program Files" "${cache}/undead_assault.zip"
add_launcher "c:\Program Files\Undead Assault.exe"
export winetricksSettings="vd=1024x768"
install_wine_bottle speechsdk vcrun6
download "http://rsgames.org/rsdownloads/rsgclient/rsgames-client-setup-2.01.exe"
wine "${cache}/rsgames-client-setup-2.01.exe" /silent
add_launcher "c:\Program Files\RS Games Client\rsg.exe"
;;
"Make a One Time Donation")
xdg-open "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=stormdragon2976@gmail.com&lc=US&item_name=Donation+to+Storm+Games&no_note=0&cn=&currency_code=USD&bn=PP-DonationsBF:btn_donateCC_LG.gif:NonHosted"

162
set-voice.sh Executable file
View File

@ -0,0 +1,162 @@
#!/bin/bash
# Set Voice
# Set the default wine voice based on installed options.
#
# Copyright 2020, Storm Dragon, <storm_dragon@linux-a11y.org>
#
# This is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free
# Software Foundation; either version 3, or (at your option) any later
# version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this package; see the file COPYING. If not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
#--code--
# Settings to improve accessibility of dialog.
export DIALOGOPTS='--insecure --no-lines --visit-items'
# Get the desired wine bottle
declare -a bottle
for i in $(find ~/.local/wine -maxdepth 1 -type d -not -name 'wine' | sort) ; do
bottle+=("$i" "${i##*/}")
done
export WINEPREFIX="$(dialog --backtitle "Use the up and down arrow keys to find the option you want, then press enter to select it." \
--clear \
--no-tags \
--menu "Select A Wine Bottle" 0 0 0 "${bottle[@]}" --stdout)"
if [[ -z "${WINEPREFIX}" ]]; then
exit 0
fi
echo "wineprefix = $WINEPREFIX"
msgbox() {
# Returns: None
# Shows the provided message on the screen with an ok button.
dialog --clear --msgbox "$*" 0 0
}
infobox() {
# Returns: None
# Shows the provided message on the screen with no buttons.
local timeout=3
dialog --infobox "$*" 0 0
read -n1 -t $timeout continue
# Clear any keypresses from the buffer
read -t 0.01 continue
}
yesno() {
# Returns: Yes or No
# Args: Question to user.
# Called in if $(yesno) == "Yes"
# Or variable=$(yesno)
dialog --clear --backtitle "Press 'Enter' for "yes" or 'Escape' for "no"." --yesno "$*" 0 0 --stdout
if [[ $? -eq 0 ]]; then
echo "Yes"
else
echo "No"
fi
}
menulist() {
# Args: List of items for menu.
# returns: selected tag
declare -a menuList
for i in "${@}" ; do
menuList+=("$i" "$i")
done
dialog --backtitle "$(gettext "Use the up and down arrow keys to find the option you want, then press enter to select it.")" \
--clear \
--extra-button \
--extra-label "$(gettext "Test Voice")" \
--no-tags \
--menu "$(gettext "Please select one")" 0 0 0 "${menuList[@]}" --stdout
return $?
}
restore_voice() {
if [[ $doRestore -eq 0 ]]; then
wineserver -k # If we don't do this it's likely wine will overwrite our reverted change or even clobber the registry key entirely
sed -i -E -e 's/"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\(SOFTWARE|Software)\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Tokens\\\\[^"]+"/"DefaultTokenId"="'"${oldVoice//\\/\\\\}"'"/g' "${WINEPREFIX}/user.reg"
fi
}
set_voice() {
doRestore=1
local tmp="$1"
local fullVoice
local counter=0
for x in ${voiceList[@]} ; do
[ "$x" = "$tmp" ] && break
counter=$(( $counter + 1 ))
done
fullVoice=${voiceListFullName[$counter]}
wineserver -k # If we don't do this it's likely wine will overwrite our reverted change or even clobber the registry key entirely
sed -i -E -e 's/"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\(SOFTWARE|Software)\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Tokens\\\\[^"]+"/"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\'"${fullVoice//\\/\\\\}"'"/g' "${WINEPREFIX}/user.reg"
}
test_voice() {
doRestore=0
local tmp="$1"
local fullVoice
local counter=0
for x in ${voiceList[@]} ; do
[ "$x" = "$tmp" ] && break
counter=$(( $counter + 1 ))
done
fullVoice=${voiceListFullName[$counter]}
wineserver -k # If we don't do this it's likely wine will overwrite our reverted change or even clobber the registry key entirely
sed -i -E -e 's/"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\(SOFTWARE|Software)\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Tokens\\\\[^"]+"/"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\'"${fullVoice//\\/\\\\}"'"/g' "${WINEPREFIX}/user.reg"
cat << "EOF" > /tmp/speak.vbs
dim speechobject
set speechobject=createobject("sapi.spvoice")
speechobject.speak "This is a test of your chosen voice. It contains multiple sentences and punctuation, and is designed to give a full representation of this voices qualities."
EOF
wine cscript "z:\tmp\speak.vbs"
}
# Handle voice restore, but only if voice changed
doRestore=1
trap restore_voice SIGINT
# Create an array of available voices.
ifs="$IFS"
IFS=$'\n'
voiceListFullName=($(grep -P '\[Software\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Tokens\\\\[^\\]+\].*' "${WINEPREFIX}/system.reg" | sed -E -e 's/\[([^]]+)\].*/\1/g'))
IFS="$ifs"
voiceList=()
for x in "${voiceListFullName[@]}" ; do
voiceList+=("$(echo "$x" | rev | cut -d\\ -f1 | rev)")
done
oldVoice="$(grep -P '"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\(SOFTWARE|Software)\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Tokens\\\\[^"]+"' "${WINEPREFIX}/user.reg" | sed -E -e 's/"DefaultTokenId"="([^"]+)"/\1/g')"
echo "oldVoice: ${oldVoice}"
echo "voiceList: ${voiceList[@]}"
echo "voiceListFullName: ${voiceListFullName[@]}"
#exit 1
exit=1
while [[ $exit -ne 0 ]] ; do
voice="$(menulist ${voiceList[@]})"
case $? in
0)
set_voice "$voice" ; exit=0 ;;
3)
test_voice "$voice";;
*)
restore_voice ; exit=0 ;;
esac
done
exit 0