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

Save SRAM and state on Android shutdown #17577

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

fishcu
Copy link
Contributor

@fishcu fishcu commented Feb 16, 2025

Guidelines

  1. Rebase before opening a pull request
  2. If you are sending several unrelated fixes or features, use a branch and a separate pull request for each
  3. If possible try squashing everything in a single commit. This is particularly beneficial in the case of feature merges since it allows easy bisecting when a problem arises

Description

Bring relevant changes in #14804 forward to latest upstream.

Related Issues

#14518

Reviewers

@hizzlekizzle
@warmenhoven

/* Flush SRAM to disk */
command_event(CMD_EVENT_SAVE_FILES, NULL);

/* TODO: Save config? */
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As hinted at by the original PR, there's this UWP function that seems to save the config:

if (config_save_file(config_path))

I'm not sure if these two functions are supposed to be functionally equivalent.

androidlocation_t *androidlocation = (androidlocation_t*)data;
JNIEnv *env = jni_thread_getenv();
if (!env)
if (!androidlocation || !env)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why the original PR added this check. If androidlocation is nullptr, handling it like this is probably wrong.

Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷 Probably in case the app was told to stop multiple times, to avoid multiple unnecessary writes? Not sure it really matters, the calls are supposed to be smart enough to know that nothing needs to be written.

@fishcu
Copy link
Contributor Author

fishcu commented Feb 16, 2025

The original PR replicated the code changes in the header (!) inside driver_location_stop().

AFAICT, driver_location_stop() will call android_location_stop() anyway, so no need to replicate this functionality. I did not bring these changes forward.

return;

#if 0
Copy link
Contributor Author

@fishcu fishcu Feb 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the iOS version: https://github.com/libretro/RetroArch/blob/master/ui/drivers/ui_cocoatouch.m#L793

We can see that the only event called is CMD_EVENT_SAVE_FILES. I commented out this code block for now but left the code until I gain more clarity from the discussion in other threads.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iOS is probably wrong here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants