#!/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 [[ -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() { # Find the last line of the script. local lastLine="$(grep -n '^exit 0' $0)" # Convert lastLine to a number andd increment it by 1. lastLine=${lastLine%%:*} lastLine=$((lastLine + 1)) # An array of infromation from the end of the file, we'll parse it to make the menu. mapfile -t installedGames < <(tail +${lastLine} "$0" | sed '/^$/d' | 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 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() { # Find the last line of the script. local lastLine="$(grep -n '^exit 0' $0)" # Convert lastLine to a number andd increment it by 1. lastLine=${lastLine%%:*} lastLine=$((lastLine + 1)) # An array of infromation from the end of the file, we'll parse it to make the menu. mapfile -t lines < <(tail +${lastLine} "$0" | sed '/^$/d') 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 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 local winePath="${game#*|}" winePath="${winePath%\\*.exe}" local wineExec="${game#*|}" wineExec="${wineExec%|*}" wineExec="${wineExec##*\\}" 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}" # Find the last line of the script. local lastLine="$(grep -n '^exit 0' $0)" # Convert lastLine to a number andd increment it by 1. lastLine=${lastLine%%:*} lastLine=$((lastLine + 1)) if ! tail +${lastLine} "$0" | grep -F -q -x "${launchSettings}" ; then echo "${launchSettings}" >> "$0" fi } automate_installer() { # Function arguments are the keys to be pressed. 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 sleep 15 type ${i} & ;; esac done 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. 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" # The list of games available for installation. # Use menu friendly names. gameList=( "Bloodshed" "Chopper Challenge" "Kitchensinc Games" "Rail Racer" "River Raiders" "Super Egg Hunt" "The Blind Swordsman" "Top Speed 3" "Q9" "RS Games" ) # 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 ) while getopts "${command[*]//[[:space:]]/}" i ; do case "$i" in c) checklist;; h) show_help;; i) game_installer;; esac done # Install game based on the selection above. case "${game}" in "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" ;; "Chopper Challenge") install_wine_bottle vb6run dx8vb wget -O "$WINEPREFIX/drive_c/Program Files/chopper challenge setup.exe" "https://www.agarchive.net/games/XSight/chopper%20challenge%20setup.exe" wine "$WINEPREFIX/drive_c/Program Files/chopper challenge setup.exe" & sleep 5 xdotool type y xdotool key --clearmodifiers --delay 1000 alt+n alt+n alt+n alt+i alt+f add_launcher "c:\Program Files\x-sight interactive\chopper challenge\Chopper.exe" echo 'Linux|n/a' >> "$WINEPREFIX/drive_c/Program Files/x-sight interactive/chopper challenge/config.dat" & rm -f "$WINEPREFIX/drive_c/Program Files/chopper challenge setup.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" add_launcher "c:\Program Files\Kitchen's Sink\gamemenu.exe" #rm -f "$WINEPREFIX/drive_c/Program Files/Kitchensinc complete Setup.exe" ;; "Rail Racer") install_wine_bottle wget -O "$WINEPREFIX/drive_c/Program Files/RailRacerDemo10Setup.exe" "https://www.agarchive.net/games/other/RailRacerDemo10Setup.exe" wine "$WINEPREFIX/drive_c/Program Files/RailRacerDemo10Setup.exe" /silent #add_launcher "c:\Program Files\" rm -f "$WINEPREFIX/drive_c/Program Files/RailRacerDemo10Setup.exe" ;; "River Raiders") install_wine_bottle wget -O "$WINEPREFIX/drive_c/Program Files/River Raiders.exe" "https://www.agarchive.net/games/XSight/River%20Raiders%201.3.5.exe" wine "c:\Program Files\River Raiders.exe" /silent & sleep 5 xdotool type y xdotool key --delay 1000 alt+y alt+n alt+n alt+n alt+i alt+f rm -f "c:\Program Files\River Raiders.exe" add_launcher "c:\Program Files\River Raiders\raid.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" ;; "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" ;; "Top Speed 3") install_wine_bottle 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") install_wine_bottle speechsdk 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" ;; *) exit 0 ;; esac # End of program, after the exit line, game information begins. # Field order bottle|path|Display Name exit 0