From 235f44935ffc9430f62dbc9aa66ca44e9bf83717 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Thu, 27 Aug 2020 17:35:32 -0400 Subject: [PATCH] Started work on the checklist functionality. Also have a non-working function to automate key presses for installers that require it. --- audiogame-manager.sh | 56 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 47 insertions(+), 9 deletions(-) diff --git a/audiogame-manager.sh b/audiogame-manager.sh index bfbb021..58665fb 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -3,6 +3,43 @@ # Wine configuration section +checklist() { + declare -a errorList + echo "Checking your system..." + echo + if command -v wine &> /dev/null ; then + echo "Wine is installed." + else + errorList+=("Critical: Wine is not installed. You will not be able to play any games.") + fi + if command -v wget &> /dev/null ; then + echo "Wget is installed." + else + errorList+=("Critical: Wget is not installed. You will not be able to install any games.") + fi + if [[ -d /usr/share/wine/gecko/ ]]; then + echo "Found wine gecko." + else + errorList+=("Warning: Wine gecko not found, some games may not work.") + fi + if [[ -d /usr/share/wine/mono/ ]]; then + echo "Found wine mono." + else + errorList+=("Warning: Wine mono not found, some games may not work.") + fi + # Show the results + if [[ ${#errorList[@]} -eq 0 ]]; then + echo "No problems found, you are good to go." + exit 0 + fi + echo "Errors detected, here is a list along with the severity." + echo "Note that errors marked critical mean that you will not be able to install and play games until they are resolved." + for i in "${errorList[@]}" ; do + echo "$i" + done + exit 0 +} + install_wine_bottle() { local bottle="${game,,}" bottle="${bottle//[[:space:]]/-}" @@ -100,17 +137,17 @@ add_launcher() { automate_installer() { # Function arguments are the keys to be pressed. - declare -a keyList=("sleep 15") + declare -a keyListD=("sleep 20") for i in ${@} ; do case "$i" in "alt+f") keyList+=("key ${i}");; "alt+i") keyList+=("sleep 10 key ${i}");; "alt+"*) keyList+=("key ${i} sleep 2");; *"+"*) keyList+=("key ${i} sleep 2");; - *) xdotool type ${i};; + *) xdotool sleep 15 type ${i} & ;; esac done - xdotool ${keyList[*]} + xdotool ${keyList[*]} & } # 32 bit installations work best and are the default here, if you need to override it, do it in the game specific installation steps. @@ -141,13 +178,15 @@ fi # Array of command line arguments command=( - "i" # Install + "c" # Check wine environment + "i" # Install games ) -while getopts "${command[@]//[[:space:]]/}" i ; do +while getopts "${command[*]//[[:space:]]/}" i ; do case "$i" in + c) checklist;; h) show_help;; - i) game_installer + i) game_installer;; esac done @@ -167,9 +206,8 @@ case "${game}" in "Kitchensinc Games") install_wine_bottle vb6run speechsdk wget -O "$WINEPREFIX/drive_c/Program Files/Kitchensinc complete Setup.exe" "https://www.agarchive.net/games/kitchensinc/Kitchensinc%20complete%20Setup.exe" - wine "$WINEPREFIX/drive_c/Program Files/Kitchensinc complete Setup.exe" & - xdotool sleep 5 key y sleep 2 key alt+n sleep 2 key alt+n sleep 2 key alt+n sleep 2 key alt+n sleep 2 key alt+i sleep 10 key alt+f - #automate_installer y alt+n alt+n alt+n alt+n alt+i alt+f + automate_installer y alt+n alt+n alt+n alt+n alt+i alt+f + wine "$WINEPREFIX/drive_c/Program Files/Kitchensinc complete Setup.exe" add_launcher "c:\Program Files\Kitchen's Sink\gamemenu.exe" #rm -f "$WINEPREFIX/drive_c/Program Files/Kitchensinc complete Setup.exe" ;;