Merge branch 'testing'. Things appear to be decently stable now.

This commit is contained in:
Storm Dragon 2022-10-06 11:56:27 -04:00
commit 90d64278aa
3 changed files with 197 additions and 13 deletions

View File

@ -363,7 +363,7 @@ get_bottle() {
"super-liam"*) ;&
"the-great-toy-robbery"*) export WINEPREFIX="${HOME}/.local/wine/l-works";;
# Nyanchan games group
"bokurano-daibouken-3"*) ;&
"bokurano-daibouken"*) ;&
"laser-breakout"*) ;&
"marina-break"*) ;&
"mp5"*) ;&
@ -775,6 +775,29 @@ game_launcher() {
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\||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 &
fi
if [[ "$game" =~ bokurano-daibouken-3 ]]; then
dictPath="$(winepath "${winePath}")"
if [[ -r "${cache}/bk3-dict.dat" ]] && [[ ! -d "${dictPath}/dict" ]]; then
cp "${cache}/bk3-dict.dat" "${dictPath}/dict.dat"
fi
if [[ -d "${dictPath}/dict" ]]; then
pgrep -u "$USER" nvda2speechd &> /dev/null || ${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd &
fi
if [[ ! -d "${dictPath}/dict" ]]; then
find "${WINEPREFIX}/drive_c/nyanchangame/bk3" -type f -name 'nvdaControllerClient.dll' -exec rm -v "{}" \;
"${0%/*}/speech/clipboard_translator.sh" play.exe &
fi
fi
if [[ "$game" =~ road-to-rage\| ]]; then
"${0%/*}/speech/speak_window_title.sh" trtr.exe &
fi
if [[ "$game" =~ sequence-storm ]]; then
[[ -x ~/.SequenceStormReader ]] && ~/.SequenceStormReader &
fi
@ -883,7 +906,7 @@ unset manualInstall
# Set up logging
echo -e "\n\n-----> Logging started at $(date '+%A, %B %d, %Y at %I:%M%p')\n" >> "${cache}/audiogame-manager.log"
exec &> >(/usr/bin/tee -a "${cache}/audiogame-manager.log")
exec &> >(command tee -a "${cache}/audiogame-manager.log")
# The list of games available for installation.
# Use menu friendly names.
@ -944,6 +967,9 @@ gameList=(
"BG Yahtzee"
"Blind Drive"
"Bloodshed"
"Bokurano Daibouken"
"Bokurano Daibouken 2"
"Bokurano Daibouken 3"
"Bombercats"
#"Breed Memorial"
"Castaways"
@ -995,7 +1021,7 @@ gameList=(
"Lunimals"
"Manamon"
"Manamon 2"
"Marina Break"
#"Marina Break"
"Monkey Business"
"MudSplat French"
"MudSplat English"
@ -1017,6 +1043,8 @@ gameList=(
"Revelation"
"Rhythm Rage"
#"River Raiders"
"Road to Rage"
"Road to Rage Offline"
"RS Games"
"Run For Your Life"
#"Sammy Center"
@ -1026,6 +1054,7 @@ gameList=(
"Sequence Storm"
#"Shades of Doom 1.2"
"Shades of Doom"
"Shadow Line"
"Shooter"
"Silver Dollar"
"Slender Lost Vision"
@ -1058,7 +1087,7 @@ gameList=(
"VIP Mud"
"Warsim"
#"Wolf Games Launcher"
#"World of War"
"World of War"
)
# Make sure the minimum of curl, sox, wget, wine, and winetricks are installed
@ -1590,6 +1619,51 @@ case "${game}" in
cp "${cache}/bloodshed.exe" "$WINEPREFIX/drive_c/Program Files/"
add_launcher "c:\Program Files\bloodshed.exe"
;;
"Bokurano Daibouken")
export bottle="nyanchan"
export winVer="win7"
install_wine_bottle
download "https://www.nyanchangames.com/softs/nn_setup.exe"
7z x -o"$WINEPREFIX/drive_c/nyanchangame/bk" "${cache}/nn_setup.exe"
find "${WINEPREFIX}/drive_c/nyanchangame/bk/" -type f -name 'nvdaControllerClient.dll' -exec rm -v "{}" \;
add_launcher "c:\nyanchangame\bk\play.exe"
;;
"Bokurano Daibouken 2")
export bottle="nyanchan"
export winVer="win7"
install_wine_bottle
download "https://www.nyanchangames.com/softs/nn2_setup.exe"
7z x -o"$WINEPREFIX/drive_c/nyanchangame/bk2" "${cache}/nn2_setup.exe"
find "${WINEPREFIX}/drive_c/nyanchangame/bk2/" -type f -name 'nvdaControllerClient.dll' -exec rm -v "{}" \;
add_launcher "c:\nyanchangame\bk2\play.exe"
;;
"Bokurano Daibouken 3")
if [[ ! -r "${cache}/bk3-dict.dat" ]]; then
echo "http://www.nyanchangames.com/order/bk3translate.html" | xclip -selection clipboard 2> /dev/null
dialog --backtitle "Audiogame manager" --msgbox "If you would like English translations, the file is available at http://www.nyanchangames.com/order/bk3translate.html. Save the dict.dat file to your Downloads or Desktop directory. For convenience the url has been copied to your clipboard. Press enter when you are ready to continue." -1 -1 --stdout
fi
dictFile=""
for i in "${HOME}/Downloads/dict.dat" "${HOME}/Desktop/dict.dat" ; do
if [[ -r "$i" ]]; then
dictFile="$i"
fi
done
if [[ "${#dictFile}" -ge 3 ]] && [[ ! -r "${cache}/bk3-dict.dat" ]]; then
dialog --backtitle "Audiogame manager" --yesno "Possible English translation file found at $dictFile. Would you like to use it for BK3?" -1 -1 --stdout && cp -v "$dictFile" "${cache}/bk3-dict.dat"
fi
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/nvda2speechd32.dll"
wine "$cache/nn3_setup.exe" &
xdotool sleep 10 key --clearmodifiers --delay=75 ctrl+a
xdotool sleep 1 key --clearmodifiers --delay=75 BackSpace
xdotool sleep 1 type --delay=75 'c:\nyanchangame\bk3'
xdotool sleep 1 key --clearmodifiers --delay=75 Return
wineserver -w
find "${WINEPREFIX}" -type f -name 'nvdaControllerClient.dll' -exec cp -v "${cache}/nvda2speechd32.dll" "{}" \;
add_launcher "c:\nyanchangame\bk3\play.exe"
;;
"Bombercats")
export bottle="oriol-gomez"
export winVer="win7"
@ -1995,6 +2069,7 @@ case "${game}" in
add_launcher "c:\Program Files\VGA\interceptor\launch_interceptor.exe"
;;
"Judgement Day")
export bottle="l-works"
install_wine_bottle vb6run dx8vb quartz
download "http://files.l-works.net/judgmentdayfullsetup.exe"
wine "${cache}/judgmentdayfullsetup.exe" /silent
@ -2022,13 +2097,12 @@ EOF
add_launcher "c:\Program Files\Kringle Crash\kringlecrash.exe"
;;
"Laser Breakout")
# Currently only speaks in japanese, looking to see if we can find an english version.
export bottle="nyanchan"
export winVer="win7"
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
download "https://www.agarchive.net/games/nyanchan/laser%20breakout.7z" "https://github.com/RastislavKish/nvda2speechd/releases/download/v0.1/nvda2speechd32.dll"
7z e -o"$WINEPREFIX/drive_c/nyanchangame/laser breakout" "$cache/laser breakout.7z"
find "${WINEPREFIX}" -type f -name 'nvdaControllerClient.dll' -exec cp -v "${cache}/nvda2speechd32.dll" "{}" \;
add_launcher "c:\nyanchangame\laser breakout\play.exe"
;;
@ -2103,11 +2177,11 @@ EOF
export bottle="nyanchan"
export winVer="win7"
install_wine_bottle speechsdk
download "https://www.nyanchangames.com/softs/MbSetupE.exe"
download "https://www.nyanchangames.com/softs/MbSetupE.exe" "https://github.com/RastislavKish/nvda2speechd/releases/download/v0.1/nvda2speechd64.dll"
wine "${cache}/MbSetupE.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\MarinaBreak\marinabreak.exe"
;;
"Monkey Business")
@ -2277,6 +2351,22 @@ EOF
wineserver -w
add_launcher "c:\Program Files\River Raiders\raid.exe"
;;
"Road to Rage")
export WINEARCH=win64
export winVer="win7"
install_wine_bottle
download "https://iamtalon.me/games/rtr_ultimate.zip"
unzip -d "$WINEPREFIX/drive_c/Program Files" "${cache}/rtr_ultimate.zip"
add_launcher "c:\Program Files\rtr_Ultimate\trtr.exe"
;;
"Road to Rage Offline")
export winVer="win7"
install_wine_bottle speechsdk
download "https://agarchive.net/games/talon/the%20road%20to%20rage%20offline.7z"
7z x -o"$WINEPREFIX/drive_c/Program Files" "${cache}/the road to rage offline.7z"
find "${WINEPREFIX}" -type f -name "nvdaControllerClient.dll" -exec rm -fv "{}" \;
add_launcher "c:\Program Files\RTR Offline\rtr.exe"
;;
"RS Games")
export winVer="win7"
install_wine_bottle speechsdk
@ -2352,6 +2442,21 @@ EOF
wine "${cache}/sod20022.exe" /silent
add_launcher "c:\Program Files\Shades of Doom 2.0\sod.exe"
;;
"Shadow Line")
export winVer="win7"
install_wine_bottle
download "https://www.mm-galabo.com/sr/Download_files_srfv/shadowrine_fullvoice3.171.exe"
wine "${cache}/shadowrine_fullvoice3.171.exe" /sp- &
xdotool sleep 30 key --clearmodifiers --delay=75 Return
xdotool key --clearmodifiers --delay=500 Return
xdotool key --clearmodifiers --delay=500 Return
xdotool key --clearmodifiers --delay=500 Return
xdotool sleep 300 key --clearmodifiers --delay=500 Down
xdotool key --clearmodifiers --delay=500 space
xdotool key --clearmodifiers --delay=500 alt+f
wineserver -w
add_launcher "c:\Program Files\GalaxyLaboratory\ShadowRine_FullVoice\play_sr.exe"
;;
"Silver Dollar")
export winVer="win7"
install_wine_bottle speechsdk
@ -2669,11 +2774,12 @@ EOF
add_launcher "c:\Program Files\wg-release\WolfGames.exe"
;;
"World of War")
export bottle="nyanchan"
export winVer="win7"
install_wine_bottle speechsdk
install_wine_bottle
download "https://www.agarchive.net/games/nyanchan/world%20of%20war%20English.7z"
7z e -o"$WINEPREFIX/drive_c/Program Files/World of War" "${cache}/world of war English.7z"
#add_launcher "c:\Program Files\"
7z x -o"$WINEPREFIX/drive_c/nyanchangame" "${cache}/world of war English.7z"
add_launcher "c:\nyanchangame\world of war English\world of war.exe"
;;
"Donate")
open_url "https://ko-fi.com/stormux"

54
speech/clipboard_translator.sh Executable file
View File

@ -0,0 +1,54 @@
#!/usr/bin/env bash
cleanup() {
sort -uo "$dictionaryFile" "$dictionaryFile"
}
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 1 ]]; then
echo "Usage: $0 application name."
fi
# Wait for the application to start
while ! pgrep -u "$USER" ^$1 &> /dev/null ; do
sleep 0.05
done
# Read so long as the application is running
while pgrep -u "$USER" ^$1 &> /dev/null ; do
newText=""
translatedText=""
newText="$(xclip -d "${DISPLAY:-:0}" -selection clipboard -o 2> /dev/null)"
sleep 0.01
if [[ "${#newText}" -lt 1 ]]; then
continue
fi
if [[ "${newText}" =~ ^[0-9A-Za-z[:space:][:punct:]]+$ ]]; then
spd-say "$newText"
echo "" | xclip -d "${DISPLAY:-:0}" -selection clipboard 2> /dev/null
continue
fi
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
translatedText="$(trans -no-autocorrect -b -- "$newText")"
if ! [[ "${newText}" =~ ^[0-9[:punct:]]+$ ]]; then
echo "${newText})==:[${translatedText}" >> "$dictionaryFile"
fi
spd-say "$translatedText"
echo "" | xclip -d "${DISPLAY:-:0}" -selection clipboard 2> /dev/null
done

24
speech/speak_window_title.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
# Adapted from the bash snippet found at:
# https://bbs.archlinux.org/viewtopic.php?id=117031
# Wait for the application to start
while ! pgrep -u "$USER" ^$1 &> /dev/null ; do
sleep 0.05
done
# Read so long as the application is running
while pgrep -u "$USER" ^$1 &> /dev/null ; do
wnd_focus=$(xdotool getwindowfocus)
wnd_title=$(xprop -id $wnd_focus WM_NAME)
lookfor='"(.*)"'
if [[ "$wnd_title" =~ $lookfor ]]; then
wnd_title=${BASH_REMATCH[1]}
if [[ "$old_title" != "$wnd_title" ]]; then
spd-say "$wnd_title"
old_title="$wnd_title"
fi
fi
sleep 0.01
done