Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autosave option for keeping carts from Surf #2410

Merged
merged 6 commits into from
Dec 17, 2023
Merged

Conversation

LettucePie
Copy link
Contributor

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...

@nesbox nesbox merged commit faf01b1 into nesbox:main Dec 17, 2023
31 checks passed
@LettucePie LettucePie deleted the autosave branch April 27, 2024 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants