Lots of changes to get Mac support working.Merge branch 'testing'
This commit is contained in:
commit
a3d5fd5b6a
@ -1,4 +1,22 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright 2020, Stormux, <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.
|
||||
#
|
||||
|
||||
# Dialog accessibility
|
||||
export DIALOGOPTS='--no-lines --visit-items'
|
||||
@ -28,6 +46,15 @@ update() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to open urls across OS.
|
||||
open_url() {
|
||||
if [[ "$(uname)" == "Darwin" ]]; then
|
||||
open "${*}"
|
||||
else
|
||||
xdg-open "${*}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Create the clipboard reading function for Sequence Storm
|
||||
write_sequence_storm_reader() {
|
||||
if -e ~/.SequenceStormReader ]]; then
|
||||
@ -35,7 +62,7 @@ write_sequence_storm_reader() {
|
||||
fi
|
||||
# Here-document start
|
||||
cat << "EOF" > ~/.SequenceStormReader
|
||||
#! /bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Wait for the game to be launched
|
||||
while ! pgrep -u $USER ^SequenceStorm &> /dev/null ; do
|
||||
@ -45,16 +72,28 @@ done
|
||||
export DISPLAY=:0
|
||||
unset cliptext
|
||||
while pgrep -u $USER ^SequenceStorm &> /dev/null ; do
|
||||
if [[ "$(uname)" == "Darwin" ]]; then
|
||||
tmp="$(pbpaste 2> /dev/null)"
|
||||
else
|
||||
tmp="$(xclip -selection clipboard -o 2> /dev/null)"
|
||||
fi
|
||||
tmp="${tmp//%/ percent }"
|
||||
if [ "$tmp" != "$cliptext" ] ; then
|
||||
cliptext="$tmp"
|
||||
if [[ "${cliptext,,}" =~ key|load|private|says|terminal ]]; then
|
||||
if [[ "$(uname)" == "Darwin" ]]; then
|
||||
say -v alex -r 300 "$cliptext"
|
||||
else
|
||||
spd-say -w -r 50 -- "$cliptext"
|
||||
fi
|
||||
else
|
||||
if [[ "$(uname)" == "Darwin" ]]; then
|
||||
say -v alex -r 300 "$cliptext"
|
||||
else
|
||||
spd-say -r 50 -- "$cliptext"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
sleep 0.05
|
||||
done
|
||||
|
||||
@ -163,7 +202,7 @@ help() {
|
||||
echo -e "Usage:\n"
|
||||
echo "With no arguments, open the game launcher."
|
||||
for i in "${!command[@]}" ; do
|
||||
echo "-${i}: ${command[${i}]}"
|
||||
echo "-${i/:/ <parameter>}: ${command[${i}]}"
|
||||
done | sort
|
||||
exit 0
|
||||
}
|
||||
@ -231,11 +270,11 @@ game_removal() {
|
||||
--menu "Please select a game to delete" 0 0 0 "${menuList[@]}" --stdout)"
|
||||
if [[ ${#game} -gt 0 ]]; then
|
||||
if [[ "$game" == "Make a One Time Donation" ]]; then
|
||||
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=¤cy_code=USD&bn=PP-DonationsBF:btn_donateCC_LG.gif:NonHosted"
|
||||
open_url "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=¤cy_code=USD&bn=PP-DonationsBF:btn_donateCC_LG.gif:NonHosted"
|
||||
exit 0
|
||||
fi
|
||||
if [[ "$game" == "Become a Patron" ]]; then
|
||||
xdg-open "https://patreon.com/stormux"
|
||||
open_url "https://patreon.com/stormux"
|
||||
exit 0
|
||||
fi
|
||||
local winePath="${game#*|}"
|
||||
@ -261,6 +300,7 @@ game_launcher() {
|
||||
echo "Install some games first."
|
||||
exit 0
|
||||
fi
|
||||
if [[ $# -eq 0 ]]; then
|
||||
# Create the menu of installed games
|
||||
declare -a menuList
|
||||
for i in "${lines[@]}" ; do
|
||||
@ -272,13 +312,21 @@ game_launcher() {
|
||||
--clear \
|
||||
--no-tags \
|
||||
--menu "Please select a game to play" 0 0 0 "${menuList[@]}" --stdout)"
|
||||
else
|
||||
local game="$(grep "^${1}|" "${configFile}")"
|
||||
game="${game%|*}"
|
||||
if [[ -z "$game" ]]; then
|
||||
echo "Game $1 not found."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
if [[ ${#game} -gt 0 ]]; then
|
||||
if [[ "$game" == "Make a One Time Donation" ]]; then
|
||||
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=¤cy_code=USD&bn=PP-DonationsBF:btn_donateCC_LG.gif:NonHosted"
|
||||
open_url "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=¤cy_code=USD&bn=PP-DonationsBF:btn_donateCC_LG.gif:NonHosted"
|
||||
exit 0
|
||||
fi
|
||||
if [[ "$game" == "Become a Patron" ]]; then
|
||||
xdg-open "https://patreon.com/stormux"
|
||||
open_url "https://patreon.com/stormux"
|
||||
exit 0
|
||||
fi
|
||||
# for games that require custom scripts before launch
|
||||
@ -333,23 +381,6 @@ add_launcher() {
|
||||
fi
|
||||
}
|
||||
|
||||
automate_installer() {
|
||||
# Function arguments are the keys to be pressed.
|
||||
sleep 15
|
||||
declare -a keyList
|
||||
for i in ${@} ; do
|
||||
case "$i" in
|
||||
"alt+f") keyList+=("sleep 15 key ${i}");;
|
||||
"space") keyList+=("sleep 1 key ${i}");;
|
||||
*"+"*) keyList+=("sleep 1 key ${i}");;
|
||||
*) xdotool sleep 1 type ${i};;
|
||||
esac
|
||||
done
|
||||
xdotool ${keyList[*]} &
|
||||
# call wineserver -w in case something failed here, the user will have a chance to try to fix it.
|
||||
wineserver -w
|
||||
}
|
||||
|
||||
# Check for updates
|
||||
update
|
||||
# If display isn't set assume we are launching from console and an X environment is running using display :0
|
||||
@ -383,6 +414,7 @@ gameList=(
|
||||
#"Chopper Challenge"
|
||||
"Christmas WhoopAss"
|
||||
"Crazy Party"
|
||||
"Crazy Tennis"
|
||||
"Death on the Road"
|
||||
"Easter Quest"
|
||||
#"Entombed"
|
||||
@ -432,9 +464,10 @@ fi
|
||||
# Array of command line arguments
|
||||
declare -A command=(
|
||||
[c]="Check your system for necessary components."
|
||||
[d]="debug mode, wine will be much more verbose when games are launched with this flag."
|
||||
[h]="This help screen."
|
||||
[i]="Install games."
|
||||
[m]="Manually handle install screens instead of using xdotools."
|
||||
[l:]="launch given game without interactive audiogame-manager menu specified by its wine bottle."
|
||||
[N]="No cache, delete the installer after it has been extracted."
|
||||
[r]="Remove a game. This will delete all game data."
|
||||
)
|
||||
@ -445,9 +478,13 @@ args="${args//[[:space:]]/}"
|
||||
while getopts "${args}" i ; do
|
||||
case "$i" in
|
||||
c) checklist;;
|
||||
d)
|
||||
unset WINEDEBUG
|
||||
game_launcher
|
||||
;;
|
||||
h) help;;
|
||||
i) game_installer;;
|
||||
m) manualInstall="true";;
|
||||
l) game_launcher "${OPTARG}";;
|
||||
N) noCache="true";;
|
||||
r) game_removal;;
|
||||
esac
|
||||
@ -523,6 +560,14 @@ case "${game}" in
|
||||
add_launcher "c:\Program Files\Crazy-Party-beta73\Crazy Party.exe"
|
||||
rm -f "${WINEPREFIX}/drive_c/Program Files/Crazy-Party-beta73/nvdaControllerClient32.dll"
|
||||
;;
|
||||
"Crazy Tennis")
|
||||
install_wine_bottle speechsdk
|
||||
download "https://www.agarchive.net/games/VIP/crazy%20tennis%20setup.exe"
|
||||
wine "${cache}/crazy tennis setup.exe" /silent &
|
||||
xdotool sleep 10 key --clearmodifiers alt+y 2> /dev/null
|
||||
wineserver -w
|
||||
add_launcher "c:\Program Files\Crazytennis\crazytennis.exe"
|
||||
;;
|
||||
"Death on the Road")
|
||||
export winVer="win7"
|
||||
install_wine_bottle
|
||||
@ -890,10 +935,10 @@ EOF
|
||||
add_launcher "c:\Program Files\undead_assault\Undead Assault.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=¤cy_code=USD&bn=PP-DonationsBF:btn_donateCC_LG.gif:NonHosted"
|
||||
open_url "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=¤cy_code=USD&bn=PP-DonationsBF:btn_donateCC_LG.gif:NonHosted"
|
||||
;;
|
||||
"Become a Patron")
|
||||
xdg-open "https://patreon.com/stormux"
|
||||
open_url "https://patreon.com/stormux"
|
||||
;;
|
||||
*)
|
||||
exit 0
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Set Voice
|
||||
# Set the default wine voice based on installed options.
|
||||
# Rate can be specified as a numeric argument to this script, 1 through 9.
|
||||
@ -91,8 +91,12 @@ 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\\\\Tokens\\\\[^"]+"/"DefaultTokenId"="'"${oldVoice//\\/\\\\}"'"/g' "${WINEPREFIX}/user.reg"
|
||||
else
|
||||
sed -i -E -e 's/"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\(SOFTWARE|Software)\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Tokens\\\\[^"]+"/"DefaultTokenId"="'"${oldVoice//\\/\\\\}"'"/g' "${WINEPREFIX}/user.reg"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
set_voice() {
|
||||
@ -107,8 +111,13 @@ set_voice() {
|
||||
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
|
||||
# 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\\\\Tokens\\\\[^"]+"/"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\\\\Tokens\\\\[^"]+"/"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\'"${fullVoice//\\/\\\\}"'"\n"DefaultTTSRate"=dword:0000000'${2:-7}'/g' "${WINEPREFIX}/user.reg"
|
||||
fi
|
||||
}
|
||||
|
||||
test_voice() {
|
||||
@ -122,7 +131,11 @@ test_voice() {
|
||||
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
|
||||
if [[ "$(uname)" == "Darwin" ]]; then
|
||||
gsed -i -E -e 's/"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\(SOFTWARE|Software)\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Tokens\\\\[^"]+"/"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\\\\Tokens\\\\[^"]+"/"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\'"${fullVoice//\\/\\\\}"'"/g' "${WINEPREFIX}/user.reg"
|
||||
fi
|
||||
cat << "EOF" > /tmp/speak.vbs
|
||||
dim speechobject
|
||||
set speechobject=createobject("sapi.spvoice")
|
||||
@ -138,13 +151,21 @@ trap restore_voice SIGINT
|
||||
# Create an array of available voices.
|
||||
ifs="$IFS"
|
||||
IFS=$'\n'
|
||||
if [[ "$(uname)" == "Darwin" ]]; then
|
||||
voiceListFullName=($(ggrep -P '\[Software\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Tokens\\\\[^\\]+\].*' "${WINEPREFIX}/system.reg" | sed -E -e 's/\[([^]]+)\].*/\1/g'))
|
||||
else
|
||||
voiceListFullName=($(grep -P '\[Software\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Tokens\\\\[^\\]+\].*' "${WINEPREFIX}/system.reg" | sed -E -e 's/\[([^]]+)\].*/\1/g'))
|
||||
fi
|
||||
IFS="$ifs"
|
||||
voiceList=()
|
||||
for x in "${voiceListFullName[@]}" ; do
|
||||
voiceList+=("$(echo "$x" | rev | cut -d\\ -f1 | rev)")
|
||||
done
|
||||
if [[ "$(uname)" == "Darwin" ]]; then
|
||||
oldVoice="$(ggrep -P '"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\(SOFTWARE|Software)\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Tokens\\\\[^"]+"' "${WINEPREFIX}/user.reg" | sed -E -e 's/"DefaultTokenId"="([^"]+)"/\1/g')"
|
||||
else
|
||||
oldVoice="$(grep -P '"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\(SOFTWARE|Software)\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Tokens\\\\[^"]+"' "${WINEPREFIX}/user.reg" | sed -E -e 's/"DefaultTokenId"="([^"]+)"/\1/g')"
|
||||
fi
|
||||
echo "oldVoice: ${oldVoice}"
|
||||
echo "voiceList: ${voiceList[@]}"
|
||||
echo "voiceListFullName: ${voiceListFullName[@]}"
|
||||
|
Loading…
Reference in New Issue
Block a user