Hi everyone, today I'd like to share my own retrogaming setup with RetroArch.

Some backstory

Some years ago I brought a Raspberry Pi 3 that I used to play retrogames through Lakka.
I had my own share of fun, until my SD card said goodbye, together with my savefiles.
To avoid this tragic event from happening again, I thought of a way to not only ensure my data would be safe, but to have them playable everywhere without having to start again or having a parallel run on another device.

The devices

My playing devices are these, in order of my own average usage:
  • Raspberry Pi 3 with Lakka (RetroPie or any other RetroArch enabled OS is fine too)
  • Android phone
  • Linux desktop
All these share the same ROMs, savefiles and savestates (almost the same, more below). The way I sync everything up is based on the fact that Lakka is the most rigid system of the three and I wanted to make as few changes as possible. Also, SD cards can die anytime so migrating to a new install should be seamless.

Data storage

All the data is stored on each device, they act as the main storage and as a backup for the other devices.
Everything is kept in two folders with the following structure:
- roms/ - gba/ - ROM A.zip - ROM B.zip - ROM C.zip - ... - snes/ - ROM A.zip - ROM B.zip - ROM C.zip - ... - psx/ - ROM A/ - ROM B/ - ROM C/ - ... - ...
As you can see, I keep them as .zip, this is because RetroArch is capable of extracting them at runtime, saving disk space up to 8 times for some games, this works only with .zip so if you have another format, like .tar.gz or .7z, you need to extract them and compress into .zip archives yourself, compressed ROMs don't seems to work for me with disk files, like the PSX's ISOs, so I just keep them as is.
- sync/ - savefiles/ - ... - savestates/ - lakka/ - ... - android/ - ... - desktop/ - ... - scripts/ - ...
The sync folder holds the actual game data along with some scripts to automate syncing them.
Except for Lakka, I store those files in a Git repository, I'm well aware that Git is a versioning system designed to store plain text files and, since savefiles are in binary format, this is not an optimal solution, yet it's not a big deal to me as the files are relatively small and in a year and half the total repo size is still below 20Mb it total.
There are other way to back those files, but for me this is the easiest, I might change it later if needs arise. The reason for using Git is the extra layer of safety for my data, I keep them on the cloud and in case a file get corrupted (it happened more than once) I can revert to the previous version quickly and get back to save the world from an alien invasion.

Savefiles

The savefiles generated by RetroArch are called "saverams" (.srm), this is a common file format that is used by almost every core, it works on any device and architecture as long as the core type is the same, sometimes the version need to be the same too.
Some cores generate a different format that won't work on other devices, an example is the cores SwanStation and DuckStation (PSX core with variants for each architecture), but they should have an option to switch back to RetroArch saverams to have them be cross-compatible like the others.

Savestates

Savestates are a different story, those are not readable on other device, I tried to share them with different combinations but they only seems to work on the device that generated them, I'm not sure of the reason, it could be due to the difference in architecture.
This issue is not a problem for me, as I generally use them as a temporary save for when I need to stop playing without reaching an actual save point, I also use them before saving in some games (like "CIMA: The enemy") that sometimes corrupts the savefiles, so that I can go back to it and save again.
Anyway, in case of a disaster, I keep them backed up too, I just use a separate folder to avoid overriding them from other devices.

Scripts

This is where things get spicy. As I said, I keep my game data in a Git repository to store them, this happens on my phone and my PC and both of them are kept in sync using the remote repository as a bridge, when I push the changes online from my phone they get pulled on my PC and viceversa. That part doesn't involve the scripts folder, what I keep in there is the automation scripts for everything not included in Git.
Above I said that Lakka is the most rigid system, what does it mean? Simply put, it the least editable of the three.
Apart from RetroArch, Lakka also includes:
  • SSH server to connect via terminal
  • Samba server to connect remotely to the folders
  • Rsync to copy files remotely via terminal or via script
Git is not available and the system is made to be immutable, so there's no way to install it as you normally would, plus I wanted to avoid changing the system too much anyway.
The way I do it is to simply copy any changes to Lakka via Rsync as it handle updates in a smart and efficient way using some simple bash scripts the device I always have at reach all the time is my phone so I did everything there, using Termux, I made them for Termux but the scripts works on any device that have a bash terminal.
The scripts I use are:
  • copy-roms-to-lakka.sh
  • copy-roms-from-lakka.sh
  • copy-roms-to-desktop.sh
  • copy-roms-from-desktop.sh
  • copy-saves-to-lakka.sh
  • copy-saves-from-lakka.sh
Nothing special about the scripts, they just call rsync to the device I want.
Here the base of all the scripts I use for syncing the folders:
#!/usr/bin/env bash DEVICE=lakka # The SSH alias to copy data to LAKKA_ROOT=/storage/roms/ # This is Lakka roms path LOCAL_ROOT=/data/data/com.termux/files/home/retroarch-roms/ # This is the path in Termux # Copy only what's new and show progress RSYNC_FLAGS="-avzhe ssh --ignore-existing --progress" rsync $RSYNC_FLAGS "${LOCAL_ROOT}" "${DEVICE}:${LAKKA_ROOT}"
I was a bit lazy so I have a script for each device and direction I need, it can be simplified a lot, but it works right now so I don't bother. The script is basically the same in each, only with different paths and $DEVICE names, The variable $DEVICE is the alias I set on my phone to connect via SSH, you need to set your keys to log on Lakka to have it work, but a plain IP is fine too.
Now the only thing left to do is run the right script, but it became annoying pretty quickly...

Automate (the step and the app)

This was the flow:
Open Termux, find the right script, run it, close the terminal, and repeat for copy the changes back.
Boring...
After a while, I decided to add another layer to it and I found Automate to be what I needed, It supports Tasker Plugins and Termux has an addon that exposes scripts to Tasker.
I linked my scripts in the folder required by the Termux plugin and added a configuration to execute them in Automate. The automation simply asks where I want to copy the data, "LAKKA" or "PHONE", it run the right script and, after that, a TTS message let me know it's done without having to look at the screen.
All that was left to do was to add a shortcut on my homescreen and tap it when I needed and wait for it to finish to start playing!

Conclusions

This is my setup for retrogaming with RetroArch, surely some of you might see this as an overkill, but I had fun putting it together and it works just the way I need.
Maybe in the future I might redo everything from scratch, but for now this is my "creature" and I'm proud of it.
Cheers!
This is so genius, I think I'm gonna copy you!
reply
Be my guest!
reply
That's a great setup! I'm using syncthing for syncing of savefiles and it's generally ok, but I only use it as a backup, I don't actually play the same game between multiple devices.
reply
Syncthing Is also really good, you can have unsecure nice on a remote server that stays encrypted if you want, things like VPS are good for that.
I generally play on my Raspberry Pi, but when I'm waiting outside it's great to been able to keep going on your adventure.
One time I had to wait at an hotel for my room to be ready for about an hour, two levels of Rayman 2 had it for by, plus a kid saw over my shoulder and asked what game it was, made me feel old...
reply
deleted by author
reply
Playing on a phone is tough for PS1 games that use L and R buttons, you should get a gamepad for it, with an OTG cable or a Bluetooth one (I have one).
Anyways, my all time favorites are:
  • ✔️Crash Bandicoot series (the second one is the best for me)
  • ✔️MediEvil I & II
  • ✔️Heart of darkness
  • Ace Combat 3 - Electrosphere
  • ✔️G-Darius
  • ✔️R-Type Delta
  • ✔️Rayman 2 - The Great Escape
  • Oddworld Series
  • ✔️Donald Duck - Quack Attack
  • ✔️Wipeout 3
  • Apocalypse
  • ✔️Spyro series
The one with the check ✔️ are the easier to play with just the on-screen buttons.
Also, you might want to try other platforms like SNES, GBA too, they're much more friendly to play on a phone and have much smaller ROMs too. 😎
reply