diff options
| author | JosJuice <josjuice@gmail.com> | 2017-12-26 22:22:42 +0100 |
|---|---|---|
| committer | mahdihijazi <mahdi.hijaz@hotmail.com> | 2017-12-27 21:53:14 +0100 |
| commit | f9a05119370dbc3a261cda61d97b17c261db7b0b (patch) | |
| tree | 758ffbae04359dcd70f4c14b24210ebe2a44e592 /Source/Android | |
| parent | 87957fadddfa95386f46aea6baac8ad65a92c7d5 (diff) | |
MainAndroid: Optionally wait for savestate to finish writing
Diffstat (limited to 'Source/Android')
3 files changed, 23 insertions, 15 deletions
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java index 35548a4930..0d55f9bb12 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java @@ -294,15 +294,19 @@ public final class NativeLibrary * Saves a game state to the slot number. * * @param slot The slot location to save state to. + * @param wait If false, returns as early as possible. + * If true, returns once the savestate has been written to disk. */ - public static native void SaveState(int slot); + public static native void SaveState(int slot, boolean wait); /** * Saves a game state to the specified path. * * @param path The path to save state to. + * @param wait If false, returns as early as possible. + * If true, returns once the savestate has been written to disk. */ - public static native void SaveStateAs(String path); + public static native void SaveStateAs(String path, boolean wait); /** * Loads a game state from the slot number. diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java index 56873cab76..de9e864914 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java @@ -412,7 +412,7 @@ public final class EmulationActivity extends AppCompatActivity // Quick save / load case MENU_ACTION_QUICK_SAVE: - NativeLibrary.SaveState(9); + NativeLibrary.SaveState(9, false); return; case MENU_ACTION_QUICK_LOAD: @@ -436,27 +436,27 @@ public final class EmulationActivity extends AppCompatActivity // Save state slots case MENU_ACTION_SAVE_SLOT1: - NativeLibrary.SaveState(0); + NativeLibrary.SaveState(0, false); return; case MENU_ACTION_SAVE_SLOT2: - NativeLibrary.SaveState(1); + NativeLibrary.SaveState(1, false); return; case MENU_ACTION_SAVE_SLOT3: - NativeLibrary.SaveState(2); + NativeLibrary.SaveState(2, false); return; case MENU_ACTION_SAVE_SLOT4: - NativeLibrary.SaveState(3); + NativeLibrary.SaveState(3, false); return; case MENU_ACTION_SAVE_SLOT5: - NativeLibrary.SaveState(4); + NativeLibrary.SaveState(4, false); return; case MENU_ACTION_SAVE_SLOT6: - NativeLibrary.SaveState(5); + NativeLibrary.SaveState(5, false); return; // Load state slots diff --git a/Source/Android/jni/MainAndroid.cpp b/Source/Android/jni/MainAndroid.cpp index ab2458c782..c4ab13f59c 100644 --- a/Source/Android/jni/MainAndroid.cpp +++ b/Source/Android/jni/MainAndroid.cpp @@ -451,10 +451,12 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetFilename( jstring jFile); JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveState(JNIEnv* env, jobject obj, - jint slot); + jint slot, + jboolean wait); JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveStateAs(JNIEnv* env, jobject obj, - jstring path); + jstring path, + jboolean wait); JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_LoadState(JNIEnv* env, jobject obj, jint slot); @@ -664,18 +666,20 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetConfig( JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveState(JNIEnv* env, jobject obj, - jint slot) + jint slot, + jboolean wait) { std::lock_guard<std::mutex> guard(s_host_identity_lock); - State::Save(slot); + State::Save(slot, wait); } JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveStateAs(JNIEnv* env, jobject obj, - jstring path) + jstring path, + jboolean wait) { std::lock_guard<std::mutex> guard(s_host_identity_lock); - State::SaveAs(GetJString(env, path)); + State::SaveAs(GetJString(env, path), wait); } JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_LoadState(JNIEnv* env, |
