From 63a98e3e1cc9dfb306bb3f063a6c89acaf1f55ad Mon Sep 17 00:00:00 2001 From: bunnei Date: Sat, 4 Feb 2023 00:46:24 -0800 Subject: [PATCH] android: jni: Add function to reload keys. --- .../main/java/org/yuzu/yuzu_emu/NativeLibrary.java | 2 ++ src/android/app/src/main/jni/native.cpp | 11 +++++++++-- src/android/app/src/main/jni/native.h | 3 +++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.java index acb3fc2d6..44869b233 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.java @@ -165,6 +165,8 @@ public final class NativeLibrary { public static native void SetAppDirectory(String directory); + public static native boolean ReloadKeys(); + // Create the config.ini file. public static native void CreateConfigFile(); diff --git a/src/android/app/src/main/jni/native.cpp b/src/android/app/src/main/jni/native.cpp index c1880db46..358316c48 100644 --- a/src/android/app/src/main/jni/native.cpp +++ b/src/android/app/src/main/jni/native.cpp @@ -19,6 +19,7 @@ #include "common/settings.h" #include "core/core.h" #include "core/cpu_manager.h" +#include "core/crypto/key_manager.h" #include "core/file_sys/registered_cache.h" #include "core/file_sys/vfs_real.h" #include "core/hid/hid_core.h" @@ -261,12 +262,18 @@ void Java_org_yuzu_yuzu_1emu_NativeLibrary_NotifyOrientationChange(JNIEnv* env, jint layout_option, jint rotation) {} -void Java_org_yuzu_yuzu_1emu_NativeLibrary_SetAppDirectory([[maybe_unused]] JNIEnv* env, +void Java_org_yuzu_yuzu_1emu_NativeLibrary_SetAppDirectory(JNIEnv* env, [[maybe_unused]] jclass clazz, - [[maybe_unused]] jstring j_directory) { + jstring j_directory) { Common::FS::SetAppDirectory(GetJString(env, j_directory)); } +jboolean Java_org_yuzu_yuzu_1emu_NativeLibrary_ReloadKeys(JNIEnv* env, + [[maybe_unused]] jclass clazz) { + Core::Crypto::KeyManager::Instance().ReloadKeys(); + return static_cast(Core::Crypto::KeyManager::Instance().IsKeysLoaded()); +} + void Java_org_yuzu_yuzu_1emu_NativeLibrary_UnPauseEmulation([[maybe_unused]] JNIEnv* env, [[maybe_unused]] jclass clazz) {} diff --git a/src/android/app/src/main/jni/native.h b/src/android/app/src/main/jni/native.h index fbe015b55..210976201 100644 --- a/src/android/app/src/main/jni/native.h +++ b/src/android/app/src/main/jni/native.h @@ -67,6 +67,9 @@ JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_SetAppDirectory(JNI jclass clazz, jstring j_directory); +JNIEXPORT jboolean JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_ReloadKeys(JNIEnv* env, + jclass clazz); + JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_utils_DirectoryInitialization_SetSysDirectory( JNIEnv* env, jclass clazz, jstring path_);