mtkennerly / ludusavi-playnite

Playnite plugin for save backups via Ludusavi
MIT License
156 stars 10 forks source link

Add option to restore data for a game before playing it #12

Closed scowalt closed 2 years ago

scowalt commented 3 years ago

Right now there's an option to "Back up save data for a game when you finish playing it". I think the logical inverse could also be useful: "Restore save data for a game before you start playing it".

Implementation: when the "Play" button is hit for an applicable game, synchronously wait to launch the game until the ludusavi restore command finishes. If the restore fails, maybe optionally abort launching the game.

This would be useful to have the backup (or cloud) folder be the ultimate "source of truth" for the location of save games.

mtkennerly commented 3 years ago

That could be an interesting feature. You can already do it from each game's context menu, which I think would be enough for most people, but I could see this being helpful for someone who switches computers a lot and wants it to be automatic.

scowalt commented 3 years ago

Yes, that's exactly the scenario I have! (I have an office computer and an "HTPC" computer that I switch between).

This is also what, for example, Steam Cloud does. It will auto-sync data when a game closes, but it will also attempt to sync data in a blocking manner before launching a game. If the data doesn't sync correctly on launch, Steam will prompt the user for further action.

turtleship69 commented 3 years ago

I think it would be worth checking if the save is the same before doing so, as it is a waste (of time, bandwidth, read write cycles on an ssd, etc, but most notably time) to retrieve the save every time.

mtkennerly commented 3 years ago

@turtleship69 That's a good point! Ludusavi already takes care of that internally and won't re-copy files during a restore if they're identical, so the plugin code won't have to worry about it (once I have a chance to add this option 😅):

https://github.com/mtkennerly/ludusavi/blob/827f07f6da1887a5ee739b56b6e77d230457cd7b/src/prelude.rs#L771-L773