MainAndroid: Allow specifying savestate to load at boot
This commit is contained in:
parent
a81cbf60fb
commit
87957faddd
|
@ -336,6 +336,11 @@ public final class NativeLibrary
|
|||
*/
|
||||
public static native void Run(String path);
|
||||
|
||||
/**
|
||||
* Begins emulation from the specified savestate.
|
||||
*/
|
||||
public static native void Run(String path, String savestatePath);
|
||||
|
||||
// Surface Handling
|
||||
public static native void SurfaceChanged(Surface surf);
|
||||
public static native void SurfaceDestroyed();
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <jni.h>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
|
||||
|
@ -476,8 +477,11 @@ JNIEXPORT void JNICALL
|
|||
Java_org_dolphinemu_dolphinemu_NativeLibrary_WriteProfileResults(JNIEnv* env, jobject obj);
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_NativeLibrary_CacheClassesAndMethods(JNIEnv* env, jobject obj);
|
||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv* env, jobject obj,
|
||||
jstring jFile);
|
||||
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);
|
||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SurfaceChanged(JNIEnv* env,
|
||||
jobject obj,
|
||||
jobject surf);
|
||||
|
@ -797,10 +801,8 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_RefreshWiimo
|
|||
WiimoteReal::Refresh();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv* env, jobject obj,
|
||||
jstring jFile)
|
||||
static void Run(const std::string& path, std::optional<std::string> savestate_path = {})
|
||||
{
|
||||
const std::string path = GetJString(env, jFile);
|
||||
__android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Running : %s", path.c_str());
|
||||
|
||||
// Install our callbacks
|
||||
|
@ -817,7 +819,7 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv*
|
|||
|
||||
// No use running the loop when booting fails
|
||||
s_have_wm_user_stop = false;
|
||||
if (BootManager::BootCore(BootParameters::GenerateFromFile(path)))
|
||||
if (BootManager::BootCore(BootParameters::GenerateFromFile(path, savestate_path)))
|
||||
{
|
||||
static constexpr int TIMEOUT = 10000;
|
||||
static constexpr int WAIT_STEP = 25;
|
||||
|
@ -848,6 +850,19 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv*
|
|||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run__Ljava_lang_String_2(
|
||||
JNIEnv* env, jobject obj, jstring jFile)
|
||||
{
|
||||
Run(GetJString(env, 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)
|
||||
{
|
||||
Run(GetJString(env, jFile), GetJString(env, jSavestate));
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue