aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordhewg2011-03-07 19:52:44 +0100
committerdhewg2011-03-07 19:56:29 +0100
commit1f90d232e3b4911f725fe22489aaa2cc2253426d (patch)
treeee08d88441bd834c66e7a8604674fa255e0a8d41
parent42c6a785c74c200b19ceef6db5003f334c3edf29 (diff)
downloadscummvm-rg350-1f90d232e3b4911f725fe22489aaa2cc2253426d.tar.gz
scummvm-rg350-1f90d232e3b4911f725fe22489aaa2cc2253426d.tar.bz2
scummvm-rg350-1f90d232e3b4911f725fe22489aaa2cc2253426d.zip
ANDROID: Save the game when the process is paused
The OS can kill the activity at will after onPause() or onStop() to free up memory for other application. Provide a parachute when the engine allows it.
-rw-r--r--backends/platform/android/jni.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/backends/platform/android/jni.cpp b/backends/platform/android/jni.cpp
index 73b74394c0..6bfe9c2095 100644
--- a/backends/platform/android/jni.cpp
+++ b/backends/platform/android/jni.cpp
@@ -631,7 +631,13 @@ void JNI::setPause(JNIEnv *env, jobject self, jboolean value) {
if (g_engine) {
LOGD("pauseEngine: %d", value);
+
g_engine->pauseEngine(value);
+
+ if (value &&
+ g_engine->hasFeature(Engine::kSupportsSavingDuringRuntime) &&
+ g_engine->canSaveGameStateCurrently())
+ g_engine->saveGameState(0, "Android parachute");
}
pause = value;