1
0
mirror of https://github.com/mauiaaron/apple2.git synced 2025-03-24 11:30:10 +00:00

Don't create new cpu_thread on app resume

This commit is contained in:
Aaron Culliney 2015-03-12 14:45:17 -07:00
parent 91e7136b8f
commit e5fde057c9
3 changed files with 16 additions and 2 deletions
Android/jni
src

@ -21,6 +21,9 @@ void Java_org_deadc0de_apple2ix_Apple2Activity_nativeOnCreate(JNIEnv *env, jobje
data_dir = strdup(dataDir);
(*env)->ReleaseStringUTFChars(env, j_dataDir, dataDir);
LOG("nativeOnCreate(%s)...", data_dir);
c_initialize_firsttime();
pthread_create(&cpu_thread_id, NULL, (void *) &cpu_thread, (void *)NULL);
}
void Java_org_deadc0de_apple2ix_Apple2Activity_nativeGraphicsChanged(JNIEnv *env, jobject obj, jint width, jint height) {
@ -31,9 +34,15 @@ void Java_org_deadc0de_apple2ix_Apple2Activity_nativeGraphicsChanged(JNIEnv *env
void Java_org_deadc0de_apple2ix_Apple2Activity_nativeGraphicsInitialized(JNIEnv *env, jobject obj, jint width, jint height) {
LOG("%s", "native graphicsInitialized...");
video_driver_reshape(width, height);
#if !TESTING
c_initialize_firsttime();
pthread_create(&cpu_thread_id, NULL, (void *) &cpu_thread, (void *)NULL);
static bool graphicsPreviouslyInitialized = false;
if (graphicsPreviouslyInitialized) {
video_driver_shutdown();
}
graphicsPreviouslyInitialized = true;
video_driver_init((void *)0);
#else
char *local_argv[] = {
"-f",

@ -604,11 +604,13 @@ void video_init(void) {
video_initialize_color();
#if !HEADLESS
#if !defined(__APPLE__)
#if !defined(ANDROID)
if (!is_headless) {
video_driver_init((void *)0);
}
#endif
#endif
#endif
}
void video_main_loop(void) {

@ -616,10 +616,13 @@ static void gldriver_init_common(void) {
static void gldriver_shutdown(void) {
// Cleanup all OpenGL objects
glDeleteTextures(1, &a2TextureName);
a2TextureName = 0;
_destroy_VAO(crtVAOName);
crtVAOName = 0;
mdlDestroyModel(crtModel);
crtModel = NULL;
glDeleteProgram(program);
program = 0;
}
//----------------------------------------------------------------------------