diff options
-rw-r--r-- | backends/platform/android/jni.cpp | 10 | ||||
-rw-r--r-- | backends/platform/android/org/inodes/gus/scummvm/ScummVM.java | 12 |
2 files changed, 5 insertions, 17 deletions
diff --git a/backends/platform/android/jni.cpp b/backends/platform/android/jni.cpp index 8964fe63d8..d8203e2a57 100644 --- a/backends/platform/android/jni.cpp +++ b/backends/platform/android/jni.cpp @@ -52,7 +52,6 @@ jfieldID JNI::_FID_Event_kbd_flags = 0; jfieldID JNI::_FID_Event_mouse_x = 0; jfieldID JNI::_FID_Event_mouse_y = 0; jfieldID JNI::_FID_Event_mouse_relative = 0; -jfieldID JNI::_FID_ScummVM_nativeScummVM = 0; jmethodID JNI::_MID_displayMessageOnOSD = 0; jmethodID JNI::_MID_setWindowCaption = 0; @@ -111,10 +110,6 @@ jint JNI::onLoad(JavaVM *vm) { if (env->RegisterNatives(cls, _natives, ARRAYSIZE(_natives)) < 0) return JNI_ERR; - _FID_ScummVM_nativeScummVM = env->GetFieldID(cls, "nativeScummVM", "J"); - if (_FID_ScummVM_nativeScummVM == 0) - return JNI_ERR; - jclass event = env->FindClass("org/inodes/gus/scummvm/Event"); if (event == 0) return JNI_ERR; @@ -415,8 +410,6 @@ void JNI::create(JNIEnv *env, jobject self, jobject am, jobject at, #undef FIND_METHOD - env->SetLongField(self, _FID_ScummVM_nativeScummVM, (jlong)_system); - _jobj_audio_track = env->NewGlobalRef(at); cls = env->GetObjectClass(_jobj_audio_track); @@ -439,7 +432,8 @@ void JNI::create(JNIEnv *env, jobject self, jobject am, jobject at, } void JNI::destroy(JNIEnv *env, jobject self) { - assert(_system); + if (!_system) + return; OSystem_Android *tmp = _system; g_system = 0; diff --git a/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java b/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java index 7a326454d9..a6bc5fafc0 100644 --- a/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java +++ b/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java @@ -35,10 +35,6 @@ import java.util.LinkedHashMap; public class ScummVM implements SurfaceHolder.Callback { protected final static String LOG_TAG = "ScummVM"; - // native code hangs itself here - private long nativeScummVM; - boolean scummVMRunning = false; - private native void create(AssetManager am, AudioTrack audio_track, int sample_rate, int buffer_size); @@ -75,17 +71,14 @@ public class ScummVM implements SurfaceHolder.Callback { String.format("Error initialising AudioTrack: %d", audio_track.getState())); - // Init C++ code, set nativeScummVM + // Init C++ code create(context.getAssets(), audio_track, sample_rate, buffer_size); } private native void nativeDestroy(); public synchronized void destroy() { - if (nativeScummVM != 0) { - nativeDestroy(); - nativeScummVM = 0; - } + nativeDestroy(); } protected void finalize() { @@ -295,6 +288,7 @@ public class ScummVM implements SurfaceHolder.Callback { // Called by ScummVM thread static private boolean _log_version = true; + protected void setupScummVMSurface() { try { surfaceLock.acquire(); |