Compare commits

...

6 Commits

Author SHA1 Message Date
Aaron Culliney bc96417091 DO NOT use API 23 yet ... we need to fix text relocations first!
- This prevents crashing on Marshmallow (for the time being)
2015-11-04 20:03:28 -08:00
Aaron Culliney fb4d6f466b Splash screen is not dismissable during first time initialization or crash reporting 2015-11-03 22:47:35 -08:00
Aaron Culliney a6ac111707 lightly refactor two-phase first-time launch 2015-11-03 22:42:24 -08:00
Aaron Culliney d0319bd2ff Splash screen may be dismissable (or not) 2015-11-03 22:41:50 -08:00
Aaron Culliney 9b56050c1e All the Broken Adrenos! 2015-11-02 20:46:16 -08:00
Aaron Culliney 871762975a Bump Android version to 1.0.2 2015-11-01 22:03:39 -08:00
8 changed files with 114 additions and 46 deletions
+6 -6
View File
@@ -71,8 +71,8 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" /> <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" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" /> <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/appcompat-v7/21.0.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/support-v4/21.0.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" /> <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/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" /> <excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content> </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="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="support-annotations-23.1.0" level="project" /> <orderEntry type="library" exported="" name="support-annotations-21.0.0" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-23.1.0" level="project" /> <orderEntry type="library" exported="" name="support-v4-21.0.0" level="project" />
<orderEntry type="library" exported="" name="support-v4-23.1.0" level="project" /> <orderEntry type="library" exported="" name="appcompat-v7-21.0.0" level="project" />
</component> </component>
</module> </module>
+5 -5
View File
@@ -1,7 +1,7 @@
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
android { android {
compileSdkVersion 23 compileSdkVersion 21
buildToolsVersion "21.1.2" buildToolsVersion "21.1.2"
signingConfigs { signingConfigs {
release { release {
@@ -26,9 +26,9 @@ android {
defaultConfig { defaultConfig {
applicationId "org.deadc0de.apple2ix.basic" applicationId "org.deadc0de.apple2ix.basic"
minSdkVersion 10 minSdkVersion 10
targetSdkVersion 23 targetSdkVersion 21
versionCode 4 versionCode 5
versionName "1.0.1" versionName "1.0.2"
ndk { ndk {
moduleName "apple2ix" moduleName "apple2ix"
} }
@@ -37,5 +37,5 @@ android {
dependencies { dependencies {
compile fileTree(dir: 'libs', include: ['*.jar']) 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 static volatile boolean DEBUG_STRICT = false;
private Apple2View mView = null; private Apple2View mView = null;
private Runnable mGraphicsInitializedRunnable = null;
private Apple2SplashScreen mSplashScreen = null; private Apple2SplashScreen mSplashScreen = null;
private Apple2MainMenu mMainMenu = null; private Apple2MainMenu mMainMenu = null;
private Apple2SettingsMenu mSettingsMenu = null; private Apple2SettingsMenu mSettingsMenu = null;
@@ -147,12 +148,32 @@ public class Apple2Activity extends Activity {
String dataDir = Apple2DisksMenu.getDataDir(this); String dataDir = Apple2DisksMenu.getDataDir(this);
nativeOnCreate(dataDir, sampleRate, monoBufferSize, stereoBufferSize); nativeOnCreate(dataDir, sampleRate, monoBufferSize, stereoBufferSize);
showSplashScreen(); final boolean firstTime = !Apple2Preferences.FIRST_TIME_CONFIGURED.booleanValue(this);
Apple2CrashHandler.getInstance().checkForCrashes(Apple2Activity.this); Apple2Preferences.FIRST_TIME_CONFIGURED.saveBoolean(this, true);
// first-time initializations #1 showSplashScreen(!firstTime);
if (!Apple2Preferences.FIRST_TIME_CONFIGURED.booleanValue(this)) { Apple2CrashHandler.getInstance().checkForCrashes(this);
Apple2DisksMenu.firstTime(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); mSettingsMenu = new Apple2SettingsMenu(this);
@@ -180,8 +201,8 @@ public class Apple2Activity extends Activity {
} }
Log.d(TAG, "onResume()"); Log.d(TAG, "onResume()");
showSplashScreen(); showSplashScreen(/*dismissable:*/true);
Apple2CrashHandler.getInstance().checkForCrashes(Apple2Activity.this); // NOTE : needs to be called again to clean-up Apple2CrashHandler.getInstance().checkForCrashes(this); // NOTE : needs to be called again to clean-up
} }
@Override @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) { if (mSplashScreen != null) {
return; return;
} }
mSplashScreen = new Apple2SplashScreen(Apple2Activity.this); mSplashScreen = new Apple2SplashScreen(this, dismissable);
mSplashScreen.show(); mSplashScreen.show();
} }
@@ -428,7 +453,8 @@ public class Apple2Activity extends Activity {
boolean glViewFirstTime = false; boolean glViewFirstTime = false;
if (mView == null) { if (mView == null) {
glViewFirstTime = true; glViewFirstTime = true;
mView = new Apple2View(this); mView = new Apple2View(this, mGraphicsInitializedRunnable);
mGraphicsInitializedRunnable = null;
mMainMenu = new Apple2MainMenu(this, mView); mMainMenu = new Apple2MainMenu(this, mView);
} }
@@ -181,14 +181,12 @@ public class Apple2CrashHandler {
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
dialog.dismiss(); dialog.dismiss();
final Button startButton = (Button) activity.findViewById(R.id.startButton); final Apple2SplashScreen splashScreen = activity.getSplashScreen();
final Button prefsButton = (Button) activity.findViewById(R.id.prefsButton); if (splashScreen != null) {
final Button disksButton = (Button) activity.findViewById(R.id.disksButton); splashScreen.setDismissable(false);
}
final ProgressBar bar = (ProgressBar) activity.findViewById(R.id.crash_progressBar); final ProgressBar bar = (ProgressBar) activity.findViewById(R.id.crash_progressBar);
try { try {
startButton.setEnabled(false);
prefsButton.setEnabled(false);
disksButton.setEnabled(false);
bar.setVisibility(View.VISIBLE); bar.setVisibility(View.VISIBLE);
} catch (NullPointerException npe) { } catch (NullPointerException npe) {
/* could happen on early lifecycle crashes */ /* could happen on early lifecycle crashes */
@@ -354,9 +352,7 @@ public class Apple2CrashHandler {
public void run() { public void run() {
try { try {
bar.setVisibility(View.INVISIBLE); bar.setVisibility(View.INVISIBLE);
startButton.setEnabled(true); splashScreen.setDismissable(true);
prefsButton.setEnabled(true);
disksButton.setEnabled(true);
} catch (NullPointerException npe) { } catch (NullPointerException npe) {
/* could happen on early lifecycle crashes */ /* could happen on early lifecycle crashes */
} }
@@ -30,6 +30,7 @@ import android.widget.CompoundButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.ListView; import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.RadioButton; import android.widget.RadioButton;
import org.json.JSONArray; import org.json.JSONArray;
@@ -135,6 +136,14 @@ public class Apple2DisksMenu implements Apple2MenuView {
} }
public static void firstTime(Apple2Activity activity) { 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); getDataDir(activity);
Log.d(TAG, "First time copying stuff-n-things out of APK for ease-of-NDK access..."); 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) { if (sExternalFilesDir != null) {
recursivelyCopyAPKAssets(activity, /*from APK directory:*/"keyboards", /*to location:*/sExternalFilesDir.getAbsolutePath()); 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) { public static void exposeSymbols(Apple2Activity activity) {
@@ -23,11 +23,13 @@ public class Apple2SplashScreen implements Apple2MenuView {
private final static String TAG = "Apple2SplashScreen"; private final static String TAG = "Apple2SplashScreen";
private Apple2Activity mActivity = null; private Apple2Activity mActivity = null;
private boolean mDismissable = true;
private View mSettingsView = null; private View mSettingsView = null;
public Apple2SplashScreen(Apple2Activity activity) { public Apple2SplashScreen(Apple2Activity activity, boolean dismissable) {
mActivity = activity; mActivity = activity;
setup(); setup();
setDismissable(dismissable);
} }
private void setup() { 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() { public final boolean isCalibrating() {
return false; return false;
} }
@@ -77,7 +94,9 @@ public class Apple2SplashScreen implements Apple2MenuView {
} }
public void dismiss() { public void dismiss() {
mActivity.popApple2View(this); if (mDismissable) {
mActivity.popApple2View(this);
}
} }
public void dismissAll() { public void dismissAll() {
@@ -22,8 +22,6 @@ import android.opengl.GLSurfaceView;
import android.util.Log; import android.util.Log;
import android.view.ViewTreeObserver; import android.view.ViewTreeObserver;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.microedition.khronos.egl.EGL10; import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLContext; import javax.microedition.khronos.egl.EGLContext;
@@ -53,7 +51,7 @@ class Apple2View extends GLSurfaceView {
private final static boolean DEBUG = false; private final static boolean DEBUG = false;
private Apple2Activity mActivity = null; private Apple2Activity mActivity = null;
private AtomicBoolean mInitialLaunch = new AtomicBoolean(true); private Runnable mGraphicsInitializedRunnable = null;
private static native void nativeGraphicsInitialized(int width, int height); private static native void nativeGraphicsInitialized(int width, int height);
@@ -61,9 +59,10 @@ class Apple2View extends GLSurfaceView {
private static native void nativeRender(); private static native void nativeRender();
public Apple2View(Apple2Activity activity) { public Apple2View(Apple2Activity activity, Runnable graphicsInitializedRunnable) {
super(activity.getApplication()); super(activity.getApplication());
mActivity = activity; mActivity = activity;
mGraphicsInitializedRunnable = graphicsInitializedRunnable;
/* By default, GLSurfaceView() creates a RGB_565 opaque surface. /* By default, GLSurfaceView() creates a RGB_565 opaque surface.
* If we want a translucent one, we should change the surface's * If we want a translucent one, we should change the surface's
@@ -347,16 +346,9 @@ class Apple2View extends GLSurfaceView {
nativeGraphicsInitialized(width, height); nativeGraphicsInitialized(width, height);
// first-time initializations #2 if (Apple2View.this.mGraphicsInitializedRunnable != null) {
if (!Apple2Preferences.FIRST_TIME_CONFIGURED.booleanValue(Apple2View.this.mActivity)) { Apple2View.this.mGraphicsInitializedRunnable.run();
Apple2Preferences.KeypadPreset.IJKM_SPACE.apply(Apple2View.this.mActivity); Apple2View.this.mGraphicsInitializedRunnable = null;
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);
} }
Apple2View.this.mActivity.maybeResumeCPU(); Apple2View.this.mActivity.maybeResumeCPU();
+14
View File
@@ -551,10 +551,19 @@ static void _gldriver_setup_hackarounds(void) {
break; 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 found200 = !regexec(&twoHundredRegex, renderer, /*nmatch:*/0, /*pmatch:*/NULL, /*eflags:*/0);
int found205 = !regexec(&twoHundredFiveRegex, 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(&twoHundredRegex);
regfree(&twoHundredFiveRegex); regfree(&twoHundredFiveRegex);
regfree(&twoHundredXXRegex);
if (found200) { if (found200) {
LOG("HACKING AROUND BROKEN ADRENO 200"); LOG("HACKING AROUND BROKEN ADRENO 200");
@@ -567,6 +576,11 @@ static void _gldriver_setup_hackarounds(void) {
hackAroundBrokenAdreno205 = true; hackAroundBrokenAdreno205 = true;
break; break;
} }
if (found2XX) {
LOG("HACKING AROUND BROKEN ADRENO 2XX");
hackAroundBrokenAdreno200 = true;
break;
}
} while (0); } while (0);
} }