diff options
| author | JosJuice <josjuice@gmail.com> | 2017-12-28 10:13:53 +0100 |
|---|---|---|
| committer | mahdihijazi <mahdi.hijaz@hotmail.com> | 2017-12-28 23:15:48 +0100 |
| commit | 82a6701f795a883d80c3b0167b4d3f3e224a5cd8 (patch) | |
| tree | aa1a58476598667185b5c77541d70719a9b3028b /Source/Android/jni/MainAndroid.cpp | |
| parent | f9a05119370dbc3a261cda61d97b17c261db7b0b (diff) | |
Optionally delete savestate that gets loaded at boot
Diffstat (limited to 'Source/Android/jni/MainAndroid.cpp')
| -rw-r--r-- | Source/Android/jni/MainAndroid.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/Source/Android/jni/MainAndroid.cpp b/Source/Android/jni/MainAndroid.cpp index c4ab13f59c..b1bd33093c 100644 --- a/Source/Android/jni/MainAndroid.cpp +++ b/Source/Android/jni/MainAndroid.cpp @@ -14,6 +14,7 @@ #include <optional> #include <string> #include <thread> +#include <utility> #include "ButtonManager.h" @@ -482,8 +483,8 @@ Java_org_dolphinemu_dolphinemu_NativeLibrary_CacheClassesAndMethods(JNIEnv* env, JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run__Ljava_lang_String_2( JNIEnv* env, jobject obj, jstring jFile); JNIEXPORT void JNICALL -Java_org_dolphinemu_dolphinemu_NativeLibrary_Run__Ljava_lang_String_2Ljava_lang_String_2( - JNIEnv* env, jobject obj, jstring jFile, jstring jSavestate); +Java_org_dolphinemu_dolphinemu_NativeLibrary_Run__Ljava_lang_String_2Ljava_lang_String_2Z( + JNIEnv* env, jobject obj, jstring jFile, jstring jSavestate, jboolean jDeleteSavestate); JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SurfaceChanged(JNIEnv* env, jobject obj, jobject surf); @@ -805,7 +806,8 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_RefreshWiimo WiimoteReal::Refresh(); } -static void Run(const std::string& path, std::optional<std::string> savestate_path = {}) +static void Run(const std::string& path, std::optional<std::string> savestate_path = {}, + bool delete_savestate = false) { __android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Running : %s", path.c_str()); @@ -823,7 +825,9 @@ static void Run(const std::string& path, std::optional<std::string> savestate_pa // No use running the loop when booting fails s_have_wm_user_stop = false; - if (BootManager::BootCore(BootParameters::GenerateFromFile(path, savestate_path))) + std::unique_ptr<BootParameters> boot = BootParameters::GenerateFromFile(path, savestate_path); + boot->delete_savestate = delete_savestate; + if (BootManager::BootCore(std::move(boot))) { static constexpr int TIMEOUT = 10000; static constexpr int WAIT_STEP = 25; @@ -861,10 +865,10 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run__Ljava_l } JNIEXPORT void JNICALL -Java_org_dolphinemu_dolphinemu_NativeLibrary_Run__Ljava_lang_String_2Ljava_lang_String_2( - JNIEnv* env, jobject obj, jstring jFile, jstring jSavestate) +Java_org_dolphinemu_dolphinemu_NativeLibrary_Run__Ljava_lang_String_2Ljava_lang_String_2Z( + JNIEnv* env, jobject obj, jstring jFile, jstring jSavestate, jboolean jDeleteSavestate) { - Run(GetJString(env, jFile), GetJString(env, jSavestate)); + Run(GetJString(env, jFile), GetJString(env, jSavestate), jDeleteSavestate); } #ifdef __cplusplus |
