2022-03-27 13:30:22 +00:00
#!/bin/bash
2022-03-30 14:14:43 +00:00
# Steam Deck SD path: /run/media/mmcblk0p1
2022-05-11 11:43:15 +00:00
# Create log
exec > ~/retrodeck/retrodeck.log 2>& 1
2022-03-30 14:14:43 +00:00
is_mounted( ) {
mount | awk -v DIR = " $1 " '{if ($3 == DIR) { exit 0}} ENDFILE{exit -1}'
}
2022-03-28 13:01:47 +00:00
# if we got the .lock file it means that it's not a first run
if [ ! -f ~/retrodeck/.lock ]
then
2022-04-02 09:21:05 +00:00
kdialog --title "RetroDECK" --yes-label "Yes" --no-label "Quit" --yesno "Welcome to the first configuration of RetroDECK.\n\nBefore starting, are you in Desktop Mode?\nIf not the program will quit as the first setup MUST be done in Desktop Mode."
if [ $? = = 1 ] #quit
then
exit 0
fi
kdialog --title "RetroDECK" --yes-label "Internal" --no-label "SD Card" --yesno "Where do you want your roms folder to be located?"
2022-03-31 06:03:00 +00:00
if [ $? = = 0 ] #yes - Internal
2022-03-30 14:14:43 +00:00
then
roms_folder = ~/retrodeck/roms
else #no - SD Card
if is_mounted "/run/media/mmcblk0p1"
then
roms_folder = /run/media/mmcblk0p1/retrodeck/roms
else
kdialog --title "RetroDECK" --error "SD Card is not readable, please check if it inserted or mounted correctly and run RetroDECK again."
exit 0
fi
fi
2022-03-31 06:03:00 +00:00
2022-04-07 13:36:28 +00:00
mkdir -p $roms_folder
2022-03-31 11:50:46 +00:00
# initializing ES-DE
2022-03-31 06:03:00 +00:00
2022-03-31 11:50:46 +00:00
mkdir -p /var/config/retrodeck/tools
# Cleaning
rm -rf /var/config/emulationstation/
rm /var/config/retrodeck/tools/*
2022-04-22 04:54:30 +00:00
rm -f /var/config/yuzu/qt-config.ini
2022-03-31 11:50:46 +00:00
2022-04-02 09:21:05 +00:00
kdialog --title "RetroDECK" --msgbox "EmulationStation will now initialize the system, please don't edit the roms location, just select:\n\nCREATE DIRECTORIES, YES, QUIT\n\nRetroDECK will manage the rest."
2022-03-31 11:50:46 +00:00
mkdir -p /var/config/emulationstation/
emulationstation --home /var/config/emulationstation
2022-04-02 09:21:05 +00:00
kdialog --title "RetroDECK" --msgbox "RetroDECK will now install the needed files, please wait one minute, another message will notify when the process will be finished.\n\nPress OK to continue."
2022-05-16 13:55:09 +00:00
# Initializing ROMs folder - Original in ~/retrodeck (or SD Card)
2022-04-07 13:36:28 +00:00
mv -f /var/config/emulationstation/ROMs /var/config/emulationstation/ROMs.bak
2022-03-31 11:50:46 +00:00
ln -s $roms_folder /var/config/emulationstation/ROMs
2022-04-07 13:36:28 +00:00
mv -f /var/config/emulationstation/ROMs.bak/* $roms_folder /
2022-05-16 13:55:09 +00:00
rm -rf /var/config/emulationstation/ROMs.bak
2022-03-30 14:14:43 +00:00
2022-03-31 11:50:46 +00:00
# XMLSTARLET HERE
cp /app/retrodeck/es_settings.xml /var/config/emulationstation/.emulationstation/es_settings.xml
2022-03-29 14:48:17 +00:00
2022-03-28 13:01:47 +00:00
mkdir -p ~/retrodeck/saves
mkdir -p ~/retrodeck/states
mkdir -p ~/retrodeck/screenshots
2022-04-27 07:20:39 +00:00
mkdir -p ~/retrodeck/bios/pico-8
2022-04-29 10:34:53 +00:00
2022-04-23 12:35:33 +00:00
# ES-DE
2022-04-07 14:00:31 +00:00
cp -r /app/retrodeck/tools/* /var/config/retrodeck/tools/
2022-04-07 13:00:44 +00:00
mkdir -p /var/config/emulationstation/.emulationstation/custom_systems/tools/
2022-04-20 10:06:31 +00:00
cp /app/retrodeck/tools-gamelist.xml /var/config/retrodeck/tools/gamelist.xml
2022-05-16 13:55:09 +00:00
# ES-DE scraped folder - Original in ~/retrodeck
2022-04-29 10:34:53 +00:00
mv -f /var/config/emulationstation/.emulationstation/downloaded_media /var/config/emulationstation/.emulationstation/downloaded_media.old
2022-04-29 12:17:30 +00:00
mkdir ~/retrodeck/.downloaded_media
ln -s ~/retrodeck/.downloaded_media /var/config/emulationstation/.emulationstation/downloaded_media
mv -f /var/config/emulationstation/.emulationstation/downloaded_media.old/* ~/retrodeck/.downloaded_media
rm -rf /var/config/emulationstation/.emulationstation/downloaded_media.old
2022-05-16 13:55:09 +00:00
# ES-DE themes folder - Original in ~/retrodeck
mv -f /var/config/emulationstation/.emulationstation/themes /var/config/emulationstation/.emulationstation/themes.old
mkdir ~/retrodeck/.themes
ln -s ~/retrodeck/.themes /var/config/emulationstation/.emulationstation/themes
mv -f /var/config/emulationstation/.emulationstation/themes.old/* ~/retrodeck/.themes
rm -rf /var/config/emulationstation/.emulationstation/themes.old
2022-03-30 14:14:43 +00:00
2022-04-23 12:35:33 +00:00
# Initializing emulators configs
emuconfigs = /app/retrodeck/emu-configs/
# RetroArch
2022-03-30 14:14:43 +00:00
mkdir -p /var/config/retroarch/cores/
2022-04-23 12:35:33 +00:00
rm -rf /var/config/retroarch/system
ln -s ~/retrodeck/bios /var/config/retroarch/system
2022-03-30 14:14:43 +00:00
cp /app/share/libretro/cores/* /var/config/retroarch/cores/
2022-04-23 12:35:33 +00:00
cp $emuconfigs /retroarch.cfg /var/config/retroarch/
2022-04-23 02:54:24 +00:00
2022-04-23 06:11:33 +00:00
# Yuzu
2022-04-28 02:55:45 +00:00
mkdir -p ~/retrodeck/bios/switch/keys
rm -rf /var/data/yuzu/keys
2022-04-22 04:54:30 +00:00
ln -s ~/retrodeck/bios/switch/keys /var/data/yuzu/keys
2022-04-28 02:55:45 +00:00
mkdir -p /var/data/yuzu/nand/system/Contents/registered/
rm ~/retrodeck/bios/switch/registered
2022-05-16 14:32:00 +00:00
ln -s /var/data/yuzu/nand/system/Contents/registered/ ~/retrodeck/bios/switch/registered
2022-04-29 13:50:21 +00:00
cp $emuconfigs /yuzu-qt-config.ini /var/config/yuzu/qt-config.ini
2022-04-22 04:54:30 +00:00
2022-04-23 12:12:02 +00:00
# Dolphin
2022-04-23 02:54:24 +00:00
mkdir -p /var/config/dolphin-emu/
2022-04-23 12:35:33 +00:00
cp $emuconfigs /Dolphin.ini /var/config/dolphin-emu/
2022-04-23 02:54:24 +00:00
2022-04-23 06:14:56 +00:00
# pcsx2
mkdir -p /var/config/PCSX2/inis/
2022-04-23 12:57:37 +00:00
cp $emuconfigs /PCSX2_ui.ini /var/config/PCSX2/inis/
2022-04-29 12:17:30 +00:00
# MelonDS
mkdir -p /var/config/melonDS/
2022-04-29 13:09:12 +00:00
ln -s ~/retrodeck/bios /var/config/melonDS/bios
2022-04-29 12:17:30 +00:00
cp $emuconfigs /melonDS.ini /var/config/melonDS/
2022-04-29 13:50:21 +00:00
# CITRA
mkdir -p /var/config/citra-emu/
cp $emuconfigs /citra-qt-config.ini /var/config/citra-emu/qt-config.ini
2022-04-29 14:07:01 +00:00
# RPCS3
mkdir -p /var/config/rpcs3/
cp $emuconfigs /config.yml /var/config/rpcs3/
2022-04-29 13:50:21 +00:00
2022-04-23 12:12:02 +00:00
# Locking RetroDECK
2022-03-28 13:01:47 +00:00
touch ~/retrodeck/.lock
2022-03-31 06:03:00 +00:00
2022-04-07 13:38:51 +00:00
kdialog --title "RetroDECK" --msgbox " Initialization completed.\nplease put your roms in:\n\n $roms_folder \n\nand your bioses in\n\n~/retrodeck/bios\n\nThen start the program again.\nIf you wish to change the roms location, you may use the tool located the tools section of RetroDECK.\n\nIt's suggested to add RetroDECK to your Steam Library for a quick access. "
2022-03-31 11:50:46 +00:00
else
emulationstation --home /var/config/emulationstation
2022-04-02 09:21:05 +00:00
fi