Changed to a file based configuration system for installed games. Added donation options.
This commit is contained in:
parent
a0ed4222f2
commit
82e7528037
@ -54,13 +54,7 @@ install_wine_bottle() {
|
|||||||
|
|
||||||
# Install games
|
# Install games
|
||||||
game_installer() {
|
game_installer() {
|
||||||
# Find the last line of the script.
|
mapfile -t installedGames < <(sed '/^$/d' "${configFile}" 2> /dev/null | cut -d '|' -f3)
|
||||||
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
|
# Create the menu of installed games
|
||||||
declare -a menuList
|
declare -a menuList
|
||||||
for i in "${gameList[@]}" ; do
|
for i in "${gameList[@]}" ; do
|
||||||
@ -78,6 +72,8 @@ game_installer() {
|
|||||||
echo "All games are already installed."
|
echo "All games are already installed."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
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" \
|
game="$(dialog --backtitle "Audio Game Installer" \
|
||||||
--clear \
|
--clear \
|
||||||
--no-tags \
|
--no-tags \
|
||||||
@ -86,13 +82,7 @@ game_installer() {
|
|||||||
|
|
||||||
# launch games that are installed
|
# launch games that are installed
|
||||||
game_launcher() {
|
game_launcher() {
|
||||||
# Find the last line of the script.
|
mapfile -t lines < <(sed '/^$/d' "${configFile}" 2> /dev/null)
|
||||||
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
|
if [[ ${#lines} -eq 0 ]]; then
|
||||||
echo "Install some games first."
|
echo "Install some games first."
|
||||||
exit 0
|
exit 0
|
||||||
@ -102,16 +92,29 @@ game_launcher() {
|
|||||||
for i in "${lines[@]}" ; do
|
for i in "${lines[@]}" ; do
|
||||||
menuList+=("${i%|*}" "${i##*|}")
|
menuList+=("${i%|*}" "${i##*|}")
|
||||||
done
|
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" \
|
local game="$(dialog --backtitle "Audio Game Launcher" \
|
||||||
--clear \
|
--clear \
|
||||||
--no-tags \
|
--no-tags \
|
||||||
--menu "Please select a game to play" 0 0 0 "${menuList[@]}" --stdout)"
|
--menu "Please select a game to play" 0 0 0 "${menuList[@]}" --stdout)"
|
||||||
if [[ ${#game} -gt 0 ]]; then
|
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#*|}"
|
local winePath="${game#*|}"
|
||||||
winePath="${winePath%\\*.exe}"
|
winePath="${winePath%\\*.exe}"
|
||||||
local wineExec="${game#*|}"
|
local wineExec="${game#*|}"
|
||||||
wineExec="${wineExec%|*}"
|
wineExec="${wineExec%|*}"
|
||||||
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"
|
WINEPREFIX="${HOME}/.local/wine/${game%|*}" wine start /d "${winePath}" "$wineExec"
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
@ -125,13 +128,8 @@ game_launcher() {
|
|||||||
add_launcher() {
|
add_launcher() {
|
||||||
local launchSettings="${game,,}"
|
local launchSettings="${game,,}"
|
||||||
launchSettings="${launchSettings//[[:space:]]/-}|${1}|${game}"
|
launchSettings="${launchSettings//[[:space:]]/-}|${1}|${game}"
|
||||||
# Find the last line of the script.
|
if ! grep -F -q -x "${launchSettings}" "${configFile}" ; then
|
||||||
local lastLine="$(grep -n '^exit 0' $0)"
|
echo "${launchSettings}" >> "${configFile}"
|
||||||
# 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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,6 +148,9 @@ automate_installer() {
|
|||||||
xdotool ${keyList[*]} &
|
xdotool ${keyList[*]} &
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 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.
|
# 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
|
export WINEARCH=win32
|
||||||
# Turn off debug messages
|
# Turn off debug messages
|
||||||
@ -169,6 +170,7 @@ gameList=(
|
|||||||
"Light Cars"
|
"Light Cars"
|
||||||
"Rail Racer"
|
"Rail Racer"
|
||||||
"River Raiders"
|
"River Raiders"
|
||||||
|
"Shades of Doom"
|
||||||
"Super Egg Hunt"
|
"Super Egg Hunt"
|
||||||
"Super Liam"
|
"Super Liam"
|
||||||
"The Blind Swordsman"
|
"The Blind Swordsman"
|
||||||
@ -238,9 +240,9 @@ case "${game}" in
|
|||||||
install_wine_bottle vb6run speechsdk
|
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"
|
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
|
#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"
|
wine "$WINEPREFIX/drive_c/Program Files/Kitchensinc complete Setup.exe" /q
|
||||||
add_launcher "c:\Program Files\Kitchen's Sink\gamemenu.exe"
|
add_launcher "c:\Program Files\Kitchen's Sink\gamemenu.exe"
|
||||||
#rm -f "$WINEPREFIX/drive_c/Program Files/Kitchensinc complete Setup.exe"
|
rm -f "$WINEPREFIX/drive_c/Program Files/Kitchensinc complete Setup.exe"
|
||||||
;;
|
;;
|
||||||
"Light Cars")
|
"Light Cars")
|
||||||
install_wine_bottle dx8vb
|
install_wine_bottle dx8vb
|
||||||
@ -267,6 +269,13 @@ case "${game}" in
|
|||||||
rm -f "c:\Program Files\River Raiders.exe"
|
rm -f "c:\Program Files\River Raiders.exe"
|
||||||
add_launcher "c:\Program Files\River Raiders\raid.exe"
|
add_launcher "c:\Program Files\River Raiders\raid.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")
|
"Super Egg Hunt")
|
||||||
install_wine_bottle
|
install_wine_bottle
|
||||||
wget -O "$WINEPREFIX/drive_c/Program Files/superegghuntsetup.exe" "http://files.l-works.net/superegghuntsetup.exe"
|
wget -O "$WINEPREFIX/drive_c/Program Files/superegghuntsetup.exe" "http://files.l-works.net/superegghuntsetup.exe"
|
||||||
@ -338,11 +347,15 @@ case "${game}" in
|
|||||||
rm -f "$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"
|
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
|
exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# End of program, after the exit line, game information begins.
|
|
||||||
# Field order bottle|path|Display Name
|
|
||||||
exit 0
|
exit 0
|
||||||
|
Loading…
Reference in New Issue
Block a user