mirror of
https://github.com/libretro/RetroArch.git
synced 2024-12-01 21:11:04 +00:00
(Android/Shield) Add optimal settings option
This commit is contained in:
parent
5699a63091
commit
66b4510237
@ -8,4 +8,5 @@
|
||||
<item android:id="@+id/retroarch_guide" android:title="@string/retroarch_guide"></item>
|
||||
<item android:id="@+id/cores_guide" android:title="@string/cores_guide"></item>
|
||||
<item android:id="@+id/overlay_guide" android:title="@string/overlay_guide"></item>
|
||||
<item android:id="@+id/optimal_settings_device" android:title="@string/optimal_settings_device"></item>
|
||||
</menu>
|
||||
|
@ -18,5 +18,6 @@
|
||||
<string name="report_ime">Report IME</string>
|
||||
<string name="report_refreshrate">Report Refresh Rate</string>
|
||||
<string name="key_bind_detect">Detect</string>
|
||||
<string name="optimal_settings_device">Optimal device settings</string>
|
||||
|
||||
</resources>
|
||||
|
@ -292,6 +292,38 @@ public class RetroArch extends Activity implements
|
||||
}
|
||||
}
|
||||
|
||||
boolean detectDevice(boolean show_dialog)
|
||||
{
|
||||
Log.i("Device MODEL", android.os.Build.MODEL);
|
||||
if (android.os.Build.MODEL.equals("SHIELD"))
|
||||
{
|
||||
AlertDialog.Builder alert = new AlertDialog.Builder(this)
|
||||
.setTitle("NVidia Shield detected")
|
||||
.setMessage("Would you like to set up the ideal configuration options for your device?")
|
||||
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
|
||||
prefs.edit().putBoolean("video_threaded", true).commit();
|
||||
prefs.edit().putBoolean("input_autodetect_enable", true).commit();
|
||||
prefs.edit().putBoolean("input_overlay_enable", false).commit();
|
||||
prefs.edit().putFloat("refresh_rate", Float.parseFloat("59.6")).commit();
|
||||
}
|
||||
})
|
||||
.setNegativeButton("No", null);
|
||||
alert.show();
|
||||
return 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();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
@ -300,6 +332,9 @@ public class RetroArch extends Activity implements
|
||||
|
||||
if (!prefs.getBoolean("first_time_refreshrate_calculate", false)) {
|
||||
prefs.edit().putBoolean("first_time_refreshrate_calculate", true).commit();
|
||||
|
||||
if (!detectDevice(false))
|
||||
{
|
||||
AlertDialog.Builder alert = new AlertDialog.Builder(this)
|
||||
.setTitle("Calculate Refresh Rate")
|
||||
.setMessage("It is highly recommended you run the refresh rate calibration test before you use RetroArch. Do you want to run it now?\n\nIf you choose No, you can run it at any time in the video preferences.\n\nIf you get performance problems even after calibration, please try threaded video driver in video preferences.")
|
||||
@ -312,6 +347,7 @@ public class RetroArch extends Activity implements
|
||||
})
|
||||
.setNegativeButton("No", null);
|
||||
alert.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -570,6 +606,9 @@ public class RetroArch extends Activity implements
|
||||
Intent mguide = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.libretro.org/documents/overlay.pdf"));
|
||||
startActivity(mguide);
|
||||
return true;
|
||||
case R.id.optimal_settings_device:
|
||||
detectDevice(true);
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user