Export/import game save files to/from USB.
-
I am awaiting some RPis that i ordered to build some Retro Pie units for my friends as Xmas gifts. I don't have my hands on one yet to explore the menu system and to fully set it all up, but from what I've been reading, there's a function missing that I'd really like to see.
Basically, once I'm done configuring one Pi with RetroPie, copy all the ROMs over and get everything the way I want, I'm going to create an image of the SD card so I can just copy it over to every other SD card for each Pi. This will also serve as a backup in case one of the SD cards gets corrupted so I can just extract the image once again to the SD. I will stress to each friend the importance of properly shutting the system down so it will reduce the chances of corrupting the card, but there's always a chance a power outage could take it out.
This got me thinking about the game save files. I won't be able to restore each person's game saves.
I was thinking a great option to include in the menu system would be to export the save files to a USB stick, and then another option to import them from the USB. I know that if you put a blank USB into RetroPie, it creates a folder for each emulator for the ROMs, so it should be fairly easy to create a script to copy the save games over from each folder (eg. *.srm, etc). Myself, I could manually bring up a command prompt and export my own, but my friends aren't that savvy. Automating it for them would be awesome. Any programmers think they can do this?
-
So I was looking around in different forums and exploring the RetroPie files myself a bit.
I want to create a menu selection under the RetroPie menu to run the save file backup. Here is what I'm thinking may work:
- create an empty .rp file called gavesave-backup.rp under /home/pi/RetroPie/retropiemenu
- create an icon and call it gsbackup.png and save it under ~/RetroPie/retropiemenu/icons/
- create an entry in the gamelist.xml file under /home/pi/RetroPie-Setup/scriptmodules/supplementary/retropiemenu/ directory with:
<game> <path>./gamesave-backup.rp</path> <name>Gamesave Backup</name> <desc>Create a backup of all your games savefiles and save states and export them to a USB stick.</desc> <image>~/RetroPie/retropiemenu/icons/gsbackup.png</image> </game>
- create a SH script named gamesave-backup.sh under /home/pi/RetroPie-Setup/scriptmodules/supplementary/ to backup SRM, STATE, and DAT files (for CaveStory gamesaves). For example:
#!/bin/bash find . -name "*.srm" -o -name "*.state*" -o -name "*.dat" | xargs cp --parents -t /media/(name of USB drive)/
So once all that is done, it should hopefully run from the menu. I have a few concerns though.
Will it run and come back to the RetroPie menu?
Will it just go to a black screen and not come back?
What will happen if someone runs it without having the USB plugged in, or puts in another USB that doesn't have the name listed in the SH file?
Is there a better way to define the USB by mounting it first rather than specifying it by name?Can anyone check this or give me some clarification? Thanks in advance.
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.