Autosave option for keeping carts from Surf #2410
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello again for my second pull request ever. This time I actually searched through pull requests and issues first to see if my idea has previously been denied lol.
While waiting until Christmas to possibly get the Retroid Pocket 2S, I've been using tic80 more with just a controller and my phone. I encountered another difficulty, and that is keeping games for offline play. Currently if you like a game you found on Surf and you want to play it later without internet; you have to close it then use the keyboard to name/save it locally. Using the app Unexpected Keboard (available on fdroid) this isn't too bad, and once again fits in logically with the keyboard/console design. However if your device is small and can barely accommodate a keyboard this quickly becomes too much.
Here I added an Autosave option into the config menu. It is set to OFF by default. When turned ON it waits for Surf to finish loading a new cart and runs a new function that checks to see if the file system has a "downloads" folder, if not it makes one. Then it tells the console to save with a new function called forceAutoSave. It's a clone of onSaveCommandConfirmed with the /downloads/ path added in.
I had to include the config.h header file thing into surf, and also toss in the config class struct thing into its init function... I still don't entirely know what I'm doing by the way... So I'm mostly just hoping I haven't done something obviously horrible.
That's kind of it. It works pretty well so far. I've tested on Linux and Android. Thing that surprised me the most is that it retains save file progress from the instance played on Surf/cache, as well as the newly autosaved one in /downloads.
I would have really liked to be able to compare the version of one already downloaded with the one on surf, but looking through the net.c file I couldn't find anything that obviously jumped out. Maybe I have to look into how the net.c file parses the server? Another qol could be deciding the folder the autosaved carts land in, or even retaining their sorting setup on surf...