mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
MainAndroid: Optionally wait for savestate to finish writing
This commit is contained in:
parent
87957faddd
commit
f9a0511937
@ -294,15 +294,19 @@ public final class NativeLibrary
|
|||||||
* Saves a game state to the slot number.
|
* Saves a game state to the slot number.
|
||||||
*
|
*
|
||||||
* @param slot The slot location to save state to.
|
* @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.
|
* Saves a game state to the specified path.
|
||||||
*
|
*
|
||||||
* @param path The path to save state to.
|
* @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.
|
* Loads a game state from the slot number.
|
||||||
|
@ -412,7 +412,7 @@ public final class EmulationActivity extends AppCompatActivity
|
|||||||
|
|
||||||
// Quick save / load
|
// Quick save / load
|
||||||
case MENU_ACTION_QUICK_SAVE:
|
case MENU_ACTION_QUICK_SAVE:
|
||||||
NativeLibrary.SaveState(9);
|
NativeLibrary.SaveState(9, false);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case MENU_ACTION_QUICK_LOAD:
|
case MENU_ACTION_QUICK_LOAD:
|
||||||
@ -436,27 +436,27 @@ public final class EmulationActivity extends AppCompatActivity
|
|||||||
|
|
||||||
// Save state slots
|
// Save state slots
|
||||||
case MENU_ACTION_SAVE_SLOT1:
|
case MENU_ACTION_SAVE_SLOT1:
|
||||||
NativeLibrary.SaveState(0);
|
NativeLibrary.SaveState(0, false);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case MENU_ACTION_SAVE_SLOT2:
|
case MENU_ACTION_SAVE_SLOT2:
|
||||||
NativeLibrary.SaveState(1);
|
NativeLibrary.SaveState(1, false);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case MENU_ACTION_SAVE_SLOT3:
|
case MENU_ACTION_SAVE_SLOT3:
|
||||||
NativeLibrary.SaveState(2);
|
NativeLibrary.SaveState(2, false);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case MENU_ACTION_SAVE_SLOT4:
|
case MENU_ACTION_SAVE_SLOT4:
|
||||||
NativeLibrary.SaveState(3);
|
NativeLibrary.SaveState(3, false);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case MENU_ACTION_SAVE_SLOT5:
|
case MENU_ACTION_SAVE_SLOT5:
|
||||||
NativeLibrary.SaveState(4);
|
NativeLibrary.SaveState(4, false);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case MENU_ACTION_SAVE_SLOT6:
|
case MENU_ACTION_SAVE_SLOT6:
|
||||||
NativeLibrary.SaveState(5);
|
NativeLibrary.SaveState(5, false);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Load state slots
|
// Load state slots
|
||||||
|
@ -451,10 +451,12 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetFilename(
|
|||||||
jstring jFile);
|
jstring jFile);
|
||||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveState(JNIEnv* env,
|
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveState(JNIEnv* env,
|
||||||
jobject obj,
|
jobject obj,
|
||||||
jint slot);
|
jint slot,
|
||||||
|
jboolean wait);
|
||||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveStateAs(JNIEnv* env,
|
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveStateAs(JNIEnv* env,
|
||||||
jobject obj,
|
jobject obj,
|
||||||
jstring path);
|
jstring path,
|
||||||
|
jboolean wait);
|
||||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_LoadState(JNIEnv* env,
|
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_LoadState(JNIEnv* env,
|
||||||
jobject obj,
|
jobject obj,
|
||||||
jint slot);
|
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,
|
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveState(JNIEnv* env,
|
||||||
jobject obj,
|
jobject obj,
|
||||||
jint slot)
|
jint slot,
|
||||||
|
jboolean wait)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> guard(s_host_identity_lock);
|
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,
|
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveStateAs(JNIEnv* env,
|
||||||
jobject obj,
|
jobject obj,
|
||||||
jstring path)
|
jstring path,
|
||||||
|
jboolean wait)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> guard(s_host_identity_lock);
|
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,
|
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_LoadState(JNIEnv* env,
|
||||||
|
Loading…
Reference in New Issue
Block a user