mirror of
https://github.com/mauiaaron/apple2.git
synced 2025-01-13 12:31:25 +00:00
Move nativeOnCreate back to proper position as first native call
- This runs discovery of CPU family - This sets up native crash handling
This commit is contained in:
parent
4999471ade
commit
6de1cae478
@ -87,12 +87,12 @@ public class Apple2Activity extends Activity {
|
||||
public final static long NATIVE_TOUCH_ASCII_MASK = 0xFF00L;
|
||||
public final static long NATIVE_TOUCH_SCANCODE_MASK = 0x00FFL;
|
||||
|
||||
private native void nativeOnCreate(String dataDir, int sampleRate, int monoBufferSize, int stereoBufferSize);
|
||||
|
||||
private native void nativeOnKeyDown(int keyCode, int metaState);
|
||||
|
||||
private native void nativeOnKeyUp(int keyCode, int metaState);
|
||||
|
||||
private native void nativeEarlyLifecycleInit();
|
||||
|
||||
public native void nativeEmulationResume();
|
||||
|
||||
public native void nativeEmulationPause();
|
||||
@ -139,11 +139,17 @@ public class Apple2Activity extends Activity {
|
||||
return;
|
||||
}
|
||||
|
||||
int sampleRate = DevicePropertyCalculator.getRecommendedSampleRate(this);
|
||||
int monoBufferSize = DevicePropertyCalculator.getRecommendedBufferSize(this, /*isStereo:*/false);
|
||||
int stereoBufferSize = DevicePropertyCalculator.getRecommendedBufferSize(this, /*isStereo:*/true);
|
||||
Log.d(TAG, "Device sampleRate:" + sampleRate + " mono bufferSize:" + monoBufferSize + " stereo bufferSize:" + stereoBufferSize);
|
||||
|
||||
String dataDir = Apple2DisksMenu.getDataDir(this);
|
||||
nativeOnCreate(dataDir, sampleRate, monoBufferSize, stereoBufferSize);
|
||||
|
||||
showSplashScreen();
|
||||
Apple2CrashHandler.getInstance().checkForCrashes(Apple2Activity.this);
|
||||
|
||||
nativeEarlyLifecycleInit();
|
||||
|
||||
// first-time initializations #1
|
||||
if (!Apple2Preferences.FIRST_TIME_CONFIGURED.booleanValue(this)) {
|
||||
Apple2DisksMenu.firstTime(this);
|
||||
|
@ -55,8 +55,6 @@ class Apple2View extends GLSurfaceView {
|
||||
private Apple2Activity mActivity = null;
|
||||
private AtomicBoolean mInitialLaunch = new AtomicBoolean(true);
|
||||
|
||||
private static native void nativeOnCreate(String dataDir, int sampleRate, int monoBufferSize, int stereoBufferSize);
|
||||
|
||||
private static native void nativeGraphicsInitialized(int width, int height);
|
||||
|
||||
private static native void nativeGraphicsChanged(int width, int height);
|
||||
@ -347,13 +345,6 @@ class Apple2View extends GLSurfaceView {
|
||||
height = w_;
|
||||
}
|
||||
|
||||
int sampleRate = DevicePropertyCalculator.getRecommendedSampleRate(Apple2View.this.mActivity);
|
||||
int monoBufferSize = DevicePropertyCalculator.getRecommendedBufferSize(Apple2View.this.mActivity, /*isStereo:*/false);
|
||||
int stereoBufferSize = DevicePropertyCalculator.getRecommendedBufferSize(Apple2View.this.mActivity, /*isStereo:*/true);
|
||||
Log.d(TAG, "Device sampleRate:" + sampleRate + " mono bufferSize:" + monoBufferSize + " stereo bufferSize:" + stereoBufferSize);
|
||||
|
||||
String dataDir = Apple2DisksMenu.getDataDir(Apple2View.this.mActivity);
|
||||
nativeOnCreate(dataDir, sampleRate, monoBufferSize, stereoBufferSize);
|
||||
nativeGraphicsInitialized(width, height);
|
||||
|
||||
// first-time initializations #2
|
||||
|
@ -96,10 +96,7 @@ static inline int _androidTouchEvent2InterfaceEvent(jint action) {
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// JNI functions
|
||||
|
||||
void Java_org_deadc0de_apple2ix_Apple2Activity_nativeEarlyLifecycleInit(JNIEnv *env, jobject obj) {
|
||||
static void discover_cpu_family(void) {
|
||||
LOG("Discovering CPU family...");
|
||||
|
||||
AndroidCpuFamily family = android_getCpuFamily();
|
||||
@ -141,7 +138,10 @@ void Java_org_deadc0de_apple2ix_Apple2Activity_nativeEarlyLifecycleInit(JNIEnv *
|
||||
}
|
||||
}
|
||||
|
||||
void Java_org_deadc0de_apple2ix_Apple2View_nativeOnCreate(JNIEnv *env, jclass cls, jstring j_dataDir, jint sampleRate, jint monoBufferSize, jint stereoBufferSize) {
|
||||
// ----------------------------------------------------------------------------
|
||||
// JNI functions
|
||||
|
||||
void Java_org_deadc0de_apple2ix_Apple2Activity_nativeOnCreate(JNIEnv *env, jobject obj, jstring j_dataDir, jint sampleRate, jint monoBufferSize, jint stereoBufferSize) {
|
||||
const char *dataDir = (*env)->GetStringUTFChars(env, j_dataDir, 0);
|
||||
|
||||
// Android lifecycle can call onCreate() multiple times...
|
||||
@ -150,6 +150,8 @@ void Java_org_deadc0de_apple2ix_Apple2View_nativeOnCreate(JNIEnv *env, jclass cl
|
||||
return;
|
||||
}
|
||||
|
||||
discover_cpu_family();
|
||||
|
||||
// Do not remove this deadc0de ... it forces a runtime load-library/link error on Gingerbread devices if we have
|
||||
// incorrectly compiled the app against a later version of the NDK!!!
|
||||
int pagesize = getpagesize();
|
||||
|
Loading…
x
Reference in New Issue
Block a user