Compare commits
No commits in common. "22e4f89a061a7620c1894c197869f30660576919" and "50bb4a538367c5a07cb884c40c0f73d24cdd41cb" have entirely different histories.
22e4f89a06
...
50bb4a5383
@ -69,7 +69,7 @@ check_news() {
|
||||
# Automatic update function
|
||||
update() {
|
||||
local url="$(git ls-remote --get-url)"
|
||||
if [[ "$url" =~ ^ssh://|git@|gitea@ ]] || [[ -z "$url" ]]; then
|
||||
if [[ "$url" =~ ^ssh://|git@ ]] || [[ -z "$url" ]]; then
|
||||
return
|
||||
fi
|
||||
git remote update &> /dev/null
|
||||
@ -130,6 +130,62 @@ desktop_launcher() {
|
||||
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
|
||||
|
||||
@ -196,24 +252,6 @@ checklist() {
|
||||
errorList+=("Warning: Sox is not installed. Audio will not work.")
|
||||
fi
|
||||
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
|
||||
[[ $# -eq 0 ]] && echo "Dos2unix is installed."
|
||||
else
|
||||
@ -398,7 +436,6 @@ help() {
|
||||
echo "The syntax is variable=\"value\""
|
||||
echo
|
||||
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 "redownload=\"true\" # Redownload sources, do not use the version stored in cache."
|
||||
echo "rhvoice=\"voicename\" # Select the voice to be installed (default Bdl)."
|
||||
@ -541,7 +578,7 @@ install_wine_bottle() {
|
||||
{ DISPLAY="" wineboot -u
|
||||
wine msiexec /i z:"$monoPath" /quiet
|
||||
wine msiexec /i z:"$geckoPath" /quiet
|
||||
if [[ "${*}" =~ (speechsdk|sapi) ]]; then
|
||||
if [[ "${*}" =~ speechsdk ]]; then
|
||||
install_rhvoice
|
||||
fi
|
||||
if [[ "${WINEARCH}" == "win64" ]]; then
|
||||
@ -732,37 +769,25 @@ game_launcher() {
|
||||
if command -v qjoypad &> /dev/null ; then
|
||||
mkdir -p ~/.qjoypad3
|
||||
touch "${HOME}/.qjoypad3/${game%|*}.lyt"
|
||||
if [[ "${noqjoypad}" != "true" ]]; then
|
||||
if pgrep qjoypad &> /dev/null ; then
|
||||
qjoypad -T "${game%|*}" 2> /dev/null
|
||||
else
|
||||
qjoypad -T "${game%|*}" 2> /dev/null &
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
# 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
|
||||
pgrep -u "$USER" nvda2speechd &> /dev/null || ${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd &
|
||||
fi
|
||||
if [[ "$game" =~ laser-breakout ]]; then
|
||||
pgrep -u "$USER" nvda2speechd &> /dev/null || ${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd &
|
||||
fi
|
||||
if [[ "$game" =~ ^bokurano-daibouken-2\| ]]; then
|
||||
"${0%/*}/speech/clipboard_translator.sh" play.exe bokurano-daibouken2 &
|
||||
fi
|
||||
if [[ "$game" =~ ^bokurano-daibouken\| ]]; then
|
||||
"${0%/*}/speech/clipboard_translator.sh" play.exe bokurano-daibouken &
|
||||
if [[ "$game" =~ ^bokurano-daibouken\||bokurano-daibouken-2\| ]]; then
|
||||
"${0%/*}/speech/clipboard_translator.sh" play.exe &
|
||||
fi
|
||||
if [[ "$game" =~ shadow-line ]]; then
|
||||
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
|
||||
if [[ "$game" =~ bokurano-daibouken-3 ]]; then
|
||||
dictPath="$(winepath "${winePath}")"
|
||||
@ -777,7 +802,7 @@ game_launcher() {
|
||||
fi
|
||||
if [[ ! -d "${dictPath}/dict" ]] && [[ ! -r "${cache}/bk3-dict.dat" ]]; then
|
||||
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
|
||||
if [[ "$game" =~ bop-it-emulator ]]; then
|
||||
@ -790,7 +815,7 @@ game_launcher() {
|
||||
"${0%/*}/speech/speak_window_title.sh" trtr.exe &
|
||||
fi
|
||||
if [[ "$game" =~ sequence-storm ]]; then
|
||||
"${0%/*}/speech/clipboard_reader.sh" SequenceStorm &
|
||||
[[ -x ~/.SequenceStormReader ]] && ~/.SequenceStormReader &
|
||||
fi
|
||||
if [[ "$game" =~ audiodisc ]]; then
|
||||
wine "$winePath\\$wineExec"
|
||||
@ -800,7 +825,7 @@ game_launcher() {
|
||||
wine "$winePath\\$wineExec"
|
||||
exit 0
|
||||
fi
|
||||
if [[ "$game" =~ rs-games ]] || [[ "$game" =~ screaming-strike-2 ]]; then
|
||||
if [[ "$game" =~ screaming-strike-2 ]]; then
|
||||
pushd "$(winepath "$winePath")"
|
||||
wine "$wineExec"
|
||||
popd
|
||||
@ -972,14 +997,13 @@ gameList=(
|
||||
"Crazy Party"
|
||||
"Crazy Tennis"
|
||||
"Crime Hunter"
|
||||
"Danger City"
|
||||
"Danger on the Wheel"
|
||||
#"Dark Destroyer"
|
||||
"Daytona and the Book of Gold"
|
||||
"Death on the Road"
|
||||
"Deathmatch"
|
||||
"Dog Who Hates Toast"
|
||||
"Dragon Pong"
|
||||
#"Dragon Pong"
|
||||
"Duck Hunt"
|
||||
"DynaMan"
|
||||
"Easter Quest"
|
||||
@ -1067,7 +1091,7 @@ gameList=(
|
||||
"The Vale"
|
||||
"Thief"
|
||||
"Traders of Known Space"
|
||||
"Three D velocity"
|
||||
#"Three D velocity"
|
||||
"Tomb Hunter"
|
||||
"Top Speed 2"
|
||||
"Top Speed 3"
|
||||
@ -1111,7 +1135,6 @@ declare -A command=(
|
||||
[N]="No cache, delete the installer after it has been extracted."
|
||||
[n]="No RHVoice, do not install RHVoice when the game is installed."
|
||||
[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]="Remove a game. This will delete all game data."
|
||||
[t]="Total games. Show how many games are currently available."
|
||||
@ -1141,9 +1164,6 @@ while getopts "${args}" i ; do
|
||||
N) noCache="true";;
|
||||
n) norh="true";;
|
||||
P) checklist quiet;;
|
||||
q)
|
||||
noqjoypad="true"
|
||||
game_launcher;;
|
||||
R) redownload="true";;
|
||||
r) game_removal;;
|
||||
t)
|
||||
@ -1650,9 +1670,7 @@ case "${game}" in
|
||||
export bottle="nyanchan"
|
||||
export winVer="win7"
|
||||
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"
|
||||
cp "${cache}/nvda2speechd" "${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd"
|
||||
chmod +x "${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd"
|
||||
download "https://www.nyanchangames.com/softs/nn3_setup.exe" "https://github.com/RastislavKish/nvda2speechd/releases/download/v0.1/nvda2speechd32.dll"
|
||||
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" "{}" \;
|
||||
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" "{}" \;
|
||||
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")
|
||||
export bottle="oriol-gomez"
|
||||
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
|
||||
;;
|
||||
"Dragon Pong")
|
||||
export winVer="win7"
|
||||
install_wine_bottle
|
||||
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"
|
||||
@ -2625,9 +2631,9 @@ EOF
|
||||
download "https://www.kaldobsky.com/audiogames/Swamp.zip"
|
||||
unzip -d "$WINEPREFIX/drive_c/Program Files/swamp" "${cache}/Swamp.zip"
|
||||
# make sure the latest version is installed.
|
||||
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"
|
||||
fi
|
||||
#if wget -O "${cache}/SwampPatch.zip" "https://www.kaldobsky.com/audiogames/SwampPatch.zip" ; then
|
||||
#nzip -o -d "$WINEPREFIX/drive_c/Program Files/swamp" "${cache}/SwampPatch.zip"
|
||||
#fi
|
||||
wine 'c:\Program Files\swamp\checkup.exe' /verysilent
|
||||
#wine cmd.exe /c 'cd /d c:\Program Files\swamp && Windows32bit.bat'
|
||||
# Delete music if requested.
|
||||
@ -2726,16 +2732,13 @@ EOF
|
||||
;;
|
||||
"Three D velocity")
|
||||
export winVer="win10"
|
||||
export WINEARCH=win64
|
||||
export norh=false # Must install a voice, and rhvoice works easily with 64 bit.
|
||||
install_wine_bottle sapi vcrun2008 gdiplus xact dotnet48 xna40
|
||||
install_wine_bottle speechsdk
|
||||
# Dotnet is evil. That is all.
|
||||
# LC_ALL=C winetricks -q dotnet48
|
||||
# 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"
|
||||
LC_ALL=C winetricks -q dotnet472
|
||||
wineserver -k # Ha ha ha.
|
||||
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"
|
||||
find "${WINEPREFIX}" -type f -name 'nvdaControllerClient32.dll' -exec cp -v "${cache}/nvda2speechd32.dll" "{}" \;
|
||||
find "${WINEPREFIX}" -type f -name 'nvdaControllerClient64.dll' -exec cp -v "${cache}/nvda2speechd64.dll" "{}" \;
|
||||
find "${WINEPREFIX}" -type f -name 'nvdaControllerClient32.dll' -exec cp -v "${cache}/nvdaControllerClient32.dll" "{}" \;
|
||||
add_launcher "c:\Program Files\Three-D-Velocity-Binaries-master\tdv.exe"
|
||||
;;
|
||||
"Triple Triad")
|
||||
|
@ -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
|
@ -1,15 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Modified from the script at:
|
||||
# https://gist.github.com/fdietze/6768a0970d7d732b7fbd7930ccceee2a
|
||||
cleanup() {
|
||||
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.
|
||||
shopt -s expand_aliases
|
||||
trap cleanup EXIT
|
||||
|
||||
# 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
|
||||
echo "Usage: $0 \"application name\" \"file name\"."
|
||||
exit 1
|
||||
if [[ $# -ne 1 ]]; then
|
||||
echo "Usage: $0 application name."
|
||||
fi
|
||||
|
||||
# Wait for the application to start
|
||||
@ -17,66 +22,33 @@ while ! pgrep -u "$USER" ^$1 &> /dev/null ; do
|
||||
sleep 0.05
|
||||
done
|
||||
|
||||
fileName="${2,,}"
|
||||
fileName="${fileName//[[:space:]]/-}.sqlite"
|
||||
translationFile="${XDG_CACHE_HOME:-$HOME/.cache}/audiogame-manager/${fileName}"
|
||||
|
||||
# Read so long as the application is running
|
||||
while pgrep -u "$USER" ^$1 &> /dev/null ; do
|
||||
sleep 0.05
|
||||
text="$(xclip -d "${DISPLAY:-:0}" -selection clipboard -o 2> /dev/null)"
|
||||
if [[ -f ~/.agmsilent ]]; then
|
||||
newText=""
|
||||
translatedText=""
|
||||
newText="$(xclip -d "${DISPLAY:-:0}" -selection clipboard -o 2> /dev/null)"
|
||||
sleep 0.01
|
||||
if [[ "${#newText}" -lt 1 ]]; then
|
||||
continue
|
||||
fi
|
||||
if [[ "${text}" =~ ^[0-9A-Za-z[:space:][:punct:]]+$ ]]; then
|
||||
spd-say -- "$text"
|
||||
if [[ "${newText}" =~ ^[0-9A-Za-z[:space:][:punct:]]+$ ]]; then
|
||||
spd-say -- "$newText"
|
||||
echo "" | xclip -d "${DISPLAY:-:0}" -selection clipboard 2> /dev/null
|
||||
continue
|
||||
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
|
||||
fi
|
||||
q() { sqlite3 -column -init "" "$translationFile" "$@" 2> /dev/null ; }
|
||||
|
||||
|
||||
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
|
||||
translatedText="$(trans -no-autocorrect -b -- "$newText")"
|
||||
if ! [[ "${newText}" =~ ^[0-9[:punct:]]+$ ]]; then
|
||||
echo "${newText})==:[${translatedText}" >> "$dictionaryFile"
|
||||
fi
|
||||
|
||||
|
||||
# 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"
|
||||
spd-say -- "$translatedText"
|
||||
echo "" | xclip -d "${DISPLAY:-:0}" -selection clipboard 2> /dev/null
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
@ -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
|
@ -113,12 +113,12 @@ menulist() {
|
||||
for i in "${@}" ; do
|
||||
menuList+=("$i" "$i")
|
||||
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 \
|
||||
--extra-button \
|
||||
--extra-label "Test Voice" \
|
||||
--extra-label "$(gettext "Test Voice")" \
|
||||
--no-tags \
|
||||
--menu "Please select one" 0 0 0 "${menuList[@]}" --stdout
|
||||
--menu "$(gettext "Please select one")" 0 0 0 "${menuList[@]}" --stdout
|
||||
return $?
|
||||
}
|
||||
|
||||
@ -163,12 +163,12 @@ test_voice() {
|
||||
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
|
||||
$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
|
||||
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 "c:\windows\temp\speak.vbs"
|
||||
wine cscript "z:\tmp\speak.vbs"
|
||||
}
|
||||
|
||||
# Handle voice restore, but only if voice changed
|
||||
@ -176,12 +176,12 @@ doRestore=1
|
||||
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.
|
||||
cat << "EOF" > "${bottle}/drive_c/windows/temp/speak.vbs"
|
||||
cat << "EOF" > /tmp/speak.vbs
|
||||
dim speechobject
|
||||
set speechobject=createobject("sapi.spvoice")
|
||||
speechobject.speak ""
|
||||
EOF
|
||||
wine cscript "c:\windows\temp\speak.vbs"
|
||||
wine cscript "z:\tmp\speak.vbs"
|
||||
|
||||
# Create an array of available voices.
|
||||
ifs="$IFS"
|
||||
@ -194,7 +194,7 @@ for x in "${voiceListFullName[@]}" ; do
|
||||
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')"
|
||||
exit=1
|
||||
if [[ "${#voiceList[@]}" -eq 0 ]]; then
|
||||
if [[ "${voiceList[@]}" -eq 0 ]]; then
|
||||
dialog --msgbox "No voices found." -1 -1
|
||||
exit 1
|
||||
fi
|
||||
|
@ -9,10 +9,6 @@ done
|
||||
|
||||
# Read so long as the application is running
|
||||
while pgrep -u "$USER" ^$1 &> /dev/null ; do
|
||||
sleep 0.05
|
||||
if [[ -f ~/.agmsilent ]]; then
|
||||
continue
|
||||
fi
|
||||
wnd_focus=$(xdotool getwindowfocus)
|
||||
wnd_title=$(xprop -id $wnd_focus WM_NAME)
|
||||
lookfor='"(.*)"'
|
||||
@ -24,6 +20,5 @@ while pgrep -u "$USER" ^$1 &> /dev/null ; do
|
||||
old_title="$wnd_title"
|
||||
fi
|
||||
fi
|
||||
sleep 0.01
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
@ -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
|
Loading…
Reference in New Issue
Block a user