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);
|
public static native void Run(String path);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Begins emulation from the specified savestate.
|
||||||
|
*/
|
||||||
|
public static native void Run(String path, String savestatePath);
|
||||||
|
|
||||||
// Surface Handling
|
// Surface Handling
|
||||||
public static native void SurfaceChanged(Surface surf);
|
public static native void SurfaceChanged(Surface surf);
|
||||||
public static native void SurfaceDestroyed();
|
public static native void SurfaceDestroyed();
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
|
@ -476,8 +477,11 @@ JNIEXPORT void JNICALL
|
||||||
Java_org_dolphinemu_dolphinemu_NativeLibrary_WriteProfileResults(JNIEnv* env, jobject obj);
|
Java_org_dolphinemu_dolphinemu_NativeLibrary_WriteProfileResults(JNIEnv* env, jobject obj);
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
Java_org_dolphinemu_dolphinemu_NativeLibrary_CacheClassesAndMethods(JNIEnv* env, jobject obj);
|
Java_org_dolphinemu_dolphinemu_NativeLibrary_CacheClassesAndMethods(JNIEnv* env, jobject obj);
|
||||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv* env, jobject obj,
|
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run__Ljava_lang_String_2(
|
||||||
jstring jFile);
|
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,
|
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SurfaceChanged(JNIEnv* env,
|
||||||
jobject obj,
|
jobject obj,
|
||||||
jobject surf);
|
jobject surf);
|
||||||
|
@ -797,10 +801,8 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_RefreshWiimo
|
||||||
WiimoteReal::Refresh();
|
WiimoteReal::Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv* env, jobject obj,
|
static void Run(const std::string& path, std::optional<std::string> savestate_path = {})
|
||||||
jstring jFile)
|
|
||||||
{
|
{
|
||||||
const std::string path = GetJString(env, jFile);
|
|
||||||
__android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Running : %s", path.c_str());
|
__android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Running : %s", path.c_str());
|
||||||
|
|
||||||
// Install our callbacks
|
// 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
|
// No use running the loop when booting fails
|
||||||
s_have_wm_user_stop = false;
|
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 TIMEOUT = 10000;
|
||||||
static constexpr int WAIT_STEP = 25;
|
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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue