Fix emulator quit path on Android

This commit is contained in:
Aaron Culliney 2015-06-01 22:50:44 -07:00
parent 29006f9c5c
commit f2abf4ce35
3 changed files with 19 additions and 8 deletions

View File

@ -357,6 +357,13 @@ public class Apple2Activity extends Activity {
@Override
public void onClick(DialogInterface dialog, int which) {
nativeOnQuit();
Apple2Activity.this.finish();
try {
Thread.sleep(1000);
} catch (InterruptedException ex) {
// ...
}
System.exit(0);
}
}).setNegativeButton(R.string.no, null).create();
/*mQuitDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {

View File

@ -183,13 +183,13 @@ void Java_org_deadc0de_apple2ix_Apple2Activity_nativeOnQuit(JNIEnv *env, jobject
c_eject_6(0);
c_eject_6(1);
#ifdef AUDIO_ENABLED
speaker_destroy();
MB_Destroy();
#endif
emulator_shutting_down = true;
video_shutdown();
exit(0);
pthread_mutex_unlock(&interface_mutex);
if (pthread_join(cpu_thread_id, NULL)) {
ERRLOG("OOPS: pthread_join of CPU thread ...");
}
}
void Java_org_deadc0de_apple2ix_Apple2Activity_nativeOnKeyDown(JNIEnv *env, jobject obj, jint keyCode, jint metaState) {

View File

@ -621,7 +621,6 @@ static void gldriver_init_common(void) {
static void _gldriver_shutdown(void) {
// Cleanup all OpenGL objects
emulator_shutting_down = true;
glDeleteTextures(1, &a2TextureName);
a2TextureName = UNINITIALIZED_GL;
_destroy_VAO(crtVAOName);
@ -637,7 +636,11 @@ static void gldriver_shutdown(void) {
#if USE_GLUT
glutLeaveMainLoop();
#else
_gldriver_shutdown();
# if MOBILE_DEVICE
// it could be a temporary backgrounding do nothing here ...
# else
emulator_shutting_down = true;
# endif
#endif
}
@ -886,6 +889,7 @@ static void gldriver_main_loop(void) {
glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
glutMainLoop();
LOG("GLUT main loop finished...");
emulator_shutting_down = true;
_gldriver_shutdown();
#endif
// fall through if not GLUT