summaryrefslogtreecommitdiff
path: root/Source/Android/jni/MainAndroid.cpp
diff options
context:
space:
mode:
author34will <wgilmour@hotmail.co.uk>2018-01-07 22:30:28 +0000
committer34will <wgilmour@hotmail.co.uk>2018-01-10 13:41:57 +0000
commit10ea9e5f5b4da1b0ff0c9615ee3772125c0348cd (patch)
tree66dd1b7dcc18bab7886b9cb856dec92db8c2548f /Source/Android/jni/MainAndroid.cpp
parentdc08b73db19b8d59ec9ba373a4fb8d7d8639c9e3 (diff)
Added an actual implementation for yes/no dialogs on Android using Object.wait and Object.notify.
Modified NativeLibrary to display alerts in AlertDialogs rather than Toast notifications, and allow yes/no options. Modified MainAndroid to use the new displayAlertMsg, and to return its output.
Diffstat (limited to 'Source/Android/jni/MainAndroid.cpp')
-rw-r--r--Source/Android/jni/MainAndroid.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/Source/Android/jni/MainAndroid.cpp b/Source/Android/jni/MainAndroid.cpp
index 56523d9eb4..85cea2092a 100644
--- a/Source/Android/jni/MainAndroid.cpp
+++ b/Source/Android/jni/MainAndroid.cpp
@@ -161,12 +161,14 @@ static bool MsgAlert(const char* caption, const char* text, bool yes_no, MsgType
g_java_vm->AttachCurrentThread(&env, NULL);
// Execute the Java method.
- env->CallStaticVoidMethod(s_jni_class, s_jni_method_alert, env->NewStringUTF(text));
+ jboolean result =
+ env->CallStaticBooleanMethod(s_jni_class, s_jni_method_alert, env->NewStringUTF(caption),
+ env->NewStringUTF(text), yes_no ? JNI_TRUE : JNI_FALSE);
// Must be called before the current thread exits; might as well do it here.
g_java_vm->DetachCurrentThread();
- return false;
+ return result != JNI_FALSE;
}
#define DVD_BANNER_WIDTH 96
@@ -767,8 +769,8 @@ Java_org_dolphinemu_dolphinemu_NativeLibrary_CacheClassesAndMethods(JNIEnv* env,
// Method signature taken from javap -s
// Source/Android/app/build/intermediates/classes/arm/debug/org/dolphinemu/dolphinemu/NativeLibrary.class
- s_jni_method_alert =
- env->GetStaticMethodID(s_jni_class, "displayAlertMsg", "(Ljava/lang/String;)V");
+ s_jni_method_alert = env->GetStaticMethodID(s_jni_class, "displayAlertMsg",
+ "(Ljava/lang/String;Ljava/lang/String;Z)Z");
}
// Surface Handling