first code for moving to new game launch system, stuff is likely broken.
This commit is contained in:
parent
42b40489ce
commit
cdfcf7aacf
1
.launch/Aliens.sh
Normal file
1
.launch/Aliens.sh
Normal file
@ -0,0 +1 @@
|
||||
open_url "https://files.jantrid.net/aliens/"
|
1
.launch/Battle Weary.sh
Normal file
1
.launch/Battle Weary.sh
Normal file
@ -0,0 +1 @@
|
||||
open_url "https://lonespelunker.itch.io/battle-weary"
|
1
.launch/Cacophony.sh
Normal file
1
.launch/Cacophony.sh
Normal file
@ -0,0 +1 @@
|
||||
open_url "https://tianmaru.itch.io/cacophony"
|
1
.launch/Donate.sh
Normal file
1
.launch/Donate.sh
Normal file
@ -0,0 +1 @@
|
||||
open_url "https://ko-fi.com/stormux"
|
1
.launch/QuentinC Play Room.sh
Normal file
1
.launch/QuentinC Play Room.sh
Normal file
@ -0,0 +1 @@
|
||||
open_url "https://qcsalon.net/"
|
1
.launch/Trigaea.sh
Normal file
1
.launch/Trigaea.sh
Normal file
@ -0,0 +1 @@
|
||||
open_url "https://ryngm.itch.io/trigaea"
|
@ -485,20 +485,37 @@ game_update() {
|
||||
|
||||
# launch games that are installed
|
||||
game_launcher() {
|
||||
mapfile -t lines < <(sed '/^$/d' "${configFile}" 2> /dev/null)
|
||||
# Create the menu of installed games
|
||||
# Initialize array for menu construction
|
||||
declare -a menuList
|
||||
for i in "${lines[@]}" ; do
|
||||
# Read both config file and .launch files into lines array
|
||||
mapfile -t lines < <(
|
||||
sed '/^$/d' "${configFile}" 2> /dev/null
|
||||
if [[ -d ".launch" ]]; then
|
||||
find "${0%/*}/.launch" -maxdepth 1 -type f -iname "*.sh" -exec bash -c '
|
||||
for f; do
|
||||
name="${f##*/}"
|
||||
echo "${name%.sh}|$f"
|
||||
done
|
||||
' bash {} \;
|
||||
fi
|
||||
)
|
||||
# Add all entries to menu
|
||||
for i in "${lines[@]}"; do
|
||||
menuList+=("${i#*|}" "${i%|*}")
|
||||
done
|
||||
# Web based games and donation
|
||||
menuList+=("Aliens" "Aliens")
|
||||
menuList+=("Cacophony" "Cacophony")
|
||||
menuList+=("Battle Weary" "Battle Weary")
|
||||
menuList+=("QuentinC Play Room" "QuentinC Play Room")
|
||||
menuList+=("Trigaea" "Trigaea")
|
||||
menuList+=("Donate" "Donate")
|
||||
game="$(dialog --backtitle "Linux Game Launcher" \
|
||||
# Sort the menu
|
||||
mapfile -t sortedList < <(
|
||||
for ((i=0; i<${#menuList[@]}; i+=2)); do
|
||||
echo "${menuList[i+1]}|${menuList[i]}"
|
||||
done | sort -f
|
||||
)
|
||||
# Rebuild menuList from sorted entries
|
||||
menuList=()
|
||||
for entry in "${sortedList[@]}"; do
|
||||
menuList+=("${entry#*|}" "${entry%|*}")
|
||||
done
|
||||
# Create the menu of all games
|
||||
selectedGame="$(dialog --backtitle "Linux Game Launcher" \
|
||||
--clear \
|
||||
--no-tags \
|
||||
--menu "Please select a game to play" 0 0 0 "${menuList[@]}" --stdout)"
|
||||
@ -506,52 +523,37 @@ game_launcher() {
|
||||
if [[ $menuCode -eq 1 ]]; then
|
||||
exit 0
|
||||
fi
|
||||
# Remove any trailing | from game variable.
|
||||
game="${game%|}"
|
||||
case "${game}" in
|
||||
"Aliens")
|
||||
open_url "https://files.jantrid.net/aliens/"
|
||||
;;
|
||||
"Battle Weary")
|
||||
open_url "https://lonespelunker.itch.io/battle-weary"
|
||||
;;
|
||||
"Cacophony")
|
||||
open_url "https://tianmaru.itch.io/cacophony"
|
||||
;;
|
||||
"QuentinC Play Room")
|
||||
open_url "https://qcsalon.net/"
|
||||
;;
|
||||
"Trigaea")
|
||||
open_url "https://ryngm.itch.io/trigaea"
|
||||
;;
|
||||
"Donate")
|
||||
open_url "https://ko-fi.com/stormux"
|
||||
;;
|
||||
# Remove any trailing | from selectedGame variable
|
||||
selectedGame="${selectedGame%|}"
|
||||
case "${selectedGame}" in
|
||||
*".tin")
|
||||
git -C "${game%/*}" pull | \
|
||||
git -C "${selectedGame%/*}" pull | \
|
||||
dialog --progressbox "Checking for updates, please wait..." -1 -1
|
||||
if [[ -n "${COLORTERM}" ]]; then
|
||||
terminal_emulator tt++ ${game##*/}
|
||||
terminal_emulator tt++ ${selectedGame##*/}
|
||||
else
|
||||
pushd "${game%/*}"
|
||||
exec tt++ ${game##*/}
|
||||
pushd "${selectedGame%/*}"
|
||||
exec tt++ ${selectedGame##*/}
|
||||
fi
|
||||
;;
|
||||
*"main.py")
|
||||
pushd "${game%/*}"
|
||||
pushd "${selectedGame%/*}"
|
||||
git pull -q | dialog --progressbox "Checking for updates, please wait..." -1 -1
|
||||
python3 ${game}
|
||||
python3 ${selectedGame}
|
||||
;;
|
||||
*.sh)
|
||||
. "${selectedGame}"
|
||||
;;
|
||||
*)
|
||||
pushd "${game%/*}"
|
||||
if file "${game##*/}" | grep -q "ELF.*x86-64"; then
|
||||
pushd "${selectedGame%/*}"
|
||||
if file "${selectedGame##*/}" | grep -q "ELF.*x86-64"; then
|
||||
if [[ "$(uname -m)" != "x86_64" ]]; then
|
||||
exec FEXLoader -- ${game}
|
||||
exec FEXLoader -- ${selectedGame}
|
||||
else
|
||||
exec ${game}
|
||||
exec ${selectedGame}
|
||||
fi
|
||||
else
|
||||
exec ${game}
|
||||
exec ${selectedGame}
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
Loading…
Reference in New Issue
Block a user