Added yad dialogues if in GUI session, retains the dialog interface if in console.

This commit is contained in:
Storm Dragon
2025-08-01 15:25:53 -04:00
parent 15f90a7979
commit 76f0c66c96
16 changed files with 392 additions and 113 deletions

View File

@ -36,7 +36,7 @@ install_wine() {
# If this goes wrong, bail out
set -e
{ curl -L --output "${installationFile}" "https://www.playonlinux.com/wine/binaries/phoenicis/upstream-linux-x86/PlayOnLinux-wine-${1}-upstream-linux-${v}.tar.gz"
tar xf "${installationFile}" -C "${wineInstallationPath}"; } | dialog --progressbox "Installing $2 bit Wine version $1." -1 -1
tar xf "${installationFile}" -C "${wineInstallationPath}"; } | agm_progressbox "Wine Installation" "Installing $2 bit Wine version $1."
set +e
}

View File

@ -0,0 +1,281 @@
#!/usr/bin/env bash
# Dialog interface wrapper for audiogame-manager
# Automatically switches between dialog (console) and yad (GUI) based on DISPLAY environment
# This provides better accessibility for GUI environments while maintaining console functionality
# Note: dialogType is now detected in the main script before DISPLAY is modified
# This ensures console detection works correctly when AGM sets DISPLAY=":0"
# If dialogType is not set (e.g., when called from standalone scripts), detect it
if [[ -z "$dialogType" ]]; then
if [[ -z "$DISPLAY" ]]; then
dialogType="dialog"
else
dialogType="yad"
fi
fi
# Wrapper function for menu selection
# Usage: agm_menu "title" "backtitle" "text" option1 "description1" option2 "description2" ...
agm_menu() {
local title="$1"
local backTitle="$2"
local text="$3"
shift 3
if [[ "$dialogType" == "yad" ]]; then
# Build yad list format: Display only, then map back to value
local yadList=""
declare -A valueMap
while [[ $# -gt 0 ]]; do
local option="$1"
local description="$2"
valueMap["$description"]="$option"
if [[ -n "$yadList" ]]; then
yadList="$yadList\n"
fi
yadList="${yadList}${description}"
shift 2
done
local selectedDescription
selectedDescription=$(echo -e "$yadList" | yad --list \
--title="$title" \
--text="$text" \
--column="Option" \
--no-headers \
--selectable-labels \
--search-column=1 \
--height=400 \
--width=600)
# Return the mapped value
if [[ -n "$selectedDescription" ]]; then
echo "${valueMap["$selectedDescription"]}"
fi
else
# Build dialog menu format with mapping (same approach as yad)
local dialogArgs=()
declare -A valueMap
while [[ $# -gt 0 ]]; do
local option="$1"
local description="$2"
valueMap["$description"]="$option"
dialogArgs+=("$description" "$description")
shift 2
done
local selectedDescription
selectedDescription=$(dialog --backtitle "$backTitle" \
--title "$title" \
--no-tags \
--menu "$text" 0 0 0 \
"${dialogArgs[@]}" \
--stdout)
# Return the mapped value
if [[ -n "$selectedDescription" ]]; then
echo "${valueMap["$selectedDescription"]}"
fi
fi
}
# Wrapper function for checklist selection
# Usage: agm_checklist "title" "backtitle" "text" option1 "description1" "status1" option2 "description2" "status2" ...
agm_checklist() {
local title="$1"
local backTitle="$2"
local text="$3"
shift 3
if [[ "$dialogType" == "yad" ]]; then
local yadList=""
while [[ $# -gt 0 ]]; do
local option="$1"
local description="$2"
local status="$3"
local checked="FALSE"
[[ "$status" == "on" ]] && checked="TRUE"
if [[ -n "$yadList" ]]; then
yadList="$yadList\n"
fi
yadList="${yadList}${checked}|${description}|${option}"
shift 3
done
echo -e "$yadList" | yad --list \
--title="$title" \
--text="$text" \
--checklist \
--column="Select:CHK" \
--column="Option" \
--column="Value:HD" \
--hide-column=3 \
--print-column=3 \
--no-headers \
--selectable-labels \
--height=400 \
--width=600 \
--separator=" "
else
local dialogArgs=()
while [[ $# -gt 0 ]]; do
dialogArgs+=("$1" "$2" "$3")
shift 3
done
dialog --backtitle "$backTitle" \
--title "$title" \
--checklist "$text" 0 0 0 \
"${dialogArgs[@]}" \
--stdout
fi
}
# Wrapper function for input dialog
# Usage: agm_inputbox "title" "backtitle" "text" "default_value"
agm_inputbox() {
local title="$1"
local backTitle="$2"
local text="$3"
local defaultValue="$4"
if [[ "$dialogType" == "yad" ]]; then
yad --entry \
--title="$title" \
--text="$text" \
--entry-text="$defaultValue" \
--selectable-labels \
--width=400
else
dialog --backtitle "$backTitle" \
--title "$title" \
--inputbox "$text" 0 0 "$defaultValue" \
--stdout
fi
}
# Wrapper function for message box
# Usage: agm_msgbox "title" "backtitle" "text"
agm_msgbox() {
local title="$1"
local backTitle="$2"
local text="$3"
if [[ "$dialogType" == "yad" ]]; then
yad --info \
--title="$title" \
--text="$text" \
--selectable-labels \
--show-cursor \
--width=400
else
dialog --backtitle "$backTitle" \
--title "$title" \
--msgbox "$text" 0 0
fi
}
# Wrapper function for yes/no dialog
# Usage: agm_yesno "title" "backtitle" "text"
agm_yesno() {
local title="$1"
local backTitle="$2"
local text="$3"
if [[ "$dialogType" == "yad" ]]; then
yad --question \
--title="$title" \
--text="$text" \
--selectable-labels \
--width=400
else
dialog --backtitle "$backTitle" \
--title "$title" \
--yesno "$text" 0 0
fi
}
# Wrapper function for info box (non-blocking message)
# Usage: agm_infobox "title" "backtitle" "text"
agm_infobox() {
local title="$1"
local backTitle="$2"
local text="$3"
if [[ "$dialogType" == "yad" ]]; then
# For yad, we'll use a notification since infobox is non-blocking
yad --notification \
--text="$text" \
--timeout=3
else
dialog --backtitle "$backTitle" \
--title "$title" \
--infobox "$text" 0 0
fi
}
# Wrapper function for progress box
# Usage: command | agm_progressbox "title" "text"
agm_progressbox() {
local title="$1"
local text="$2"
if [[ "$dialogType" == "yad" ]]; then
yad --progress \
--title="$title" \
--text="$text" \
--pulsate \
--auto-close \
--no-buttons \
--show-cursor \
--width=400
else
dialog --title "$title" \
--progressbox "$text" 20 70
fi
}
# Wrapper function for file selection
# Usage: agm_fselect "title" "backtitle" "default_path"
agm_fselect() {
local title="$1"
local backTitle="$2"
local defaultPath="$3"
if [[ "$dialogType" == "yad" ]]; then
yad --file \
--title="$title" \
--filename="$defaultPath" \
--width=600 \
--height=400
else
dialog --backtitle "$backTitle" \
--title "$title" \
--fselect "$defaultPath" 0 0 \
--stdout
fi
}
# Wrapper function for directory selection
# Usage: agm_dselect "title" "backtitle" "default_path"
agm_dselect() {
local title="$1"
local backTitle="$2"
local defaultPath="$3"
if [[ "$dialogType" == "yad" ]]; then
yad --file \
--directory \
--title="$title" \
--filename="$defaultPath" \
--width=600 \
--height=400
else
dialog --backtitle "$backTitle" \
--title "$title" \
--dselect "$defaultPath" 0 0 \
--stdout
fi
}

View File

@ -59,18 +59,15 @@ download() {
{ if ! curl -L4 -C - --retry 10 --output "${cache}/${dest}" "${i}" ; then
echo "Could not download \"$i\"..."
exit 1
fi; } | dialog --backtitle "Audio Game Manager" \
--progressbox "Downloading \"$dest\" from \"$i\"" -1 -1
fi; } | agm_progressbox "Audio Game Manager" "Downloading \"$dest\" from \"$i\""
local downloadError=1
case "${dest##*.}" in
"pk3"|"zip")
unzip -tq "${cache}/${dest}" | dialog --backtitle "Audio Game Manager" \
--progressbox "Validating ${dest##*.} file" -1 -1 --stdout
unzip -tq "${cache}/${dest}" | agm_progressbox "Audio Game Manager" "Validating ${dest##*.} file"
downloadError=$?
;;
"7z")
7z t "${cache}/${dest}" | dialog --backtitle "Audio Game Manager" \
--progressbox "Validating 7z file" -1 -1 --stdout
7z t "${cache}/${dest}" | agm_progressbox "Audio Game Manager" "Validating 7z file"
downloadError=$?
;;
"exe")
@ -95,8 +92,7 @@ download() {
esac
if [[ $downloadError -ne 0 ]]; then
rm -fv "${cache}/${dest}"
dialog --backtitle "Audio Game Manager" \
--infobox "Error downloading \"${dest}\". Installation cannot continue." -1 -1 --stdout
agm_infobox "Audio Game Manager" "Audio Game Manager" "Error downloading \"${dest}\". Installation cannot continue."
alert
exit 1
fi
@ -118,9 +114,7 @@ get_installer() {
if echo "$2" | xclip -selection clipboard 2> /dev/null ; then
message+="\n\nThe URL has been copied to the clipboard."
fi
dialog --ok-label "Continue" \
--backtitle "Audiogame Manager" \
--msgbox "$message" -1 -1
agm_msgbox "Audiogame Manager" "Audiogame Manager" "$message"
# Search the Desktop and Downloads directories for the installation file
for i in ~/Downloads ~/Desktop ; do
find $i -type f -name "$1" -exec cp -v {} "${cache}/" \;
@ -137,26 +131,19 @@ get_steam() {
trap "exit 0" SIGINT
echo "manual intervention required."
alert
dialog --backtitle "Audiogame Manager" \
--yes-label "Continue with Steam" \
--no-label "Install manually" \
--extra-button \
--extra-label "Exit" \
--yesno "To install the game manually, place files in \"${WINEPREFIX}/drive_c/Program Files/${game}\"" -1 -1 --stdout
agm_yesno "Audiogame Manager" "Audiogame Manager" "To install the game manually, place files in \"${WINEPREFIX}/drive_c/Program Files/${game}\". Continue with Steam installation?"
case $? in
0) echo "The next steps will install through steamcmd." ;;
1)
mkdir -p "${WINEPREFIX}/drive_c/Program Files/${game}"
dialog --backtitle "Audiogame Manager" \
--msgbox "Place game files in \"${WINEPREFIX}/drive_c/Program Files/${game}\" and press enter to continue." -1 -1 --stdout
agm_msgbox "Audiogame Manager" "Audiogame Manager" "Place game files in \"${WINEPREFIX}/drive_c/Program Files/${game}\" and press enter to continue."
return
;;
*) exit 0 ;;
esac
# Check for steamcmd
if ! command -v steamcmd &> /dev/null ; then
dialog --backtitle "Audiogame Manager" \
--infobox "This installer requires steamcmd. Please install steamcmd and try again." -1 -1
agm_infobox "Audiogame Manager" "Audiogame Manager" "This installer requires steamcmd. Please install steamcmd and try again."
exit 1
fi
# Create message for dialog.
@ -164,17 +151,12 @@ get_steam() {
if echo "$2" | xclip -selection clipboard 2> /dev/null ; then
message+="\n\nThe URL has been copied to the clipboard."
fi
dialog --ok-label "Continue" \
--backtitle "Audiogame Manager" \
--msgbox "$message" -1 -1
agm_msgbox "Audiogame Manager" "Audiogame Manager" "$message"
# Get Steam user name.
steamUser="$(dialog --ok-label "Continue" \
--backtitle "Audiogame Manager" \
--inputbox "Please enter your Steam user name:" -1 -1 --stdout)"
steamUser="$(agm_inputbox "Audiogame Manager" "Audiogame Manager" "Please enter your Steam user name:" "")"
# Download the game
mkdir -p "${WINEPREFIX}/drive_c/Program Files/${game}"
steamcmd +@sSteamCmdForcePlatformType windows +force_install_dir "${WINEPREFIX}/drive_c/Program Files/$game" +login "$steamUser" +app_update "$1" +quit || { dialog --backtitle "Audiogame Manager" \
--infobox "Something went wrong. Please make sure you have a stable internet connection, and if the problem persists, contact audiogame-manager's developers." -1 -1
steamcmd +@sSteamCmdForcePlatformType windows +force_install_dir "${WINEPREFIX}/drive_c/Program Files/$game" +login "$steamUser" +app_update "$1" +quit || { agm_infobox "Audiogame Manager" "Audiogame Manager" "Something went wrong. Please make sure you have a stable internet connection, and if the problem persists, contact audiogame-manager's developers."
exit 1; }
}

View File

@ -12,10 +12,7 @@ check_news() {
fi
local newsOldTag="$(cat "$newsPath" 2> /dev/null)"
if [[ "$newsTag" != "$newsOldTag" ]]; then
dialog --yes-label 'Play' \
--no-label 'Later' \
--backtitle 'Audiogame Manager News' \
--yesno 'Audiogame manager news is available. Please use left and right arrows to navigate and enter to confirm.' -1 -1 || return
agm_yesno 'Audiogame Manager News' 'Audiogame Manager News' 'Audiogame manager news is available. Would you like to play it now?' || return
sox -qV0 "$newsFile" -d &> /dev/null
echo -n "$newsTag" > "$newsPath"
fi
@ -38,8 +35,7 @@ update() {
if [[ "$home" == "$remote" ]]; then
return
fi
dialog --backtitle "Audiogame Manager" \
--yesno "Updates are available. Would you like to update now?" -1 -1 --stdout || return
agm_yesno "Audiogame Manager" "Audiogame Manager" "Updates are available. Would you like to update now?" || return
{ git pull
git log '@{1}..' --pretty=format:'%an: %s' | tac; }
exit $?

View File

@ -1,6 +1,9 @@
# Source dialog interface wrapper
source "${0%/*}/../.includes/dialog-interface.sh"
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
agm_msgbox "Bokurano Daibouken 3" "Bokurano Daibouken 3" "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."
fi
dictFile=""
for i in "${HOME}/Downloads/dict.dat" "${HOME}/Desktop/dict.dat" ; do
@ -9,7 +12,7 @@ for i in "${HOME}/Downloads/dict.dat" "${HOME}/Desktop/dict.dat" ; do
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"
agm_yesno "Bokurano Daibouken 3" "Bokurano Daibouken 3" "Possible English translation file found at $dictFile. Would you like to use it for BK3?" && cp -v "$dictFile" "${cache}/bk3-dict.dat"
fi
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"
export bottle="nyanchan"

View File

@ -1,3 +1,6 @@
# Source dialog interface wrapper
source "${0%/*}/../.includes/dialog-interface.sh"
export WINEARCH=win64
export winVer="win7"
get_installer "sideparty-win.zip" "https://masonasons.itch.io/sideparty"
@ -8,9 +11,7 @@ unzip -d "$WINEPREFIX/drive_c/Program Files/Side Party" "${cache}/sideparty-win.
find "${WINEPREFIX}" -type f -name 'nvdaControllerClient64.dll' -exec cp -v "${cache}/nvda2speechd64.dll" "{}" \;
add_launcher "c:\Program Files\Side Party\SideParty.exe"
alert
sidePartyUser="$(dialog --ok-label "Continue" \
--backtitle "Audiogame Manager" \
--inputbox "Please enter a user name for Side Party score board:" -1 -1 --stdout)"
sidePartyUser="$(agm_inputbox "Side Party Installation" "Side Party Installation" "Please enter a user name for Side Party score board:" "")"
mkdir -p "$WINEPREFIX/drive_c/Program Files/Side Party/masonasons.me/SideParty"
cp -v "${cache}/SidePartySettings.dat" "$WINEPREFIX/drive_c/Program Files/Side Party/masonasons.me/SideParty/settings.dat"
if [[ ${#sidePartyUser} -gt 3 ]]; then

View File

@ -1,7 +1,10 @@
# Source dialog interface wrapper
source "${0%/*}/../.includes/dialog-interface.sh"
export bottle="aprone"
export winVer="win7"
export winetricksSettings="vd=1024x768"
dialog --backtitle "Audiogame manager" --yesno "If you do not have a full 32 bit gstreamer installation, the Swamp music can cause stuttering and crashes. Would you like to remove the music directory after installation?" -1 -1 --stdout
agm_yesno "Swamp Installation" "Swamp Installation" "If you do not have a full 32 bit gstreamer installation, the Swamp music can cause stuttering and crashes. Would you like to remove the music directory after installation?"
deleteMusic=$?
download "https://www.kaldobsky.com/audiogames/Swamp.zip"
install_wine_bottle dx8vb quartz corefonts vb6run speechsdk

View File

@ -39,11 +39,7 @@ game_installer() {
menuList+=("Donate" "Donate")
menuList+=("Become a Patron" "Become a Patron")
# Show game selection dialog
game="$(dialog --backtitle "Audio Game Installer" \
--clear \
--ok-label "Install" \
--no-tags \
--menu "Please select a game to install" 0 0 0 "${menuList[@]}" --stdout)"
game="$(agm_menu "Audio Game Installer" "Audio Game Installer" "Please select a game to install" "${menuList[@]}")"
[[ $? -ne 0 ]] && exit 0
# Handle selection
if [[ -n "$game" ]]; then
@ -64,8 +60,7 @@ game_installer() {
# Source and execute the install script
source "$installScript"
else
dialog --backtitle "Audio Game Installer" \
--msgbox "Installation script not found for ${game}" -1 -1
agm_msgbox "Audio Game Installer" "Audio Game Installer" "Installation script not found for ${game}"
exit 1
fi
;;
@ -95,11 +90,7 @@ game_removal() {
menuList+=("Donate" "Donate")
menuList+=("Become a Patron" "Become a Patron")
local game
game="$(dialog --backtitle "Audio Game Removal" \
--clear \
--ok-label "Remove" \
--no-tags \
--menu "Please select a game to delete" 0 0 0 "${menuList[@]}" --stdout)"
game="$(agm_menu "Audio Game Removal" "Audio Game Removal" "Please select a game to delete" "${menuList[@]}")"
if [[ ${#game} -gt 0 ]]; then
if [[ "$game" == "Donate" ]]; then
open_url "https://ko-fi.com/stormux"
@ -155,11 +146,7 @@ kill_game() {
done
menuList+=("Donate" "Donate")
menuList+=("Become a Patron" "Become a Patron")
local game="$(dialog --backtitle "Audio Game Killer" \
--clear \
--ok-label "Kill" \
--no-tags \
--menu "Please select a game to force stop" 0 0 0 "${menuList[@]}" --stdout)"
local game="$(agm_menu "Audio Game Killer" "Audio Game Killer" "Please select a game to force stop" "${menuList[@]}")"
if [[ ${#game} -gt 0 ]]; then
if [[ "$game" == "Donate" ]]; then
open_url "https://ko-fi.com/stormux"
@ -319,13 +306,7 @@ game_launcher() {
menuList+=("Donate" "Donate")
menuList+=("Become a Patron" "Become a Patron")
local game=""
game="$(dialog --backtitle "Audio Game Launcher" \
--clear \
--extra-button \
--extra-label "Documentation" \
--ok-label "Launch" \
--no-tags \
--menu "Please select a game to play" 0 0 0 "${menuList[@]}" --stdout)"
game="$(agm_menu "Audio Game Launcher" "Audio Game Launcher" "Please select a game to play" "${menuList[@]}")"
local menuCode=$?
if [[ $menuCode -eq 1 ]] || [[ $menuCode -eq 255 ]]; then
exit 0
@ -387,6 +368,14 @@ game_launcher() {
trap "exit 0" SIGINT
# Detect dialog interface type BEFORE potentially setting DISPLAY
# This must happen before we modify DISPLAY to preserve console detection
if [[ -z "$DISPLAY" ]]; then
dialogType="dialog"
else
dialogType="yad"
fi
# If display isn't set assume we are launching from console and an X environment is running using display :0
if [[ -z "$DISPLAY" ]]; then
export DISPLAY=":0"
@ -431,6 +420,7 @@ export nvdaControllerClientDll="${ipfsGateway}/ipfs/QmWu7YdSbKMk1Qm5DKvEA5hk1YuA
# Source helper functions
source .includes/bottle.sh # Also sourced in functions that need it
source .includes/desktop.sh
source .includes/dialog-interface.sh
source .includes/functions.sh
source .includes/help.sh
source .includes/update.sh
@ -502,8 +492,7 @@ while getopts "${args}" i ; do
S) defaultRate="${OPTARG}";;
t)
gameCount=$(find ".install" -type f -iname "*.sh" | wc -l)
dialog --backtitle "Linux Game Manager" \
--infobox "There are currently ${gameCount} games available." -1 -1
agm_infobox "Linux Game Manager" "Linux Game Manager" "There are currently ${gameCount} games available."
exit 0
;;
v) voiceName="${OPTARG}";;

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# âe contents of this file are subject to the Common Public Attribution
# License Version 1.0 (the âcenseâ you may not use this file except in
@ -37,6 +37,10 @@
# Works which are defined in the CPAL as a work which combines Covered Code
# or portions thereof with code not governed by the terms of the CPAL.
# Source dialog interface wrapper
source "${0%/*}/../.includes/dialog-interface.sh"
for i in dialog unix2dos; do
if ! command -v $i &> /dev/null ; then
echo "Please install dialog and dos2unix before using this script."
@ -55,12 +59,7 @@ for i in "${gameList[@]}" ; do
done
unset gameList
gameList="$(dialog --clear \
--no-tags \
--ok-label "Add Games" \
--separate-output \
--backtitle "Select games to add to the $1 list." \
--checklist "Press space to check or uncheck a selected game." 0 0 0 "${menuList[@]}" --stdout)"
gameList="$(agm_checklist "Crazy Party Game Builder" "Crazy Party Game Builder" "Press space to check or uncheck a selected game." "${menuList[@]}")"
if [[ -z "${gameList}" ]]; then
exit 0
@ -70,5 +69,5 @@ mkdir -p "$HOME/.local/wine/crazy-party/drive_c/Program Files/Crazy-Party-beta73
echo "$gameList" >> "$HOME/.local/wine/crazy-party/drive_c/Program Files/Crazy-Party-beta73/game/${1}.txt"
sort -uno "$HOME/.local/wine/crazy-party/drive_c/Program Files/Crazy-Party-beta73/game/${1}.txt" "$HOME/.local/wine/crazy-party/drive_c/Program Files/Crazy-Party-beta73/game/${1}.txt"
eunix2dos "$HOME/.local/wine/crazy-party/drive_c/Program Files/Crazy-Party-beta73/game/${1}.txt"
dialog --infobox "Game list \"$1\" updated." 10 80
agm_infobox "Crazy Party Game Builder" "Crazy Party Game Builder" "Game list \"$1\" updated."
exit 0

View File

@ -37,6 +37,10 @@
# Works which are defined in the CPAL as a work which combines Covered Code
# or portions thereof with code not governed by the terms of the CPAL.
# Source dialog interface wrapper
source "${0%/*}/../.includes/dialog-interface.sh"
newVersion=82
WINEPREFIX="${XDG_DATA_HOME:-$HOME/.local}/wine/crazy-party"
@ -68,6 +72,6 @@ find "${WINEPREFIX}" -type f -name 'nvdaControllerClient64.dll' -exec cp -v "${c
sed -i "s/Crazy-Party-beta${oldVersion}/Crazy-Party-beta${newVersion}/" "$configFile"
cp -v "${WINEPREFIX}/drive_c/Program Files/Crazy-Party-beta${oldVersion}/save.bin" "$HOME/.local/wine/crazy-party/drive_c/Program Files/Crazy-Party-beta${newVersion}/"
cp -ruv "${WINEPREFIX}/drive_c/Program Files/Crazy-Party-beta${oldVersion}/"* "$HOME/.local/wine/crazy-party/drive_c/Program Files/Crazy-Party-beta${newVersion}/" 2> /dev/null
rm -rf "${WINEPREFIX}/drive_c/Program Files/Crazy-Party-beta${oldVersion}/") | dialog --progressbox "updating Crazy Party, please wait..." -1 -1
rm -rf "${WINEPREFIX}/drive_c/Program Files/Crazy-Party-beta${oldVersion}/") | agm_progressbox "Crazy Party Update" "Updating Crazy Party, please wait..."
exit 0

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# âe contents of this file are subject to the Common Public Attribution
# License Version 1.0 (the âcenseâ you may not use this file except in
@ -37,6 +37,10 @@
# Works which are defined in the CPAL as a work which combines Covered Code
# or portions thereof with code not governed by the terms of the CPAL.
# Source dialog interface wrapper
source "${0%/*}/../.includes/dialog-interface.sh"
cache="${XDG_CACHE_HOME:-$HOME/.cache}/audiogame-manager"
updateURL="https://www.kaldobsky.com/audiogames"
updateFiles=("rettou.zip")
@ -47,7 +51,7 @@ for i in "${updateFiles[@]}" ; do
rm -fv "${cache}/${i}"
curl -L4 -C - --retry 10 --output "${cache}/$i" "${updateURL}/$i"
unzip -o -d ~/".local/wine/aprone/drive_c/Program Files/rettou" "${cache}/${i}"
done | dialog --progressbox "Updating Rettou, please wait..." -1 -1
done | agm_progressbox "Rettou Update" "Updating Rettou, please wait..."
exit 0

View File

@ -37,11 +37,15 @@
# Works which are defined in the CPAL as a work which combines Covered Code
# or portions thereof with code not governed by the terms of the CPAL.
# Source dialog interface wrapper
source "${0%/*}/../.includes/dialog-interface.sh"
cache="${XDG_CACHE_HOME:-$HOME/.cache}/audiogame-manager"
url="https://stevend.net/downloads/scramble_win32.zip"
(rm -v "${cache}/scramble_win32.zip"
wget -O "${cache}/scramble_win32.zip" "$url" || { echo "Could not download file."; exit 1; }
unzip -DDod "$HOME/.local/wine/scramble!/drive_c/Program Files" "${cache}/scramble_win32.zip"
find ~/".local/wine/scramble!" -type f -name 'nvdaControllerClient32.dll' -exec cp -v "${cache}/nvdaControllerClient32.dll" "{}" \;) | dialog --progressbox "updating Scramble!, please wait..." -1 -1
find ~/".local/wine/scramble!" -type f -name 'nvdaControllerClient32.dll' -exec cp -v "${cache}/nvdaControllerClient32.dll" "{}" \;) | agm_progressbox "Scramble Update" "Updating Scramble!, please wait..."
exit 0

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# âe contents of this file are subject to the Common Public Attribution
# License Version 1.0 (the âcenseâ you may not use this file except in
@ -37,19 +37,23 @@
# Works which are defined in the CPAL as a work which combines Covered Code
# or portions thereof with code not governed by the terms of the CPAL.
# Source dialog interface wrapper
source "${0%/*}/../.includes/dialog-interface.sh"
cache="${XDG_CACHE_HOME:-$HOME/.cache}/audiogame-manager"
updateURL="https://www.kaldobsky.com/audiogames"
updateFiles=("SwampPatch.zip")
dialog --backtitle "Audiogame manager" --yesno "If you do not have a full 32 bit gstreamer installation, the Swamp music can cause stuttering and crashes. Would you like to remove the music directory after installation?" -1 -1 --stdout
agm_yesno "Swamp Update" "Swamp Update" "If you do not have a full 32 bit gstreamer installation, the Swamp music can cause stuttering and crashes. Would you like to remove the music directory after installation?"
deleteMusic=$?
# Back up configuration files.
for i in losers.txt muted.txt scriptkeys.txt keyconfig.ini ; do
cp -v ~/".local/wine/aprone/drive_c/Program Files/swamp/${i}" ~/".local/wine/aprone/drive_c/Program Files/swamp/${i}.agm"
echo "${i} backed up as ${i}.agm"
done | dialog --progressbox "Backing up configuration files. They can be found in your swamp directory." -1 -1
done | agm_progressbox "Swamp Update" "Backing up configuration files. They can be found in your swamp directory."
sleep 3
@ -57,7 +61,7 @@ sleep 3
for i in "${updateFiles[@]}" ; do
wget -O "${cache}/$i" "${updateURL}/$i"
unzip -o -d ~/".local/wine/aprone/drive_c/Program Files/swamp" "${cache}/${i}"
done | dialog --progressbox "Updating Swamp, please wait..." -1 -1
done | agm_progressbox "Swamp Update" "Updating Swamp, please wait..."
# Delete music if requested.
if [[ $deleteMusic -eq 0 ]]; then

View File

@ -8,6 +8,16 @@
# Dialog accessibility
export DIALOGOPTS='--no-lines --visit-items'
# Detect dialog interface type BEFORE potentially setting DISPLAY
if [[ -z "$DISPLAY" ]]; then
dialogType="dialog"
else
dialogType="yad"
fi
# Source dialog interface wrapper
source "${0%/*}/../.includes/dialog-interface.sh"
# Turn off debug messages
export WINEDEBUG="-all"
# Make sure display is set in case installed from console.
@ -21,9 +31,9 @@ prefix="https://www.cepstral.com/downloads/installers/windows/"
register() {
local v="$1"
company="$(dialog --clear --inputbox "Company name (leave empty if none)" -1 -1 --stdout)" || exit $?
customer="$(dialog --clear --inputbox "Customer name" -1 -1 --stdout)" || exit $?
key="$(dialog --clear --inputbox "License key" -1 -1 --stdout)" || exit $?
company="$(agm_inputbox "Install Cepstral" "Install Cepstral" "Company name (leave empty if none)" "")" || exit $?
customer="$(agm_inputbox "Install Cepstral" "Install Cepstral" "Customer name" "")" || exit $?
key="$(agm_inputbox "Install Cepstral" "Install Cepstral" "License key" "")" || exit $?
eval "wine \"c:\\Program Files\\Cepstral\\bin\\swift.exe\" --reg-voice --voice-name \"$v\" --customer-name \"$customer\" --company-name \"$company\" --license-key \"$key\""
exit 0
}
@ -75,10 +85,7 @@ declare -a bottle
for i in $(find ~/.local/wine/ -maxdepth 1 -type d -not -name 'wine' | sort) ; do
bottle+=("$i" "${i##*/}")
done
export WINEPREFIX="$(dialog --backtitle "Use the up and down arrow keys to find the option you want, then press enter to select it." \
--clear \
--no-tags \
--menu "Select A Wine Bottle" 0 0 0 "${bottle[@]}" --stdout)"
export WINEPREFIX="$(agm_menu "Install Cepstral" "Install Cepstral" "Select A Wine Bottle" "${bottle[@]}")"
if [[ -z "${WINEPREFIX}" ]]; then
@ -90,10 +97,7 @@ if [[ "$1" == "-r" || "$1" == "--register" ]]; then
action="register"
fi
voice="$(dialog --backtitle "Use the up and down arrow keys to find the option you want, then press enter to select it." \
--clear \
--no-tags \
--menu "Select A voice to $action" 0 0 0 "${voices[@]}" --stdout)"
voice="$(agm_menu "Install Cepstral" "Install Cepstral" "Select A voice to $action" "${voices[@]}")"
if [[ "$action" == "register" ]]; then
register $voice
@ -103,7 +107,7 @@ fi
mkdir -p ~/Downloads
if ! [[ -e ~/Downloads/Cepstral_${voice}_windows_${version}.${msiexe} ]]; then
wget -P ~/Downloads/ "${prefix}Cepstral_${voice}_windows_${version}.${msiexe}" | dialog --progressbox "Downloading voice..." -1 -1
wget -P ~/Downloads/ "${prefix}Cepstral_${voice}_windows_${version}.${msiexe}" | agm_progressbox "Install Cepstral" "Downloading voice..."
fi
# Get the install command.
@ -114,7 +118,7 @@ cmd="${cmd} ~/Downloads/Cepstral_${voice}_windows_${version}.${msiexe}"
# Install the voice
(eval "$cmd" &
[ "$msiexe" = "exe" ] && xdotool sleep 20 key --delay 75 alt+n key --delay 75 alt+a key --delay 75 alt+n key --delay 75 alt+o key --delay 75 alt+i sleep 20 key --delay 75 alt+f
wineserver -w) | dialog --progressbox "installing voice..." -1 -1
wineserver -w) | agm_progressbox "Install Cepstral" "Installing voice..."
# Make voices louder.
find "${WINEPREFIX}/drive_c/Program Files/Cepstral/voices" -type d -not -name voices -exec bash -c 'for d ; do echo "GAIN 2.5" > "$d/default.sfx";done' _ {} \;

View File

@ -42,6 +42,16 @@
#--code--
# Detect dialog interface type BEFORE potentially setting DISPLAY
if [[ -z "$DISPLAY" ]]; then
dialogType="dialog"
else
dialogType="yad"
fi
# Source dialog interface wrapper
source "${0%/*}/../.includes/dialog-interface.sh"
help() {
echo "${0##*/}"
echo "Released under the terms of the Common Public Attribution License Version 1.0"
@ -84,14 +94,14 @@ declare -A command=(
msgbox() {
# Returns: None
# Shows the provided message on the screen with an ok button.
dialog --clear --msgbox "$*" 0 0
agm_msgbox "Set Voice" "Set Voice" "$*"
}
infobox() {
# Returns: None
# Shows the provided message on the screen with no buttons.
local timeout=3
dialog --infobox "$*" 0 0
agm_infobox "Set Voice" "Set Voice" "$*"
read -n1 -t $timeout continue
# Clear any keypresses from the buffer
read -t 0.01 continue
@ -102,7 +112,7 @@ yesno() {
# Args: Question to user.
# Called in if $(yesno) == "Yes"
# Or variable=$(yesno)
dialog --clear --backtitle "Press 'Enter' for "yes" or 'Escape' for "no"." --yesno "$*" 0 0 --stdout
agm_yesno "Set Voice" "Set Voice" "$*"
if [[ $? -eq 0 ]]; then
echo "Yes"
else
@ -117,12 +127,7 @@ 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." \
--clear \
--extra-button \
--extra-label "Test Voice" \
--no-tags \
--menu "Please select one" 0 0 0 "${menuList[@]}" --stdout
agm_menu "Set Voice" "Set Voice" "Please select one" "${menuList[@]}"
return $?
}
@ -251,10 +256,7 @@ if [[ -z "${bottle}" ]]; then
exit 1
fi
export WINEPREFIX="$(dialog --backtitle "Use the up and down arrow keys to find the option you want, then press enter to select it." \
--clear \
--no-tags \
--menu "Select A Wine Bottle" 0 0 0 "${bottles[@]}" --stdout)"
export WINEPREFIX="$(agm_menu "Set Voice" "Set Voice" "Select A Wine Bottle" "${bottles[@]}")"
fi
if [[ -z "${WINEPREFIX}" ]]; then
@ -303,7 +305,7 @@ 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
dialog --msgbox "No voices found in ${WINEPREFIX}. Make sure SAPI voices are installed in this Wine prefix." 0 0
agm_msgbox "Set Voice" "Set Voice" "No voices found in ${WINEPREFIX}. Make sure SAPI voices are installed in this Wine prefix."
exit 1
fi
while [[ $exit -ne 0 ]] ; do

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# âe contents of this file are subject to the Common Public Attribution
# License Version 1.0 (the âcenseâ you may not use this file except in
@ -38,6 +38,9 @@
# or portions thereof with code not governed by the terms of the CPAL.
# Source dialog interface wrapper
source "${0%/*}/../.includes/dialog-interface.sh"
export WINEARCH=win32
bottle="${1,,}"
shift
@ -47,6 +50,6 @@ export WINEPREFIX="$HOME/.local/wine/${bottle}"
# Arguments to the function are dependancies to be installed.
(wine msiexec /i z:/usr/share/wine/mono/$(ls -1 /usr/share/wine/mono/) /silent
wine msiexec /i z:$(ls -1 /usr/share/wine/gecko/*x86.msi) /silent
winetricks -q $@ ${winVer:-winxp} ${winetricksSettings}) | dialog --progressbox "Installing wine bottle, please wait..." -1 -1
winetricks -q $@ ${winVer:-winxp} ${winetricksSettings}) | agm_progressbox "Wine Bottle Creation" "Installing wine bottle, please wait..."
exit 0