libretro / libretro/RetroArch

Feature Request: Retain state on Android close

Open
#14,518 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
14.1k
Forks
2.2k
Avg merge
7h 35m
Merged PRs (30d)
51

Description

First and foremost consider this:

  • Only RetroArch bugs should be filed here. Not core bugs or game bugs
  • This is not a forum or a help section, this is strictly developer oriented

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

Actual behavior

Everything is lost when the app is killed in background

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

This is a feature request

Version/Commit

You can find this information under Information/System Information

  • RetroArch: 1.11.1
Environment information
  • OS: Android 12

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the lifecycle handling in uwp/uwp_main.cpp at App::OnSuspending with the Android activity lifecycle entry point. Trace how SRAM and auto-save states are written when Android invokes onStop(), then verify the behavior by reproducing the task-switcher and background-kill steps on Android 12.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, cpp
Domain
mobile-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.