NativeLibrary: Add function to start system menu

This commit is contained in:
OatmealDome 2022-01-09 17:47:30 -05:00
parent 30d51348f9
commit 8ad1292df7
2 changed files with 22 additions and 8 deletions

View File

@ -387,6 +387,11 @@ public final class NativeLibrary
public static native void Run(String[] path, boolean riivolution, String savestatePath,
boolean deleteSavestate);
/**
* Begins emulation of the System Menu.
*/
public static native void RunSystemMenu();
public static native void ChangeDisc(String path);
// Surface Handling

View File

@ -32,6 +32,7 @@
#include "Core/Boot/Boot.h"
#include "Core/BootManager.h"
#include "Core/CommonTitles.h"
#include "Core/ConfigLoaders/GameConfigLoader.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
@ -547,21 +548,14 @@ static float GetRenderSurfaceScale(JNIEnv* env)
return env->CallStaticFloatMethod(native_library_class, get_render_surface_scale_method);
}
static void Run(JNIEnv* env, const std::vector<std::string>& paths, bool riivolution,
BootSessionData boot_session_data = BootSessionData())
static void Run(JNIEnv* env, std::unique_ptr<BootParameters>&& boot, bool riivolution)
{
ASSERT(!paths.empty());
__android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Running : %s", paths[0].c_str());
std::unique_lock<std::mutex> host_identity_guard(s_host_identity_lock);
WiimoteReal::InitAdapterClass();
s_have_wm_user_stop = false;
std::unique_ptr<BootParameters> boot =
BootParameters::GenerateFromFile(paths, std::move(boot_session_data));
if (riivolution && std::holds_alternative<BootParameters::Disc>(boot->parameters))
{
const std::string& riivolution_dir = File::GetUserPath(D_RIIVOLUTION_IDX);
@ -624,6 +618,15 @@ static void Run(JNIEnv* env, const std::vector<std::string>& paths, bool riivolu
IDCache::GetFinishEmulationActivity());
}
static void Run(JNIEnv* env, const std::vector<std::string>& paths, bool riivolution,
BootSessionData boot_session_data = BootSessionData())
{
ASSERT(!paths.empty());
__android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Running : %s", paths[0].c_str());
Run(env, BootParameters::GenerateFromFile(paths, std::move(boot_session_data)), riivolution);
}
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run___3Ljava_lang_String_2Z(
JNIEnv* env, jclass, jobjectArray jPaths, jboolean jRiivolution)
{
@ -641,6 +644,12 @@ Java_org_dolphinemu_dolphinemu_NativeLibrary_Run___3Ljava_lang_String_2ZLjava_la
BootSessionData(GetJString(env, jSavestate), delete_state));
}
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_RunSystemMenu(JNIEnv* env,
jclass)
{
Run(env, std::make_unique<BootParameters>(BootParameters::NANDTitle{Titles::SYSTEM_MENU}), false);
}
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_ChangeDisc(JNIEnv* env, jclass,
jstring jFile)
{