(Android) Try to deinit RetroArch when closing - currently fails due to

not being able to dequeue native window buffer
This commit is contained in:
twinaphex 2012-10-16 13:48:08 +02:00
parent 5e85906f94
commit 2f26f8e76f

View File

@ -78,28 +78,36 @@ static void engine_handle_cmd(struct android_app* app, int32_t cmd)
break; break;
case APP_CMD_TERM_WINDOW: case APP_CMD_TERM_WINDOW:
// The window is being hidden or closed, clean it up. // The window is being hidden or closed, clean it up.
//gfx_ctx_destroy(); rarch_main_deinit();
rarch_deinit_msg_queue();
rarch_main_clear_state();
break; break;
case APP_CMD_GAINED_FOCUS: case APP_CMD_GAINED_FOCUS:
// When our app gains focus, we start monitoring the accelerometer. // When our app gains focus, we start monitoring the accelerometer.
/*
if (g_android.accelerometerSensor != NULL) if (g_android.accelerometerSensor != NULL)
{ {
*/
ASensorEventQueue_enableSensor(g_android.sensorEventQueue, ASensorEventQueue_enableSensor(g_android.sensorEventQueue,
g_android.accelerometerSensor); g_android.accelerometerSensor);
// We'd like to get 60 events per second (in us). // We'd like to get 60 events per second (in us).
ASensorEventQueue_setEventRate(g_android.sensorEventQueue, ASensorEventQueue_setEventRate(g_android.sensorEventQueue,
g_android.accelerometerSensor, (1000L/60)*1000); g_android.accelerometerSensor, (1000L/60)*1000);
} //}
break; break;
case APP_CMD_LOST_FOCUS: case APP_CMD_LOST_FOCUS:
// When our app loses focus, we stop monitoring the accelerometer. // When our app loses focus, we stop monitoring the accelerometer.
// This is to avoid consuming battery while not being used. // This is to avoid consuming battery while not being used.
if (g_android.accelerometerSensor != NULL) if (!g_android.window_inited)
ASensorEventQueue_disableSensor(g_android.sensorEventQueue, {
g_android.accelerometerSensor); if (g_android.accelerometerSensor != NULL)
// Also stop animating. ASensorEventQueue_disableSensor(g_android.sensorEventQueue,
g_android.animating = 0; g_android.accelerometerSensor);
// Also stop animating.
g_android.animating = 0;
}
break; break;
} }
} }