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
This commit is contained in:
Stefanos Kornilios Mitsis Poiitidis 2014-11-10 13:34:59 +01:00
parent d1aa96d3e1
commit c2d1fbfdc2
4 changed files with 13 additions and 5 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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);

View File

@ -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) {