diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/BooleanSupplier.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/BooleanSupplier.java index d1c490fe2a..70ce355ed4 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/BooleanSupplier.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/BooleanSupplier.java @@ -1,6 +1,9 @@ package org.dolphinemu.dolphinemu.utils; +import androidx.annotation.Keep; + public interface BooleanSupplier { + @Keep boolean get(); } diff --git a/Source/Android/jni/AndroidCommon/IDCache.cpp b/Source/Android/jni/AndroidCommon/IDCache.cpp index b5ca604c6e..586ffd0845 100644 --- a/Source/Android/jni/AndroidCommon/IDCache.cpp +++ b/Source/Android/jni/AndroidCommon/IDCache.cpp @@ -271,11 +271,9 @@ jmethodID GetBooleanSupplierGet() } // namespace IDCache -#ifdef __cplusplus extern "C" { -#endif -jint JNI_OnLoad(JavaVM* vm, void* reserved) +JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { s_java_vm = vm; @@ -336,11 +334,13 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved) s_linked_hash_map_init = env->GetMethodID(s_linked_hash_map_class, "", "(I)V"); s_linked_hash_map_put = env->GetMethodID( s_linked_hash_map_class, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"); + env->DeleteLocalRef(map_class); const jclass compress_cb_class = env->FindClass("org/dolphinemu/dolphinemu/utils/CompressCallback"); s_compress_cb_class = reinterpret_cast(env->NewGlobalRef(compress_cb_class)); s_compress_cb_run = env->GetMethodID(s_compress_cb_class, "run", "(Ljava/lang/String;F)Z"); + env->DeleteLocalRef(compress_cb_class); const jclass content_handler_class = env->FindClass("org/dolphinemu/dolphinemu/utils/ContentHandler"); @@ -358,6 +358,7 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved) s_content_handler_do_file_search = env->GetStaticMethodID(s_content_handler_class, "doFileSearch", "(Ljava/lang/String;[Ljava/lang/String;Z)[Ljava/lang/String;"); + env->DeleteLocalRef(content_handler_class); const jclass network_helper_class = env->FindClass("org/dolphinemu/dolphinemu/utils/NetworkHelper"); @@ -368,16 +369,18 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved) env->GetStaticMethodID(s_network_helper_class, "GetNetworkPrefixLength", "()I"); s_network_helper_get_network_gateway = env->GetStaticMethodID(s_network_helper_class, "GetNetworkGateway", "()I"); + env->DeleteLocalRef(network_helper_class); const jclass boolean_supplier_class = env->FindClass("org/dolphinemu/dolphinemu/utils/BooleanSupplier"); s_boolean_supplier_class = reinterpret_cast(env->NewGlobalRef(boolean_supplier_class)); s_boolean_supplier_get = env->GetMethodID(s_boolean_supplier_class, "get", "()Z"); + env->DeleteLocalRef(boolean_supplier_class); return JNI_VERSION; } -void JNI_OnUnload(JavaVM* vm, void* reserved) +JNIEXPORT void JNI_OnUnload(JavaVM* vm, void* reserved) { JNIEnv* env; if (vm->GetEnv(reinterpret_cast(&env), JNI_VERSION) != JNI_OK) @@ -393,8 +396,6 @@ void JNI_OnUnload(JavaVM* vm, void* reserved) env->DeleteGlobalRef(s_compress_cb_class); env->DeleteGlobalRef(s_content_handler_class); env->DeleteGlobalRef(s_network_helper_class); + env->DeleteGlobalRef(s_boolean_supplier_class); } - -#ifdef __cplusplus } -#endif diff --git a/Source/Android/jni/IniFile.cpp b/Source/Android/jni/IniFile.cpp index e78d8b78f2..97482ef3f3 100644 --- a/Source/Android/jni/IniFile.cpp +++ b/Source/Android/jni/IniFile.cpp @@ -60,9 +60,7 @@ static void Set(JNIEnv* env, jobject obj, jstring section_name, jstring key, T n ->Set(GetJString(env, key), new_value); } -#ifdef __cplusplus extern "C" { -#endif JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_utils_IniFile_00024Section_exists( JNIEnv* env, jobject obj, jstring key) @@ -243,7 +241,4 @@ JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_utils_IniFile_copyIniFile { return reinterpret_cast(new IniFile(*GetIniFilePointer(env, other))); } - -#ifdef __cplusplus } -#endif diff --git a/Source/Android/jni/MainAndroid.cpp b/Source/Android/jni/MainAndroid.cpp index 1290f586fb..6542109949 100644 --- a/Source/Android/jni/MainAndroid.cpp +++ b/Source/Android/jni/MainAndroid.cpp @@ -196,9 +196,7 @@ static std::string GetAnalyticValue(const std::string& key) return stdvalue; } -#ifdef __cplusplus extern "C" { -#endif JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_UnPauseEmulation(JNIEnv*, jclass) @@ -703,7 +701,4 @@ Java_org_dolphinemu_dolphinemu_NativeLibrary_GetCurrentTitleDescriptionUnchecked return ToJString(env, description); } - -#ifdef __cplusplus } -#endif diff --git a/Source/Android/jni/NativeConfig.cpp b/Source/Android/jni/NativeConfig.cpp index 270a999d0c..31fe9ade9a 100644 --- a/Source/Android/jni/NativeConfig.cpp +++ b/Source/Android/jni/NativeConfig.cpp @@ -94,9 +94,7 @@ static void Set(jint layer, const Config::Location& location, T value) Config::OnConfigChanged(); } -#ifdef __cplusplus extern "C" { -#endif JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_isSettingSaveable( @@ -210,7 +208,4 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_features_settings_model_Na { return Set(layer, GetLocation(env, file, section, key), value); } - -#ifdef __cplusplus } -#endif