mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-14 06:40:48 +00:00
Check in Java if NEON is present.
This commit is contained in:
parent
3139b98be7
commit
784bafdb19
@ -80,29 +80,27 @@ public class RetroArch extends Activity implements
|
|||||||
return rate;
|
return rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String ReadCPUinfo()
|
private String readCPUInfo() {
|
||||||
{
|
String result = "";
|
||||||
ProcessBuilder cmd;
|
|
||||||
String result="";
|
try {
|
||||||
|
BufferedReader br = new BufferedReader(new InputStreamReader(
|
||||||
try{
|
new FileInputStream("/proc/cpuinfo")));
|
||||||
String[] args = {"/system/bin/cat", "/proc/cpuinfo"};
|
|
||||||
cmd = new ProcessBuilder(args);
|
String line;
|
||||||
|
while ((line = br.readLine()) != null)
|
||||||
Process process = cmd.start();
|
result += line + "\n";
|
||||||
InputStream in = process.getInputStream();
|
br.close();
|
||||||
byte[] re = new byte[1024];
|
} catch (IOException ex) {
|
||||||
while(in.read(re) != -1){
|
ex.printStackTrace();
|
||||||
System.out.println(new String(re));
|
}
|
||||||
result = result + new String(re);
|
return result;
|
||||||
}
|
}
|
||||||
in.close();
|
|
||||||
} catch(IOException ex){
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
private boolean cpuInfoIsNeon(String info) {
|
||||||
|
return info.contains("neon");
|
||||||
|
}
|
||||||
|
|
||||||
private byte[] loadAsset(String asset) throws IOException {
|
private byte[] loadAsset(String asset) throws IOException {
|
||||||
String path = asset;
|
String path = asset;
|
||||||
InputStream stream = getAssets().open(path);
|
InputStream stream = getAssets().open(path);
|
||||||
@ -160,6 +158,12 @@ public class RetroArch extends Activity implements
|
|||||||
config = new ConfigFile();
|
config = new ConfigFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String cpuInfo = readCPUInfo();
|
||||||
|
boolean cpuIsNeon = cpuInfoIsNeon(cpuInfo);
|
||||||
|
if (cpuIsNeon) {
|
||||||
|
Toast.makeText(this, "CPU is NEON capable: " + (cpuIsNeon ? "yes" : "no"), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
// Extracting assets appears to take considerable amount of time, so
|
// Extracting assets appears to take considerable amount of time, so
|
||||||
// move extraction to a thread.
|
// move extraction to a thread.
|
||||||
Thread assetThread = new Thread(new Runnable() {
|
Thread assetThread = new Thread(new Runnable() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user