From c2d1fbfdc2df5d5b31b38118fa399942d01443f9 Mon Sep 17 00:00:00 2001 From: Stefanos Kornilios Mitsis Poiitidis Date: Mon, 10 Nov 2014 13:34:59 +0100 Subject: [PATCH] WIP to get an alert dialog show - new String() fails, somewhere deep on the android run-time, with no exception or some kind of logged error on my N4. WHY? - The android debugger is a huge PITA. - Eclipse is best left unused --- shell/android/jni/src/Android.cpp | 6 ++++-- .../android/src/com/reicast/emulator/GL2JNIActivity.java | 2 +- .../src/com/reicast/emulator/config/EditVJoyActivity.java | 2 +- .../android/src/com/reicast/emulator/emu/GL2JNIView.java | 8 +++++++- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/shell/android/jni/src/Android.cpp b/shell/android/jni/src/Android.cpp index b7b6c2b71..82572c3e9 100644 --- a/shell/android/jni/src/Android.cpp +++ b/shell/android/jni/src/Android.cpp @@ -308,6 +308,9 @@ JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_run(JNIEnv *env,jobje coreMessageMid=env->GetMethodID(env->GetObjectClass(emu),"coreMessage","([B)V"); dieMid=env->GetMethodID(env->GetObjectClass(emu),"Die","()V"); + + msgboxf("HELLO!", MBX_OK); + dc_run(); } @@ -324,10 +327,9 @@ int msgboxf(const wchar* Text,unsigned int Type,...) jbyteArray bytes = jenv->NewByteArray(byteCount); jenv->SetByteArrayRegion(bytes, 0, byteCount, (jbyte*)S); - //puts(S); jenv->CallVoidMethod(emu,coreMessageMid,bytes); - return(MBX_OK); + return (MBX_OK); } JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_setupMic(JNIEnv *env,jobject obj,jobject sip) diff --git a/shell/android/src/com/reicast/emulator/GL2JNIActivity.java b/shell/android/src/com/reicast/emulator/GL2JNIActivity.java index 32c6b76ac..1a2d5f30f 100644 --- a/shell/android/src/com/reicast/emulator/GL2JNIActivity.java +++ b/shell/android/src/com/reicast/emulator/GL2JNIActivity.java @@ -198,7 +198,7 @@ public class GL2JNIActivity extends Activity { fileName = Uri.decode(getIntent().getData().toString()); // Create the actual GLES view - mView = new GL2JNIView(getApplication(), config, fileName, false, + mView = new GL2JNIView(this, config, fileName, false, prefs.getInt(Config.pref_renderdepth, 24), 0, false); setContentView(mView); diff --git a/shell/android/src/com/reicast/emulator/config/EditVJoyActivity.java b/shell/android/src/com/reicast/emulator/config/EditVJoyActivity.java index 9e5250878..a2677ad1f 100644 --- a/shell/android/src/com/reicast/emulator/config/EditVJoyActivity.java +++ b/shell/android/src/com/reicast/emulator/config/EditVJoyActivity.java @@ -61,7 +61,7 @@ public class EditVJoyActivity extends Activity { config.getConfigurationPrefs(); // Create the actual GLES view - mView = new GL2JNIView(getApplication(), config, null, false, + mView = new GL2JNIView(this, config, null, false, prefs.getInt(Config.pref_renderdepth, 24), 0, true); mView.setFpsDisplay(null); setContentView(mView); diff --git a/shell/android/src/com/reicast/emulator/emu/GL2JNIView.java b/shell/android/src/com/reicast/emulator/emu/GL2JNIView.java index d05484777..7858647ed 100644 --- a/shell/android/src/com/reicast/emulator/emu/GL2JNIView.java +++ b/shell/android/src/com/reicast/emulator/emu/GL2JNIView.java @@ -1,6 +1,7 @@ package com.reicast.emulator.emu; +import java.io.UnsupportedEncodingException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.nio.charset.Charset; @@ -688,7 +689,12 @@ public class GL2JNIView extends GLSurfaceView } void coreMessage(byte[] msg) { - showMessage(new String(msg, Charset.forName("UTF-8"))); + try { + showMessage(new String(msg, "UTF-8")); + } + catch (UnsupportedEncodingException e) { + showMessage("coreMessage: Failed to display error"); + } } void showMessage(final String msg) {