Apparently not possible to query this early on Gingerbread devices

This commit is contained in:
Aaron Culliney 2015-11-01 13:43:09 -08:00
parent 3d634004cf
commit 9a2044f75e
2 changed files with 48 additions and 40 deletions

View File

@ -91,6 +91,8 @@ public class Apple2Activity extends Activity {
private native void nativeOnKeyUp(int keyCode, int metaState); private native void nativeOnKeyUp(int keyCode, int metaState);
private native void nativeEarlyLifecycleInit();
public native void nativeEmulationResume(); public native void nativeEmulationResume();
public native void nativeEmulationPause(); public native void nativeEmulationPause();
@ -140,6 +142,8 @@ public class Apple2Activity extends Activity {
showSplashScreen(); showSplashScreen();
Apple2CrashHandler.getInstance().checkForCrashes(Apple2Activity.this); Apple2CrashHandler.getInstance().checkForCrashes(Apple2Activity.this);
nativeEarlyLifecycleInit();
// first-time initializations #1 // first-time initializations #1
if (!Apple2Preferences.FIRST_TIME_CONFIGURED.booleanValue(this)) { if (!Apple2Preferences.FIRST_TIME_CONFIGURED.booleanValue(this)) {
Apple2DisksMenu.firstTime(this); Apple2DisksMenu.firstTime(this);
@ -516,7 +520,7 @@ public class Apple2Activity extends Activity {
// if no more views on menu stack, resume emulation // if no more views on menu stack, resume emulation
if (mMenuStack.size() == 0) { if (mMenuStack.size() == 0) {
dismissAllMenus(); dismissAllMenus(); // NOTE : at this point, this should not be re-entrant into mMenuStack, it should just dismiss lingering popups
if (!mPausing.get()) { if (!mPausing.get()) {
if (dismissedSplashScreen) { if (dismissedSplashScreen) {
setupGLView(); setupGLView();

View File

@ -99,6 +99,48 @@ static inline int _androidTouchEvent2InterfaceEvent(jint action) {
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// JNI functions // JNI functions
void Java_org_deadc0de_apple2ix_Apple2Activity_nativeEarlyLifecycleInit(JNIEnv *env, jobject obj) {
LOG("Discovering CPU family...");
AndroidCpuFamily family = android_getCpuFamily();
uint64_t features = android_getCpuFeatures();
if (family == ANDROID_CPU_FAMILY_X86) {
if (features & ANDROID_CPU_X86_FEATURE_SSSE3) {
LOG("nANDROID_CPU_X86_FEATURE_SSSE3");
android_x86SSSE3Enabled = true;
}
if (features & ANDROID_CPU_X86_FEATURE_MOVBE) {
LOG("ANDROID_CPU_X86_FEATURE_MOVBE");
}
if (features & ANDROID_CPU_X86_FEATURE_POPCNT) {
LOG("ANDROID_CPU_X86_FEATURE_POPCNT");
}
} else if (family == ANDROID_CPU_FAMILY_ARM) {
if (features & ANDROID_CPU_ARM_FEATURE_ARMv7) {
LOG("ANDROID_CPU_ARM_FEATURE_ARMv7");
android_armArchV7A = true;
} else {
LOG("!!! NOT ANDROID_CPU_ARM_FEATURE_ARMv7");
android_armArch = true;
}
if (features & ANDROID_CPU_ARM_FEATURE_VFPv3) {
LOG("ANDROID_CPU_ARM_FEATURE_VFPv3");
}
if (features & ANDROID_CPU_ARM_FEATURE_NEON) {
LOG("ANDROID_CPU_ARM_FEATURE_NEON");
android_armNeonEnabled = true;
}
if (features & ANDROID_CPU_ARM_FEATURE_LDREX_STREX) {
LOG("ANDROID_CPU_ARM_FEATURE_LDREX_STREX");
}
} else if (family == ANDROID_CPU_FAMILY_ARM64) {
#warning FIXME TODO ...
//android_arm64Arch = true;
android_armArchV7A = true;
}
}
void Java_org_deadc0de_apple2ix_Apple2View_nativeOnCreate(JNIEnv *env, jclass cls, jstring j_dataDir, jint sampleRate, jint monoBufferSize, jint stereoBufferSize) { void Java_org_deadc0de_apple2ix_Apple2View_nativeOnCreate(JNIEnv *env, jclass cls, jstring j_dataDir, jint sampleRate, jint monoBufferSize, jint stereoBufferSize) {
const char *dataDir = (*env)->GetStringUTFChars(env, j_dataDir, 0); const char *dataDir = (*env)->GetStringUTFChars(env, j_dataDir, 0);
@ -302,44 +344,6 @@ void Java_org_deadc0de_apple2ix_Apple2Activity_nativeEjectDisk(JNIEnv *env, jobj
__attribute__((constructor(CTOR_PRIORITY_LATE))) __attribute__((constructor(CTOR_PRIORITY_LATE)))
static void _init_jnihooks(void) { static void _init_jnihooks(void) {
LOG("Discovering CPU family"); // ...
AndroidCpuFamily family = android_getCpuFamily();
uint64_t features = android_getCpuFeatures();
if (family == ANDROID_CPU_FAMILY_X86) {
if (features & ANDROID_CPU_X86_FEATURE_SSSE3) {
LOG("nANDROID_CPU_X86_FEATURE_SSSE3");
android_x86SSSE3Enabled = true;
}
if (features & ANDROID_CPU_X86_FEATURE_MOVBE) {
LOG("ANDROID_CPU_X86_FEATURE_MOVBE");
}
if (features & ANDROID_CPU_X86_FEATURE_POPCNT) {
LOG("ANDROID_CPU_X86_FEATURE_POPCNT");
}
} else if (family == ANDROID_CPU_FAMILY_ARM) {
if (features & ANDROID_CPU_ARM_FEATURE_ARMv7) {
LOG("ANDROID_CPU_ARM_FEATURE_ARMv7");
android_armArchV7A = true;
} else {
LOG("!!! NOT ANDROID_CPU_ARM_FEATURE_ARMv7");
android_armArch = true;
}
if (features & ANDROID_CPU_ARM_FEATURE_VFPv3) {
LOG("ANDROID_CPU_ARM_FEATURE_VFPv3");
}
if (features & ANDROID_CPU_ARM_FEATURE_NEON) {
LOG("ANDROID_CPU_ARM_FEATURE_NEON");
android_armNeonEnabled = true;
}
if (features & ANDROID_CPU_ARM_FEATURE_LDREX_STREX) {
LOG("ANDROID_CPU_ARM_FEATURE_LDREX_STREX");
}
} else if (family == ANDROID_CPU_FAMILY_ARM64) {
#warning FIXME TODO ...
//android_arm64Arch = true;
android_armArchV7A = true;
}
} }