summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinWX/MainAndroid.cpp
diff options
context:
space:
mode:
authorRyan Houdek <Sonicadvance1@gmail.com>2015-05-25 23:37:48 -0400
committerRyan Houdek <Sonicadvance1@gmail.com>2015-05-25 23:37:48 -0400
commitc88d6c804a0e878ce917164dd90face01e89f927 (patch)
tree9a8727b11f6886bb3eb348564e454c4f07692119 /Source/Core/DolphinWX/MainAndroid.cpp
parent4ba430951a87c1831c7dcaa92d7dd3c9b859e098 (diff)
parentd789d8d75fda89d68a75e2ce605f082f379b8cfe (diff)
Merge pull request #2430 from Sonicadvance1/android_panic_handler
[Android] Add support for panic alerts to the JNI.
Diffstat (limited to 'Source/Core/DolphinWX/MainAndroid.cpp')
-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 97956512e3..2f37f36240 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;
}
@@ -370,6 +379,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();
@@ -564,6 +578,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);