mirror of
https://github.com/mauiaaron/apple2.git
synced 2026-01-22 15:16:10 +00:00
Compare commits
6 Commits
android-1.
...
android-1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc96417091 | ||
|
|
fb4d6f466b | ||
|
|
a6ac111707 | ||
|
|
d0319bd2ff | ||
|
|
9b56050c1e | ||
|
|
871762975a |
@@ -71,8 +71,8 @@
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.1.0/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.1.0/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.0/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/21.0.0/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
|
||||
@@ -88,10 +88,10 @@
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" exported="" name="support-annotations-23.1.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="appcompat-v7-23.1.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-v4-23.1.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-annotations-21.0.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-v4-21.0.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="appcompat-v7-21.0.0" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -1,7 +1,7 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 23
|
||||
compileSdkVersion 21
|
||||
buildToolsVersion "21.1.2"
|
||||
signingConfigs {
|
||||
release {
|
||||
@@ -26,9 +26,9 @@ android {
|
||||
defaultConfig {
|
||||
applicationId "org.deadc0de.apple2ix.basic"
|
||||
minSdkVersion 10
|
||||
targetSdkVersion 23
|
||||
versionCode 4
|
||||
versionName "1.0.1"
|
||||
targetSdkVersion 21
|
||||
versionCode 5
|
||||
versionName "1.0.2"
|
||||
ndk {
|
||||
moduleName "apple2ix"
|
||||
}
|
||||
@@ -37,5 +37,5 @@ android {
|
||||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compile 'com.android.support:appcompat-v7:23.1.0'
|
||||
compile 'com.android.support:appcompat-v7:21.0.0'
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ public class Apple2Activity extends Activity {
|
||||
private static volatile boolean DEBUG_STRICT = false;
|
||||
|
||||
private Apple2View mView = null;
|
||||
private Runnable mGraphicsInitializedRunnable = null;
|
||||
private Apple2SplashScreen mSplashScreen = null;
|
||||
private Apple2MainMenu mMainMenu = null;
|
||||
private Apple2SettingsMenu mSettingsMenu = null;
|
||||
@@ -147,12 +148,32 @@ public class Apple2Activity extends Activity {
|
||||
String dataDir = Apple2DisksMenu.getDataDir(this);
|
||||
nativeOnCreate(dataDir, sampleRate, monoBufferSize, stereoBufferSize);
|
||||
|
||||
showSplashScreen();
|
||||
Apple2CrashHandler.getInstance().checkForCrashes(Apple2Activity.this);
|
||||
final boolean firstTime = !Apple2Preferences.FIRST_TIME_CONFIGURED.booleanValue(this);
|
||||
Apple2Preferences.FIRST_TIME_CONFIGURED.saveBoolean(this, true);
|
||||
|
||||
// first-time initializations #1
|
||||
if (!Apple2Preferences.FIRST_TIME_CONFIGURED.booleanValue(this)) {
|
||||
Apple2DisksMenu.firstTime(this);
|
||||
showSplashScreen(!firstTime);
|
||||
Apple2CrashHandler.getInstance().checkForCrashes(this);
|
||||
|
||||
mGraphicsInitializedRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (firstTime) {
|
||||
Apple2Preferences.KeypadPreset.IJKM_SPACE.apply(Apple2Activity.this);
|
||||
}
|
||||
Apple2Preferences.loadPreferences(Apple2Activity.this);
|
||||
}
|
||||
};
|
||||
|
||||
// first-time initializations
|
||||
if (firstTime) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Apple2DisksMenu.firstTime(Apple2Activity.this);
|
||||
mSplashScreen.setDismissable(true);
|
||||
Log.d(TAG, "Finished first time copying...");
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
mSettingsMenu = new Apple2SettingsMenu(this);
|
||||
@@ -180,8 +201,8 @@ public class Apple2Activity extends Activity {
|
||||
}
|
||||
|
||||
Log.d(TAG, "onResume()");
|
||||
showSplashScreen();
|
||||
Apple2CrashHandler.getInstance().checkForCrashes(Apple2Activity.this); // NOTE : needs to be called again to clean-up
|
||||
showSplashScreen(/*dismissable:*/true);
|
||||
Apple2CrashHandler.getInstance().checkForCrashes(this); // NOTE : needs to be called again to clean-up
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -415,11 +436,15 @@ public class Apple2Activity extends Activity {
|
||||
});
|
||||
}
|
||||
|
||||
private void showSplashScreen() {
|
||||
public Apple2SplashScreen getSplashScreen() {
|
||||
return mSplashScreen;
|
||||
}
|
||||
|
||||
private void showSplashScreen(boolean dismissable) {
|
||||
if (mSplashScreen != null) {
|
||||
return;
|
||||
}
|
||||
mSplashScreen = new Apple2SplashScreen(Apple2Activity.this);
|
||||
mSplashScreen = new Apple2SplashScreen(this, dismissable);
|
||||
mSplashScreen.show();
|
||||
}
|
||||
|
||||
@@ -428,7 +453,8 @@ public class Apple2Activity extends Activity {
|
||||
boolean glViewFirstTime = false;
|
||||
if (mView == null) {
|
||||
glViewFirstTime = true;
|
||||
mView = new Apple2View(this);
|
||||
mView = new Apple2View(this, mGraphicsInitializedRunnable);
|
||||
mGraphicsInitializedRunnable = null;
|
||||
mMainMenu = new Apple2MainMenu(this, mView);
|
||||
}
|
||||
|
||||
|
||||
@@ -181,14 +181,12 @@ public class Apple2CrashHandler {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
|
||||
final Button startButton = (Button) activity.findViewById(R.id.startButton);
|
||||
final Button prefsButton = (Button) activity.findViewById(R.id.prefsButton);
|
||||
final Button disksButton = (Button) activity.findViewById(R.id.disksButton);
|
||||
final Apple2SplashScreen splashScreen = activity.getSplashScreen();
|
||||
if (splashScreen != null) {
|
||||
splashScreen.setDismissable(false);
|
||||
}
|
||||
final ProgressBar bar = (ProgressBar) activity.findViewById(R.id.crash_progressBar);
|
||||
try {
|
||||
startButton.setEnabled(false);
|
||||
prefsButton.setEnabled(false);
|
||||
disksButton.setEnabled(false);
|
||||
bar.setVisibility(View.VISIBLE);
|
||||
} catch (NullPointerException npe) {
|
||||
/* could happen on early lifecycle crashes */
|
||||
@@ -354,9 +352,7 @@ public class Apple2CrashHandler {
|
||||
public void run() {
|
||||
try {
|
||||
bar.setVisibility(View.INVISIBLE);
|
||||
startButton.setEnabled(true);
|
||||
prefsButton.setEnabled(true);
|
||||
disksButton.setEnabled(true);
|
||||
splashScreen.setDismissable(true);
|
||||
} catch (NullPointerException npe) {
|
||||
/* could happen on early lifecycle crashes */
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import android.widget.CompoundButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.RadioButton;
|
||||
|
||||
import org.json.JSONArray;
|
||||
@@ -135,6 +136,14 @@ public class Apple2DisksMenu implements Apple2MenuView {
|
||||
}
|
||||
|
||||
public static void firstTime(Apple2Activity activity) {
|
||||
final ProgressBar bar = (ProgressBar) activity.findViewById(R.id.crash_progressBar);
|
||||
try {
|
||||
bar.setVisibility(View.VISIBLE);
|
||||
bar.setIndeterminate(true);
|
||||
} catch (NullPointerException npe) {
|
||||
Log.v(TAG, "Whoa, avoided NPE in first time #1");
|
||||
}
|
||||
|
||||
getDataDir(activity);
|
||||
|
||||
Log.d(TAG, "First time copying stuff-n-things out of APK for ease-of-NDK access...");
|
||||
@@ -149,6 +158,18 @@ public class Apple2DisksMenu implements Apple2MenuView {
|
||||
if (sExternalFilesDir != null) {
|
||||
recursivelyCopyAPKAssets(activity, /*from APK directory:*/"keyboards", /*to location:*/sExternalFilesDir.getAbsolutePath());
|
||||
}
|
||||
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
bar.setVisibility(View.INVISIBLE);
|
||||
bar.setIndeterminate(false);
|
||||
} catch (NullPointerException npe) {
|
||||
Log.v(TAG, "Whoa, avoided NPE in first time #2");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void exposeSymbols(Apple2Activity activity) {
|
||||
|
||||
@@ -23,11 +23,13 @@ public class Apple2SplashScreen implements Apple2MenuView {
|
||||
private final static String TAG = "Apple2SplashScreen";
|
||||
|
||||
private Apple2Activity mActivity = null;
|
||||
private boolean mDismissable = true;
|
||||
private View mSettingsView = null;
|
||||
|
||||
public Apple2SplashScreen(Apple2Activity activity) {
|
||||
public Apple2SplashScreen(Apple2Activity activity, boolean dismissable) {
|
||||
mActivity = activity;
|
||||
setup();
|
||||
setDismissable(dismissable);
|
||||
}
|
||||
|
||||
private void setup() {
|
||||
@@ -61,6 +63,21 @@ public class Apple2SplashScreen implements Apple2MenuView {
|
||||
});
|
||||
}
|
||||
|
||||
public void setDismissable(boolean dismissable) {
|
||||
mDismissable = dismissable;
|
||||
mActivity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Button startButton = (Button) mSettingsView.findViewById(R.id.startButton);
|
||||
startButton.setEnabled(mDismissable);
|
||||
Button prefsButton = (Button) mSettingsView.findViewById(R.id.prefsButton);
|
||||
prefsButton.setEnabled(mDismissable);
|
||||
Button disksButton = (Button) mSettingsView.findViewById(R.id.disksButton);
|
||||
disksButton.setEnabled(mDismissable);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public final boolean isCalibrating() {
|
||||
return false;
|
||||
}
|
||||
@@ -77,7 +94,9 @@ public class Apple2SplashScreen implements Apple2MenuView {
|
||||
}
|
||||
|
||||
public void dismiss() {
|
||||
mActivity.popApple2View(this);
|
||||
if (mDismissable) {
|
||||
mActivity.popApple2View(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void dismissAll() {
|
||||
|
||||
@@ -22,8 +22,6 @@ import android.opengl.GLSurfaceView;
|
||||
import android.util.Log;
|
||||
import android.view.ViewTreeObserver;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import javax.microedition.khronos.egl.EGL10;
|
||||
import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.egl.EGLContext;
|
||||
@@ -53,7 +51,7 @@ class Apple2View extends GLSurfaceView {
|
||||
private final static boolean DEBUG = false;
|
||||
|
||||
private Apple2Activity mActivity = null;
|
||||
private AtomicBoolean mInitialLaunch = new AtomicBoolean(true);
|
||||
private Runnable mGraphicsInitializedRunnable = null;
|
||||
|
||||
private static native void nativeGraphicsInitialized(int width, int height);
|
||||
|
||||
@@ -61,9 +59,10 @@ class Apple2View extends GLSurfaceView {
|
||||
|
||||
private static native void nativeRender();
|
||||
|
||||
public Apple2View(Apple2Activity activity) {
|
||||
public Apple2View(Apple2Activity activity, Runnable graphicsInitializedRunnable) {
|
||||
super(activity.getApplication());
|
||||
mActivity = activity;
|
||||
mGraphicsInitializedRunnable = graphicsInitializedRunnable;
|
||||
|
||||
/* By default, GLSurfaceView() creates a RGB_565 opaque surface.
|
||||
* If we want a translucent one, we should change the surface's
|
||||
@@ -347,16 +346,9 @@ class Apple2View extends GLSurfaceView {
|
||||
|
||||
nativeGraphicsInitialized(width, height);
|
||||
|
||||
// first-time initializations #2
|
||||
if (!Apple2Preferences.FIRST_TIME_CONFIGURED.booleanValue(Apple2View.this.mActivity)) {
|
||||
Apple2Preferences.KeypadPreset.IJKM_SPACE.apply(Apple2View.this.mActivity);
|
||||
Apple2Preferences.FIRST_TIME_CONFIGURED.saveBoolean(Apple2View.this.mActivity, true);
|
||||
}
|
||||
|
||||
// load preferences on each new process creation
|
||||
if (mInitialLaunch.get()) {
|
||||
mInitialLaunch.set(false);
|
||||
Apple2Preferences.loadPreferences(Apple2View.this.mActivity);
|
||||
if (Apple2View.this.mGraphicsInitializedRunnable != null) {
|
||||
Apple2View.this.mGraphicsInitializedRunnable.run();
|
||||
Apple2View.this.mGraphicsInitializedRunnable = null;
|
||||
}
|
||||
|
||||
Apple2View.this.mActivity.maybeResumeCPU();
|
||||
|
||||
@@ -551,10 +551,19 @@ static void _gldriver_setup_hackarounds(void) {
|
||||
break;
|
||||
}
|
||||
|
||||
regex_t twoHundredXXRegex = { 0 };
|
||||
err = regcomp(&twoHundredXXRegex, "2[2-9][0-9]", REG_ICASE|REG_NOSUB|REG_EXTENDED);
|
||||
if (err) {
|
||||
LOG("Cannot compile regex : %d", err);
|
||||
break;
|
||||
}
|
||||
|
||||
int found200 = !regexec(&twoHundredRegex, renderer, /*nmatch:*/0, /*pmatch:*/NULL, /*eflags:*/0);
|
||||
int found205 = !regexec(&twoHundredFiveRegex, renderer, /*nmatch:*/0, /*pmatch:*/NULL, /*eflags:*/0);
|
||||
int found2XX = !regexec(&twoHundredXXRegex, renderer, /*nmatch:*/0, /*pmatch:*/NULL, /*eflags:*/0);
|
||||
regfree(&twoHundredRegex);
|
||||
regfree(&twoHundredFiveRegex);
|
||||
regfree(&twoHundredXXRegex);
|
||||
|
||||
if (found200) {
|
||||
LOG("HACKING AROUND BROKEN ADRENO 200");
|
||||
@@ -567,6 +576,11 @@ static void _gldriver_setup_hackarounds(void) {
|
||||
hackAroundBrokenAdreno205 = true;
|
||||
break;
|
||||
}
|
||||
if (found2XX) {
|
||||
LOG("HACKING AROUND BROKEN ADRENO 2XX");
|
||||
hackAroundBrokenAdreno200 = true;
|
||||
break;
|
||||
}
|
||||
} while (0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user