First, set up a samba server on a machine on your network that's always on. I have a Pi Zero acting as a pi-hole on 10.0.0.2 (see www.pi-hole.net), piggybacking on this. I only mention because the pi-hole project slaps. Your machine can be anything, Windows is great too since it has built in Samba, DLNA all sorts of fun sharing protocols.
To set that up on pi you can follow a guide like https://magpi.raspberrypi.org/articles/samba-file-server. Windows is much easier, just share a folder under Properties, Sharing.
So now I have a server share //10.0.0.2/share with a saves/ subfolder
On every RetroPie device, I now want to do two things:
-
Mount the share on boot up
- Ensure the samba client is installed with
sudo apt update && sudo apt install samba samba-common-bin smbclient cifs-utils
- Edit the file
/opt/retropie/configs/all/autostart.sh
below
- Ensure the samba client is installed with
-
Set up the emulators to use that share for save files and save states
- Edit the file
/opt/retropie/configs/all/retroarch.cfg
below - Sometimes individual emulators override this, so if it's not working comment out the
savestate_directory
andsavefile_directory
lines in any other/opt/retropie/configs/*/retroarch.cfg
- To do this in one fell swoop:
sed -i 's/^savefile_directory/#savefile_directory/g' /opt/retropie/configs/*/retroarch.cfg
andsed -i 's/^savestate_directory/#savestate_directory/g' /opt/retropie/configs/*/retroarch.cfg
- Oops, if you did above, you also modified your
/all/
config, so reapply that change. I would have told you to do that last but it's the most important change. Heh.
- Edit the file
Be careful when using newer builds with very old builds — I've noticed SNES savestates that the older build fails to read. Nothing worse than losing progress. You may want to run a cron script to back up your saves! Use
rsync
andcrontab