Properly hook up Android shutdown paths

This commit is contained in:
Aaron Culliney 2015-06-06 21:18:27 -07:00
parent aa31141455
commit 1da7acbaba
2 changed files with 10 additions and 1 deletions

View File

@ -111,6 +111,7 @@ void Java_org_deadc0de_apple2ix_Apple2Activity_nativeGraphicsInitialized(JNIEnv
LOG("native graphicsInitialized width:%d height:%d", width, height);
static bool graphicsPreviouslyInitialized = false;
if (graphicsPreviouslyInitialized) {
LOG("shutting down previous context");
video_backend->shutdown();
}
graphicsPreviouslyInitialized = true;
@ -144,6 +145,10 @@ void Java_org_deadc0de_apple2ix_Apple2Activity_nativeOnPause(JNIEnv *env, jobjec
}
void Java_org_deadc0de_apple2ix_Apple2Activity_nativeRender(JNIEnv *env, jobject obj) {
if (UNLIKELY(emulator_shutting_down)) {
return;
}
if (!nativePaused) {
c_keys_handle_input(-1, 0, 0);
}
@ -242,6 +247,9 @@ void Java_org_deadc0de_apple2ix_Apple2Activity_nativeOnKeyUp(JNIEnv *env, jobjec
jboolean Java_org_deadc0de_apple2ix_Apple2Activity_nativeOnTouch(JNIEnv *env, jobject obj, jint action, jint pointerCount, jint pointerIndex, jfloatArray xCoords, jfloatArray yCoords) {
//LOG("nativeOnTouch : %d/%d/%d :", action, pointerCount, pointerIndex);
if (UNLIKELY(emulator_shutting_down)) {
return true;
}
if (nativePaused) {
LOG("UNPAUSING NATIVE CPU THREAD");

View File

@ -318,7 +318,7 @@ static GLuint _build_program(demoSource *vertexSource, demoSource *fragmentSourc
if (version) {
sprintf(sourceString, "#version %d\n%s", version, vertexSource->string);
} else {
RELEASE_LOG("YAY, you have an awesome OpenGL vendor for this device ... no GLSL version specified ... so NOT adding a #version directive to shader sources =P");
RELEASE_LOG("No GLSL version specified ... so NOT adding a #version directive to shader sources =P");
sprintf(sourceString, "%s", vertexSource->string);
}
@ -631,6 +631,7 @@ static void gldriver_shutdown(void) {
#else
# if MOBILE_DEVICE
// it could be a temporary backgrounding do nothing here ...
_gldriver_shutdown();
# else
emulator_shutting_down = true;
# endif