mirror of
https://github.com/mauiaaron/apple2.git
synced 2025-08-06 07:25:14 +00:00
Prevent creating a second native CPU thread on multiple onCreate() calls
- This was blowing up in an assert on the native side, yay defensive coding!
This commit is contained in:
@@ -76,6 +76,13 @@ static inline int _androidTouchEvent2JoystickEvent(jint action) {
|
||||
|
||||
void Java_org_deadc0de_apple2ix_Apple2Activity_nativeOnCreate(JNIEnv *env, jobject obj, jstring j_dataDir) {
|
||||
const char *dataDir = (*env)->GetStringUTFChars(env, j_dataDir, 0);
|
||||
|
||||
// Android lifecycle can call onCreate() multiple times...
|
||||
if (data_dir) {
|
||||
LOG("IGNORING multiple calls to nativeOnCreate ...");
|
||||
return;
|
||||
}
|
||||
|
||||
data_dir = strdup(dataDir);
|
||||
(*env)->ReleaseStringUTFChars(env, j_dataDir, dataDir);
|
||||
LOG("nativeOnCreate(%s)...", data_dir);
|
||||
@@ -158,7 +165,7 @@ void Java_org_deadc0de_apple2ix_Apple2Activity_nativeReboot(JNIEnv *env, jobject
|
||||
}
|
||||
|
||||
void Java_org_deadc0de_apple2ix_Apple2Activity_nativeOnQuit(JNIEnv *env, jobject obj) {
|
||||
LOG("%s", "native quit...");
|
||||
LOG("%s", "nativeOnQuit...");
|
||||
|
||||
c_eject_6(0);
|
||||
c_eject_6(1);
|
||||
|
Reference in New Issue
Block a user