Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Android] Spawn a message if someone's phone doesn't support NEON. NE…
…ON is a requirement for Dolphin Mobile on ARM, CPU core will crash without it.
  • Loading branch information
Sonicadvance1 committed Nov 15, 2013
1 parent c712fb7 commit 0e41546
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 5 deletions.
Expand Up @@ -86,4 +86,9 @@ public void onCreate(Bundle savedInstanceState)
UserPreferences.LoadIniToPrefs(this);
}
}
protected void onRestart()
{
super.onRestart();
finish(); // If we are ever returning to this activity then we are exiting.
}
}
Expand Up @@ -104,6 +104,13 @@
*/
public static native String GetVersionString();

/**
* Returns if the phone supports NEON or not
*
* @return if it supports NEON
*/
public static native boolean SupportsNEON();

/**
* Saves a game state to the slot number.
*
Expand Down
Expand Up @@ -13,16 +13,16 @@
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.widget.DrawerLayout;
import android.view.*;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;

import org.dolphinemu.dolphinemu.AboutFragment;
import org.dolphinemu.dolphinemu.NativeLibrary;
import org.dolphinemu.dolphinemu.R;
Expand All @@ -31,6 +31,9 @@
import org.dolphinemu.dolphinemu.sidemenu.SideMenuAdapter;
import org.dolphinemu.dolphinemu.sidemenu.SideMenuItem;

import java.util.ArrayList;
import java.util.List;

/**
* The activity that implements all of the functions
* for the game list.
Expand Down Expand Up @@ -104,6 +107,26 @@ public void onDrawerOpened(View drawerView) {
mCurFragment = new GameListFragment();
FragmentManager fragmentManager = getFragmentManager();
fragmentManager.beginTransaction().replace(R.id.content_frame, mCurFragment).commit();

// Create an alert telling them that their phone sucks
if (Build.CPU_ABI.contains("arm") && !NativeLibrary.SupportsNEON())
{
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("ALERT!");
builder.setMessage("Your phone doesn't support NEON which makes it incapable of running Dolphin Mobile?\nDo you want to try anyway?");
builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// Do Nothing. Just create the Yes button
}
});
builder.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which)
{
finish();
}
});
builder.show();
}
}

/**
Expand Down
6 changes: 6 additions & 0 deletions Source/Core/DolphinWX/Src/MainAndroid.cpp
Expand Up @@ -282,6 +282,12 @@ JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetVersio
{
return env->NewStringUTF(scm_rev_str);
}

JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SupportsNEON(JNIEnv *env, jobject obj)
{
return cpu_info.bNEON;
}

JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetConfig(JNIEnv *env, jobject obj, jstring jFile, jstring jKey, jstring jValue, jstring jDefault)
{
IniFile ini;
Expand Down

0 comments on commit 0e41546

Please sign in to comment.