summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorRyan Houdek <Sonicadvance1@gmail.com>2015-05-21 18:48:35 -0500
committerRyan Houdek <Sonicadvance1@gmail.com>2015-05-25 22:13:00 -0500
commitd789d8d75fda89d68a75e2ce605f082f379b8cfe (patch)
tree0168d62775675a9de9d0b87110404b942aed4030 /Source/Core
parent7c04c76a26484184c59a406a16cd278751d417c2 (diff)
[Android] Add support for panic alerts to the JNI.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/DolphinWX/MainAndroid.cpp33
1 files changed, 31 insertions, 2 deletions
diff --git a/Source/Core/DolphinWX/MainAndroid.cpp b/Source/Core/DolphinWX/MainAndroid.cpp
index 884472a13c..4c6ee1c5ff 100644
--- a/Source/Core/DolphinWX/MainAndroid.cpp
+++ b/Source/Core/DolphinWX/MainAndroid.cpp
@@ -37,6 +37,11 @@ ANativeWindow* surf;
std::string g_filename;
std::string g_set_userpath = "";
+// PanicAlert
+static bool g_alert_available = false;
+static std::string g_alert_message = "";
+static Common::Event g_alert_event;
+
#define DOLPHIN_TAG "DolphinEmuNative"
void Host_NotifyMapLoaded() {}
@@ -92,9 +97,13 @@ void Host_SetWiiMoteConnectionState(int _State) {}
void Host_ShowVideoConfig(void*, const std::string&, const std::string&) {}
-static bool MsgAlert(const char* caption, const char* text, bool /*yes_no*/, int /*Style*/)
+static bool MsgAlert(const char* caption, const char* text, bool yes_no, int /*Style*/)
{
- __android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "%s:%s", caption, text);
+ g_alert_message = std::string(text);
+ g_alert_available = true;
+ // XXX: Uncomment next line when the Android UI actually handles messages
+ // g_alert_event.Wait()
+ g_alert_available = false;
return false;
}
@@ -371,6 +380,11 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetProfiling
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_WriteProfileResults(JNIEnv *env, jobject obj);
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv *env, jobject obj, jobject _surf);
+// MsgAlert
+JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_HasAlertMsg(JNIEnv *env, jobject obj);
+JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetAlertMsg(JNIEnv *env, jobject obj);
+JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_ClearAlertMsg(JNIEnv *env, jobject obj);
+
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_UnPauseEmulation(JNIEnv *env, jobject obj)
{
PowerPC::Start();
@@ -565,6 +579,21 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_WriteProfile
JitInterface::WriteProfileResults(filename);
}
+JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_HasAlertMsg(JNIEnv *env, jobject obj)
+{
+ return g_alert_available;
+}
+
+JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetAlertMsg(JNIEnv *env, jobject obj)
+{
+ return env->NewStringUTF(g_alert_message.c_str());
+}
+
+JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_ClearAlertMsg(JNIEnv *env, jobject obj)
+{
+ g_alert_event.Set(); // Kick the alert
+}
+
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv *env, jobject obj, jobject _surf)
{
surf = ANativeWindow_fromSurface(env, _surf);