Merge branch 'testing'

This commit is contained in:
Storm Dragon 2022-09-19 11:14:10 -04:00
commit 620b8af135
2 changed files with 110 additions and 70 deletions

View File

@ -434,6 +434,7 @@ help() {
echo "noCache=\"true\" # Do not keep downloaded items in the cache."
echo "norh=\"true\" # Do not install RHVoice."
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 "winedebug=\"flag(s)\" # Set wine debug flags, useful for development."
exit 0
}
@ -502,8 +503,6 @@ winetricks() {
echo "1" > "${XDG_CACHE_HOME:-$HOME/.cache}/winetricks/track_usage"
fi
# Download or update agm's copy of winetricks
winetricksPath="${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager"
mkdir -p "${winetricksPath}"
if [[ ! -e "${winetricksPath}/winetricks" ]]; then
checkWinetricksUpdate="true"
download "https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks"
@ -526,10 +525,23 @@ install_rhvoice() {
if [[ "$norh" == "true" ]]; then
return
fi
download "https://rhvoice.eu-central-1.linodeobjects.com/RHVoice-voice-English-Bdl-v4.1.2007.13-setup.exe"
declare -A RHVoice=(
[alan]="https://rhvoice.eu-central-1.linodeobjects.com/RHVoice-voice-English-Alan-v4.0.2008.15-setup.exe"
[bdl]="https://rhvoice.eu-central-1.linodeobjects.com/RHVoice-voice-English-Bdl-v4.1.2008.15-setup.exe"
[clb]="https://rhvoice.eu-central-1.linodeobjects.com/RHVoice-voice-English-Clb-v4.0.2008.15-setup.exe"
[slt]="https://rhvoice.eu-central-1.linodeobjects.com/RHVoice-voice-English-Slt-v4.0.2008.15-setup.exe"
)
voiceName="${voiceName:-bdl}"
voiceName="${voiceName,,}"
if [[ "${RHVoice[${voiceName}]}" == "" ]]; then
echo "Invalid RHVoice name specified, defaulting to Bdl."
voiceName="bdl"
fi
local voiceFile="${RHVoice[${voiceName}]##*/}"
download "${RHVoice[${voiceName}]}"
winetricks -q win8
echo "Installing RHVoice..."
wine "${cache}/RHVoice-voice-English-Bdl-v4.1.2007.13-setup.exe" &
echo "Installing RHVoice ${voiceName^}..."
wine "${cache}/${voiceFile}" &
sleep 20
wineserver -k
}
@ -562,9 +574,16 @@ install_wine_bottle() {
{ DISPLAY="" wineboot -u
wine msiexec /i z:"$monoPath" /quiet
wine msiexec /i z:"$geckoPath" /quiet
if [[ "${*}" =~ speechsdk ]] || [[ "${WINEARCH}" == "win64" ]]; then
if [[ "${*}" =~ speechsdk ]]; then
install_rhvoice
fi
if [[ "${WINEARCH}" == "win64" ]]; then
download "https://github.com/RastislavKish/nvda2speechd/releases/download/v0.1/nvda2speechd"
fi
if [[ "${WINEARCH}" == "win64" ]] && [[ ! -f "${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd" ]]; then
cp "${cache}/nvda2speechd" "${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd"
chmod +x "${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd"
fi
winetricks -q $@ ${winVer:-winxp} ${winetricksSettings}; } | dialog --progressbox "Installing wine bottle, please wait..." -1 -1
}
@ -753,6 +772,9 @@ game_launcher() {
fi
fi
# for games that require custom scripts before launch or custom launch parameters
if [[ "$game" =~ laser-breakout ]]; then
pgrep -u "$USER" nvda2speechd &> /dev/null || ${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd &
fi
if [[ "$game" =~ sequence-storm ]]; then
[[ -x ~/.SequenceStormReader ]] && ~/.SequenceStormReader &
fi
@ -764,6 +786,9 @@ game_launcher() {
wine "$winePath\\$wineExec"
exit 0
fi
if [[ "$game" =~ rs-games ]]; then
pgrep -u "$USER" nvda2speechd &> /dev/null || ${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd &
fi
if [[ "$game" =~ screaming-strike-2 ]]; then
pushd "$(winepath "$winePath")"
wine "$wineExec"
@ -783,6 +808,7 @@ game_launcher() {
exit 0
fi
if [[ -d "${WINEPREFIX}/drive_c/windows/syswow64" ]]; then
pgrep -u "$USER" nvda2speechd &> /dev/null || ${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd &
wine64 start /realtime /d "${winePath}" "$wineExec"
else
wine start /d "${winePath}" "$wineExec" /realtime
@ -828,6 +854,10 @@ cache="${XDG_CACHE_HOME:-$HOME/.cache}/audiogame-manager"
configFile="${XDG_CONFIG_HOME:-$HOME/.config}/storm-games/audiogame-manager/games.conf"
mkdir -p "${cache}"
mkdir -p "${configFile%/*}"
# Create the path for AGM's helper programs.
# Originally this was only winetricks, thus the name, and I'm too lazy to change it now.
winetricksPath="${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager"
mkdir -p "${winetricksPath}"
# Load any arguments from settings.conf file
if [[ -r "${configFile%/*}/settings.conf" ]]; then
source "${configFile%/*}/settings.conf"
@ -912,7 +942,7 @@ gameList=(
"BG Word Target"
"BG Word Yahtzee"
"BG Yahtzee"
#"Blind Drive"
"Blind Drive"
"Bloodshed"
"Bombercats"
#"Breed Memorial"
@ -933,9 +963,11 @@ gameList=(
"Death on the Road"
"Deathmatch"
"Dog Who Hates Toast"
#"Dragon Pong"
"Duck Hunt"
"DynaMan"
"Easter Quest"
#"Endless Runner"
"Entombed"
"ESP Pinball Classic"
"ESP Pinball Extreme"
@ -945,7 +977,6 @@ gameList=(
#"Fartman"
"Finger Panic"
"Fuck That Bird"
"Future Life"
"GMA Tank Commander"
"Grizzly Gulch"
"Hammer of Glory"
@ -995,9 +1026,9 @@ gameList=(
"Sequence Storm"
#"Shades of Doom 1.2"
"Shades of Doom"
"Shooter"
"Silver Dollar"
"Slender Lost Vision"
#"Shooter"
"Sonic the Hedgehog"
"Sonic Zoom"
#"Space Defender"
@ -1026,7 +1057,7 @@ gameList=(
"Villains From Beyond"
"VIP Mud"
"Warsim"
"Windows Attack"
#"Wolf Games Launcher"
#"World of War"
)
@ -1062,6 +1093,7 @@ declare -A command=(
[R]="Redownload. Removes old versions of packages from cache before installing."
[r]="Remove a game. This will delete all game data."
[t]="Total games. Show how many games are currently available."
[v:]="Select the voice to be installed, default is Bdl."
)
# Convert the keys of the associative array to a format usable by getopts
@ -1094,6 +1126,7 @@ while getopts "${args}" i ; do
--infobox "There are currently ${#gameList[@]} games available." -1 -1
exit 0
;;
v) voiceName="${OPTARG}";;
esac
done
@ -1169,9 +1202,10 @@ case "${game}" in
add_launcher "c:\Program Files\Battle Zone\ss.exe"
;;
"Beatstar Pro")
# Sapi is broken on win64 for now, and this game doesn't support nvda it seems.
export WINEARCH=win64
export winVer="win7"
install_wine_bottle sapi mf
install_wine_bottle mf
download "https://oriolgomez.com/games/beat_windows.zip"
unzip -d "$WINEPREFIX/drive_c/Program Files/Beatstar Pro" "${cache}/beat_windows.zip"
add_launcher "c:\Program Files\Beatstar Pro\beatstar.exe"
@ -1538,13 +1572,15 @@ case "${game}" in
;;
"Blind Drive")
get_installer "Blind Drive 1.1.112.00i-win64.zip" "https://lofipeople.itch.io/blind-drive"
download "https://github.com/RastislavKish/nvda2speechd/releases/download/v0.1/nvda2speechd64.dll"
export WINEARCH=win64
export winVer="win8"
install_wine_bottle sapi
install_wine_bottle
unzip -d "$WINEPREFIX/drive_c/Program Files/blind-drive" "${cache}/Blind Drive 1.1.112.00i-win64.zip"
# Weird work around to get keyboard working.
winetricks -q usetakefocus=y
winetricks -q usetakefocus=n
find "${WINEPREFIX}" -type f -name 'nvdaControllerClient.dll' -exec cp -v "${cache}/nvda2speechd64.dll" "{}" \;
add_launcher "c:\Program Files\blind-drive\Blind Drive.exe"
;;
"Bloodshed")
@ -1629,6 +1665,7 @@ case "${game}" in
;;
"Code Dungeon")
get_installer "codedungeon-win-64.zip" "https://stealcase.itch.io/codedungeon"
download "https://github.com/RastislavKish/nvda2speechd/releases/download/v0.1/nvda2speechd64.dll"
export WINEARCH=win64
export winVer="win8"
install_wine_bottle
@ -1636,6 +1673,7 @@ case "${game}" in
# Weird work around to get keyboard working.
winetricks -q usetakefocus=y
winetricks -q usetakefocus=n
find "${WINEPREFIX}" -type f -name 'nvdaControllerClient.dll' -exec cp -v "${cache}/nvda2speechd64.dll" "{}" \;
add_launcher "c:\Program Files\code-dungeon\Code Dungeon.exe"
;;
"Copter Mission")
@ -1663,10 +1701,10 @@ case "${game}" in
"Crime Hunter")
export WINEARCH=win64
export winVer="win7"
install_wine_bottle sapi
download "http://masonasons.me/softs/CH2.0Win.zip" "https://stormgames.wolfe.casa/downloads/nvdaControllerClient64.dll"
install_wine_bottle
download "http://masonasons.me/softs/CH2.0Win.zip" "https://github.com/RastislavKish/nvda2speechd/releases/download/v0.1/nvda2speechd64.dll"
unzip -d "$WINEPREFIX/drive_c/Program Files/crime-hunter" "${cache}/CH2.0Win.zip"
find "${WINEPREFIX}" -type f -name 'nvdaControllerClient64.dll' -exec cp -v "${cache}/nvdaControllerClient64.dll" "{}" \;
find "${WINEPREFIX}" -type f -name 'nvdaControllerClient64.dll' -exec cp -v "${cache}/nvda2speechd64.dll" "{}" \;
add_launcher "c:\Program Files\crime-hunter\ch.exe"
;;
"Danger on the Wheel")
@ -1715,6 +1753,12 @@ case "${game}" in
add_launcher "c:\Program Files\dogwhohatestoast\DogwhoHatesToast.exe"
echo "Note: Dog who Hates Toast installed. Once you start the game, you must press tab until you hear sapi on to get speech." >&2
;;
"Dragon Pong")
install_wine_bottle vb6run dx8vb speechsdk
download "https://www.iamtalon.me/games/dragonpong.zip"
unzip -d "$WINEPREFIX/drive_c/Program Files" "${cache}/dragonpong.zip"
add_launcher "c:\Program Files\dragonpong\DragonPong.exe"
;;
"Duck Hunt")
export bottle="l-works"
install_wine_bottle vb6run dx8vb speechsdk
@ -1739,6 +1783,13 @@ case "${game}" in
wine "${cache}/easter quest setup.exe" /silent
add_launcher "c:\Program Files\MTGames\Easter Quest\easter.exe"
;;
"Endless Runner")
install_wine_bottle speechsdk
download "http://www.masonasons.me/softs/EndlessRunner.7z"
7z e -y -o"$WINEPREFIX/drive_c/Program Files/Endless Runner" "${cache}/EndlessRunner.7z" -prunner
find "${WINEPREFIX}" -type f -name "nvdaControllerClient32.dll" -exec rm -fv "{}" \;
add_launcher "c:\Program Files\Endless Runner\runner.exe"
;;
"Entombed")
export winVer="win7"
install_wine_bottle speechsdk msvcrt40 gdiplus ie7 wmp11 mf
@ -1839,15 +1890,6 @@ case "${game}" in
unzip -d "$WINEPREFIX/drive_c/Program Files/fuck that bird" "${cache}/bird_en.zip"
add_launcher "c:\Program Files\fuck that bird\game.exe"
;;
"Future Life")
export winVer="win7"
install_wine_bottle speechsdk
get_installer "Future Life.zip" "https://www.mediafire.com/file/phkzxtqjaw6nao9/Future"
unzip -d "$WINEPREFIX/drive_c/Program Files" "${cache}/Future Life.zip"
chmod +w "$WINEPREFIX/drive_c/Program Files/Future Life"
find "${WINEPREFIX}" -type f -name "nvdaControllerClient32.dll" -exec rm -fv "{}" \;
add_launcher "c:\Program Files\Future Life\future_life.exe"
;;
"GMA Tank Commander")
install_wine_bottle vb6run dx8vb speechsdk
download "http://www.gmagames.com/gtc120.exe"
@ -1982,12 +2024,12 @@ EOF
"Laser Breakout")
export bottle="nyanchan"
export winVer="win7"
install_wine_bottle speechsdk
download "http://www.nyanchangames.com/softs/lsSetup.exe" "https://stormgames.wolfe.casa/downloads/nvdaControllerClient32.dll"
install_wine_bottle
download "http://www.nyanchangames.com/softs/lsSetup.exe" "https://github.com/RastislavKish/nvda2speechd/releases/download/v0.1/nvda2speechd32.dll"
wine "${cache}/lsSetup.exe" &
xdotool sleep 10 key Return
wineserver -w
find "${WINEPREFIX}" -type f -name "nvdaControllerClient.dll" -exec rm -fv "{}" \;
find "${WINEPREFIX}" -type f -name 'nvdaControllerClient.dll' -exec cp -v "${cache}/nvda2speechd32.dll" "{}" \;
add_launcher "c:\nyanchangame\laser breakout\play.exe"
;;
"Light Battles")
@ -2230,6 +2272,7 @@ EOF
download "https://www.agarchive.net/games/XSight/River%20Raiders%201.3.5.exe"
wine "$cache/River Raiders 1.3.5.exe" &
xdotool sleep 5 type y 2> /dev/null
xdotool sleep 1 type y 2> /dev/null
xdotool sleep 1 key --clearmodifiers alt+n sleep 2 key alt+n sleep 2 key alt+n sleep 2 key alt+i sleep 5 key alt+f 2> /dev/null
wineserver -w
add_launcher "c:\Program Files\River Raiders\raid.exe"
@ -2237,9 +2280,9 @@ EOF
"RS Games")
export winVer="win7"
install_wine_bottle speechsdk
download "http://rsgames.org/rsdownloads/rsgclient/rsgames-client-setup-2.01.exe" "https://stormgames.wolfe.casa/downloads/nvdaControllerClient32.dll"
download "http://rsgames.org/rsdownloads/rsgclient/rsgames-client-setup-2.01.exe" "https://github.com/RastislavKish/nvda2speechd/releases/download/v0.1/nvda2speechd32.dll"
wine "${cache}/rsgames-client-setup-2.01.exe" /silent
find "${WINEPREFIX}" -type f -name 'nvdaControllerClient32.dll' -exec cp -v "${cache}/nvdaControllerClient32.dll" "{}" \;
find "${WINEPREFIX}" -type f -name 'nvdaControllerClient32.dll' -exec cp -v "${cache}/nvda2speechd32.dll" "{}" \;
add_launcher "c:\Program Files\RS Games Client\rsg.exe"
;;
"Run For Your Life")
@ -2331,10 +2374,9 @@ EOF
export WINEARCH=win64
export winVer="win7"
install_wine_bottle
download "http://masonasons.me/softs/Shooter.zip" "https://stormgames.wolfe.casa/downloads/nvdaControllerClient32.dll" "https://stormgames.wolfe.casa/downloads/nvdaControllerClient64.dll"
download "http://masonasons.me/softs/Shooter.zip" "https://github.com/RastislavKish/nvda2speechd/releases/download/v0.1/nvda2speechd64.dll"
unzip -d "$WINEPREFIX/drive_c/Program Files/shooter" "${cache}/Shooter.zip"
find "${WINEPREFIX}" -type f -name 'nvdaControllerClient32.dll' -exec cp -v "${cache}/nvdaControllerClient32.dll" "{}" \;
find "${WINEPREFIX}" -type f -name 'nvdaControllerClient64.dll' -exec cp -v "${cache}/nvdaControllerClient64.dll" "{}" \;
find "${WINEPREFIX}" -type f -name 'nvdaControllerClient64.dll' -exec cp -v "${cache}/nvda2speechd64.dll" "{}" \;
add_launcher "c:\Program Files\shooter\shooter.exe"
;;
"Sonic the Hedgehog")
@ -2599,7 +2641,7 @@ EOF
;;
"VIP Mud")
export winVer="win7"
install_wine_bottle vb6run dx8vb speechsdk
install_wine_bottle vb6run dx8vb speechsdk ole32
download "http://gmagames.com/vipmud20016.exe"
wine "${cache}/vipmud20016.exe" /silent
mkdir -p "${HOME}/.local/wine/vip-mud/drive_c/users/${USER}/Documents/VIP Mud"
@ -2617,12 +2659,14 @@ EOF
unzip -d "$WINEPREFIX/drive_c/Program Files/Warsim/" "${cache}/Warsim Full Game.zip"
add_launcher "c:\Program Files\Warsim\Warsim.exe"
;;
"Windows Attack")
get_installer "WA.exe" "https://drive.google.com/file/d/1BwKGLP37m-Z6nyKdo8LwmU9J1CEqfMb_/view?usp=drivesdk"
"Wolf Games Launcher")
download "https://sightlesswolf.com/wg-release.zip" "https://github.com/RastislavKish/nvda2speechd/releases/download/v0.1/nvda2speechd64.dll"
export WINEARCH=win64
export winVer="win7"
install_wine_bottle speechsdk
cp "${cache}/WA.exe" "$WINEPREFIX/drive_c/Program Files/"
add_launcher "c:\Program Files\WA.exe"
install_wine_bottle
unzip -d "$WINEPREFIX/drive_c/Program Files" "${cache}/wg-release.zip"
find "${WINEPREFIX}" -type f -name 'nvdaControllerClient64.dll' -exec cp -v "${cache}/nvda2speechd64.dll" "{}" \;
add_launcher "c:\Program Files\wg-release\WolfGames.exe"
;;
"World of War")
export winVer="win7"

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Set Voice
# Set the default wine voice based on installed options.
# Set the default wine voice ba$sed on installed options.
# Rate can be specified as a numeric argument to this script, 1 through 9.
# The default rate is 7
@ -8,7 +8,7 @@
# ■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
# https://opensource.org/licenses/CPAL-1.0. The License is ba$sed 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
@ -44,6 +44,15 @@
#--code--
# Set a variable to make mac compatibility easier...
sed="sed"
grep="grep"
if [[ "$(uname)" == "Darwin" ]]; then
sed="gsed"
grep="ggrep"
fi
export grep
export sed
# Settings to improve accessibility of dialog.
export DIALOGOPTS='--insecure --no-lines --visit-items'
# Turn off debug messages
@ -116,11 +125,7 @@ menulist() {
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
if [[ "$(uname)" == "Darwin" ]]; then
gsed -i -E -e 's/"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\(SOFTWARE|Software)\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Token(Enum|)s\\\\[^"]+"/"DefaultTokenId"="'"${oldVoice//\\/\\\\}"'"/g' "${WINEPREFIX}/user.reg"
else
sed -i -E -e 's/"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\(SOFTWARE|Software)\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Token(Enum|)s\\\\[^"]+"/"DefaultTokenId"="'"${oldVoice//\\/\\\\}"'"/g' "${WINEPREFIX}/user.reg"
fi
$sed -i -E -e 's/"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\(SOFTWARE|Software)\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Token(Enum|)s\\\\[^"]+"/"DefaultTokenId"="'"${oldVoice//\\/\\\\}"'"/g' "${WINEPREFIX}/user.reg"
fi
}
@ -133,17 +138,14 @@ set_voice() {
[ "$x" = "$tmp" ] && break
counter=$(( $counter + 1 ))
done
local RHVoiceName="$(find "${WINEPREFIX}/drive_c/ProgramData/Olga Yakovleva/RHVoice/data/voices/" -maxdepth 1 -type d)"
RHVoiceName="${RHVoiceName##*/}"
fullVoice="${voiceListFullName[$counter]}"
fullVoice="${fullVoice/RHVoice/RHVoice\\\\bdl}"
fullVoice="${fullVoice/RHVoice/RHVoice\\\\${RHVoiceName}}"
wineserver -k # If we don't do this it's likely wine will overwrite our reverted change or even clobber the registry key entirely
# Remove any existing rate change for voices
if [[ "$(uname)" == "Darwin" ]]; then
gsed -i '/"DefaultTTSRate"=dword:/d' "${WINEPREFIX}/user.reg"
gsed -i -E -e 's/"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\(SOFTWARE|Software)\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Token(Enum|)s\\\\[^"]+"/"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\'"${fullVoice//\\/\\\\}"'"\n"DefaultTTSRate"=dword:0000000'${2:-7}'/g' "${WINEPREFIX}/user.reg"
else
sed -i '/"DefaultTTSRate"=dword:/d' "${WINEPREFIX}/user.reg"
sed -i -E -e 's/"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\(SOFTWARE|Software)\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Token(Enum|)s\\\\[^"]+"/"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\'"${fullVoice//\\/\\\\}"'"\n"DefaultTTSRate"=dword:0000000'${2:-7}'/g' "${WINEPREFIX}/user.reg"
fi
$sed -i '/"DefaultTTSRate"=dword:/d' "${WINEPREFIX}/user.reg"
$sed -i -E -e 's/"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\(SOFTWARE|Software)\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Token(Enum|)s\\\\[^"]+"/"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\'"${fullVoice//\\/\\\\}"'"\n"DefaultTTSRate"=dword:0000000'${2:-7}'/g' "${WINEPREFIX}/user.reg"
}
test_voice() {
@ -155,14 +157,12 @@ test_voice() {
[ "$x" = "$tmp" ] && break
counter=$(( $counter + 1 ))
done
local RHVoiceName="$(find "${WINEPREFIX}/drive_c/ProgramData/Olga Yakovleva/RHVoice/data/voices/" -maxdepth 1 -type d)"
RHVoiceName="${RHVoiceName##*/}"
fullVoice="${voiceListFullName[$counter]}"
fullVoice="${fullVoice/RHVoice/RHVoice\\\\bdl}"
fullVoice="${fullVoice/RHVoice/RHVoice\\\\${RHVoiceName}}"
wineserver -k # If we don't do this it's likely wine will overwrite our reverted change or even clobber the registry key entirely
if [[ "$(uname)" == "Darwin" ]]; then
gsed -i -E -e 's/"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\(SOFTWARE|Software)\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Token(Enum|)s\\\\[^"]+"/"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\'"${fullVoice//\\/\\\\}"'"/g' "${WINEPREFIX}/user.reg"
else
sed -i -E -e 's/"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\(SOFTWARE|Software)\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Token(Enum|)s\\\\[^"]+"/"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\'"${fullVoice//\\/\\\\}"'"/g' "${WINEPREFIX}/user.reg"
fi
$sed -i -E -e 's/"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\(SOFTWARE|Software)\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Token(Enum|)s\\\\[^"]+"/"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\'"${fullVoice//\\/\\\\}"'"/g' "${WINEPREFIX}/user.reg"
cat << "EOF" > /tmp/speak.vbs
dim speechobject
set speechobject=createobject("sapi.spvoice")
@ -186,22 +186,18 @@ wine cscript "z:\tmp\speak.vbs"
# Create an array of available voices.
ifs="$IFS"
IFS=$'\n'
if [[ "$(uname)" == "Darwin" ]]; then
voiceListFullName=($(ggrep -P '\[Software\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Token(Enum|)s\\\\[^\\]+\].*' "${WINEPREFIX}/system.reg" | sed -E -e 's/\[([^]]+)\].*/\1/g'))
else
voiceListFullName=($(grep -P '\[Software\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Token(Enum|)s\\\\[^\\]+\].*' "${WINEPREFIX}/system.reg" | sed -E -e 's/\[([^]]+)\].*/\1/g'))
fi
voiceListFullName=($($grep -P '\[Software\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Token(Enum|)s\\\\[^\\]+\].*' "${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)")
voiceList+=("$(echo "$x" | $sed -E -e 's/Software\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Token(Enum|)s\\\\(.+)/\3/g')")
done
if [[ "$(uname)" == "Darwin" ]]; then
oldVoice="$(ggrep -P '"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\(SOFTWARE|Software)\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Token(Enum|)s\\\\[^"]+"' "${WINEPREFIX}/user.reg" | sed -E -e 's/"DefaultTokenId"="([^"]+)"/\1/g')"
else
oldVoice="$(grep -P '"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\(SOFTWARE|Software)\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Token(Enum|)s\\\\[^"]+"' "${WINEPREFIX}/user.reg" | sed -E -e 's/"DefaultTokenId"="([^"]+)"/\1/g')"
fi
oldVoice="$($grep -P '"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\(SOFTWARE|Software)\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Token(Enum|)s\\\\[^"]+"' "${WINEPREFIX}/user.reg" | $sed -E -e 's/"DefaultTokenId"="([^"]+)"/\1/g')"
exit=1
if [[ "${voiceList[@]}" -eq 0 ]]; then
dialog --msgbox "No voices found." -1 -1
exit 1
fi
while [[ $exit -ne 0 ]] ; do
voice="$(menulist "${voiceList[@]}")"