#!/bin/bash # 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 command -v ocrdesktop &> /dev/null ; then echo "Ocrdesktop is installed." else errorList+=("Warning: ocrdesktop is not installed. It can help if the installer gets stuck to figure out what is happening.") fi if command -v unix2dos &> /dev/null ; then echo "Dos2unix is installed." else errorList+=("Warning: unix2dos is not installed. Some games need a configuration file in dos format before they will run.") 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:]]/-}" mkdir -p "$HOME/.local/wine/${bottle}" 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 } # Install games game_installer() { mapfile -t installedGames < <(sed '/^$/d' "${configFile}" 2> /dev/null | cut -d '|' -f3) # Create the menu of installed games declare -a menuList for i in "${gameList[@]}" ; do local menuItem="$i" for j in "${installedGames[@]}" ; do if [[ "$j" == "$menuItem" ]]; then unset menuItem fi done if [[ -n "$menuItem" ]]; then menuList+=("$menuItem" "$menuItem") fi done if [[ ${#menuList[@]} -eq 0 ]]; then echo "All games are already installed." exit 0 fi menuList+=("Make a One Time Donation" "Make a One Time Donation") menuList+=("Become a Patron" "Become a Patron") game="$(dialog --backtitle "Audio Game Installer" \ --clear \ --no-tags \ --menu "Please select a game to install" 0 0 0 "${menuList[@]}" --stdout)" } # launch games that are installed game_launcher() { mapfile -t lines < <(sed '/^$/d' "${configFile}" 2> /dev/null) if [[ ${#lines} -eq 0 ]]; then echo "Install some games first." exit 0 fi # Create the menu of installed games declare -a menuList for i in "${lines[@]}" ; do menuList+=("${i%|*}" "${i##*|}") done menuList+=("Make a One Time Donation" "Make a One Time Donation") menuList+=("Become a Patron" "Become a Patron") local game="$(dialog --backtitle "Audio Game Launcher" \ --clear \ --no-tags \ --menu "Please select a game to play" 0 0 0 "${menuList[@]}" --stdout)" if [[ ${#game} -gt 0 ]]; then if [[ "$game" == "Make a One Time Donation" ]]; then xdg-open "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=stormdragon2976@gmail.com&lc=US&item_name=Donation+to+Storm+Games&no_note=0&cn=¤cy_code=USD&bn=PP-DonationsBF:btn_donateCC_LG.gif:NonHosted" exit 0 fi if [[ "$game" == "Become a Patron" ]]; then xdg-open "https://patreon.com/stormux" exit 0 fi local winePath="${game#*|}" winePath="${winePath%\\*.exe}" local wineExec="${game#*|}" wineExec="${wineExec%|*}" wineExec="${wineExec##*\\}" # kill any previous existing wineservers for this prefix in case they didn't shut down properly. WINEPREFIX="${HOME}/.local/wine/${game%|*}" wineserver -k # launch the game WINEPREFIX="${HOME}/.local/wine/${game%|*}" wine start /d "${winePath}" "$wineExec" fi exit 0 } # main script #functions add_launcher() { local launchSettings="${game,,}" launchSettings="${launchSettings//[[:space:]]/-}|${1}|${game}" if ! grep -F -q -x "${launchSettings}" "${configFile}" ; then echo "${launchSettings}" >> "${configFile}" fi } automate_installer() { # Function arguments are the keys to be pressed. sleep 15 declare -a keyList for i in ${@} ; do case "$i" in "alt+f") keyList+=("sleep 15 key ${i}");; "space") keyList+=("sleep 1 key ${i}");; *"+"*) keyList+=("sleep 1 key ${i}");; *) xdotool sleep 1 type ${i};; esac done xdotool ${keyList[*]} & # call wineserver -w in case something failed here, the user will have a chance to try to fix it. wineserver -w } # Settings file configFile="${XDG_CONFIG_HOME:-$HOME/.config}/storm-games/audiogame-manager/games.conf" mkdir -p "${configFile%/*}" # 32 bit installations work best and are the default here, if you need to override it, do it in the game specific installation steps. export WINEARCH=win32 # Turn off debug messages export WINEDEBUG="-all" # During installation, you can set winVer to the versions available. # To set winetricks arguments, such as virtual desktop, set the winetricksSettings variable. # Example: winetricksSettings="vd=1024x768" # Manual installation is not default, make sure it's unset unset manualInstall # The list of games available for installation. # Use menu friendly names. gameList=( "Battle Zone" "Bloodshed" "Kitchensinc Games" "Light Cars" "Shades of Doom" "Super Egg Hunt" "Super Liam" "The Blind Swordsman" "Technoshock" "Top Speed 3" "Q9" "RS Games" "Undead Assault" ) # With no arguments, open the game launcher. if [[ $# -eq 0 ]]; then game_launcher fi # Array of command line arguments command=( "c" # Check wine environment "i" # Install games "m" # Manually handle install screens ) while getopts "${command[*]//[[:space:]]/}" i ; do case "$i" in c) checklist;; h) show_help;; i) game_installer;; i) manualInstall="true" esac done # Install game based on the selection above. case "${game}" in "Battle Zone") # Speech not working through sapi. export winVer="win7" install_wine_bottle speechsdk wget -O "$WINEPREFIX/drive_c/Program Files/battle zone 13.5 setup.exe" "https://www.agarchive.net/games/gameMadnessInteractive/battle%20zone%2013.5%20setup.exe" wine "$WINEPREFIX/drive_c/Program Files/battle zone 13.5 setup.exe" /silent add_launcher "c:\Program Files\Battle Zone\ss.exe" rm -f "$WINEPREFIX/drive_c/Program Files/battle zone 13.5 setup.exe" ;; "Bloodshed") install_wine_bottle speechsdk wget -O "$WINEPREFIX/drive_c/Program Files/bloodshed.exe" "http://www.samtupy.com/games/bloodshed.exe" add_launcher "c:\Program Files\bloodshed.exe" ;; "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" #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" /q add_launcher "c:\Program Files\Kitchen's Sink\gamemenu.exe" rm -f "$WINEPREFIX/drive_c/Program Files/Kitchensinc complete Setup.exe" ;; "Light Cars") install_wine_bottle dx8vb vb6run wget -O "$WINEPREFIX/drive_c/Program Files/light cars setup.exe" "https://www.agarchive.net/games/lighttech/light%20cars%20setup.exe" if [[ -n "$manualInstall" ]]; then wine "$WINEPREFIX/drive_c/Program Files/light cars setup.exe" else wine "$WINEPREFIX/drive_c/Program Files/light cars setup.exe" & automate_installer alt+n alt+a space alt+n alt+n alt+i alt+f fi echo -e "${USER} ${HOST}\nna@na.na\nUS" > ~/.local/wine/light-cars/drive_c/Program\ Files/Lighttech\ Interactive/Light\ Cars/config.dat unix2dos ~/.local/wine/light-cars/drive_c/Program\ Files/Lighttech\ Interactive/Light\ Cars/config.dat add_launcher "c:\Program Files\Lighttech Interactive\Light Cars\lightCars.exe" rm -f "$WINEPREFIX/drive_c/Program Files/light cars setup.exe" ;; "Shades of Doom") install_wine_bottle vcrun6 wget -O "$WINEPREFIX/drive_c/Program Files/sod20022.exe" "http://www.gmagames.com/sod20022.exe" wine "$WINEPREFIX/drive_c/Program Files/sod20022.exe" /silent add_launcher "c:\Program Files\Shades of Doom 2.0\sod.exe" rm -f "$WINEPREFIX/drive_c/Program Files/sod20022.exe" ;; "Super Egg Hunt") install_wine_bottle wget -O "$WINEPREFIX/drive_c/Program Files/superegghuntsetup.exe" "http://files.l-works.net/superegghuntsetup.exe" wine "$WINEPREFIX/drive_c/Program Files/superegghuntsetup.exe" /silent add_launcher "c:\Program Files\Lworks\super egg hunt\superegghunt.exe" rm -f "$WINEPREFIX/drive_c/Program Files/superegghuntsetup.exe" ;; "Super Liam") install_wine_bottle vb6run dx8vb wget -O "$WINEPREFIX/drive_c/Program Files/superliamsetup.exe" "http://files.l-works.net/superliamsetup.exe" wine "$WINEPREFIX/drive_c/Program Files/superliamsetup.exe" /silent add_launcher "c:\Program Files\lWorks\Super Liam\sl.exe" rm -f "$WINEPREFIX/drive_c/Program Files/superliam.exe" ;; "The Blind Swordsman") install_wine_bottle wget -O "$WINEPREFIX/drive_c/Program Files/theblindswordsmanPC.zip" "http://www.evildogserver.com/theblindswordsman/theblindswordsmanPC.zip" unzip -d "$WINEPREFIX/drive_c/Program Files" "$WINEPREFIX/drive_c/Program Files/theblindswordsmanPC.zip" rm -f "$WINEPREFIX/drive_c/Program Files/theblindswordsmanPC.zip" add_launcher "c:\Program Files\TheBlindSwordsman.exe" ;; "Technoshock") install_wine_bottle wget -O "$WINEPREFIX/drive_c/Program Files/technoshock_140b_en.zip" "http://tiflocomp.ru/download/games/technoshock_140b_en.zip" wget -O "$WINEPREFIX/drive_c/Program Files/technoshock_140b_en_update.zip" "http://tiflocomp.ru/download/games/technoshock140b_en_update.zip" unzip -d "$WINEPREFIX/drive_c/Program Files" "$WINEPREFIX/drive_c/Program Files/technoshock_140b_en.zip" unzip -d "$WINEPREFIX/drive_c/Program Files" "$WINEPREFIX/drive_c/Program Files/technoshock_140b_en_update.zip" wine "$WINEPREFIX/drive_c/Program Files/setup_eng.exe" /silent wineserver -w wine "$WINEPREFIX/drive_c/Program Files/setup_eng_update_pack.exe" /silent add_launcher "c:\Program Files\Tiflocomp Games\Technoshock\ts.exe" rm -f "$WINEPREFIX/drive_c/Program Files/setup_eng.exe" "$WINEPREFIX/drive_c/Program Files/setup_eng_update_pack.exe" "$WINEPREFIX/drive_c/Program Files/technoshock_140b_en.zip" "$WINEPREFIX/drive_c/Program Files/technoshock_140b_en_update.zip" ;; "Top Speed 3") install_wine_bottle directplay wget -O "$WINEPREFIX/drive_c/Program Files/Tspeed_3.0.3.exe" "https://github.com/PlayingintheDark/TopSpeed/releases/download/h/Tspeed_3.0.3.exe" wine "$WINEPREFIX/drive_c/Program Files/Tspeed_3.0.3.exe" /silent add_launcher "c:\Program Files\Playing in the dark\Top Speed 3\TopSpeed.exe" rm -f "$WINEPREFIX/drive_c/Program Files/Tspeed_3.0.3.exe" ;; "Q9") install_wine_bottle wget -O "$WINEPREFIX/drive_c/Program Files/q9_english_installer.exe" "http://www.blastbay.com/q9_english_installer.exe" wine "$WINEPREFIX/drive_c/Program Files/q9_english_installer.exe" /silent add_launcher "c:\Program Files\Q9 Action Game\q9.exe" rm -f "$WINEPREFIX/drive_c/Program Files/q9_english_installer.exe" ;; "RS Games") # Does not speak with sapi. install_wine_bottle speechsdk vcrun6 wget -O "$WINEPREFIX/drive_c/Program Files/rsgames-client-setup-2.01.exe" "http://rsgames.org/rsdownloads/rsgclient/rsgames-client-setup-2.01.exe" wine "$WINEPREFIX/drive_c/Program Files/rsgames-client-setup-2.01.exe" /silent add_launcher "c:\Program Files\RS Games Client\rsg.exe" rm -f "$WINEPREFIX/drive_c/Program Files/rsgames-client-setup-2.01.exe" ;; "Undead Assault") # Does not speak with sapi. install_wine_bottle speechsdk vcrun6sp6 wget -O "$WINEPREFIX/drive_c/Program Files/undead_assault.zip" "http://undead-assault.com/static/files/public/undead_assault.zip" unzip -d "$WINEPREFIX/drive_c/Program Files" "$WINEPREFIX/drive_c/Program Files/undead_assault.zip" rm -f "$WINEPREFIX/drive_c/Program Files/undead_assault.zip" add_launcher "c:\Program Files\Undead Assault.exe" ;; "Make a One Time Donation") xdg-open "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=stormdragon2976@gmail.com&lc=US&item_name=Donation+to+Storm+Games&no_note=0&cn=¤cy_code=USD&bn=PP-DonationsBF:btn_donateCC_LG.gif:NonHosted" ;; "Become a Patron") xdg-open "https://patreon.com/stormux" ;; *) exit 0 ;; esac exit 0