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

fix Everything is lost when the app is killed in background for android #14804

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

Conversation

gitgudyyao
Copy link

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

When RetroArch Android is closed by swiping up in Android task switcher, or automatically by the background task killer all progress in RetroArch is lost

Expected behavior
There should be an option (or always on) that flush in memory states to disk on activity onStop()

Flush SRAM to disk
If auto save state is on, make a save state
Flush auto save state to disk
Looking at uwp/uwp_main.cpp App::OnSuspending it seems like similar behavior was implemented for UWP, but not Android

Related Issues

Actual behavior
Everything is lost when the app is killed in background

Steps to reproduce the bug
Play a game in Retroarch
Switch to 5 other apps
Android should've killed Retroarch at this point
Go back to Retroarch. It appears as fresh instance without the game running and all progress are lost

Related Pull Requests

[Any other PRs from related repositories that might be needed for this pull request to work]

Reviewers

[If possible @mention all the people that should review your pull request]

@hizzlekizzle
Copy link
Contributor

This is an oft-requested feature that will be very much appreciated by users. :)

It looks like our multi-platform compile checks failed due to the changes to location_driver.c. Perhaps you could wrap them in an 'android' ifdef?

multi-platform compile checks failed due to the changes to location_driver.c. Perhaps you could wrap them in an 'android' ifdef?
location_driver.c Outdated Show resolved Hide resolved
@@ -92,7 +92,29 @@ void driver_location_set_interval(unsigned interval_msecs,
*
* Returns: true (1) if successful, otherwise false (0).
**/
void driver_location_stop(void);
void driver_location_stop(void)
Copy link
Contributor

Choose a reason for hiding this comment

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

this is a header.

@@ -116,6 +116,8 @@ void driver_location_stop(void)
location_st->driver->stop(location_st->data);
}



Copy link
Contributor

Choose a reason for hiding this comment

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

redundant newlines

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

Choose a reason for hiding this comment

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

wrong indentation

@requeijaum
Copy link

Was this merged?

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.

6 participants