EmuDeck/setup.sh

519 lines
10 KiB
Bash
Raw Normal View History

#!/bin/bash
2023-11-30 16:20:28 -05:00
MSG=$HOME/emudeck/logs/msg.log
2022-09-24 18:58:09 -04:00
echo "0" > "$MSG"
2024-02-09 05:11:37 -05:00
#Darwin
appleChip=$(uname -m)
if [ appleChip != "Linux" ]; then
PATH="/opt/homebrew/opt/gnu-sed/libexec/gnubin:$PATH"
fi
#
##
## Pid Lock...
##
#
2022-09-24 18:58:09 -04:00
mkdir -p "$HOME/.config/EmuDeck"
2023-10-23 07:39:52 -04:00
mkdir -p "$HOME/emudeck/logs"
2022-09-24 18:58:09 -04:00
PIDFILE="$HOME/.config/EmuDeck/install.pid"
if [ -f "$PIDFILE" ]; then
PID=$(cat "$PIDFILE")
ps -p "$PID" > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo "Process already running"
exit 1
else
## Process not found assume not running
echo $$ > "$PIDFILE"
if [ $? -ne 0 ]; then
echo "Could not create PID file"
exit 1
fi
fi
else
echo $$ > "$PIDFILE"
if [ $? -ne 0 ]; then
echo "Could not create PID file"
exit 1
fi
fi
function finish {
echo "Script terminating. Exit code $?"
finished=true
rm "$MSG"
2023-09-07 14:23:57 -04:00
}
trap finish EXIT
#
##
2023-09-07 14:23:57 -04:00
## Init...
##
#
#Clean up previous installations
rm ~/emudek.log 2>/dev/null # This is emudeck's old log file, it's not a typo!
rm -rf ~/dragoonDoriseTools
2022-09-24 18:58:09 -04:00
rm -rf ~/emudeck/backend
#Creating log file
2023-10-23 07:36:26 -04:00
LOGFILE="$HOME/emudeck/logs/emudeckSetup.log"
2022-09-26 17:42:31 -04:00
mkdir -p "$HOME/emudeck"
2022-10-14 15:33:19 -04:00
#Custom Scripts
mkdir -p "$HOME/emudeck/custom_scripts"
echo $'#!/bin/bash\nEMUDECKGIT="$HOME/.config/EmuDeck/backend"\nsource "$EMUDECKGIT/functions/all.sh"' > "$HOME/emudeck/custom_scripts/example.sh"
2022-09-25 16:47:56 -04:00
echo "Press the button to start..." > "$LOGFILE"
2022-09-10 12:50:34 -04:00
2023-10-23 07:36:26 -04:00
mv "${LOGFILE}" "$HOME/emudeck/logs/emudeckSetup.last.log" #backup last log
2022-09-26 17:42:31 -04:00
if echo "${@}" > "${LOGFILE}" ; then
echo "Log created"
else
exit
fi
2023-02-25 16:57:26 -05:00
#exec > >(tee "${LOGFILE}") 2>&1
#Installation log
{
date "+%Y.%m.%d-%H:%M:%S %Z"
#Mark if this not a fresh install
2022-09-24 18:58:09 -04:00
FOLDER="$HOME/.config/EmuDeck/"
if [ -d "$FOLDER" ]; then
2022-09-24 18:58:09 -04:00
echo "" > "$HOME/.config/EmuDeck/.finished"
fi
sleep 1
2022-09-24 18:58:09 -04:00
SECONDTIME="$HOME/.config/EmuDeck/.finished"
2023-02-01 11:09:34 -05:00
#Lets log github API limits just in case
echo 'Github API limits:'
curl -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" "https://api.github.com/rate_limit"
#
##
## set backend location
##
# I think this should just be in the source, so there's one spot for initialization. hrm, no i'm wrong. Here is best.
2022-09-24 18:58:09 -04:00
EMUDECKGIT="$HOME/.config/EmuDeck/backend"
#
##
## Start of installation
2023-11-02 07:16:20 -04:00
##
#
2024-01-28 10:17:07 -05:00
source "$EMUDECKGIT"/functions/helperFunctions.sh
jsonToBashVars "$HOME/.config/EmuDeck/settings.json"
source "$EMUDECKGIT/functions/all.sh"
#after sourcing functins, check if path is empty.
2023-11-22 14:29:49 -05:00
# [[ -z "$emulationPath" ]] && { echo "emulationPath is Empty!"; setMSG "There's been an issue, please restart the app"; exit 1; }
echo "Current Settings: "
grep -vi pass "$emuDecksettingsFile"
#
#Environment Check
#
echo ""
echo "Env Details: "
getEnvironmentDetails
testRealDeck
#this sets up the settings file with defaults, in case they don't have a new setting we've added.
#also echos them all out so they are in the log.
2024-01-28 10:25:12 -05:00
#echo "Setup Settings File: "
#createUpdateSettingsFile
#create folders after tests!
createFolders
#setup Proton-Launch.sh
#because this path gets updated by sed, we really should be installing it every time and allowing it to be updated every time. In case the user changes their path.
cp "$EMUDECKGIT/tools/proton-launch.sh" "${toolsPath}/proton-launch.sh"
chmod +x "${toolsPath}/proton-launch.sh"
2022-09-22 23:53:42 -04:00
cp "$EMUDECKGIT/tools/appID.py" "${toolsPath}/appID.py"
# Setup emu-launch.sh
cp "${EMUDECKGIT}/tools/emu-launch.sh" "${toolsPath}/emu-launch.sh"
chmod +x "${toolsPath}/emu-launch.sh"
#ESDE Installation
if [ $doInstallESDE == "true" ]; then
echo "install esde"
2023-11-02 07:16:20 -04:00
ESDE_install
fi
#Pegasus Installation
if [ $doInstallPegasus == "true" ]; then
echo "install Pegasus"
2023-12-01 04:57:23 -05:00
pegasus_install
fi
#SRM Installation
if [ $doInstallSRM == "true" ]; then
echo "install srm"
SRM_install
fi
2023-11-02 07:16:20 -04:00
if [ "$doInstallPCSX2QT" == "true" ]; then
echo "install pcsx2Qt"
PCSX2QT_install
fi
2023-04-21 03:34:27 -04:00
if [ $doInstallPrimeHack == "true" ]; then
echo "install primehack"
Primehack_install
fi
if [ $doInstallRPCS3 == "true" ]; then
echo "install rpcs3"
RPCS3_install
fi
if [ $doInstallCitra == "true" ]; then
echo "install Citra"
Citra_install
fi
if [ $doInstallDolphin == "true" ]; then
2023-11-02 07:16:20 -04:00
echo "install Dolphin"
Dolphin_install
fi
if [ $doInstallDuck == "true" ]; then
echo "DuckStation_install"
DuckStation_install
fi
if [ $doInstallRA == "true" ]; then
echo "RetroArch_install"
2023-11-02 07:16:20 -04:00
RetroArch_install
fi
if [ $doInstallRMG == "true" ]; then
echo "RMG_install"
2023-11-02 07:16:20 -04:00
RMG_install
fi
if [ $doInstallares == "true" ]; then
echo "ares_install"
ares_install
fi
if [ $doInstallPPSSPP == "true" ]; then
echo "PPSSPP_install"
2023-11-02 07:16:20 -04:00
PPSSPP_install
fi
2023-11-02 07:16:20 -04:00
if [ $doInstallYuzu == "true" ]; then
echo "Yuzu_install"
Yuzu_install
fi
2024-03-20 13:56:57 -04:00
if [ $doInstallSuyu == "true" ]; then
echo "suyu_install"
suyu_install
fi
2023-11-02 07:16:20 -04:00
if [ $doInstallRyujinx == "true" ]; then
echo "Ryujinx_install"
Ryujinx_install
fi
2023-11-02 07:16:20 -04:00
if [ $doInstallMAME == "true" ]; then
echo "MAME_install"
MAME_install
fi
if [ $doInstallXemu == "true" ]; then
echo "Xemu_install"
Xemu_install
fi
if [ $doInstallCemu == "true" ]; then
echo "Cemu_install"
Cemu_install
fi
Add cemu native (#603) * Update cemu.sh to handle checking for an AppImage or Flatpak * Make less checks on doProton * Update userConfigurations.json for Cemu Native parsers * Add emuDeckCemuNative.sh to functions * PROTONVER should be a parameter. * Update setup.sh for CemuNative * Add settings. Link mlc01 for now. Set correct config * Have both ROM locations for now * More updates to emuDeckCemuNative * Move config and update emuDeckCemuNative * Remove the extra roms from the gamepathentryfound * Set up migrate * add emuDeckCemuNative.sh to all.sh * Don't know why there was an -r flag there. * Clobber Windows version and migrate what can be. * PROTONVER in xenia.sh * Add controllerProfiles * remove install from storage setup * Setup Emulation paths using the Cemu proton paths * Fix temp file cleanup for installEmuBI * Make Cemu be Cemu (proton) in labeling Change cemu.sh to take -w to use proton * Update ES-DE config script change Cemu (proton) to use -w add Cemu (native) add function to update cemu (native) * modify CemuNative script use original Cemu Paths for stuff save migration for future * Fixes the ES-DE media_dir update if the user changes Emulation path * cemu.sh add -w proton check * Realign Desktop creation to make more sense no more EmuDeck - now says AppImage or Binary * Creating icons purges the baloo index * Cemu.sh Override to windows with -w uses ~/emudeck/settings.sh to determine paths * ES-DE needs one system, multiple commands * update custom system base xml to include cemu native * Silly external * update / fix custom systems for esde add new commands too. * fix uninstall.sh Co-authored-by: AngelofWoe <jaia.one.winged.angel@gmail.com>
2023-01-23 23:03:12 -05:00
if [ "${doInstallCemuNative}" == "true" ]; then
echo "CemuNative_install"
CemuNative_install
fi
2022-09-24 04:29:49 -04:00
if [ $doInstallScummVM == "true" ]; then
echo "ScummVM_install"
ScummVM_install
fi
if [ $doInstallVita3K == "true" ]; then
echo "Vita3K_install"
Vita3K_install
fi
if [ $doInstallMGBA == "true" ]; then
echo "mGBA_install"
mGBA_install
fi
if [ $doInstallFlycast == "true" ]; then
echo "Flycast_install"
Flycast_install
fi
2023-02-05 14:56:15 -05:00
if [ $doInstallRMG == "true" ]; then
echo "RMG_install"
RMG_install
fi
if [ $doInstallares == "true" ]; then
echo "ares_install"
ares_install
fi
if [ $doInstallmelonDS == "true" ]; then
2023-02-07 11:12:49 -05:00
echo "melonDS_install"
melonDS_install
2023-02-05 14:56:15 -05:00
fi
if [ $doInstallBigPEmu == "true" ]; then
echo "BigPEmu_install"
BigPEmu_install
fi
if [ $doInstallSupermodel == "true" ]; then
echo "Supermodel_install"
Supermodel_install
fi
#Xenia - We need to install Xenia after creating the Roms folders!
if [ "$doInstallXenia" == "true" ]; then
echo "Xenia_install"
Xenia_install
fi
if [ "$doInstallModel2" == "true" ]; then
echo "Model2_install"
Model2_install
fi
#Steam RomManager Config
if [ "$doSetupSRM" == "true" ]; then
echo "SRM_init"
SRM_init
fi
#ESDE Config
if [ "$doSetupESDE" == "true" ]; then
echo "ESDE_init"
ESDE_update
2023-11-02 07:16:20 -04:00
fi
#Pegasus Config
#if [ $doSetupPegasus == "true" ]; then
2023-12-01 04:57:23 -05:00
# echo "pegasus_init"
# pegasus_init
Merge from early - CloudSync 2.0, Pegasus, Darwin support (#886) * add json for apotris. this PR adds the needed json for accessing Apotris. * fix pcsx2 cloud * decky functions + Customization moved inside every emulator _init * Decky_setClourd * arSnes var * last touch * test * Darwin wip * darwin wip * old EmuAI * SRM * RA + SRM + ESDE * Moving more if darwin to override.sh * Moving more if darwin to override.sh * installToolAI + darwin ifs cleanups, more overrides :) * fi fix * fixed SRM parsers with ,, * fix rm dmg * RA flatpak first * darwin install * darwin fixes * darwinnnn * jsonjson * darwin srm * fix launchers * SRM env vars moved to a function + override to darwin * ares out for now * fix flycast broking everything * dont check if.cef-enable-remote-debugging * better zenity * fix watcher * zenity fix * cloudSync provider detection * fixed paths fix * darwin fixed paths * fixed paths fix * enable cloudsync * no appinit * last minute fixes * weird fixes * hash fix? * this needs a proper cleanup... * fixed? * back to linkToSaveFolder for now * better duplicate detection * parser disabled * cloudSync final touches * darwin installation * improvements * customSRM * Revert "customSRM" This reverts commit 2787d2282c367801c13ee671f3fab9d198f05fb7. * first batch * second batch * SGBC + Jaguar parsers * Pegasus settings and functions * proper order * Path fixed * install on setup * SRM parser * icon * early beta * chimeraOS improvements # Conflicts: # setup.sh * cosmetic * helpers: Fix FlatPak installed check (#875) * chimeraOS retroarch * clear console * Steam installation * fix shellcheck * path fixes * fix SRM * = * Steam-ROM-Manager * srm new path fix * SRM_IsInstalled * cloudsync wtf * SRM_IsInstalled * Steam ROM Manager proper name * ROM * srm stuff * SRM_migration * icon * fix savedownload * launchers * srm icon * ROM * ummm * fixes installToolAI * ESDE Migration * RetroArch_setConfigOverride fix * fix RA * fix PCSX2QT * back to flatpaks * EmuDecky no internet message * noInternet EmuDecky * pegasus theme installer * pegasus launchers * Pegasus install Darwin * Pegasus install Darwin * Init pegasus * ESDE Theme * = * > * override getEmuInstallStatus --------- Co-authored-by: Glazed_Belmont <48196637+GlaZedBelmont@users.noreply.github.com>
2023-10-10 16:20:54 -04:00
#fi
#Emus config
#setMSG "Configuring Steam Input for emulators.." moved to emu install
setMSG "Configuring emulators.."
if [ "$doSetupRA" == "true" ]; then
echo "RetroArch_init"
RetroArch_init
fi
2023-04-21 03:34:27 -04:00
if [ "$doSetupPrimehack" == "true" ]; then
echo "Primehack_init"
Primehack_init
fi
if [ "$doSetupDolphin" == "true" ]; then
echo "Dolphin_init"
Dolphin_init
fi
if [ "$doSetupPCSX2QT" == "true" ]; then
echo "PCSX2QT_init"
PCSX2QT_init
fi
if [ "$doSetupRPCS3" == "true" ]; then
echo "RPCS3_init"
RPCS3_init
fi
if [ "$doSetupCitra" == "true" ]; then
echo "Citra_init"
Citra_init
fi
if [ "$doSetupDuck" == "true" ]; then
echo "DuckStation_init"
DuckStation_init
fi
if [ "$doSetupYuzu" == "true" ]; then
echo "Yuzu_init"
Yuzu_init
fi
2024-03-20 13:56:57 -04:00
if [ "$doSetupSuyu" == "true" ]; then
echo "suzu_init"
suzu_init
fi
if [ "$doSetupRyujinx" == "true" ]; then
echo "Ryujinx_init"
Ryujinx_init
fi
if [ "$doSetupPPSSPP" == "true" ]; then
echo "PPSSPP_init"
PPSSPP_init
fi
if [ "$doSetupXemu" == "true" ]; then
echo "Xemu_init"
Xemu_init
fi
if [ "$doSetupMAME" == "true" ]; then
echo "MAME_init"
MAME_init
fi
2022-09-24 04:29:49 -04:00
if [ "$doSetupScummVM" == "true" ]; then
echo "ScummVM_init"
ScummVM_init
fi
if [ "$doSetupVita3K" == "true" ]; then
echo "Vita3K_init"
Vita3K_init
fi
2023-02-05 14:56:15 -05:00
if [ "$doSetupRMG" == "true" ]; then
echo "RMG_init"
RMG_init
fi
if [ "$doSetupares" == "true" ]; then
echo "ares_init"
ares_init
fi
if [ "$doSetupmelonDS" == "true" ]; then
2023-02-07 11:12:49 -05:00
echo "melonDS_init"
melonDS_init
2023-02-05 14:56:15 -05:00
fi
if [ "$doSetupMGBA" == "true" ]; then
echo "mGBA_init"
mGBA_init
fi
Add cemu native (#603) * Update cemu.sh to handle checking for an AppImage or Flatpak * Make less checks on doProton * Update userConfigurations.json for Cemu Native parsers * Add emuDeckCemuNative.sh to functions * PROTONVER should be a parameter. * Update setup.sh for CemuNative * Add settings. Link mlc01 for now. Set correct config * Have both ROM locations for now * More updates to emuDeckCemuNative * Move config and update emuDeckCemuNative * Remove the extra roms from the gamepathentryfound * Set up migrate * add emuDeckCemuNative.sh to all.sh * Don't know why there was an -r flag there. * Clobber Windows version and migrate what can be. * PROTONVER in xenia.sh * Add controllerProfiles * remove install from storage setup * Setup Emulation paths using the Cemu proton paths * Fix temp file cleanup for installEmuBI * Make Cemu be Cemu (proton) in labeling Change cemu.sh to take -w to use proton * Update ES-DE config script change Cemu (proton) to use -w add Cemu (native) add function to update cemu (native) * modify CemuNative script use original Cemu Paths for stuff save migration for future * Fixes the ES-DE media_dir update if the user changes Emulation path * cemu.sh add -w proton check * Realign Desktop creation to make more sense no more EmuDeck - now says AppImage or Binary * Creating icons purges the baloo index * Cemu.sh Override to windows with -w uses ~/emudeck/settings.sh to determine paths * ES-DE needs one system, multiple commands * update custom system base xml to include cemu native * Silly external * update / fix custom systems for esde add new commands too. * fix uninstall.sh Co-authored-by: AngelofWoe <jaia.one.winged.angel@gmail.com>
2023-01-23 23:03:12 -05:00
if [ "${doSetupCemuNative}" == "true" ]; then
echo "CemuNative_init"
CemuNative_init
fi
if [ "$doSetupFlycast" == "true" ]; then
echo "Flycast_init"
Flycast_init
fi
if [ "$doSetupSupermodel" == "true" ]; then
echo "Supermodel_init"
Supermodel_init
fi
if [ "$doSetupModel2" == "true" ]; then
echo "model2_init"
Model2_init
fi
#Proton Emus
if [ "$doSetupCemu" == "true" ]; then
echo "Cemu_init"
Cemu_init
fi
if [ "$doSetupBigPEmu" == "true" ]; then
echo "BigPEmu_init"
BigPEmu_init
fi
if [ "$doSetupXenia" == "true" ]; then
echo "Xenia_init"
Xenia_init
fi
#
##
##End of installation
##
#
#Always install
BINUP_install
CHD_install
#
##
## Overrides for non Steam hardware...
##
#
#
#Fixes for 16:9 Screens
#
2022-10-31 19:39:16 -04:00
if [ "$doSetupRA" == "true" ]; then
if [ "$(getScreenAR)" == 169 ];then
2023-11-02 07:16:20 -04:00
nonDeck_169Screen
2022-10-31 19:39:16 -04:00
fi
2023-11-02 07:16:20 -04:00
2022-10-31 19:39:16 -04:00
#Anbernic Win600 Special configuration
if [ "$(getProductName)" == "Win600" ];then
2023-11-02 07:16:20 -04:00
nonDeck_win600
2022-10-31 19:39:16 -04:00
fi
fi
2023-11-02 07:16:20 -04:00
if [ "$system" == "chimeraos" ]; then
mkdir -p $HOME/Applications
downloads_dir="$HOME/Downloads"
destination_dir="$HOME/Applications"
file_name="EmuDeck"
2023-11-30 11:24:44 -05:00
mkdir -p $destination_dir
2023-11-02 07:16:20 -04:00
find "$downloads_dir" -type f -name "*$file_name*.AppImage" -exec mv {} "$destination_dir/$file_name.AppImage" \;
2023-11-30 11:24:44 -05:00
chmod +x "$destination_dir/EmuDeck.AppImage"
2023-11-02 07:16:20 -04:00
fi
2024-02-09 02:49:41 -05:00
createDesktopIcons
2022-09-10 20:27:29 -04:00
2024-03-08 11:33:31 -05:00
if [ "$controllerLayout" == "bayx" ] || [ "$controllerLayout" == "baxy" ] ; then
2024-03-05 13:57:15 -05:00
controllerLayout_BAYX
else
controllerLayout_ABXY
2022-12-12 06:30:29 -05:00
fi
2022-09-10 20:27:29 -04:00
#
##
2023-12-29 10:49:41 -05:00
##Plugins
##
#
2024-02-21 04:28:15 -05:00
#GyroDSU
2024-02-27 13:36:54 -05:00
#Plugins_installSteamDeckGyroDSU
2022-09-10 20:43:57 -04:00
#EmuDeck updater on gaming Mode
2023-11-30 08:14:35 -05:00
#mkdir -p "${toolsPath}/updater"
#cp -v "$EMUDECKGIT/tools/updater/emudeck-updater.sh" "${toolsPath}/updater/"
#chmod +x "${toolsPath}/updater/emudeck-updater.sh"
2022-08-31 11:44:41 -04:00
#RemotePlayWhatever
2023-11-02 07:16:20 -04:00
# if [[ ! $branch == "main" ]]; then
2022-09-19 14:30:48 -04:00
# RemotePlayWhatever_install
# fi
#
2023-11-02 07:16:20 -04:00
# We mark the script as finished
#
2022-09-24 18:58:09 -04:00
echo "" > "$HOME/.config/EmuDeck/.finished"
echo "" > "$HOME/.config/EmuDeck/.ui-finished"
2023-11-30 16:20:28 -05:00
echo "100" > "$HOME/emudeck/logs/msg.log"
echo "# Installation Complete" >> "$HOME/emudeck/logs/msg.log"
finished=true
rm "$PIDFILE"
2022-10-14 15:21:11 -04:00
#
## We check all the selected emulators are installed
#
checkInstalledEmus
2022-10-14 15:33:19 -04:00
#
# Run custom scripts... shhh for now ;)
#
2022-10-14 18:29:42 -04:00
for entry in "$HOME"/emudeck/custom_scripts/*.sh
2022-10-14 15:33:19 -04:00
do
bash $entry
done
2023-10-02 12:54:38 -04:00
} | tee "${LOGFILE}" 2>&1