Compare commits

..

No commits in common. "22e4f89a061a7620c1894c197869f30660576919" and "50bb4a538367c5a07cb884c40c0f73d24cdd41cb" have entirely different histories.

7 changed files with 119 additions and 307 deletions

View File

@ -69,7 +69,7 @@ check_news() {
# Automatic update function # Automatic update function
update() { update() {
local url="$(git ls-remote --get-url)" local url="$(git ls-remote --get-url)"
if [[ "$url" =~ ^ssh://|git@|gitea@ ]] || [[ -z "$url" ]]; then if [[ "$url" =~ ^ssh://|git@ ]] || [[ -z "$url" ]]; then
return return
fi fi
git remote update &> /dev/null git remote update &> /dev/null
@ -130,6 +130,62 @@ desktop_launcher() {
exit 0 exit 0
} }
# Create the clipboard reading function for Sequence Storm
write_sequence_storm_reader() {
if -e ~/.SequenceStormReader ]]; then
return
fi
# Here-document start
cat << "EOF" > ~/.SequenceStormReader
#!/usr/bin/env bash
# Wait for the game to be launched
while ! pgrep -u "$USER" ^SequenceStorm &> /dev/null ; do
sleep 0.05
done
export DISPLAY=:0
unset cliptext
socketFile="$(find /tmp -maxdepth 1 -name "orca-*.sock")"
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
if [[ -w "${socketFile}" ]]; then
echo "<#APPEND#>$cliptext" | socat - UNIX-CLIENT:"${socketFile}"
else
spd-say -w -r 50 -- "$cliptext"
fi
fi
else
if [[ "$(uname)" == "Darwin" ]]; then
say -v alex -r 300 "$cliptext"
else
if [[ -w "${socketFile}" ]]; then
echo "$cliptext" | socat - UNIX-CLIENT:"${socketFile}"
else
spd-say -r 50 -- "$cliptext"
fi
fi
fi
fi
sleep 0.05
done
exit 0
EOF
# Here-document end
chmod 755 ~/.SequenceStormReader
}
# Wine configuration section # Wine configuration section
@ -196,24 +252,6 @@ checklist() {
errorList+=("Warning: Sox is not installed. Audio will not work.") errorList+=("Warning: Sox is not installed. Audio will not work.")
fi fi
packageList+=("sox") packageList+=("sox")
if command -v trans &> /dev/null ; then
[[ $# -eq 0 ]] && echo "Translate-shell is installed."
else
errorList+=("Warning: translate-shell is not installed. Games that require translation will not be translated.")
fi
packageList+=("translate-shell")
if command -v sqlite3 &> /dev/null ; then
[[ $# -eq 0 ]] && echo "Sqlite3 is installed."
else
errorList+=("Warning: sqlite is not installed. Required for games that need to be translated.")
fi
if command -v perl &> /dev/null ; then
[[ $# -eq 0 ]] && echo "Perl is installed."
else
errorList+=("Warning: perl is not installed. Required for games that need to be translated.")
fi
packageList+=("perl")
packageList+=("sqlite")
if command -v unix2dos &> /dev/null ; then if command -v unix2dos &> /dev/null ; then
[[ $# -eq 0 ]] && echo "Dos2unix is installed." [[ $# -eq 0 ]] && echo "Dos2unix is installed."
else else
@ -398,7 +436,6 @@ help() {
echo "The syntax is variable=\"value\"" echo "The syntax is variable=\"value\""
echo echo
echo "noCache=\"true\" # Do not keep downloaded items in the cache." echo "noCache=\"true\" # Do not keep downloaded items in the cache."
echo "noqjoypad=\"true\" # Do not launch qjoypad."
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)."
@ -541,7 +578,7 @@ install_wine_bottle() {
{ DISPLAY="" wineboot -u { DISPLAY="" wineboot -u
wine msiexec /i z:"$monoPath" /quiet wine msiexec /i z:"$monoPath" /quiet
wine msiexec /i z:"$geckoPath" /quiet wine msiexec /i z:"$geckoPath" /quiet
if [[ "${*}" =~ (speechsdk|sapi) ]]; then if [[ "${*}" =~ speechsdk ]]; then
install_rhvoice install_rhvoice
fi fi
if [[ "${WINEARCH}" == "win64" ]]; then if [[ "${WINEARCH}" == "win64" ]]; then
@ -732,37 +769,25 @@ game_launcher() {
if command -v qjoypad &> /dev/null ; then if command -v qjoypad &> /dev/null ; then
mkdir -p ~/.qjoypad3 mkdir -p ~/.qjoypad3
touch "${HOME}/.qjoypad3/${game%|*}.lyt" touch "${HOME}/.qjoypad3/${game%|*}.lyt"
if [[ "${noqjoypad}" != "true" ]]; then if pgrep qjoypad &> /dev/null ; then
if pgrep qjoypad &> /dev/null ; then qjoypad -T "${game%|*}" 2> /dev/null
qjoypad -T "${game%|*}" 2> /dev/null else
else qjoypad -T "${game%|*}" 2> /dev/null &
qjoypad -T "${game%|*}" 2> /dev/null &
fi
fi fi
fi fi
# for games that require custom scripts before launch or custom launch parameters # for games that require custom scripts before launch or custom launch parameters
if [[ "$game" =~ dragon-pong ]]; then
"${0%/*}/speech/speak_window_title.sh" DragonPong.exe &
pushd "$(winepath "$winePath")"
wine "$wineExec"
popd
exit 0
fi
if [[ "$game" =~ haunted-party ]]; then if [[ "$game" =~ haunted-party ]]; then
pgrep -u "$USER" nvda2speechd &> /dev/null || ${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd & pgrep -u "$USER" nvda2speechd &> /dev/null || ${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd &
fi fi
if [[ "$game" =~ laser-breakout ]]; then if [[ "$game" =~ laser-breakout ]]; then
pgrep -u "$USER" nvda2speechd &> /dev/null || ${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd & pgrep -u "$USER" nvda2speechd &> /dev/null || ${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd &
fi fi
if [[ "$game" =~ ^bokurano-daibouken-2\| ]]; then if [[ "$game" =~ ^bokurano-daibouken\||bokurano-daibouken-2\| ]]; then
"${0%/*}/speech/clipboard_translator.sh" play.exe bokurano-daibouken2 & "${0%/*}/speech/clipboard_translator.sh" play.exe &
fi
if [[ "$game" =~ ^bokurano-daibouken\| ]]; then
"${0%/*}/speech/clipboard_translator.sh" play.exe bokurano-daibouken &
fi fi
if [[ "$game" =~ shadow-line ]]; then if [[ "$game" =~ shadow-line ]]; then
find "${WINEPREFIX}/drive_c/" -type f -name 'nvdaControllerClient.dll' -exec rm -v "{}" \; find "${WINEPREFIX}/drive_c/" -type f -name 'nvdaControllerClient.dll' -exec rm -v "{}" \;
"${0%/*}/speech/clipboard_translator.sh" play_sr.exe shadow-line & "${0%/*}/speech/clipboard_translator.sh" play_sr.exe &
fi fi
if [[ "$game" =~ bokurano-daibouken-3 ]]; then if [[ "$game" =~ bokurano-daibouken-3 ]]; then
dictPath="$(winepath "${winePath}")" dictPath="$(winepath "${winePath}")"
@ -777,7 +802,7 @@ game_launcher() {
fi fi
if [[ ! -d "${dictPath}/dict" ]] && [[ ! -r "${cache}/bk3-dict.dat" ]]; then if [[ ! -d "${dictPath}/dict" ]] && [[ ! -r "${cache}/bk3-dict.dat" ]]; then
find "${WINEPREFIX}/drive_c/nyanchangame/bk3" -type f -name 'nvdaControllerClient.dll' -exec rm -v "{}" \; find "${WINEPREFIX}/drive_c/nyanchangame/bk3" -type f -name 'nvdaControllerClient.dll' -exec rm -v "{}" \;
"${0%/*}/speech/clipboard_translator.sh" play.exe bokurano-daibouken3 & "${0%/*}/speech/clipboard_translator.sh" play.exe &
fi fi
fi fi
if [[ "$game" =~ bop-it-emulator ]]; then if [[ "$game" =~ bop-it-emulator ]]; then
@ -790,7 +815,7 @@ game_launcher() {
"${0%/*}/speech/speak_window_title.sh" trtr.exe & "${0%/*}/speech/speak_window_title.sh" trtr.exe &
fi fi
if [[ "$game" =~ sequence-storm ]]; then if [[ "$game" =~ sequence-storm ]]; then
"${0%/*}/speech/clipboard_reader.sh" SequenceStorm & [[ -x ~/.SequenceStormReader ]] && ~/.SequenceStormReader &
fi fi
if [[ "$game" =~ audiodisc ]]; then if [[ "$game" =~ audiodisc ]]; then
wine "$winePath\\$wineExec" wine "$winePath\\$wineExec"
@ -800,7 +825,7 @@ game_launcher() {
wine "$winePath\\$wineExec" wine "$winePath\\$wineExec"
exit 0 exit 0
fi fi
if [[ "$game" =~ rs-games ]] || [[ "$game" =~ screaming-strike-2 ]]; then if [[ "$game" =~ screaming-strike-2 ]]; then
pushd "$(winepath "$winePath")" pushd "$(winepath "$winePath")"
wine "$wineExec" wine "$wineExec"
popd popd
@ -972,14 +997,13 @@ gameList=(
"Crazy Party" "Crazy Party"
"Crazy Tennis" "Crazy Tennis"
"Crime Hunter" "Crime Hunter"
"Danger City"
"Danger on the Wheel" "Danger on the Wheel"
#"Dark Destroyer" #"Dark Destroyer"
"Daytona and the Book of Gold" "Daytona and the Book of Gold"
"Death on the Road" "Death on the Road"
"Deathmatch" "Deathmatch"
"Dog Who Hates Toast" "Dog Who Hates Toast"
"Dragon Pong" #"Dragon Pong"
"Duck Hunt" "Duck Hunt"
"DynaMan" "DynaMan"
"Easter Quest" "Easter Quest"
@ -1067,7 +1091,7 @@ gameList=(
"The Vale" "The Vale"
"Thief" "Thief"
"Traders of Known Space" "Traders of Known Space"
"Three D velocity" #"Three D velocity"
"Tomb Hunter" "Tomb Hunter"
"Top Speed 2" "Top Speed 2"
"Top Speed 3" "Top Speed 3"
@ -1111,7 +1135,6 @@ declare -A command=(
[N]="No cache, delete the installer after it has been extracted." [N]="No cache, delete the installer after it has been extracted."
[n]="No RHVoice, do not install RHVoice when the game is installed." [n]="No RHVoice, do not install RHVoice when the game is installed."
[P]="Print a list of packages required by audiogame-manager." [P]="Print a list of packages required by audiogame-manager."
[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."
[t]="Total games. Show how many games are currently available." [t]="Total games. Show how many games are currently available."
@ -1141,9 +1164,6 @@ while getopts "${args}" i ; do
N) noCache="true";; N) noCache="true";;
n) norh="true";; n) norh="true";;
P) checklist quiet;; P) checklist quiet;;
q)
noqjoypad="true"
game_launcher;;
R) redownload="true";; R) redownload="true";;
r) game_removal;; r) game_removal;;
t) t)
@ -1650,9 +1670,7 @@ case "${game}" in
export bottle="nyanchan" export bottle="nyanchan"
export winVer="win7" export winVer="win7"
install_wine_bottle install_wine_bottle
download "https://www.nyanchangames.com/softs/nn3_setup.exe" "https://github.com/RastislavKish/nvda2speechd/releases/download/v0.1/nvda2speechd" "https://github.com/RastislavKish/nvda2speechd/releases/download/v0.1/nvda2speechd32.dll" download "https://www.nyanchangames.com/softs/nn3_setup.exe" "https://github.com/RastislavKish/nvda2speechd/releases/download/v0.1/nvda2speechd32.dll"
cp "${cache}/nvda2speechd" "${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd"
chmod +x "${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd"
7z x -o"$WINEPREFIX/drive_c/nyanchangame/bk3" "${cache}/nn3_setup.exe" 7z x -o"$WINEPREFIX/drive_c/nyanchangame/bk3" "${cache}/nn3_setup.exe"
find "${WINEPREFIX}" -type f -name 'nvdaControllerClient.dll' -exec cp -v "${cache}/nvda2speechd32.dll" "{}" \; find "${WINEPREFIX}" -type f -name 'nvdaControllerClient.dll' -exec cp -v "${cache}/nvda2speechd32.dll" "{}" \;
add_launcher "c:\nyanchangame\bk3\play.exe" add_launcher "c:\nyanchangame\bk3\play.exe"
@ -1800,17 +1818,6 @@ case "${game}" in
find "${WINEPREFIX}" -type f -name 'nvdaControllerClient64.dll' -exec cp -v "${cache}/nvda2speechd64.dll" "{}" \; find "${WINEPREFIX}" -type f -name 'nvdaControllerClient64.dll' -exec cp -v "${cache}/nvda2speechd64.dll" "{}" \;
add_launcher "c:\Program Files\crime-hunter\ch.exe" add_launcher "c:\Program Files\crime-hunter\ch.exe"
;; ;;
"Danger City")
install_wine_bottle vb6run dx8vb
download "https://www.agarchive.net/games/xl/DangerCityBeta2.exe"
wine "$cache/DangerCityBeta2.exe" /silent &
xdotool sleep 15 key --clearmodifiers --delay 200 Return 2> /dev/null
xdotool sleep 5 key --clearmodifiers --delay 200 Return 2> /dev/null
xdotool sleep 5key --clearmodifiers --delay 200 Return 2> /dev/null
xdotool sleep 10 --clearmodifiers --delay 200 Return 2> /dev/null
wineserver -w
add_launcher 'c:\Program Files\Danger City\dc.exe'
;;
"Danger on the Wheel") "Danger on the Wheel")
export bottle="oriol-gomez" export bottle="oriol-gomez"
export winVer="win7" export winVer="win7"
@ -1865,8 +1872,7 @@ case "${game}" in
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 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") "Dragon Pong")
export winVer="win7" install_wine_bottle vb6run dx8vb speechsdk
install_wine_bottle
download "https://www.iamtalon.me/games/dragonpong.zip" download "https://www.iamtalon.me/games/dragonpong.zip"
unzip -d "$WINEPREFIX/drive_c/Program Files" "${cache}/dragonpong.zip" unzip -d "$WINEPREFIX/drive_c/Program Files" "${cache}/dragonpong.zip"
add_launcher "c:\Program Files\dragonpong\DragonPong.exe" add_launcher "c:\Program Files\dragonpong\DragonPong.exe"
@ -2625,9 +2631,9 @@ EOF
download "https://www.kaldobsky.com/audiogames/Swamp.zip" download "https://www.kaldobsky.com/audiogames/Swamp.zip"
unzip -d "$WINEPREFIX/drive_c/Program Files/swamp" "${cache}/Swamp.zip" unzip -d "$WINEPREFIX/drive_c/Program Files/swamp" "${cache}/Swamp.zip"
# make sure the latest version is installed. # make sure the latest version is installed.
if wget -O "${cache}/SwampPatch.zip" "https://www.kaldobsky.com/audiogames/SwampPatch.zip" ; then #if wget -O "${cache}/SwampPatch.zip" "https://www.kaldobsky.com/audiogames/SwampPatch.zip" ; then
unzip -o -d "$WINEPREFIX/drive_c/Program Files/swamp" "${cache}/SwampPatch.zip" #nzip -o -d "$WINEPREFIX/drive_c/Program Files/swamp" "${cache}/SwampPatch.zip"
fi #fi
wine 'c:\Program Files\swamp\checkup.exe' /verysilent wine 'c:\Program Files\swamp\checkup.exe' /verysilent
#wine cmd.exe /c 'cd /d c:\Program Files\swamp && Windows32bit.bat' #wine cmd.exe /c 'cd /d c:\Program Files\swamp && Windows32bit.bat'
# Delete music if requested. # Delete music if requested.
@ -2726,16 +2732,13 @@ EOF
;; ;;
"Three D velocity") "Three D velocity")
export winVer="win10" export winVer="win10"
export WINEARCH=win64 install_wine_bottle speechsdk
export norh=false # Must install a voice, and rhvoice works easily with 64 bit.
install_wine_bottle sapi vcrun2008 gdiplus xact dotnet48 xna40
# Dotnet is evil. That is all. # Dotnet is evil. That is all.
# LC_ALL=C winetricks -q dotnet48 LC_ALL=C winetricks -q dotnet472
# wineserver -k # Ha ha ha. wineserver -k # Ha ha ha.
download "https://github.com/munawarb/Three-D-Velocity-Binaries/archive/master.zip" "https://github.com/RastislavKish/nvda2speechd/releases/download/v0.1/nvda2speechd64.dll" "https://github.com/RastislavKish/nvda2speechd/releases/download/v0.1/nvda2speechd32.dll" download "https://github.com/munawarb/Three-D-Velocity-Binaries/archive/master.zip" "https://stormgames.wolfe.casa/downloads/nvdaControllerClient32.dll"
unzip -d "$WINEPREFIX/drive_c/Program Files" "${cache}/master.zip" unzip -d "$WINEPREFIX/drive_c/Program Files" "${cache}/master.zip"
find "${WINEPREFIX}" -type f -name 'nvdaControllerClient32.dll' -exec cp -v "${cache}/nvda2speechd32.dll" "{}" \; find "${WINEPREFIX}" -type f -name 'nvdaControllerClient32.dll' -exec cp -v "${cache}/nvdaControllerClient32.dll" "{}" \;
find "${WINEPREFIX}" -type f -name 'nvdaControllerClient64.dll' -exec cp -v "${cache}/nvda2speechd64.dll" "{}" \;
add_launcher "c:\Program Files\Three-D-Velocity-Binaries-master\tdv.exe" add_launcher "c:\Program Files\Three-D-Velocity-Binaries-master\tdv.exe"
;; ;;
"Triple Triad") "Triple Triad")

View File

@ -1,47 +0,0 @@
#!/usr/bin/env bash
# Wait for the game to be launched
while ! pgrep -u "$USER" ^$1 &> /dev/null ; do
sleep 0.05
done
unset cliptext
socketFile="$(find /tmp -maxdepth 1 -name "orca-*.sock")"
while pgrep -u "$USER" ^$1 &> /dev/null ; do
sleep 0.05
if [[ -f ~/.agmsilent ]]; then
continue
fi
if [[ "$(uname)" == "Darwin" ]]; then
tmp="$(pbpaste 2> /dev/null)"
else
tmp="$(xclip -d "${DISPLAY:-:0}" -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
if [[ -w "${socketFile}" ]]; then
echo "<#APPEND#>$cliptext" | socat - UNIX-CLIENT:"${socketFile}"
else
spd-say -w -r 50 -- "$cliptext"
fi
fi
else
if [[ "$(uname)" == "Darwin" ]]; then
say -v alex -r 300 "$cliptext"
else
if [[ -w "${socketFile}" ]]; then
echo "$cliptext" | socat - UNIX-CLIENT:"${socketFile}"
else
spd-say -r 50 -- "$cliptext"
fi
fi
fi
fi
done
exit 0

View File

@ -1,82 +1,54 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Modified from the script at: cleanup() {
# https://gist.github.com/fdietze/6768a0970d7d732b7fbd7930ccceee2a sort -uo "$dictionaryFile" "$dictionaryFile"
}
set -Eeuo pipefail # https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/#:~:text=set%20%2Du,is%20often%20highly%20desirable%20behavior. trap cleanup EXIT
shopt -s expand_aliases
# Clear the clipboard so you don't accidently send personal info to the translator.
echo "" | xclip -d "${DISPLAY:-:0}" -selection clipboard 2> /dev/null
export dictionaryFile="${XDG_CONFIG_HOME:-$HOME/.config}/storm-games/audiogame-manager/translations.txt"
if [[ ! -r "$dictionaryFile" ]]; then
touch "$dictionaryFile"
fi
if [[ $# -ne 2 ]]; then if [[ $# -ne 1 ]]; then
echo "Usage: $0 \"application name\" \"file name\"." echo "Usage: $0 application name."
exit 1
fi fi
# Wait for the application to start # Wait for the application to start
while ! pgrep -u "$USER" ^$1 &> /dev/null ; do while ! pgrep -u "$USER" ^$1 &> /dev/null ; do
sleep 0.05 sleep 0.05
done done
fileName="${2,,}"
fileName="${fileName//[[:space:]]/-}.sqlite"
translationFile="${XDG_CACHE_HOME:-$HOME/.cache}/audiogame-manager/${fileName}"
# Read so long as the application is running # Read so long as the application is running
while pgrep -u "$USER" ^$1 &> /dev/null ; do while pgrep -u "$USER" ^$1 &> /dev/null ; do
sleep 0.05 newText=""
text="$(xclip -d "${DISPLAY:-:0}" -selection clipboard -o 2> /dev/null)" translatedText=""
if [[ -f ~/.agmsilent ]]; then newText="$(xclip -d "${DISPLAY:-:0}" -selection clipboard -o 2> /dev/null)"
sleep 0.01
if [[ "${#newText}" -lt 1 ]]; then
continue continue
fi fi
if [[ "${text}" =~ ^[0-9A-Za-z[:space:][:punct:]]+$ ]]; then if [[ "${newText}" =~ ^[0-9A-Za-z[:space:][:punct:]]+$ ]]; then
spd-say -- "$text" spd-say -- "$newText"
echo "" | xclip -d "${DISPLAY:-:0}" -selection clipboard 2> /dev/null echo "" | xclip -d "${DISPLAY:-:0}" -selection clipboard 2> /dev/null
continue continue
fi fi
if [[ -z "$text" ]]; then export newText
translatedText="$(awk -v originalText="${newText})==:" 'BEGIN { exitCode = 1; FS = "\\)==:\\[" }
$0~originalText { print $2; exitCode = 0; exit}
END { exit exitCode }' "$dictionaryFile")"
if [[ "${#translatedText}" -ge 1 ]]; then
spd-say -- "$translatedText"
echo "" | xclip -d "${DISPLAY:-:0}" -selection clipboard 2> /dev/null
continue continue
fi fi
q() { sqlite3 -column -init "" "$translationFile" "$@" 2> /dev/null ; } translatedText="$(trans -no-autocorrect -b -- "$newText")"
if ! [[ "${newText}" =~ ^[0-9[:punct:]]+$ ]]; then
echo "${newText})==:[${translatedText}" >> "$dictionaryFile"
if [[ ! -s "$translationFile" ]]; then
rm -f "$translationFile"
cat << EOF | sqlite3 -init "" "$translationFile" 2> /dev/null
.bail on
CREATE TABLE translations(
text TEXT NOT NULL,
translation TEXT NOT NULL,
PRIMARY KEY (text)
);
CREATE INDEX translations_text_idx ON translations (text);
EOF
fi fi
spd-say -- "$translatedText"
# https://en.wikipedia.org/wiki/Unicode_equivalence#Combining_and_precomposed_characters
# https://www.effectiveperlprogramming.com/2011/09/normalize-your-perl-source/
alias nfc="perl -MUnicode::Normalize -CS -ne 'print NFC(\$_)'" # composed characters
# Normalize different unicode space characters to the same space
# https://stackoverflow.com/a/43640405
alias normalize_spaces="perl -CSDA -plE 's/[^\\S\\t]/ /g'"
alias normalize_unicode="normalize_spaces | nfc"
textEscaped="$(echo "$text" | sed "s/'/''/g" | normalize_unicode)" # escape single quotes for sqlite
translated="$(q "SELECT translation FROM translations WHERE text = '$textEscaped' LIMIT 1" | sed 's/\s*$//')"
if [[ -z "$translated" ]]; then
translated="$(trans -no-autocorrect -no-warn -brief "$text" | head -1 | sed 's/\s*$//' | normalize_unicode)"
if [[ -n "$translated" ]]; then
translatedEscaped="$(echo "$translated" | sed "s/'/''/g")"
q "INSERT OR IGNORE INTO translations (text, translation) VALUES ('$textEscaped', '$translatedEscaped')"
fi
fi
spd-say -- "$translated"
echo "" | xclip -d "${DISPLAY:-:0}" -selection clipboard 2> /dev/null echo "" | xclip -d "${DISPLAY:-:0}" -selection clipboard 2> /dev/null
done done
exit 0

View File

@ -1,11 +0,0 @@
#!/usr/bin/env bash
export DISPLAY=${DISPLAY:-:0}
export WINEARCH=win32
export WINEPREFIX=~/.local/wine/${1:-nvda}
export winetricksPath="${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager"
${winetricksPath}/winetricks msaa riched20 riched30 win7
[[ -f ~/Downloads/nvda_2017.3.exe ]] || wget -O ~/Downloads/nvda_2017.3.exe https://www.nvaccess.org/download/nvda/releases/2017.3/nvda_2017.3.exe
wine ~/Downloads/nvda_2017.3.exe

View File

@ -113,12 +113,12 @@ menulist() {
for i in "${@}" ; do for i in "${@}" ; do
menuList+=("$i" "$i") menuList+=("$i" "$i")
done done
dialog --backtitle "Use the up and down arrow keys to find the option you want, then press enter to select it." \ dialog --backtitle "$(gettext "Use the up and down arrow keys to find the option you want, then press enter to select it.")" \
--clear \ --clear \
--extra-button \ --extra-button \
--extra-label "Test Voice" \ --extra-label "$(gettext "Test Voice")" \
--no-tags \ --no-tags \
--menu "Please select one" 0 0 0 "${menuList[@]}" --stdout --menu "$(gettext "Please select one")" 0 0 0 "${menuList[@]}" --stdout
return $? return $?
} }
@ -163,12 +163,12 @@ test_voice() {
fullVoice="${fullVoice/RHVoice/RHVoice\\\\${RHVoiceName}}" 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 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\\\\Token(Enum|)s\\\\[^"]+"/"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\'"${fullVoice//\\/\\\\}"'"/g' "${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//\\/\\\\}"'"/g' "${WINEPREFIX}/user.reg"
cat << "EOF" > "${bottle}/drive_c/windows/temp/speak.vbs" cat << "EOF" > /tmp/speak.vbs
dim speechobject dim speechobject
set speechobject=createobject("sapi.spvoice") 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." 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 EOF
wine cscript "c:\windows\temp\speak.vbs" wine cscript "z:\tmp\speak.vbs"
} }
# Handle voice restore, but only if voice changed # Handle voice restore, but only if voice changed
@ -176,12 +176,12 @@ doRestore=1
trap restore_voice SIGINT trap restore_voice SIGINT
# In case the user hasn't run a game using sapi in this prefix yet, let's try to initialize all the registry keys properly. # In case the user hasn't run a game using sapi in this prefix yet, let's try to initialize all the registry keys properly.
cat << "EOF" > "${bottle}/drive_c/windows/temp/speak.vbs" cat << "EOF" > /tmp/speak.vbs
dim speechobject dim speechobject
set speechobject=createobject("sapi.spvoice") set speechobject=createobject("sapi.spvoice")
speechobject.speak "" speechobject.speak ""
EOF EOF
wine cscript "c:\windows\temp\speak.vbs" wine cscript "z:\tmp\speak.vbs"
# Create an array of available voices. # Create an array of available voices.
ifs="$IFS" ifs="$IFS"
@ -194,7 +194,7 @@ for x in "${voiceListFullName[@]}" ; do
done done
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')" 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 exit=1
if [[ "${#voiceList[@]}" -eq 0 ]]; then if [[ "${voiceList[@]}" -eq 0 ]]; then
dialog --msgbox "No voices found." -1 -1 dialog --msgbox "No voices found." -1 -1
exit 1 exit 1
fi fi

View File

@ -9,10 +9,6 @@ done
# Read so long as the application is running # Read so long as the application is running
while pgrep -u "$USER" ^$1 &> /dev/null ; do while pgrep -u "$USER" ^$1 &> /dev/null ; do
sleep 0.05
if [[ -f ~/.agmsilent ]]; then
continue
fi
wnd_focus=$(xdotool getwindowfocus) wnd_focus=$(xdotool getwindowfocus)
wnd_title=$(xprop -id $wnd_focus WM_NAME) wnd_title=$(xprop -id $wnd_focus WM_NAME)
lookfor='"(.*)"' lookfor='"(.*)"'
@ -24,6 +20,5 @@ while pgrep -u "$USER" ^$1 &> /dev/null ; do
old_title="$wnd_title" old_title="$wnd_title"
fi fi
fi fi
sleep 0.01
done done
exit 0

View File

@ -1,100 +0,0 @@
#!/bin/bash
# Immediately exit if errors are encountered.
set -e
# Installer/configuration tool for wine
# If this fails on your system, please contact storm_dragon@linux-a11y.org
is_function() {
LC_ALL=C type "$1" 2> /dev/null | grep -q "$1 is a function"
}
configure_arch() {
packageList=(
cabextract
dialog
dos2unix
gawk
unzip
w3m
wget
wine
winetricks
wine_gecko
wine-mono
sdl2
ncurses
mpg123
libpulse
libpng
libjpeg-turbo
gnutls
alsa-plugins
alsa-lib
mesa
openal
translate-shell
xz
gst-plugins-bad
gst-plugins-good
gst-plugins-ugly
gst-libav
p7zip
)
if [[ "$(uname -m)" == "x86_64" ]]; then
# Enable multilib
sudo sed -i '/^#\[multilib\]$/{{N;s/^#\[multilib\]\n#Include = \/etc\/pacman.d\/mirrorlist$/[multilib]\nInclude = \/etc\/pacman.d\/mirrorlist/;t;P;D}}' /etc/pacman.conf
# include lib32 packages.
packageList+=(
lib32-sdl2
lib32-ncurses
lib32-mpg123
lib32-libpulse
lib32-libpng
lib32-libjpeg-turbo
lib32-gnutls
lib32-alsa-plugins
lib32-alsa-lib
lib32-mesa
lib32-openal
lib32-gst-plugins-good
lib32-gst-plugins-bad
lib32-gst-plugins-ugly
lib32-gst-libav)
fi
# Some of these may fail, so do them in a for loop.
yay -Syy
for i in "${packageList[@]}" ; do
yay -S --needed --noconfirm $i
done
}
configure_debian() {
packageList=(
dialog
gawk
gstreamer1.0-plugins-bad:i386
gstreamer1.0-plugins-good:i386
gstreamer1.0-plugins-ugly:i386
mono-complete
ncurses5-dev
w3m
winehq-stable
)
# make sure 32 bit libraries are available
sudo dpkg --add-architecture i386
sudo apt install --install-recommends ${packageList[*]}
}
distro="$(head -1 /etc/issue | cut -d ' ' -f1)"
distro="${distro,,}"
if is_function configure_${distro} ; then
configure_${distro}
else
echo "${distro^} is not yet supported. If you want it added, please contact storm_dragon@linux-a11y.org" | fold -s -w 72
fi
exit 0