diff --git a/audiogame-manager.sh b/audiogame-manager.sh index a109226..6d2deb9 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash license() { -cat << EOF + cat << EOF ■The contents of this file are subject to the Common Public Attribution License Version 1.0 (the ■License■); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -68,36 +68,21 @@ check_news() { # Automatic update function update() { - local filePath="$(command -v ${0})" - if file "${filePath}" | grep -q 'Bourne-Again shell script' ; then + local url="$(git ls-remote --get-url)" + if [[ "$url" =~ ^ssh://|git@ ]] || [[ -z "$url" ]]; then return fi - # make sure the site can be reached - ping -c1 stormgames.wolfe.casa &> /dev/null || return - if [[ "$(uname)" == "Darwin" ]]; then - local downloadFile="audiogame-manager.mac" - else - if [[ "$(uname -m)" == "armv7l" ]]; then - local downloadFile="audiogame-manager.arm" - else - local downloadFile="audiogame-manager" - fi - fi - if [[ "$(wget --quiet -O - https://stormgames.wolfe.casa/downloads/${downloadFile} | sha256sum | cut -d ' ' -f1)" == "$(sha256sum "${filePath}" | cut -d ' ' -f1)" ]]; then - return - fi - dialog --backtitle "Audiogame Manager" --yesno "There is a new version of ${0##*/} available.\nDo you want to update now?" -1 -1 - if [[ ${?} -eq 0 ]]; then - if [[ -w "$0" ]]; then - wget --quiet -O "${filePath}" "https://stormgames.wolfe.casa/downloads/${downloadFile}" - chmod +x "$0" - else - sudo wget --quiet -O "${filePath}" "https://stormgames.wolfe.casa/downloads/${downloadFile}" - sudo chmod +x "$0" - fi - echo "${0##*/} has been updated. Please launch the program again to use the latest version." - exit 0 - fi + git remote update &> /dev/null + local upstream='@{u}' + local home="$(git rev-parse @)" + local remote="$(git rev-parse "$upstream")" +if [[ "$home" == "$remote" ]]; then + return +fi + dialog --backtitle "Audiogame Manager" \ + --yesno "Updates are available. Would you like to update now?" -1 -1 --stdout || return + git pull + exit $? } # Function to open urls across OS. @@ -106,7 +91,7 @@ open_url() { open "${*}" 2> /dev/null else xdg-open "${*}" 2> /dev/null -fi + fi } # Create desktop launcher file @@ -135,7 +120,7 @@ desktop_launcher() { 'StartupNotify=false' 'Keywords=game;' 'Categories=Game;' - 'Version=1.0') + 'Version=1.0') for i in "${dotDesktop[@]}" ; do echo "$i" >> "${desktopFile}" done @@ -147,18 +132,18 @@ desktop_launcher() { # Create the clipboard reading function for Sequence Storm write_sequence_storm_reader() { - if -e ~/.SequenceStormReader ]]; then +if -e ~/.SequenceStormReader ]]; then return fi # Here-document start cat << "EOF" > ~/.SequenceStormReader #!/usr/bin/env bash - + # Wait for the game to be launched while ! pgrep -u "$USER" ^SequenceStorm &> /dev/null ; do sleep 0.05 done - + export DISPLAY=:0 unset cliptext socketFile="$(find /tmp -maxdepth 1 -name "orca-*.sock")" @@ -195,7 +180,7 @@ while pgrep -u "$USER" ^SequenceStorm &> /dev/null ; do fi sleep 0.05 done - + exit 0 EOF # Here-document end @@ -351,7 +336,7 @@ download() { get_bottle() { # Handles games that use the same wine bottle - case "${game}" in + case "${game}" in # Aprone (Jeremy Kaldobsky) games. "castaways"*) ;& "castaways-2"*) ;& @@ -377,6 +362,13 @@ get_bottle() { "super-egg-hunt"*) ;& "super-liam"*) ;& "the-great-toy-robbery"*) export WINEPREFIX="${HOME}/.local/wine/l-works";; + # Nyanchan games group + "bokurano-daibouken-3"*) ;& + "laser-breakout"*) ;& + "marina-break"*) ;& + "mp5"*) ;& + "screaming-strike-2"*) ;& + "world-of-war"*) export WINEPREFIX="${HOME}/.local/wine/nyanchan";; # Oriol Gomez games group "bombercats"*) ;& "copter-mission"*) ;& @@ -434,6 +426,15 @@ help() { for i in "${!command[@]}" ; do echo "-${i/:/ }: ${command[${i}]}" done | sort + echo + echo "Some settings that are often used can be stored in a settings.conf file." + echo "If wanted, place it at ${configFile%/*}/settings.conf." + echo "The syntax is variable=\"value\"" + echo + echo "noCache=\"true\" # Do not keep downloaded items in the cache." + echo "norh=\"true\" # Do not install RHVoice." + echo "redownload=\"true\" # Redownload sources, do not use the version stored in cache." + echo "winedebug=\"flag(s)\" # Set wine debug flags, useful for development." exit 0 } @@ -493,7 +494,7 @@ echo "Loading documentation, please wait..." fi exit 0 } - + winetricks() { # Report used packages to the winetricks maintainer so he knows they are being used. if ! [[ -e "${XDG_CACHE_HOME:-$HOME/.cache}/winetricks/track_usage" ]]; then @@ -821,6 +822,10 @@ cache="${XDG_CACHE_HOME:-$HOME/.cache}/audiogame-manager" configFile="${XDG_CONFIG_HOME:-$HOME/.config}/storm-games/audiogame-manager/games.conf" mkdir -p "${cache}" mkdir -p "${configFile%/*}" +# Load any arguments from settings.conf file +if [[ -r "${configFile%/*}/settings.conf" ]]; then + source "${configFile%/*}/settings.conf" +fi # Update the cache for older versions of audiogame-manager if [[ -d "${configFile%/*}/cache" ]]; then { mv -v "${configFile%/*}/cache/"* "${cache}" @@ -829,7 +834,7 @@ if [[ -d "${configFile%/*}/cache" ]]; then fi checkWinetricksUpdate="false" # Turn off debug messages -export WINEDEBUG="-all" +export WINEDEBUG="${winedebug:--all}" # Compatibility with box86 export BOX86_NOBANNER=1 # During installation, you can set winVer to the versions available. @@ -901,6 +906,7 @@ gameList=( "BG Word Target" "BG Word Yahtzee" "BG Yahtzee" + #"Blind Drive" "Bloodshed" "Bombercats" #"Breed Memorial" @@ -929,7 +935,6 @@ gameList=( "ESP Pinball Party Pack" #"Eurofly" "Extant" - "Fantasy Story II" #"Fartman" "Finger Panic" "Fuck That Bird" @@ -942,6 +947,7 @@ gameList=( "Judgement Day" "Kitchensinc Games" "Kringle Crash" + #"Laser Breakout" #"Light Battles" "Light Cars" "Lockpick" @@ -949,6 +955,7 @@ gameList=( "Lunimals" "Manamon" "Manamon 2" + "Marina Break" "Monkey Business" "MudSplat French" "MudSplat English" @@ -969,7 +976,7 @@ gameList=( "Q9" "Revelation" "Rhythm Rage" - #"River raiders" + #"River Raiders" "RS Games" "Run For Your Life" #"Sammy Center" @@ -1032,7 +1039,7 @@ declare -A command=( [c]="Check your system for necessary components." [C]="Clear the cache. All game installers will be deleted." [D]="Create desktop shortcut. You can launch audiogame-manager from the desktop or applications menu." - [d]="Debug mode, wine will be much more verbose when games are launched with this flag." + [d]="Debug mode, wine will be much more verbose when games are installed with this flag." [h]="This help screen." [i]="Install games." [I:]="Noninteractive game installation." @@ -1044,6 +1051,7 @@ declare -A command=( [P]="Print a list of packages required by audiogame-manager." [R]="Redownload. Removes old versions of packages from cache before installing." [r]="Remove a game. This will delete all game data." + [t]="Total games. Show how many games are currently available." ) # Convert the keys of the associative array to a format usable by getopts @@ -1056,7 +1064,7 @@ while getopts "${args}" i ; do D) desktop_launcher;; d) unset WINEDEBUG - game_launcher + game_installer ;; h) help;; i) game_installer;; @@ -1071,6 +1079,11 @@ while getopts "${args}" i ; do P) checklist quiet;; R) redownload="true";; r) game_removal;; + t) + dialog --backtitle "Audiogame Manager" \ + --infobox "There are currently ${#gameList[@]} games available." -1 -1 + exit 0 + ;; esac done @@ -1078,6 +1091,7 @@ done case "${game}" in "A Hero's Call") export winVer="win7" + export winetricksSettings="vd=1024x768" install_wine_bottle speechsdk corefonts # Dotnet is evil. That is all. LC_ALL=C DISPLAY="" winetricks -q dotnet462 xna40 @@ -1512,6 +1526,17 @@ case "${game}" in wine "${cache}/${bgInstaller}" /silent add_launcher "c:\Program Files\Games\yahtzeeB\BGYahtzee.exe" ;; + "Blind Drive") + get_installer "Blind Drive 1.1.112.00i-win64.zip" "https://lofipeople.itch.io/blind-drive" + export WINEARCH=win64 + export winVer="win8" + install_wine_bottle sapi + unzip -d "$WINEPREFIX/drive_c/Program Files/blind-drive" "${cache}/Blind Drive 1.1.112.00i-win64.zip" + # Weird work around to get keyboard working. + winetricks -q usetakefocus=y + winetricks -q usetakefocus=n + add_launcher "c:\Program Files\blind-drive\Blind Drive.exe" + ;; "Bloodshed") export winVer="win7" install_wine_bottle speechsdk @@ -1700,7 +1725,7 @@ case "${game}" in ;; "Entombed") export winVer="win7" - install_wine_bottle speechsdk msvcrt40 + install_wine_bottle speechsdk msvcrt40 gdiplus ie7 # Ok, more dotnet. LC_ALL=C DISPLAY="" winetricks -q dotnet462 wineserver -k # Sigh. @@ -1711,7 +1736,14 @@ case "${game}" in wine msiexec /i "${WINEPREFIX}/drive_c/temp/SSCERuntime_x86-ENU.msi" /q rm * popd + pushd "${WINEPREFIX}/drive_c/Program Files/Microsoft SQL Server Compact Edition/v3.5" + wine regsvr32 sqlceoledb35.dll + wine regsvr32 sqlceca35.dll + popd wine "${cache}/EntombedSetup.exe" /silent + pushd "${WINEPREFIX}/drive_c/Program Files/Entombed" + cp ../Microsoft\ SQL\ Server\ Compact\ Edition/v3.5/System.Data.SqlServerCe.Entity.dll ../Microsoft\ SQL\ Server\ Compact\ Edition/v3.5/Desktop/System.Data.SqlServerCe.dll . + popd add_launcher "c:\Program Files\Entombed\Entombed.exe" ;; "ESP Pinball Classic") @@ -1766,13 +1798,6 @@ case "${game}" in unzip -d "$WINEPREFIX/drive_c/Program Files/extant" "${cache}/extant.zip" add_launcher "c:\Program Files\extant\Extant.exe" ;; - "Fantasy Story II") - export winVer="win10" - install_wine_bottle speechsdk - download "https://stormgames.wolfe.casa/downloads/FS2_2.2_Windows_x86.zip" - unzip -d "$WINEPREFIX/drive_c/Program Files/" "${cache}/FS2_2.2_Windows_x86.zip" - add_launcher "c:\Program Files\FS2_2.2_Windows_x86\FantasyStory2.exe" - ;; "Fartman") install_wine_bottle dx8vb vb6run download "http://www.agarchive.net/games/bpc/fartman.exe" @@ -1834,8 +1859,8 @@ case "${game}" in add_launcher "c:\Program Files\hammer of glory\game.exe" ;; "Hearthstone") - export winVer="win7" - install_wine_bottle speechsdk + export winVer="win10" + install_wine_bottle ie8 vcrun2015 speechsdk # This download url breaks the download function, so grab it manually. wget -O "${cache}/Hearthstone.exe" "https://www.battle.net/download/getInstallerForGame?os=win&gameProgram=HEARTHSTONE&version=Live" wget -O "${cache}/Hearthstone_patch.zip" "https://github.com/HearthstoneAccess/HearthstoneAccess/releases/latest/download/patch.zip" @@ -1900,7 +1925,7 @@ case "${game}" in wine "${cache}/judgmentdayfullsetup.exe" /silent cat << EOF > /tmp/judgementday.reg Windows Registry Editor Version 5.00 - + [HKEY_CURRENT_USER\Software\VB and VBA Program Settings\judgmentday\config] "name"="$USER" EOF @@ -1921,6 +1946,17 @@ EOF wine "${cache}/kringle crash setup.exe" /silent add_launcher "c:\Program Files\Kringle Crash\kringlecrash.exe" ;; + "Laser Breakout") + export bottle="nyanchan" + export winVer="win7" + install_wine_bottle speechsdk + download "http://www.nyanchangames.com/softs/lsSetup.exe" "https://stormgames.wolfe.casa/downloads/nvdaControllerClient32.dll" + wine "${cache}/lsSetup.exe" & + xdotool sleep 10 key Return + wineserver -w + find "${WINEPREFIX}" -type f -name "nvdaControllerClient.dll" -exec rm -fv "{}" \; + add_launcher "c:\nyanchangame\laser breakout\play.exe" + ;; "Light Battles") export winVer="win7" install_wine_bottle speechsdk @@ -1988,6 +2024,17 @@ EOF wine "${cache}/manamon2_installer.exe" /silent add_launcher "c:\Program Files\VGStorm.com\Manamon 2\rpg.exe" ;; + "Marina Break") + export bottle="nyanchan" + export winVer="win7" + install_wine_bottle speechsdk + download "https://www.nyanchangames.com/softs/MbSetupE.exe" + wine "${cache}/MbSetupE.exe" & + xdotool sleep 10 key Return + wineserver -w + find "${WINEPREFIX}" -type f -name "nvdaControllerClient.dll" -exec rm -fv "{}" \; + add_launcher "c:\nyanchangame\MarinaBreak\marinabreak.exe" + ;; "Monkey Business") export winVer="win7" install_wine_bottle vb6run dx8vb speechsdk quartz @@ -2148,9 +2195,10 @@ EOF # Choppy sound under water. install_wine_bottle download "https://www.agarchive.net/games/XSight/River%20Raiders%201.3.5.exe" - wine "$cache/River Raiders 1.3.5.exe" /silent & + wine "$cache/River Raiders 1.3.5.exe" & xdotool sleep 5 type y 2> /dev/null xdotool sleep 1 key --clearmodifiers alt+n sleep 2 key alt+n sleep 2 key alt+n sleep 2 key alt+i sleep 5 key alt+f 2> /dev/null + wineserver -w add_launcher "c:\Program Files\River Raiders\raid.exe" ;; "RS Games") @@ -2187,6 +2235,7 @@ EOF add_launcher "c:\Program Files\scramble_win32\scramble.exe" ;; "Screaming Strike 2") + export bottle="nyanchan" export winVer="win7" install_wine_bottle fakejapanese speechsdk download "https://www.nyanchangames.com/softs/screamingStrike2.exe" "https://stormgames.wolfe.casa/downloads/nvdaControllerClient32.dll" @@ -2289,7 +2338,7 @@ EOF ;; "Super Egg Hunt") export bottle="l-works" - install_wine_bottle + install_wine_bottle download "http://files.l-works.net/superegghuntsetup.exe" wine "${cache}/superegghuntsetup.exe" /silent add_launcher "c:\Program Files\Lworks\super egg hunt\superegghunt.exe"