mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 08:37:41 +00:00
Add Load Game (History) to Android frontend.
Also cleanup core selection list a bit to be more readable.
This commit is contained in:
parent
8ebd81edbf
commit
758dc7e196
@ -16,6 +16,7 @@
|
||||
android:label="@string/app_name"
|
||||
android:hasCode="true">
|
||||
<activity android:name=".browser.CoreSelection"></activity>
|
||||
<activity android:name=".browser.HistorySelection"></activity>
|
||||
<activity android:name=".browser.DisplayRefreshRateTest"></activity>
|
||||
<activity android:name=".browser.RefreshRateSetOS"></activity>
|
||||
<activity android:name=".browser.MainMenuActivity">
|
||||
|
@ -1,27 +1,81 @@
|
||||
libretro_mednafen_pce_fast = "Mednafen PCE-fast (PC Engine/PC Engine CD)"
|
||||
libretro_mednafen_wswan = "Mednafen WSwan (Wonderswan)"
|
||||
libretro_fceumm = "FCEUmm (Nintendo NES)"
|
||||
libretro_mednafen_vb = "Mednafen VB (Virtual Boy)"
|
||||
libretro_fba = "Final Burn Alpha (Arcade)"
|
||||
libretro_mednafen_ngp = "Mednafen NGP (Neo-Geo Pocket)"
|
||||
libretro_mednafen_psx = "Mednafen PSX (PlayStation1)"
|
||||
libretro_gambatte = "Gambatte (GameBoy/GameBoy Color)"
|
||||
libretro_genesis_plus_gx = "Genesis Plus GX (Sega Genesis/Sega CD/Master System)"
|
||||
libretro_picodrive = "Picodrive (Sega Genesis/Sega CD/Master System/32X)"
|
||||
libretro_vba_next = "VBA Next (GameBoy Advance)"
|
||||
libretro_prboom = "PrBoom (DOOM)"
|
||||
libretro_snes9x = "SNES9x (Nintendo SNES)"
|
||||
libretro_snes9x_next = "SNES9x Next (Nintendo SNES)"
|
||||
libretro_nestopia = "Nestopia (Nintendo NES)"
|
||||
libretro_pcsx_rearmed-neon = "PCSX-reARMed (PlayStation1) [NEON]"
|
||||
libretro_pcsx_rearmed = "PCSX-reARMed (PlayStation1)"
|
||||
libretro_nxengine = "NXEngine (Cave Story/Doukutsu Monogatari)"
|
||||
libretro_quicknes = "QuickNES (Nintendo NES)"
|
||||
libretro_tyrquake = "TyrQuake (Quake 1)"
|
||||
libretro_instancingviewer = "InstancingViewer (Images)"
|
||||
libretro_desmume = "Desmume (Nintendo DS)"
|
||||
libretro_stella = "Stella (Atari 2600)"
|
||||
libretro_scenewalker = "SceneWalker (Objects)"
|
||||
libretro_modelviewer = "ModelViewer (Objects)"
|
||||
libretro_mame078 = "MAME 2003 [0.78] (Arcade)"
|
||||
libretro_bsnes_performance = "bsnes/higan Performance (Nintendo SNES)"
|
||||
libretro_mednafen_pce_fast = "Mednafen PCE-fast"
|
||||
libretro_mednafen_pce_fast_system = "PC Engine/PC Engine CD"
|
||||
|
||||
libretro_mednafen_wswan = "Mednafen WSwan"
|
||||
libretro_mednafen_wswan_system = "Wonderswan"
|
||||
|
||||
libretro_fceumm = "FCEUmm"
|
||||
libretro_fceumm_system = "Nintendo NES"
|
||||
|
||||
libretro_mednafen_vb = "Mednafen VB"
|
||||
libretro_mednafen_vb_system = "Virtual Boy"
|
||||
|
||||
libretro_fba = "Final Burn Alpha"
|
||||
libretro_fba_system = "Arcade"
|
||||
|
||||
libretro_mednafen_ngp = "Mednafen NGP"
|
||||
libretro_mednafen_ngp_system = "Neo-Geo Pocket"
|
||||
|
||||
libretro_mednafen_psx = "Mednafen PSX"
|
||||
libretro_mednafen_psx_system = "PlayStation1"
|
||||
|
||||
libretro_gambatte = "Gambatte"
|
||||
libretro_gambatte_system = "GameBoy/GameBoy Color"
|
||||
|
||||
libretro_genesis_plus_gx = "Genesis Plus GX"
|
||||
libretro_genesis_plus_gx_system = "Sega Genesis/Sega CD/Master System"
|
||||
|
||||
libretro_picodrive = "Picodrive"
|
||||
libretro_picodrive_system = "Sega Genesis/Sega CD/Master System/32X"
|
||||
|
||||
libretro_vba_next = "VBA Next"
|
||||
libretro_vba_next_system = "GameBoy Advance"
|
||||
|
||||
libretro_prboom = "PrBoom"
|
||||
libretro_prboom_system = "DOOM"
|
||||
|
||||
libretro_snes9x = "SNES9x"
|
||||
libretro_snes9x_system = "Nintendo SNES"
|
||||
|
||||
libretro_snes9x_next = "SNES9x Next"
|
||||
libretro_snes9x_next_system = "Nintendo SNES"
|
||||
|
||||
libretro_nestopia = "Nestopia"
|
||||
libretro_nestopia_system = "Nintendo NES"
|
||||
|
||||
libretro_pcsx_rearmed-neon = "PCSX-reARMed [NEON]"
|
||||
libretro_pcsx_rearmed-neon_system = "PlayStation1"
|
||||
|
||||
libretro_pcsx_rearmed = "PCSX-reARMed"
|
||||
libretro_pcsx_rearmed_system = "PlayStation1"
|
||||
|
||||
libretro_nxengine = "NXEngine"
|
||||
libretro_nxengine_system = "Cave Story/Doukutsu Monogatari"
|
||||
|
||||
libretro_quicknes = "QuickNES"
|
||||
libretro_quicknes_system = "Nintendo NES"
|
||||
|
||||
libretro_tyrquake = "TyrQuake"
|
||||
libretro_tyrquake_system = "Quake 1"
|
||||
|
||||
libretro_instancingviewer = "InstancingViewer"
|
||||
libretro_instancingviewer_system = "Images"
|
||||
|
||||
libretro_desmume = "Desmume"
|
||||
libretro_desmume_system = "Nintendo DS"
|
||||
|
||||
libretro_stella = "Stella"
|
||||
libretro_stella_system = "Atari 2600"
|
||||
|
||||
libretro_scenewalker = "SceneWalker"
|
||||
libretro_scenewalker_system = "Objects"
|
||||
|
||||
libretro_modelviewer = "ModelViewer"
|
||||
libretro_modelviewer_system = "Objects"
|
||||
|
||||
libretro_mame078 = "MAME 2003 [0.78]"
|
||||
libretro_mame078_system = "Arcade"
|
||||
|
||||
libretro_bsnes_performance = "bsnes/higan Performance"
|
||||
libretro_bsnes_performance_system = "Nintendo SNES"
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="48dp">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
@ -11,13 +11,27 @@
|
||||
android:layout_height="48dp"
|
||||
android:contentDescription="@string/file_type_icon"
|
||||
android:padding="8dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="0dp"
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="0.5"
|
||||
android:textSize="18sp" />
|
||||
android:layout_gravity="center_vertical"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sub_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left"
|
||||
android:visibility="gone"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -12,6 +12,11 @@
|
||||
android:targetClass="org.retroarch.browser.CoreSelection"
|
||||
android:targetPackage="org.retroarch" />
|
||||
</PreferenceScreen>
|
||||
<PreferenceScreen android:title="Load Game (History)">
|
||||
<intent
|
||||
android:targetClass="org.retroarch.browser.HistorySelection"
|
||||
android:targetPackage="org.retroarch" />
|
||||
</PreferenceScreen>
|
||||
<PreferenceScreen android:title="Video Options" >
|
||||
<PreferenceCategory android:title="General" >
|
||||
<CheckBoxPreference
|
||||
|
@ -28,17 +28,17 @@ public class CoreSelection extends Activity implements
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
ConfigFile core_config;
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
|
||||
core_config = new ConfigFile();
|
||||
try {
|
||||
core_config.append(getAssets().open("libretro_cores.cfg"));
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "Failed to load libretro_cores.cfg from assets.");
|
||||
}
|
||||
|
||||
|
||||
String cpuInfo = MainMenuActivity.readCPUInfo();
|
||||
boolean cpuIsNeon = cpuInfo.contains("neon");
|
||||
|
||||
|
||||
setContentView(R.layout.line_list);
|
||||
|
||||
// Setup the list
|
||||
@ -50,15 +50,16 @@ public class CoreSelection extends Activity implements
|
||||
setTitle("Select Libretro core");
|
||||
|
||||
// Populate the list
|
||||
final String modulePath = MainMenuActivity.getInstance().getApplicationInfo().nativeLibraryDir;
|
||||
final String modulePath = MainMenuActivity.getInstance()
|
||||
.getApplicationInfo().nativeLibraryDir;
|
||||
final File[] libs = new File(modulePath).listFiles();
|
||||
for (final File lib : libs) {
|
||||
String libName = lib.getName();
|
||||
|
||||
|
||||
// Never append a NEON lib if we don't have NEON.
|
||||
if (libName.contains("neon") && !cpuIsNeon)
|
||||
continue;
|
||||
|
||||
|
||||
// If we have a NEON version with NEON capable CPU,
|
||||
// never append a non-NEON version.
|
||||
if (cpuIsNeon && !libName.contains("neon")) {
|
||||
@ -66,18 +67,20 @@ public class CoreSelection extends Activity implements
|
||||
for (final File lib_ : libs) {
|
||||
String otherName = lib_.getName();
|
||||
String baseName = libName.replace(".so", "");
|
||||
if (otherName.contains("neon") && otherName.startsWith(baseName)) {
|
||||
if (otherName.contains("neon")
|
||||
&& otherName.startsWith(baseName)) {
|
||||
hasNeonVersion = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (hasNeonVersion)
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Allow both libretro-core.so and libretro_core.so.
|
||||
if (libName.startsWith("libretro") && !libName.startsWith("libretroarch")) {
|
||||
if (libName.startsWith("libretro")
|
||||
&& !libName.startsWith("libretroarch")) {
|
||||
try {
|
||||
adapter.add(new ModuleWrapper(this, lib, core_config));
|
||||
} catch (IOException e) {
|
||||
@ -85,9 +88,9 @@ public class CoreSelection extends Activity implements
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.setVolumeControlStream(AudioManager.STREAM_MUSIC);
|
||||
|
||||
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
|
||||
this.registerForContextMenu(findViewById(android.R.id.content));
|
||||
}
|
||||
@ -106,10 +109,12 @@ public class CoreSelection extends Activity implements
|
||||
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
Intent myIntent;
|
||||
String current_ime = Settings.Secure.getString(getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
|
||||
|
||||
String current_ime = Settings.Secure.getString(getContentResolver(),
|
||||
Settings.Secure.DEFAULT_INPUT_METHOD);
|
||||
|
||||
MainMenuActivity.updateConfigFile();
|
||||
|
||||
MainMenuActivity.waitAssetThread();
|
||||
|
||||
switch (requestCode) {
|
||||
case ACTIVITY_LOAD_ROM:
|
||||
if (data.getStringExtra("PATH") != null) {
|
||||
@ -119,14 +124,14 @@ public class CoreSelection extends Activity implements
|
||||
myIntent = new Intent(this, RetroActivity.class);
|
||||
myIntent.putExtra("ROM", data.getStringExtra("PATH"));
|
||||
myIntent.putExtra("LIBRETRO", libretro_path);
|
||||
myIntent.putExtra("CONFIGFILE", MainMenuActivity.getDefaultConfigPath());
|
||||
myIntent.putExtra("CONFIGFILE",
|
||||
MainMenuActivity.getDefaultConfigPath());
|
||||
myIntent.putExtra("IME", current_ime);
|
||||
startActivity(myIntent);
|
||||
finish();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -137,35 +142,31 @@ public class CoreSelection extends Activity implements
|
||||
}
|
||||
|
||||
public void showPopup(View v) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
|
||||
{
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
PopupMenuAbstract menu = new PopupMenuAbstract(this, v);
|
||||
MenuInflater inflater = menu.getMenuInflater();
|
||||
inflater.inflate(R.menu.context_menu, menu.getMenu());
|
||||
menu.setOnMenuItemClickListener(new PopupMenuAbstract.OnMenuItemClickListener()
|
||||
{
|
||||
menu.setOnMenuItemClickListener(new PopupMenuAbstract.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
return onContextItemSelected(item);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
menu.show();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.openContextMenu(findViewById(android.R.id.content));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreateContextMenu(ContextMenu menu, View v,
|
||||
ContextMenuInfo menuInfo) {
|
||||
super.onCreateContextMenu(menu, v, menuInfo);
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.context_menu, menu);
|
||||
ContextMenuInfo menuInfo) {
|
||||
super.onCreateContextMenu(menu, v, menuInfo);
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.context_menu, menu);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem aItem) {
|
||||
switch (aItem.getItemId()) {
|
||||
@ -177,7 +178,7 @@ public class CoreSelection extends Activity implements
|
||||
return super.onOptionsItemSelected(aItem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onContextItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
|
@ -43,6 +43,11 @@ class FileWrapper implements IconAdapterItem {
|
||||
else
|
||||
return file.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSubText() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconResourceId() {
|
||||
|
@ -0,0 +1,83 @@
|
||||
package org.retroarch.browser;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
import org.retroarch.R;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class HistorySelection extends Activity implements
|
||||
AdapterView.OnItemClickListener {
|
||||
|
||||
private IconAdapter<HistoryWrapper> adapter;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.line_list);
|
||||
|
||||
// Setup the list
|
||||
adapter = new IconAdapter<HistoryWrapper>(this, R.layout.line_list_item);
|
||||
ListView list = (ListView) findViewById(R.id.list);
|
||||
list.setAdapter(adapter);
|
||||
list.setOnItemClickListener(this);
|
||||
|
||||
setTitle("Recently played games");
|
||||
|
||||
File history = new File(getApplicationInfo().dataDir, "retroarch-history.txt");
|
||||
|
||||
try {
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(
|
||||
new FileInputStream(history)));
|
||||
|
||||
for (;;) {
|
||||
String game = br.readLine();
|
||||
String core = br.readLine();
|
||||
String name = br.readLine();
|
||||
if (game == null || core == null || name == null)
|
||||
break;
|
||||
|
||||
adapter.add(new HistoryWrapper(game, core, name));
|
||||
}
|
||||
br.close();
|
||||
} catch (IOException ex) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> aListView, View aView,
|
||||
int aPosition, long aID) {
|
||||
final HistoryWrapper item = adapter.getItem(aPosition);
|
||||
final String gamePath = item.getGamePath();
|
||||
final String corePath = item.getCorePath();
|
||||
|
||||
Intent myIntent;
|
||||
String current_ime = Settings.Secure.getString(getContentResolver(),
|
||||
Settings.Secure.DEFAULT_INPUT_METHOD);
|
||||
|
||||
MainMenuActivity.updateConfigFile();
|
||||
MainMenuActivity.waitAssetThread();
|
||||
|
||||
Toast.makeText(this, "Loading: [" + gamePath + "] ...",
|
||||
Toast.LENGTH_SHORT).show();
|
||||
myIntent = new Intent(this, RetroActivity.class);
|
||||
myIntent.putExtra("ROM", gamePath);
|
||||
myIntent.putExtra("LIBRETRO", corePath);
|
||||
myIntent.putExtra("CONFIGFILE", MainMenuActivity.getDefaultConfigPath());
|
||||
myIntent.putExtra("IME", current_ime);
|
||||
startActivity(myIntent);
|
||||
finish();
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package org.retroarch.browser;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
public class HistoryWrapper implements IconAdapterItem {
|
||||
|
||||
private String gamePath;
|
||||
private String gamePathShort;
|
||||
private String corePath;
|
||||
private String coreName;
|
||||
|
||||
public HistoryWrapper(String gamePath, String corePath, String coreName) {
|
||||
this.gamePath = gamePath;
|
||||
this.corePath = corePath;
|
||||
this.coreName = coreName;
|
||||
|
||||
File file = new File(gamePath);
|
||||
gamePathShort = file.getName();
|
||||
try {
|
||||
gamePathShort = gamePathShort.substring(0, gamePathShort.lastIndexOf('.'));
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
public String getGamePath() {
|
||||
return gamePath;
|
||||
}
|
||||
|
||||
public String getCorePath() {
|
||||
return corePath;
|
||||
}
|
||||
|
||||
public String getCoreName() {
|
||||
return coreName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return gamePathShort;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSubText() {
|
||||
return coreName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconResourceId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Drawable getIconDrawable() {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -10,11 +10,9 @@ import android.widget.*;
|
||||
|
||||
interface IconAdapterItem {
|
||||
public abstract boolean isEnabled();
|
||||
|
||||
public abstract String getText();
|
||||
|
||||
public abstract String getSubText();
|
||||
public abstract int getIconResourceId();
|
||||
|
||||
public abstract Drawable getIconDrawable();
|
||||
}
|
||||
|
||||
@ -23,7 +21,6 @@ class IconAdapter<T extends IconAdapterItem> extends ArrayAdapter<T> {
|
||||
|
||||
public IconAdapter(Activity aContext, int aLayout) {
|
||||
super(aContext, aLayout);
|
||||
|
||||
layout = aLayout;
|
||||
}
|
||||
|
||||
@ -45,6 +42,16 @@ class IconAdapter<T extends IconAdapterItem> extends ArrayAdapter<T> {
|
||||
textView.setText(item.getText());
|
||||
textView.setEnabled(enabled);
|
||||
}
|
||||
|
||||
textView = (TextView) aConvertView.findViewById(R.id.sub_name);
|
||||
if (null != textView) {
|
||||
String subText = item.getSubText();
|
||||
if (null != subText) {
|
||||
textView.setVisibility(View.VISIBLE);
|
||||
textView.setEnabled(item.isEnabled());
|
||||
textView.setText(subText);
|
||||
}
|
||||
}
|
||||
|
||||
ImageView imageView = (ImageView) aConvertView.findViewById(R.id.icon);
|
||||
if (null != imageView) {
|
||||
|
@ -24,6 +24,19 @@ import android.widget.Toast;
|
||||
public class MainMenuActivity extends PreferenceActivity {
|
||||
private static MainMenuActivity instance = null;
|
||||
static private final String TAG = "MainMenu";
|
||||
static private Thread assetThread = null;
|
||||
|
||||
public static void waitAssetThread() {
|
||||
if (assetThread != null) {
|
||||
try {
|
||||
assetThread.join();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
assetThread = null;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
@ -32,56 +45,62 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
addPreferencesFromResource(R.xml.prefs);
|
||||
PreferenceManager.setDefaultValues(this, R.xml.prefs, false);
|
||||
this.setVolumeControlStream(AudioManager.STREAM_MUSIC);
|
||||
|
||||
|
||||
// Extracting assets appears to take considerable amount of time, so
|
||||
// move extraction to a thread.
|
||||
Thread assetThread = new Thread(new Runnable() {
|
||||
assetThread = new Thread(new Runnable() {
|
||||
public void run() {
|
||||
extractAssets();
|
||||
}
|
||||
});
|
||||
assetThread.start();
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
|
||||
|
||||
|
||||
SharedPreferences prefs = PreferenceManager
|
||||
.getDefaultSharedPreferences(getBaseContext());
|
||||
|
||||
if (!prefs.getBoolean("first_time_refreshrate_calculate", false)) {
|
||||
prefs.edit().putBoolean("first_time_refreshrate_calculate", true).commit();
|
||||
|
||||
if (!detectDevice(false))
|
||||
{
|
||||
prefs.edit().putBoolean("first_time_refreshrate_calculate", true)
|
||||
.commit();
|
||||
|
||||
if (!detectDevice(false)) {
|
||||
AlertDialog.Builder alert = new AlertDialog.Builder(this)
|
||||
.setTitle("Welcome to RetroArch")
|
||||
.setMessage("This is your first time starting up RetroArch. RetroArch will now be preconfigured for the best possible gameplay experience. Please be aware that it might take some time until all shader and overlay assets are extracted...")
|
||||
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
|
||||
SharedPreferences.Editor edit = prefs.edit();
|
||||
edit.putBoolean("video_threaded", true);
|
||||
edit.commit();
|
||||
}
|
||||
});
|
||||
alert.show();
|
||||
}
|
||||
else
|
||||
{
|
||||
.setTitle("Welcome to RetroArch")
|
||||
.setMessage(
|
||||
"This is your first time starting up RetroArch. RetroArch will now be preconfigured for the best possible gameplay experience. Please be aware that it might take some time until all shader and overlay assets are extracted...")
|
||||
.setPositiveButton("OK",
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog,
|
||||
int which) {
|
||||
SharedPreferences prefs = PreferenceManager
|
||||
.getDefaultSharedPreferences(getBaseContext());
|
||||
SharedPreferences.Editor edit = prefs
|
||||
.edit();
|
||||
edit.putBoolean("video_threaded", true);
|
||||
edit.commit();
|
||||
}
|
||||
});
|
||||
alert.show();
|
||||
} else {
|
||||
AlertDialog.Builder alert = new AlertDialog.Builder(this)
|
||||
.setTitle("Welcome to RetroArch")
|
||||
.setMessage("This is your first time starting up RetroArch. Please be aware that it might take some time until all shader and overlay assets are extracted...")
|
||||
.setPositiveButton("OK", null);
|
||||
alert.show();
|
||||
.setTitle("Welcome to RetroArch")
|
||||
.setMessage(
|
||||
"This is your first time starting up RetroArch. Please be aware that it might take some time until all shader and overlay assets are extracted...")
|
||||
.setPositiveButton("OK", null);
|
||||
alert.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static MainMenuActivity getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
private final double getDisplayRefreshRate() {
|
||||
// Android is *very* likely to screw this up.
|
||||
// It is rarely a good value to use, so make sure it's not
|
||||
// completely wrong. Some phones return refresh rates that are completely bogus
|
||||
// completely wrong. Some phones return refresh rates that are
|
||||
// completely bogus
|
||||
// (like 0.3 Hz, etc), so try to be very conservative here.
|
||||
final WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
|
||||
final Display display = wm.getDefaultDisplay();
|
||||
@ -94,7 +113,8 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
public static final double getRefreshRate() {
|
||||
double rate = 0;
|
||||
SharedPreferences prefs = PreferenceManager
|
||||
.getDefaultSharedPreferences(MainMenuActivity.getInstance().getBaseContext());
|
||||
.getDefaultSharedPreferences(MainMenuActivity.getInstance()
|
||||
.getBaseContext());
|
||||
String refresh_rate = prefs.getString("video_refresh_rate", "");
|
||||
if (!refresh_rate.isEmpty()) {
|
||||
try {
|
||||
@ -106,11 +126,11 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
} else {
|
||||
rate = MainMenuActivity.getInstance().getDisplayRefreshRate();
|
||||
}
|
||||
|
||||
|
||||
Log.i(TAG, "Using refresh rate: " + rate + " Hz.");
|
||||
return rate;
|
||||
}
|
||||
|
||||
|
||||
public static String readCPUInfo() {
|
||||
String result = "";
|
||||
|
||||
@ -127,28 +147,32 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@TargetApi(17)
|
||||
public static int getLowLatencyOptimalSamplingRate() {
|
||||
AudioManager manager = (AudioManager)MainMenuActivity.getInstance().getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
|
||||
return Integer.parseInt(manager.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE));
|
||||
AudioManager manager = (AudioManager) MainMenuActivity.getInstance()
|
||||
.getApplicationContext()
|
||||
.getSystemService(Context.AUDIO_SERVICE);
|
||||
return Integer.parseInt(manager
|
||||
.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE));
|
||||
}
|
||||
|
||||
|
||||
public static int getOptimalSamplingRate() {
|
||||
int ret;
|
||||
if (android.os.Build.VERSION.SDK_INT >= 17)
|
||||
ret = getLowLatencyOptimalSamplingRate();
|
||||
else
|
||||
ret = AudioTrack.getNativeOutputSampleRate(AudioManager.STREAM_MUSIC);
|
||||
|
||||
ret = AudioTrack
|
||||
.getNativeOutputSampleRate(AudioManager.STREAM_MUSIC);
|
||||
|
||||
Log.i(TAG, "Using sampling rate: " + ret + " Hz");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
public static String getDefaultConfigPath() {
|
||||
String internal = System.getenv("INTERNAL_STORAGE");
|
||||
String external = System.getenv("EXTERNAL_STORAGE");
|
||||
|
||||
|
||||
if (external != null) {
|
||||
String confPath = external + File.separator + "retroarch.cfg";
|
||||
if (new File(confPath).exists())
|
||||
@ -162,17 +186,23 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
if (new File(confPath).exists())
|
||||
return confPath;
|
||||
}
|
||||
|
||||
if (internal != null && new File(internal + File.separator + "retroarch.cfg").canWrite())
|
||||
|
||||
if (internal != null
|
||||
&& new File(internal + File.separator + "retroarch.cfg")
|
||||
.canWrite())
|
||||
return internal + File.separator + "retroarch.cfg";
|
||||
else if (external != null && new File(internal + File.separator + "retroarch.cfg").canWrite())
|
||||
else if (external != null
|
||||
&& new File(internal + File.separator + "retroarch.cfg")
|
||||
.canWrite())
|
||||
return external + File.separator + "retroarch.cfg";
|
||||
else if ((MainMenuActivity.getInstance().getApplicationInfo().dataDir) != null)
|
||||
return (MainMenuActivity.getInstance().getApplicationInfo().dataDir) + File.separator + "retroarch.cfg";
|
||||
else // emergency fallback, all else failed
|
||||
return (MainMenuActivity.getInstance().getApplicationInfo().dataDir)
|
||||
+ File.separator + "retroarch.cfg";
|
||||
else
|
||||
// emergency fallback, all else failed
|
||||
return "/mnt/sd/retroarch.cfg";
|
||||
}
|
||||
|
||||
|
||||
public static void updateConfigFile() {
|
||||
ConfigFile config;
|
||||
try {
|
||||
@ -180,30 +210,55 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
} catch (IOException e) {
|
||||
config = new ConfigFile();
|
||||
}
|
||||
|
||||
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.setInt("audio_out_rate", MainMenuActivity.getOptimalSamplingRate());
|
||||
config.setInt("audio_latency", prefs.getBoolean("audio_high_latency", false) ? 160 : 64);
|
||||
config.setBoolean("audio_enable", prefs.getBoolean("audio_enable", true));
|
||||
config.setBoolean("video_smooth", prefs.getBoolean("video_smooth", true));
|
||||
config.setBoolean("video_allow_rotate", prefs.getBoolean("video_allow_rotate", true));
|
||||
config.setBoolean("savestate_auto_load", prefs.getBoolean("savestate_auto_load", true));
|
||||
config.setBoolean("savestate_auto_save", prefs.getBoolean("savestate_auto_save", false));
|
||||
config.setBoolean("rewind_enable", prefs.getBoolean("rewind_enable", false));
|
||||
|
||||
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.setInt("audio_out_rate",
|
||||
MainMenuActivity.getOptimalSamplingRate());
|
||||
config.setInt("audio_latency",
|
||||
prefs.getBoolean("audio_high_latency", false) ? 160 : 64);
|
||||
config.setBoolean("audio_enable",
|
||||
prefs.getBoolean("audio_enable", true));
|
||||
config.setBoolean("video_smooth",
|
||||
prefs.getBoolean("video_smooth", true));
|
||||
config.setBoolean("video_allow_rotate",
|
||||
prefs.getBoolean("video_allow_rotate", true));
|
||||
config.setBoolean("savestate_auto_load",
|
||||
prefs.getBoolean("savestate_auto_load", true));
|
||||
config.setBoolean("savestate_auto_save",
|
||||
prefs.getBoolean("savestate_auto_save", false));
|
||||
config.setBoolean("rewind_enable",
|
||||
prefs.getBoolean("rewind_enable", false));
|
||||
config.setBoolean("video_vsync", prefs.getBoolean("video_vsync", true));
|
||||
config.setBoolean("input_autodetect_enable", prefs.getBoolean("input_autodetect_enable", true));
|
||||
config.setBoolean("input_debug_enable", prefs.getBoolean("input_debug_enable", false));
|
||||
config.setInt("input_back_behavior", Integer.valueOf(prefs.getString("input_back_behavior", "0")));
|
||||
config.setInt("input_autodetect_icade_profile_pad1", Integer.valueOf(prefs.getString("input_autodetect_icade_profile_pad1", "0")));
|
||||
config.setInt("input_autodetect_icade_profile_pad2", Integer.valueOf(prefs.getString("input_autodetect_icade_profile_pad2", "0")));
|
||||
config.setInt("input_autodetect_icade_profile_pad3", Integer.valueOf(prefs.getString("input_autodetect_icade_profile_pad3", "0")));
|
||||
config.setInt("input_autodetect_icade_profile_pad4", Integer.valueOf(prefs.getString("input_autodetect_icade_profile_pad4", "0")));
|
||||
|
||||
config.setDouble("video_refresh_rate", MainMenuActivity.getRefreshRate());
|
||||
config.setBoolean("video_threaded", prefs.getBoolean("video_threaded", true));
|
||||
|
||||
config.setBoolean("input_autodetect_enable",
|
||||
prefs.getBoolean("input_autodetect_enable", true));
|
||||
config.setBoolean("input_debug_enable",
|
||||
prefs.getBoolean("input_debug_enable", false));
|
||||
config.setInt("input_back_behavior",
|
||||
Integer.valueOf(prefs.getString("input_back_behavior", "0")));
|
||||
config.setInt("input_autodetect_icade_profile_pad1", Integer
|
||||
.valueOf(prefs.getString("input_autodetect_icade_profile_pad1",
|
||||
"0")));
|
||||
config.setInt("input_autodetect_icade_profile_pad2", Integer
|
||||
.valueOf(prefs.getString("input_autodetect_icade_profile_pad2",
|
||||
"0")));
|
||||
config.setInt("input_autodetect_icade_profile_pad3", Integer
|
||||
.valueOf(prefs.getString("input_autodetect_icade_profile_pad3",
|
||||
"0")));
|
||||
config.setInt("input_autodetect_icade_profile_pad4", Integer
|
||||
.valueOf(prefs.getString("input_autodetect_icade_profile_pad4",
|
||||
"0")));
|
||||
|
||||
config.setDouble("video_refresh_rate",
|
||||
MainMenuActivity.getRefreshRate());
|
||||
config.setBoolean("video_threaded",
|
||||
prefs.getBoolean("video_threaded", true));
|
||||
|
||||
String aspect = prefs.getString("video_aspect_ratio", "auto");
|
||||
if (aspect.equals("full")) {
|
||||
config.setBoolean("video_force_aspect", false);
|
||||
@ -220,9 +275,10 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
config.setBoolean("video_force_aspect", true);
|
||||
config.setDouble("video_aspect_ratio", aspect_ratio);
|
||||
}
|
||||
|
||||
config.setBoolean("video_scale_integer", prefs.getBoolean("video_scale_integer", false));
|
||||
|
||||
|
||||
config.setBoolean("video_scale_integer",
|
||||
prefs.getBoolean("video_scale_integer", false));
|
||||
|
||||
String shaderPath = prefs.getString("video_shader", "");
|
||||
config.setString("video_shader", shaderPath);
|
||||
config.setBoolean("video_shader_enable",
|
||||
@ -231,28 +287,42 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
|
||||
boolean useOverlay = prefs.getBoolean("input_overlay_enable", true);
|
||||
if (useOverlay) {
|
||||
String overlayPath = prefs.getString("input_overlay", (MainMenuActivity.getInstance().getApplicationInfo().dataDir) + "/overlays/snes-landscape.cfg");
|
||||
String overlayPath = prefs
|
||||
.getString("input_overlay", (MainMenuActivity.getInstance()
|
||||
.getApplicationInfo().dataDir)
|
||||
+ "/overlays/snes-landscape.cfg");
|
||||
config.setString("input_overlay", overlayPath);
|
||||
config.setDouble("input_overlay_opacity", prefs.getFloat("input_overlay_opacity", 1.0f));
|
||||
config.setDouble("input_overlay_opacity",
|
||||
prefs.getFloat("input_overlay_opacity", 1.0f));
|
||||
} else {
|
||||
config.setString("input_overlay", "");
|
||||
}
|
||||
|
||||
config.setString(
|
||||
"savefile_directory",
|
||||
prefs.getBoolean("savefile_directory_enable", false) ? prefs
|
||||
.getString("savefile_directory", "") : "");
|
||||
config.setString(
|
||||
"savestate_directory",
|
||||
prefs.getBoolean("savestate_directory_enable", false) ? prefs
|
||||
.getString("savestate_directory", "") : "");
|
||||
config.setString(
|
||||
"system_directory",
|
||||
prefs.getBoolean("system_directory_enable", false) ? prefs
|
||||
.getString("system_directory", "") : "");
|
||||
|
||||
config.setBoolean("video_font_enable",
|
||||
prefs.getBoolean("video_font_enable", true));
|
||||
|
||||
config.setString("savefile_directory", prefs.getBoolean("savefile_directory_enable", false) ?
|
||||
prefs.getString("savefile_directory", "") : "");
|
||||
config.setString("savestate_directory", prefs.getBoolean("savestate_directory_enable", false) ?
|
||||
prefs.getString("savestate_directory", "") : "");
|
||||
config.setString("system_directory", prefs.getBoolean("system_directory_enable", false) ?
|
||||
prefs.getString("system_directory", "") : "");
|
||||
|
||||
config.setBoolean("video_font_enable", prefs.getBoolean("video_font_enable", true));
|
||||
|
||||
for (int i = 1; i <= 4; i++)
|
||||
{
|
||||
final String btns[] = {"up", "down", "left", "right", "a", "b", "x", "y", "start", "select", "l", "r", "l2", "r2", "l3", "r3" };
|
||||
for (String b : btns)
|
||||
{
|
||||
String p = "input_player" + String.valueOf(i) + "_" + b + "_btn";
|
||||
config.setString("game_history_path", MainMenuActivity.getInstance().getApplicationInfo().dataDir + "/retroarch-history.txt");
|
||||
|
||||
for (int i = 1; i <= 4; i++) {
|
||||
final String btns[] = { "up", "down", "left", "right", "a", "b",
|
||||
"x", "y", "start", "select", "l", "r", "l2", "r2", "l3",
|
||||
"r3" };
|
||||
for (String b : btns) {
|
||||
String p = "input_player" + String.valueOf(i) + "_" + b
|
||||
+ "_btn";
|
||||
config.setInt(p, prefs.getInt(p, 0));
|
||||
}
|
||||
}
|
||||
@ -264,7 +334,7 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
Log.e(TAG, "Failed to save config file to: " + confPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private byte[] loadAsset(String asset) throws IOException {
|
||||
String path = asset;
|
||||
InputStream stream = getAssets().open(path);
|
||||
@ -273,22 +343,24 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
stream.read(buf, 0, len);
|
||||
return buf;
|
||||
}
|
||||
|
||||
private void extractAssets(AssetManager manager, String dataDir, String relativePath, int level) throws IOException {
|
||||
|
||||
private void extractAssets(AssetManager manager, String dataDir,
|
||||
String relativePath, int level) throws IOException {
|
||||
final String[] paths = manager.list(relativePath);
|
||||
if (paths != null && paths.length > 0) { // Directory
|
||||
//Log.d(TAG, "Extracting assets directory: " + relativePath);
|
||||
// Log.d(TAG, "Extracting assets directory: " + relativePath);
|
||||
for (final String path : paths)
|
||||
extractAssets(manager, dataDir, relativePath + (level > 0 ? File.separator : "") + path, level + 1);
|
||||
extractAssets(manager, dataDir, relativePath
|
||||
+ (level > 0 ? File.separator : "") + path, level + 1);
|
||||
} else { // File, extract.
|
||||
//Log.d(TAG, "Extracting assets file: " + relativePath);
|
||||
|
||||
// Log.d(TAG, "Extracting assets file: " + relativePath);
|
||||
|
||||
String parentPath = new File(relativePath).getParent();
|
||||
if (parentPath != null) {
|
||||
File parentFile = new File(dataDir, parentPath);
|
||||
parentFile.mkdirs(); // Doesn't throw.
|
||||
}
|
||||
|
||||
|
||||
byte[] asset = loadAsset(relativePath);
|
||||
BufferedOutputStream writer = new BufferedOutputStream(
|
||||
new FileOutputStream(new File(dataDir, relativePath)));
|
||||
@ -298,128 +370,146 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void extractAssets() {
|
||||
int version = 0;
|
||||
try {
|
||||
version = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
|
||||
} catch(NameNotFoundException e) {
|
||||
} catch (NameNotFoundException e) {
|
||||
// weird exception, shouldn't happen
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
AssetManager assets = getAssets();
|
||||
String dataDir = getApplicationInfo().dataDir;
|
||||
File cacheVersion = new File(dataDir, ".cacheversion");
|
||||
if (cacheVersion != null && cacheVersion.isFile() && cacheVersion.canRead() && cacheVersion.canWrite())
|
||||
{
|
||||
DataInputStream cacheStream = new DataInputStream(new FileInputStream(cacheVersion));
|
||||
if (cacheVersion != null && cacheVersion.isFile()
|
||||
&& cacheVersion.canRead() && cacheVersion.canWrite()) {
|
||||
DataInputStream cacheStream = new DataInputStream(
|
||||
new FileInputStream(cacheVersion));
|
||||
|
||||
int currentCacheVersion = 0;
|
||||
try {
|
||||
currentCacheVersion = cacheStream.readInt();
|
||||
} catch (IOException e) {}
|
||||
cacheStream.close();
|
||||
|
||||
if (currentCacheVersion == version)
|
||||
{
|
||||
} catch (IOException e) {
|
||||
}
|
||||
cacheStream.close();
|
||||
|
||||
if (currentCacheVersion == version) {
|
||||
Log.i("ASSETS", "Assets already extracted, skipping...");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//extractAssets(assets, cacheDir, "", 0);
|
||||
|
||||
// extractAssets(assets, cacheDir, "", 0);
|
||||
Log.i("ASSETS", "Extracting shader assets now ...");
|
||||
try {
|
||||
extractAssets(assets, dataDir, "shaders_glsl", 1);
|
||||
} catch (IOException e) {
|
||||
Log.i("ASSETS", "Failed to extract shaders ...");
|
||||
}
|
||||
|
||||
|
||||
Log.i("ASSETS", "Extracting overlay assets now ...");
|
||||
try {
|
||||
extractAssets(assets, dataDir, "overlays", 1);
|
||||
} catch (IOException e) {
|
||||
Log.i("ASSETS", "Failed to extract overlays ...");
|
||||
}
|
||||
|
||||
DataOutputStream outputCacheVersion = new DataOutputStream(new FileOutputStream(cacheVersion, false));
|
||||
|
||||
DataOutputStream outputCacheVersion = new DataOutputStream(
|
||||
new FileOutputStream(cacheVersion, false));
|
||||
outputCacheVersion.writeInt(version);
|
||||
outputCacheVersion.close();
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "Failed to extract assets to cache.");
|
||||
Log.e(TAG, "Failed to extract assets to cache.");
|
||||
}
|
||||
}
|
||||
|
||||
boolean detectDevice(boolean show_dialog)
|
||||
{
|
||||
|
||||
boolean detectDevice(boolean show_dialog) {
|
||||
boolean retval = false;
|
||||
|
||||
|
||||
Log.i("Device MODEL", android.os.Build.MODEL);
|
||||
if (android.os.Build.MODEL.equals("SHIELD"))
|
||||
{
|
||||
if (android.os.Build.MODEL.equals("SHIELD")) {
|
||||
AlertDialog.Builder alert = new AlertDialog.Builder(this)
|
||||
.setTitle("NVidia Shield detected")
|
||||
.setMessage("The ideal configuration options for your device will now be preconfigured.\nNOTE: For optimal performance, turn off Google Account sync, Google Play Store auto-updates, GPS and Wifi in your Android settings menu.")
|
||||
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
|
||||
SharedPreferences.Editor edit = prefs.edit();
|
||||
edit.putString("video_refresh_rate", Double.valueOf(60.00d).toString());
|
||||
edit.putBoolean("input_overlay_enable", false);
|
||||
edit.putBoolean("input_autodetect_enable", true);
|
||||
edit.commit();
|
||||
}
|
||||
});
|
||||
.setTitle("NVidia Shield detected")
|
||||
.setMessage(
|
||||
"The ideal configuration options for your device will now be preconfigured.\nNOTE: For optimal performance, turn off Google Account sync, Google Play Store auto-updates, GPS and Wifi in your Android settings menu.")
|
||||
.setPositiveButton("OK",
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog,
|
||||
int which) {
|
||||
SharedPreferences prefs = PreferenceManager
|
||||
.getDefaultSharedPreferences(getBaseContext());
|
||||
SharedPreferences.Editor edit = prefs
|
||||
.edit();
|
||||
edit.putString("video_refresh_rate", Double
|
||||
.valueOf(60.00d).toString());
|
||||
edit.putBoolean("input_overlay_enable",
|
||||
false);
|
||||
edit.putBoolean("input_autodetect_enable",
|
||||
true);
|
||||
edit.commit();
|
||||
}
|
||||
});
|
||||
alert.show();
|
||||
retval = true;
|
||||
} else if (android.os.Build.MODEL.equals("OUYA Console")) {
|
||||
AlertDialog.Builder alert = new AlertDialog.Builder(this)
|
||||
.setTitle("OUYA detected")
|
||||
.setMessage(
|
||||
"The ideal configuration options for your device will now be preconfigured.\nNOTE: For optimal performance, turn off Google Account sync, GPS and Wifi in your Android settings menu.")
|
||||
.setPositiveButton("OK",
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog,
|
||||
int which) {
|
||||
SharedPreferences prefs = PreferenceManager
|
||||
.getDefaultSharedPreferences(getBaseContext());
|
||||
SharedPreferences.Editor edit = prefs
|
||||
.edit();
|
||||
edit.putBoolean("input_overlay_enable",
|
||||
false);
|
||||
edit.putBoolean("input_autodetect_enable",
|
||||
true);
|
||||
edit.commit();
|
||||
}
|
||||
});
|
||||
alert.show();
|
||||
retval = true;
|
||||
} else if (android.os.Build.ID.equals("JSS15J")) {
|
||||
AlertDialog.Builder alert = new AlertDialog.Builder(this)
|
||||
.setTitle("Nexus 7 2013 detected")
|
||||
.setMessage(
|
||||
"The ideal configuration options for your device will now be preconfigured.\nNOTE: For optimal performance, turn off Google Account sync, Google Play Store auto-updates, GPS and Wifi in your Android settings menu.")
|
||||
.setPositiveButton("OK",
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog,
|
||||
int which) {
|
||||
SharedPreferences prefs = PreferenceManager
|
||||
.getDefaultSharedPreferences(getBaseContext());
|
||||
SharedPreferences.Editor edit = prefs
|
||||
.edit();
|
||||
edit.putString("video_refresh_rate", Double
|
||||
.valueOf(59.65).toString());
|
||||
edit.commit();
|
||||
}
|
||||
});
|
||||
alert.show();
|
||||
retval = true;
|
||||
}
|
||||
else if (android.os.Build.MODEL.equals( "OUYA Console"))
|
||||
{
|
||||
AlertDialog.Builder alert = new AlertDialog.Builder(this)
|
||||
.setTitle("OUYA detected")
|
||||
.setMessage("The ideal configuration options for your device will now be preconfigured.\nNOTE: For optimal performance, turn off Google Account sync, GPS and Wifi in your Android settings menu.")
|
||||
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
|
||||
SharedPreferences.Editor edit = prefs.edit();
|
||||
edit.putBoolean("input_overlay_enable", false);
|
||||
edit.putBoolean("input_autodetect_enable", true);
|
||||
edit.commit();
|
||||
}
|
||||
});
|
||||
alert.show();
|
||||
retval = true;
|
||||
}
|
||||
else if (android.os.Build.ID.equals("JSS15J"))
|
||||
{
|
||||
AlertDialog.Builder alert = new AlertDialog.Builder(this)
|
||||
.setTitle("Nexus 7 2013 detected")
|
||||
.setMessage("The ideal configuration options for your device will now be preconfigured.\nNOTE: For optimal performance, turn off Google Account sync, Google Play Store auto-updates, GPS and Wifi in your Android settings menu.")
|
||||
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
|
||||
SharedPreferences.Editor edit = prefs.edit();
|
||||
edit.putString("video_refresh_rate", Double.valueOf(59.65).toString());
|
||||
edit.commit();
|
||||
}
|
||||
});
|
||||
alert.show();
|
||||
retval = true;
|
||||
}
|
||||
|
||||
|
||||
if (show_dialog) {
|
||||
Toast.makeText(this,
|
||||
"Device either not detected in list or doesn't have any optimal settings in our database.",
|
||||
Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(
|
||||
this,
|
||||
"Device either not detected in list or doesn't have any optimal settings in our database.",
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
|
@ -28,6 +28,15 @@ class ModuleWrapper implements IconAdapterItem {
|
||||
} else
|
||||
return stripped;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSubText() {
|
||||
String stripped = file.getName().replace(".so", "") + "_system";
|
||||
if (config.keyExists(stripped)) {
|
||||
return config.getString(stripped);
|
||||
} else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconResourceId() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user