(Android Phoenix) Set default libretro path (for TV Mode)
This commit is contained in:
parent
1eb78a9481
commit
b0799be6ba
|
@ -24,30 +24,6 @@ public class CoreSelection extends Activity implements
|
||||||
static private String libretro_path;
|
static private String libretro_path;
|
||||||
static private final String TAG = "CoreSelection";
|
static private final String TAG = "CoreSelection";
|
||||||
|
|
||||||
|
|
||||||
private String readCPUInfo() {
|
|
||||||
String result = "";
|
|
||||||
|
|
||||||
try {
|
|
||||||
BufferedReader br = new BufferedReader(new InputStreamReader(
|
|
||||||
new FileInputStream("/proc/cpuinfo")));
|
|
||||||
|
|
||||||
String line;
|
|
||||||
while ((line = br.readLine()) != null)
|
|
||||||
result += line + "\n";
|
|
||||||
br.close();
|
|
||||||
} catch (IOException ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean cpuInfoIsNeon(String info) {
|
|
||||||
return info.contains("neon");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
ConfigFile core_config;
|
ConfigFile core_config;
|
||||||
|
@ -60,8 +36,8 @@ public class CoreSelection extends Activity implements
|
||||||
Log.e(TAG, "Failed to load libretro_cores.cfg from assets.");
|
Log.e(TAG, "Failed to load libretro_cores.cfg from assets.");
|
||||||
}
|
}
|
||||||
|
|
||||||
String cpuInfo = readCPUInfo();
|
String cpuInfo = MainMenuActivity.readCPUInfo();
|
||||||
boolean cpuIsNeon = cpuInfoIsNeon(cpuInfo);
|
boolean cpuIsNeon = cpuInfo.contains("neon");
|
||||||
|
|
||||||
setContentView(R.layout.line_list);
|
setContentView(R.layout.line_list);
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,6 @@
|
||||||
package org.retroarch.browser;
|
package org.retroarch.browser;
|
||||||
|
|
||||||
import java.io.BufferedOutputStream;
|
import java.io.*;
|
||||||
import java.io.DataInputStream;
|
|
||||||
import java.io.DataOutputStream;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
|
|
||||||
import org.retroarch.R;
|
import org.retroarch.R;
|
||||||
|
|
||||||
|
@ -110,6 +103,23 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||||
return rate;
|
return rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String readCPUInfo() {
|
||||||
|
String result = "";
|
||||||
|
|
||||||
|
try {
|
||||||
|
BufferedReader br = new BufferedReader(new InputStreamReader(
|
||||||
|
new FileInputStream("/proc/cpuinfo")));
|
||||||
|
|
||||||
|
String line;
|
||||||
|
while ((line = br.readLine()) != null)
|
||||||
|
result += line + "\n";
|
||||||
|
br.close();
|
||||||
|
} catch (IOException ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
@TargetApi(17)
|
@TargetApi(17)
|
||||||
public static int getLowLatencyOptimalSamplingRate() {
|
public static int getLowLatencyOptimalSamplingRate() {
|
||||||
AudioManager manager = (AudioManager)MainMenuActivity.getInstance().getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
|
AudioManager manager = (AudioManager)MainMenuActivity.getInstance().getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
|
||||||
|
@ -164,6 +174,7 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(MainMenuActivity.getInstance().getBaseContext());
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(MainMenuActivity.getInstance().getBaseContext());
|
||||||
|
config.setString("libretro_path", MainMenuActivity.getInstance().getApplicationInfo().nativeLibraryDir);
|
||||||
config.setBoolean("audio_rate_control", prefs.getBoolean("audio_rate_control", true));
|
config.setBoolean("audio_rate_control", prefs.getBoolean("audio_rate_control", true));
|
||||||
config.setInt("audio_out_rate", MainMenuActivity.getOptimalSamplingRate());
|
config.setInt("audio_out_rate", MainMenuActivity.getOptimalSamplingRate());
|
||||||
config.setInt("audio_latency", prefs.getBoolean("audio_high_latency", false) ? 160 : 64);
|
config.setInt("audio_latency", prefs.getBoolean("audio_high_latency", false) ? 160 : 64);
|
||||||
|
|
Loading…
Reference in New Issue