Better error message when starting without a binary for the current ABI

This commit is contained in:
Henrik Rydgard committed 2015-03-19 20:44:27 +01:00
1 parent 6b2acbae8f
commit 6acd06348e
1 file changed
+15 -5
@@ -13,13 +13,17 @@ import com.henrikrydgard.libnative.NativeApp;
public class PpssppActivity extends NativeActivity {
private static boolean m_hasUnsupportedABI = false;
private static boolean m_hasNoNativeBinary = false;
static {
if(Build.CPU_ABI.equals("armeabi")) {
m_hasUnsupportedABI = true;
} else {
System.loadLibrary("ppsspp_jni");
try {
System.loadLibrary("ppsspp_jni");
} catch (UnsatisfiedLinkError e) {
m_hasNoNativeBinary = true;
}
}
}
@@ -35,14 +39,18 @@ public class PpssppActivity extends NativeActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
if(m_hasUnsupportedABI) {
if(m_hasUnsupportedABI || m_hasNoNativeBinary) {
new Thread() {
@Override
public void run() {
Looper.prepare();
AlertDialog.Builder builder = new AlertDialog.Builder(PpssppActivity.this);
builder.setMessage(Build.CPU_ABI + " target is not supported.").setTitle("Error").create().show();
if (m_hasUnsupportedABI) {
builder.setMessage(Build.CPU_ABI + " target is not supported.").setTitle("Error starting PPSSPP").create().show();
} else {
builder.setMessage("The native part of PPSSPP for ABI " + Build.CPU_ABI + " is missing. Try downloading an official build?").setTitle("Error starting PPSSPP").create().show();
}
Looper.loop();
}
@@ -55,7 +63,9 @@ public class PpssppActivity extends NativeActivity {
}
System.exit(-1);
return;
}
// In case app launched from homescreen shortcut, get shortcut parameter
// using Intent extra string. Intent extra will be null if launch normal
// (from app drawer).
@@ -123,4 +133,4 @@ public class PpssppActivity extends NativeActivity {
}
correctRatio(sz, (float)scale);
}
}
}