(Android) Add Report Refresh Rate (Java)
This commit is contained in:
parent
bc28ccbaad
commit
00a8ceab7e
|
@ -2,7 +2,9 @@
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||||
<item android:id="@+id/rarch_settings" android:title="@string/rarch_settings" android:showAsAction="ifRoom" />
|
<item android:id="@+id/rarch_settings" android:title="@string/rarch_settings" android:showAsAction="ifRoom" />
|
||||||
<item android:id="@+id/input_method_select" android:title="@string/input_method" android:showAsAction="ifRoom" />
|
<item android:id="@+id/input_method_select" android:title="@string/input_method" android:showAsAction="ifRoom" />
|
||||||
<item android:id="@+id/report_ime" android:title="@string/report_ime"></item><item android:id="@+id/retroarch_guide" android:title="@string/retroarch_guide"></item>
|
<item android:id="@+id/report_ime" android:title="@string/report_ime"></item>
|
||||||
|
<item android:id="@+id/report_refreshrate" android:title="@string/report_refreshrate"></item>
|
||||||
|
<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/cores_guide" android:title="@string/cores_guide"></item>
|
||||||
<item android:id="@+id/overlay_guide" android:title="@string/overlay_guide"></item>
|
<item android:id="@+id/overlay_guide" android:title="@string/overlay_guide"></item>
|
||||||
<item android:id="@+id/shader_pack" android:title="@string/shader_pack"></item>
|
<item android:id="@+id/shader_pack" android:title="@string/shader_pack"></item>
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
<string name="key_bind_title">Select the button to use</string>
|
<string name="key_bind_title">Select the button to use</string>
|
||||||
<string name="key_bind_clear">Unbind</string>
|
<string name="key_bind_clear">Unbind</string>
|
||||||
<string name="report_ime">Report IME</string>
|
<string name="report_ime">Report IME</string>
|
||||||
|
<string name="report_refreshrate">Report Refresh Rate</string>
|
||||||
<string name="key_bind_detect">Detect</string>
|
<string name="key_bind_detect">Detect</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -60,6 +60,7 @@ public class RetroArch extends Activity implements
|
||||||
private IconAdapter<ModuleWrapper> adapter;
|
private IconAdapter<ModuleWrapper> adapter;
|
||||||
static private final int ACTIVITY_LOAD_ROM = 0;
|
static private final int ACTIVITY_LOAD_ROM = 0;
|
||||||
static private String libretro_path;
|
static private String libretro_path;
|
||||||
|
static private Double report_refreshrate;
|
||||||
static private final String TAG = "RetroArch-Phoenix";
|
static private final String TAG = "RetroArch-Phoenix";
|
||||||
private ConfigFile config;
|
private ConfigFile config;
|
||||||
private ConfigFile core_config;
|
private ConfigFile core_config;
|
||||||
|
@ -147,9 +148,9 @@ public class RetroArch extends Activity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private void extractAssets() {
|
private void extractAssets() {
|
||||||
long version = 0;
|
int version = 0;
|
||||||
try {
|
try {
|
||||||
version = getPackageManager().getPackageInfo(getPackageName(), 0).lastUpdateTime;
|
version = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
|
||||||
} catch(NameNotFoundException e) {
|
} catch(NameNotFoundException e) {
|
||||||
// weird exception, shouldn't happen
|
// weird exception, shouldn't happen
|
||||||
}
|
}
|
||||||
|
@ -162,13 +163,10 @@ public class RetroArch extends Activity implements
|
||||||
{
|
{
|
||||||
DataInputStream cacheStream = new DataInputStream(new FileInputStream(cacheVersion));
|
DataInputStream cacheStream = new DataInputStream(new FileInputStream(cacheVersion));
|
||||||
|
|
||||||
long currentCacheVersion = 0;
|
int curretnCacheVersion = cacheStream.readInt();
|
||||||
try {
|
|
||||||
currentCacheVersion = cacheStream.readLong();
|
|
||||||
} catch (IOException e) {}
|
|
||||||
cacheStream.close();
|
cacheStream.close();
|
||||||
|
|
||||||
if (currentCacheVersion == version)
|
if (curretnCacheVersion == version)
|
||||||
{
|
{
|
||||||
Log.i(TAG, "assets already extracted, skipping");
|
Log.i(TAG, "assets already extracted, skipping");
|
||||||
return;
|
return;
|
||||||
|
@ -178,8 +176,8 @@ public class RetroArch extends Activity implements
|
||||||
//extractAssets(assets, cacheDir, "Shaders", 1);
|
//extractAssets(assets, cacheDir, "Shaders", 1);
|
||||||
extractAssets(assets, cacheDir, "Overlays", 1);
|
extractAssets(assets, cacheDir, "Overlays", 1);
|
||||||
|
|
||||||
DataOutputStream outputCacheVersion = new DataOutputStream(new FileOutputStream(cacheVersion, false));
|
DataOutputStream outputCacheVersion = new DataOutputStream(new FileOutputStream(cacheVersion));
|
||||||
outputCacheVersion.writeLong(version);
|
outputCacheVersion.writeInt(version);
|
||||||
outputCacheVersion.close();
|
outputCacheVersion.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(TAG, "Failed to extract assets to cache.");
|
Log.e(TAG, "Failed to extract assets to cache.");
|
||||||
|
@ -206,6 +204,7 @@ public class RetroArch extends Activity implements
|
||||||
|
|
||||||
String cpuInfo = readCPUInfo();
|
String cpuInfo = readCPUInfo();
|
||||||
boolean cpuIsNeon = cpuInfoIsNeon(cpuInfo);
|
boolean cpuIsNeon = cpuInfoIsNeon(cpuInfo);
|
||||||
|
report_refreshrate = getRefreshRate();
|
||||||
|
|
||||||
// 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.
|
||||||
|
@ -492,6 +491,10 @@ public class RetroArch extends Activity implements
|
||||||
String current_ime = Settings.Secure.getString(getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
|
String current_ime = Settings.Secure.getString(getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
|
||||||
new AlertDialog.Builder(this).setMessage(current_ime).setNeutralButton("Close", null).show();
|
new AlertDialog.Builder(this).setMessage(current_ime).setNeutralButton("Close", null).show();
|
||||||
return true;
|
return true;
|
||||||
|
case R.id.report_refreshrate:
|
||||||
|
String current_rate = "Screen Refresh Rate: " + new Double(report_refreshrate).toString();
|
||||||
|
new AlertDialog.Builder(this).setMessage(current_rate).setNeutralButton("Close", null).show();
|
||||||
|
return true;
|
||||||
|
|
||||||
case R.id.retroarch_guide:
|
case R.id.retroarch_guide:
|
||||||
Intent rguide = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.libretro.org/documents/retroarch-manual.pdf"));
|
Intent rguide = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.libretro.org/documents/retroarch-manual.pdf"));
|
||||||
|
|
Loading…
Reference in New Issue