Skip to content

Commit

Permalink
new launchers
Browse files Browse the repository at this point in the history
  • Loading branch information
dragoonDorise committed Jan 27, 2025
1 parent bcb2178 commit c9e3f64
Show file tree
Hide file tree
Showing 20 changed files with 45 additions and 501 deletions.
38 changes: 24 additions & 14 deletions functions/helperFunctions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1118,23 +1118,33 @@ function emulatorInit(){
exe=("$exe_path")
fi

#run the executable with the params.
launch_args=()
for rom in "${params}"; do
# Parsers previously had single quotes ("'/path/to/rom'" ), this allows those shortcuts to continue working.
removedLegacySingleQuotes=$(echo "$rom" | sed "s/^'//; s/'$//")
launch_args+=("$removedLegacySingleQuotes")
done

echo "Launching: ${exe[*]} ${launch_args[*]}"
fileExtension="${@##*.}"

if [[ -z "${*}" ]]; then
echo "ROM not found. Launching $emuName directly"
"${exe[@]}"
if [[ $fileExtension == "psvita" ]]; then
vita3kFile=$(<"${*}")
echo "GAME ID: $vita3kFile"
"${exe[@]}" -Fr "$vita3kFile"
else
echo "ROM found, launching game"
"${exe[@]}" "${launch_args[@]}"
#run the executable with the params.
launch_args=()
for rom in "${params}"; do
# Parsers previously had single quotes ("'/path/to/rom'" ), this allows those shortcuts to continue working.
removedLegacySingleQuotes=$(echo "$rom" | sed "s/^'//; s/'$//")
launch_args+=("$removedLegacySingleQuotes")
done

echo "Launching: ${exe[*]} ${launch_args[*]}"

if [[ -z "${*}" ]]; then
echo "ROM not found. Launching $emuName directly"
"${exe[@]}"
else
echo "ROM found, launching game"
"${exe[@]}" "${launch_args[@]}"
fi

fi

fi


Expand Down
13 changes: 1 addition & 12 deletions tools/launchers/cemu-native.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
#!/bin/bash
. "$HOME/.config/EmuDeck/backend/functions/all.sh"
emulatorInit "cemu"
# shellcheck disable=SC1091
. "$emudeckFolder/settings.sh"

# shellcheck disable=SC2154
LAUNCH="${toolsPath}/emu-launch.sh"

# Set emulator name
EMU="Cemu"

# Launch emu-launch.sh
"${LAUNCH}" -e "${EMU}" -- "${@}"
emulatorInit "Cemu" "Cemu" "${@}"
rm -rf "$savesPath/.gaming"
3 changes: 1 addition & 2 deletions tools/launchers/duckstation.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. "$HOME/.config/EmuDeck/backend/functions/all.sh"
emulatorInit "duckstation"
/usr/bin/flatpak run org.duckstation.DuckStation "${@}"
emulatorInit "duckstation" "duckstation" "${@}"
rm -rf "$savesPath/.gaming"
5 changes: 2 additions & 3 deletions tools/launchers/flycast.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. "$HOME/.config/EmuDeck/backend/functions/all.sh"
emulatorInit "flycast"
/usr/bin/flatpak run org.flycast.Flycast "${@}"
rm -rf "$savesPath/.gaming"
emulatorInit "flycast" "flycast" "${@}"
/usr/bin/flatpak run org.flycast.Flycast "${@}"
3 changes: 1 addition & 2 deletions tools/launchers/mame.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. "$HOME/.config/EmuDeck/backend/functions/all.sh"
emulatorInit "mame"
/usr/bin/flatpak run org.mamedev.MAME "${@}"
emulatorInit "mame" "MAME" "${@}"
rm -rf "$savesPath/.gaming"
3 changes: 1 addition & 2 deletions tools/launchers/melonds.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. "$HOME/.config/EmuDeck/backend/functions/all.sh"
emulatorInit "melonds"
/usr/bin/flatpak run net.kuribo64.melonDS "${@}"
emulatorInit "melonds" "melonDS" "${@}"
rm -rf "$savesPath/.gaming"
42 changes: 1 addition & 41 deletions tools/launchers/mgba.sh
Original file line number Diff line number Diff line change
@@ -1,44 +1,4 @@
#!/bin/bash
. "$HOME/.config/EmuDeck/backend/functions/all.sh"
emulatorInit "mgba"
emuName="mGBA" #parameterize me
emufolder="$emusFolder" # has to be applications for ES-DE to find it

#initialize execute array
exe=()

#find full path to emu executable
exe_path=$(find "$emufolder" -iname "${emuName}*.AppImage" | sort -n | cut -d' ' -f 2- | tail -n 1 2>/dev/null)

#if appimage doesn't exist fall back to flatpak.
if [[ -z "$exe_path" ]]; then
#flatpak
flatpakApp=$(flatpak list --app --columns=application | grep "$emuName")
#fill execute array
exe=("flatpak" "run" "$flatpakApp")
else
#make sure that file is executable
chmod +x "$exe_path"
#fill execute array
exe=("$exe_path")
fi

#run the executable with the params.
launch_args=()
for rom in "${@}"; do
# Parsers previously had single quotes ("'/path/to/rom'" ), this allows those shortcuts to continue working.
removedLegacySingleQuotes=$(echo "$rom" | sed "s/^'//; s/'$//")
launch_args+=("$removedLegacySingleQuotes")
done

echo "Launching: ${exe[*]} ${launch_args[*]}"

if [[ -z "${*}" ]]; then
echo "ROM not found. Launching $emuName directly"
"${exe[@]}"
else
echo "ROM found, launching game"
"${exe[@]}" "${launch_args[@]}"
fi

emulatorInit "mgba" "mGBA" ${@}
rm -rf "$savesPath/.gaming"
42 changes: 1 addition & 41 deletions tools/launchers/pcsx2-qt.sh
Original file line number Diff line number Diff line change
@@ -1,44 +1,4 @@
#!/bin/bash
. "$HOME/.config/EmuDeck/backend/functions/all.sh"
emulatorInit "pcsx2"
emuName="pcsx2-Qt" #parameterize me
emufolder="$emusFolder" # has to be applications for ES-DE to find it

#initialize execute array
exe=()

#find full path to emu executable
exe_path=$(find "$emufolder" -iname "${emuName}*.AppImage" | sort -n | cut -d' ' -f 2- | tail -n 1 2>/dev/null)

#if appimage doesn't exist fall back to flatpak.
if [[ -z "$exe_path" ]]; then
#flatpak
flatpakApp=$(flatpak list --app --columns=application | grep "$emuName")
#fill execute array
exe=("flatpak" "run" "$flatpakApp")
else
#make sure that file is executable
chmod +x "$exe_path"
#fill execute array
exe=("$exe_path")
fi

#run the executable with the params.
launch_args=()
for rom in "${@}"; do
# Parsers previously had single quotes ("'/path/to/rom'" ), this allows those shortcuts to continue working.
removedLegacySingleQuotes=$(echo "$rom" | sed "s/^'//; s/'$//")
launch_args+=("$removedLegacySingleQuotes")
done

echo "Launching: ${exe[*]} ${launch_args[*]}"

if [[ -z "${*}" ]]; then
echo "ROM not found. Launching $emuName directly"
"${exe[@]}"
else
echo "ROM found, launching game"
"${exe[@]}" "${launch_args[@]}"
fi

emulatorInit "pcsx2" "pcsx2-Qt" ${@}
rm -rf "$savesPath/.gaming"
3 changes: 1 addition & 2 deletions tools/launchers/ppsspp.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. "$HOME/.config/EmuDeck/backend/functions/all.sh"
emulatorInit "ppsspp"
/usr/bin/flatpak run org.ppsspp.PPSSPP "${@}"
emulatorInit "ppsspp" "ppsspp" "${@}"
rm -rf "$savesPath/.gaming"
3 changes: 1 addition & 2 deletions tools/launchers/primehack.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. "$HOME/.config/EmuDeck/backend/functions/all.sh"
emulatorInit "primehack"
/usr/bin/flatpak run io.github.shiiion.primehack "${@}"
emulatorInit "primehack" "primehack" "${@}"
rm -rf "$savesPath/.gaming"
3 changes: 1 addition & 2 deletions tools/launchers/rosaliesmupengui.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. "$HOME/.config/EmuDeck/backend/functions/all.sh"
emulatorInit "RMG"
/usr/bin/flatpak run com.github.Rosalie241.RMG "${@}"
emulatorInit "RMG" "RMG" "${@}"
rm -rf "$savesPath/.gaming"
50 changes: 1 addition & 49 deletions tools/launchers/rpcs3.sh
Original file line number Diff line number Diff line change
@@ -1,52 +1,4 @@
#!/bin/bash
. "$HOME/.config/EmuDeck/backend/functions/all.sh"
emulatorInit "rpcs3"
emuName="rpcs3" #parameterize me
emufolder="$emusFolder" # has to be applications for ES-DE to find it

#initialize execute array
exe=()

#find full path to emu executable
exe_path=$(find "$emufolder" -iname "${emuName}*.AppImage" | sort -n | cut -d' ' -f 2- | tail -n 1 2>/dev/null)

#if appimage doesn't exist fall back to flatpak.
if [[ -z "$exe_path" ]]; then
#flatpak
flatpakApp=$(flatpak list --app --columns=application | grep "$RPCS3_emuPathFlatpak")
#fill execute array
exe=("flatpak" "run" "$flatpakApp")
else
#make sure that file is executable
chmod +x "$exe_path"
#fill execute array
exe=("$exe_path")
fi

fileExtension="${@##*.}"

if [[ $fileExtension == "desktop" ]]; then
rpcs3desktopFile=$(grep -E "^Exec=" "${*}" | sed 's/^Exec=//' | sed 's/%%/%/g')
echo "Exec=$rpcs3desktopFile"
eval $rpcs3desktopFile
else
#run the executable with the params.
launch_args=()
for rom in "${@}"; do
# Parsers previously had single quotes ("'/path/to/rom'" ), this allows those shortcuts to continue working.
removedLegacySingleQuotes=$(echo "$rom" | sed "s/^'//; s/'$//")
launch_args+=("$removedLegacySingleQuotes")
done

echo "Launching: ${exe[*]} ${launch_args[*]}"

if [[ -z "${*}" ]]; then
echo "ROM not found. Launching $emuName directly"
"${exe[@]}"
else
echo "ROM found, launching game"
"${exe[@]}" "${launch_args[@]}"
fi
fi

emulatorInit "rpcs3""rpcs3" "${@}"
rm -rf "$savesPath/.gaming"
42 changes: 1 addition & 41 deletions tools/launchers/ryujinx.sh
Original file line number Diff line number Diff line change
@@ -1,44 +1,4 @@
#!/bin/bash
. "$HOME/.config/EmuDeck/backend/functions/all.sh"
emulatorInit "ryujinx"
emuName="Ryujinx" #parameterize me
emufolder="$emusFolder/publish" # has to be here for ES-DE to find it

#initialize execute array
exe=()

#find full path to emu executable
exe_path=$(find "$emufolder" -iname "${emuName}.sh" | sort -n | cut -d' ' -f 2- | tail -n 1 2>/dev/null)

#if appimage doesn't exist fall back to flatpak.
if [[ -z "$exe_path" ]]; then
#flatpak
flatpakApp=$(flatpak list --app --columns=application | grep "$emuName")
#fill execute array
exe=("flatpak" "run" "$flatpakApp")
else
#make sure that file is executable
chmod +x "$exe_path"
#fill execute array
exe=("$exe_path")
fi

#run the executable with the params.
launch_args=()
for rom in "${@}"; do
# Parsers previously had single quotes ("'/path/to/rom'" ), this allows those shortcuts to continue working.
removedLegacySingleQuotes=$(echo "$rom" | sed "s/^'//; s/'$//")
launch_args+=("$removedLegacySingleQuotes")
done

echo "Launching: ${exe[*]} ${launch_args[*]}"

if [[ -z "${*}" ]]; then
echo "ROM not found. Launching $emuName directly"
"${exe[@]}"
else
echo "ROM found, launching game"
"${exe[@]}" "${launch_args[@]}"
fi

emulatorInit "ryujinx" "Ryujinx" "${@}"
rm -rf "$savesPath/.gaming"
3 changes: 1 addition & 2 deletions tools/launchers/scummvm.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. "$HOME/.config/EmuDeck/backend/functions/all.sh"
emulatorInit "scummvm"
/usr/bin/flatpak run org.scummvm.ScummVM "${@}"
emulatorInit "scummvm" "scummvm" "${@}"
rm -rf "$savesPath/.gaming"
71 changes: 1 addition & 70 deletions tools/launchers/shadps4.sh
Original file line number Diff line number Diff line change
@@ -1,73 +1,4 @@
#!/bin/bash
. "$HOME/.config/EmuDeck/backend/functions/all.sh"
emulatorInit "shadps4"
emuName="Shadps4-qt" #parameterize me
emufolder="$emusFolder" # has to be applications for ES-DE to find it

#initialize execute array
exe=()

#find full path to emu executable
exe_path=$(find "$ShadPS4_emuPath" -iname "${ShadPS4_emuFileName}*.AppImage" | sort -n | cut -d' ' -f 2- | tail -n 1 2>/dev/null)

#if appimage doesn't exist fall back to flatpak.
if [[ -z "$exe_path" ]]; then
#flatpak
flatpakApp=$(flatpak list --app --columns=application | grep "$ShadPS4_emuName")
#check if flatpakApp is empty
if [[ -z "$flatpakApp" ]]; then
echo "Flatpak for '$ShadPS4_emuName' not found."
exit 1
fi
#fill execute array
exe=("flatpak" "run" "$flatpakApp")
else
#make sure that file is executable
chmod +x "$exe_path"
#fill execute array
exe=("$exe_path")
fi

fileExtension="${@##*.}"

if [[ $fileExtension == "desktop" ]]; then
# trying to figure this out... :)
# In desktop file the Exec line is like this:
# Exec=/tmp/.mount_ShadpsT3Dso0/usr/bin/shadps4 "/run/media/mmcblk0p1/Emulation/storage/shadps4/games/CUSA01369/eboot.bin"

# takes desktop file and extracts Exec= line
shadps4DesktopExec=$(grep -E "^Exec=" "${*}" | sed 's/^Exec=//' | sed 's/%%/%/g')

# commented, doing it bit different...
#launchParam="Exec=$shadps4DesktopExec" # construct new Exec= line
#launchParam=$(echo "$launchParam" | sed "s|^\(Exec=\)[^\"']*\"|\1$emusFolder/Shadps4-qt.AppImage -g \"|" | sed 's/^Exec=//')

# this removes everything in Exec= line before first " or ' (quotes), keeps everything after that (including the quotes)
# given example above, result will be: "/run/media/mmcblk0p1/Emulation/storage/shadps4/games/CUSA01369/eboot.bin"
launchParam=$(echo "Exec=$shadps4DesktopExec" | sed "s|^\(Exec=\)[^\"\']*\([\"\']\)|\2|")

# construct launch args and run
launch_args=("-g" "$launchParam")
echo "Launching: ${exe[*]} ${launch_args[*]}"
"${exe[@]}" "${launch_args[@]}"
else
#run the executable with the params.
launch_args=()
for rom in "${@}"; do
# Parsers previously had single quotes ("'/path/to/rom'" ), this allows those shortcuts to continue working.
removedLegacySingleQuotes=$(echo "$rom" | sed "s/^'//; s/'$//")
launch_args+=("$removedLegacySingleQuotes")
done

echo "Launching: ${exe[*]} ${launch_args[*]}"

if [[ -z "${*}" ]]; then
echo "ROM not found. Launching $ShadPS4_emuName directly"
"${exe[@]}"
else
echo "ROM found, launching game"
"${exe[@]}" "${launch_args[@]}"
fi
fi

emulatorInit "shadps4" "shadps4" "${@}"
rm -rf "$savesPath/.gaming"
Loading

0 comments on commit c9e3f64

Please sign in to comment.