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:
parent
91e7136b8f
commit
e5fde057c9
@ -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;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user