From 91741afa642b72d28d706cfbf47640f9f7ce58c5 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Fri, 11 Dec 2020 21:46:50 -0500 Subject: [PATCH 01/10] Working toward Mac compatability. --- audiogame-manager.sh | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/audiogame-manager.sh b/audiogame-manager.sh index 526b6e3..a15002d 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Dialog accessibility export DIALOGOPTS='--no-lines --visit-items' @@ -28,6 +28,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 @@ -231,11 +240,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#*|}" @@ -274,11 +283,11 @@ game_launcher() { --menu "Please select a game to play" 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 # for games that require custom scripts before launch @@ -890,10 +899,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 From 858211865d64e3ea58ef6e223eff9f7556503432 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Fri, 11 Dec 2020 23:01:49 -0500 Subject: [PATCH 02/10] Updated sequence storm reader for Mac compatibility. --- audiogame-manager.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/audiogame-manager.sh b/audiogame-manager.sh index a15002d..93d185a 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -44,7 +44,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 @@ -54,14 +54,26 @@ done export DISPLAY=:0 unset cliptext while pgrep -u $USER ^SequenceStorm &> /dev/null ; do - tmp="$(xclip -selection clipboard -o 2> /dev/null)" + 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 - spd-say -w -r 50 -- "$cliptext" + if [[ "$(uname)" == "Darwin" ]]; then + say -v alex -r 300 "$cliptext" + else + spd-say -w -r 50 -- "$cliptext" + fi else - spd-say -r 50 -- "$cliptext" + if [[ "$(uname)" == "Darwin" ]]; then + say -v alex -r 300 "$cliptext" + else + spd-say -r 50 -- "$cliptext" + fi fi fi sleep 0.05 From bd2763ee54a6c991b7baea4455cf2d4833d24636 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sat, 12 Dec 2020 01:11:43 -0500 Subject: [PATCH 03/10] Added -l option to launch games without going through the menu. --- audiogame-manager.sh | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/audiogame-manager.sh b/audiogame-manager.sh index 93d185a..8b019a4 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -282,17 +282,26 @@ game_launcher() { echo "Install some games first." exit 0 fi - # Create the menu of installed games - declare -a menuList - for i in "${lines[@]}" ; do - menuList+=("${i%|*}" "${i##*|}") - done - menuList+=("Make a One Time Donation" "Make a One Time Donation") - menuList+=("Become a Patron" "Become a Patron") - local game="$(dialog --backtitle "Audio Game Launcher" \ - --clear \ - --no-tags \ - --menu "Please select a game to play" 0 0 0 "${menuList[@]}" --stdout)" + if [[ $# -eq 0 ]]; then + # Create the menu of installed games + declare -a menuList + for i in "${lines[@]}" ; do + menuList+=("${i%|*}" "${i##*|}") + done + menuList+=("Make a One Time Donation" "Make a One Time Donation") + menuList+=("Become a Patron" "Become a Patron") + local game="$(dialog --backtitle "Audio 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 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" @@ -455,7 +464,7 @@ declare -A command=( [c]="Check your system for necessary components." [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." ) @@ -468,7 +477,7 @@ while getopts "${args}" i ; do c) checklist;; h) help;; i) game_installer;; - m) manualInstall="true";; + l) game_launcher "${OPTARG}";; N) noCache="true";; r) game_removal;; esac From 0403da6b0e66603adb5dbd08c0674e1fee0c6761 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sat, 12 Dec 2020 02:21:35 -0500 Subject: [PATCH 04/10] Updated set-voice for mac compatibility. --- speech/set-voice.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/speech/set-voice.sh b/speech/set-voice.sh index ef18b12..7bddd1e 100755 --- a/speech/set-voice.sh +++ b/speech/set-voice.sh @@ -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. From 3bdd559ae8784b4777802d52672e65657b73abdf Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sat, 12 Dec 2020 02:38:43 -0500 Subject: [PATCH 05/10] Updated set fvoice script to work with ggrep on mac. --- speech/set-voice.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/speech/set-voice.sh b/speech/set-voice.sh index 7bddd1e..e736f34 100755 --- a/speech/set-voice.sh +++ b/speech/set-voice.sh @@ -138,13 +138,21 @@ 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')) +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 -oldVoice="$(grep -P '"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\(SOFTWARE|Software)\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Tokens\\\\[^"]+"' "${WINEPREFIX}/user.reg" | sed -E -e 's/"DefaultTokenId"="([^"]+)"/\1/g')" +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[@]}" From 6401a61cacde14a0223db0234d6c06c6d20b2f33 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sat, 12 Dec 2020 02:46:08 -0500 Subject: [PATCH 06/10] Updated set fvoice script to work with gsed on mac. --- speech/set-voice.sh | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/speech/set-voice.sh b/speech/set-voice.sh index e736f34..946cccb 100755 --- a/speech/set-voice.sh +++ b/speech/set-voice.sh @@ -91,7 +91,11 @@ 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 - sed -i -E -e 's/"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\(SOFTWARE|Software)\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Tokens\\\\[^"]+"/"DefaultTokenId"="'"${oldVoice//\\/\\\\}"'"/g' "${WINEPREFIX}/user.reg" + 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 } @@ -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 - 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" + 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") From 3509cccf9661351fcc487f889427a7ddf691101e Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sat, 12 Dec 2020 03:17:31 -0500 Subject: [PATCH 07/10] Added a header, did some code cleanup. --- audiogame-manager.sh | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/audiogame-manager.sh b/audiogame-manager.sh index 8b019a4..caf6c2e 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -1,4 +1,22 @@ #!/usr/bin/env bash +# +# Copyright 2020, Stormux, +# +# 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' @@ -363,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 From a2504dcd7ea0f8802e68745d058c68b65072f90c Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sat, 12 Dec 2020 12:10:13 -0500 Subject: [PATCH 08/10] Improved the help function. --- audiogame-manager.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audiogame-manager.sh b/audiogame-manager.sh index caf6c2e..e1ea3b8 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -202,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/:/ }: ${command[${i}]}" done | sort exit 0 } From 763b6887f55ca280f9cb2fff70aaf95bc2bcb672 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sat, 12 Dec 2020 16:14:48 -0500 Subject: [PATCH 09/10] Added debug flag. --- audiogame-manager.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/audiogame-manager.sh b/audiogame-manager.sh index e1ea3b8..c12b057 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -463,6 +463,7 @@ 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." [l:]="launch given game without interactive audiogame-manager menu specified by its wine bottle." @@ -476,6 +477,10 @@ args="${args//[[:space:]]/}" while getopts "${args}" i ; do case "$i" in c) checklist;; + d) + unset WINEDEBUG + game_launcher + ;; h) help;; i) game_installer;; l) game_launcher "${OPTARG}";; From bd09450e4c93ecbf28f4141525ea0cfae3def1fc Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sun, 13 Dec 2020 12:21:33 -0500 Subject: [PATCH 10/10] Added game Crazy tennis. --- audiogame-manager.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/audiogame-manager.sh b/audiogame-manager.sh index c12b057..52dfa09 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -414,6 +414,7 @@ gameList=( #"Chopper Challenge" "Christmas WhoopAss" "Crazy Party" + "Crazy Tennis" "Death on the Road" "Easter Quest" #"Entombed" @@ -559,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