fixed the bios crash plague, it was a jni issue with the vmu lcd. the way we cache jnienv is messy/lucky.
This commit is contained in:
parent
7ecf7d5727
commit
31bd0f5742
|
@ -163,6 +163,8 @@ float vjoy_pos[14][8];
|
||||||
|
|
||||||
extern bool print_stats;
|
extern bool print_stats;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void os_DoEvents()
|
void os_DoEvents()
|
||||||
{
|
{
|
||||||
// @@@ Nothing here yet
|
// @@@ Nothing here yet
|
||||||
|
@ -249,7 +251,6 @@ JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_config(JNIEnv *env,jo
|
||||||
}
|
}
|
||||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_init(JNIEnv *env,jobject obj,jstring fileName)
|
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_init(JNIEnv *env,jobject obj,jstring fileName)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Get filename string from Java
|
// Get filename string from Java
|
||||||
const char* P = fileName? env->GetStringUTFChars(fileName,0):0;
|
const char* P = fileName? env->GetStringUTFChars(fileName,0):0;
|
||||||
if(!P) CurFileName[0] = '\0';
|
if(!P) CurFileName[0] = '\0';
|
||||||
|
@ -283,7 +284,8 @@ JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_init(JNIEnv *env,jobj
|
||||||
|
|
||||||
#define SAMPLE_COUNT 512
|
#define SAMPLE_COUNT 512
|
||||||
|
|
||||||
JNIEnv* jenv;
|
JNIEnv* jenv; //we are abusing the f*** out of this poor guy
|
||||||
|
JavaVM* javaVM = NULL; //this seems like the right way to go
|
||||||
//stuff for audio
|
//stuff for audio
|
||||||
jshortArray jsamples;
|
jshortArray jsamples;
|
||||||
jmethodID writemid;
|
jmethodID writemid;
|
||||||
|
@ -293,7 +295,7 @@ jobject sipemu;
|
||||||
jmethodID getmicdata;
|
jmethodID getmicdata;
|
||||||
//stuff for vmu lcd
|
//stuff for vmu lcd
|
||||||
jobject vmulcd;
|
jobject vmulcd;
|
||||||
jbyteArray jpix;
|
jbyteArray jpix = NULL;
|
||||||
jmethodID updatevmuscreen;
|
jmethodID updatevmuscreen;
|
||||||
|
|
||||||
|
|
||||||
|
@ -308,6 +310,7 @@ JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_run(JNIEnv *env,jobje
|
||||||
writemid=env->GetMethodID(env->GetObjectClass(track),"WriteBuffer","([SI)I");
|
writemid=env->GetMethodID(env->GetObjectClass(track),"WriteBuffer","([SI)I");
|
||||||
|
|
||||||
dc_run();
|
dc_run();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_setupMic(JNIEnv *env,jobject obj,jobject sip)
|
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_setupMic(JNIEnv *env,jobject obj,jobject sip)
|
||||||
|
@ -320,9 +323,10 @@ JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_setupMic(JNIEnv *env,
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_setupVmu(JNIEnv *env,jobject obj,jobject vmu)
|
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_setupVmu(JNIEnv *env,jobject obj,jobject vmu)
|
||||||
{
|
{
|
||||||
|
//env->GetJavaVM(&javaVM);
|
||||||
vmulcd = env->NewGlobalRef(vmu);
|
vmulcd = env->NewGlobalRef(vmu);
|
||||||
updatevmuscreen = env->GetMethodID(env->GetObjectClass(vmu),"updateBytes","([B)V");
|
updatevmuscreen = env->GetMethodID(env->GetObjectClass(vmu),"updateBytes","([B)V");
|
||||||
jpix=jenv->NewByteArray(1536);
|
//jpix=env->NewByteArray(1536);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_stop(JNIEnv *env,jobject obj)
|
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_stop(JNIEnv *env,jobject obj)
|
||||||
|
@ -478,7 +482,12 @@ int get_mic_data(u8* buffer)
|
||||||
|
|
||||||
int push_vmu_screen(u8* buffer)
|
int push_vmu_screen(u8* buffer)
|
||||||
{
|
{
|
||||||
jenv->SetByteArrayRegion(jpix,0,1536,(jbyte*)buffer);
|
JNIEnv *env = jenv;
|
||||||
jenv->CallVoidMethod(vmulcd,updatevmuscreen,jpix);
|
//javaVM->AttachCurrentThread(&env, NULL);
|
||||||
|
if(jpix==NULL){
|
||||||
|
jpix=env->NewByteArray(1536);
|
||||||
|
}
|
||||||
|
env->SetByteArrayRegion(jpix,0,1536,(jbyte*)buffer);
|
||||||
|
env->CallVoidMethod(vmulcd,updatevmuscreen,jpix);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue