mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-24 21:21:05 +00:00
ANDROID: Remove an indirection when pausing
This commit is contained in:
parent
1e3c96b3ef
commit
a7a7542d1d
@ -196,6 +196,11 @@ void *OSystem_Android::audioThreadFunc(void *arg) {
|
||||
|
||||
while (!system->_audio_thread_exit) {
|
||||
if (JNI::pause) {
|
||||
JNI::setAudioStop();
|
||||
|
||||
paused = true;
|
||||
silence_count = 33;
|
||||
|
||||
LOGD("audio thread going to sleep");
|
||||
sem_wait(&JNI::pause_sem);
|
||||
LOGD("audio thread woke up");
|
||||
|
@ -97,8 +97,8 @@ const JNINativeMethod JNI::_natives[] = {
|
||||
(void *)JNI::pushEvent },
|
||||
{ "enableZoning", "(Z)V",
|
||||
(void *)JNI::enableZoning },
|
||||
{ "pauseEngine", "(Z)V",
|
||||
(void *)JNI::pauseEngine }
|
||||
{ "setPause", "(Z)V",
|
||||
(void *)JNI::setPause }
|
||||
};
|
||||
|
||||
JNI::JNI() {
|
||||
@ -625,7 +625,7 @@ void JNI::enableZoning(JNIEnv *env, jobject self, jboolean enable) {
|
||||
_system->enableZoning(enable);
|
||||
}
|
||||
|
||||
void JNI::pauseEngine(JNIEnv *env, jobject self, jboolean value) {
|
||||
void JNI::setPause(JNIEnv *env, jobject self, jboolean value) {
|
||||
if (!_system)
|
||||
return;
|
||||
|
||||
|
@ -134,7 +134,7 @@ private:
|
||||
static void pushEvent(JNIEnv *env, jobject self, jobject java_event);
|
||||
static void enableZoning(JNIEnv *env, jobject self, jboolean enable);
|
||||
|
||||
static void pauseEngine(JNIEnv *env, jobject self, jboolean pause);
|
||||
static void setPause(JNIEnv *env, jobject self, jboolean value);
|
||||
};
|
||||
|
||||
inline bool JNI::haveSurface() {
|
||||
|
@ -44,9 +44,9 @@ public abstract class ScummVM implements SurfaceHolder.Callback, Runnable {
|
||||
final private native void destroy();
|
||||
final private native void setSurface(int width, int height);
|
||||
final private native int main(String[] args);
|
||||
final private native void pauseEngine(boolean pause);
|
||||
|
||||
// Set scummvm config options
|
||||
// pause the engine and all native threads
|
||||
final public native void setPause(boolean pause);
|
||||
final public native void enableZoning(boolean enable);
|
||||
// Feed an event to ScummVM. Safe to call from other threads.
|
||||
final public native void pushEvent(Event e);
|
||||
@ -135,16 +135,6 @@ public abstract class ScummVM implements SurfaceHolder.Callback, Runnable {
|
||||
System.exit(res);
|
||||
}
|
||||
|
||||
public void pause(boolean pause) {
|
||||
if (audio_track != null && !pause)
|
||||
audio_track.play();
|
||||
|
||||
pauseEngine(pause);
|
||||
|
||||
if (audio_track != null && pause)
|
||||
audio_track.stop();
|
||||
}
|
||||
|
||||
final private void initEGL() throws Exception {
|
||||
egl = (EGL10)EGLContext.getEGL();
|
||||
eglDisplay = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
|
||||
|
@ -175,7 +175,7 @@ public class ScummVMActivity extends Activity {
|
||||
super.onResume();
|
||||
|
||||
if (scummvm != null)
|
||||
scummvm.pause(false);
|
||||
scummvm.setPause(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -185,7 +185,7 @@ public class ScummVMActivity extends Activity {
|
||||
super.onPause();
|
||||
|
||||
if (scummvm != null)
|
||||
scummvm.pause(true);
|
||||
scummvm.setPause(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user