summaryrefslogtreecommitdiff
path: root/Source/Android
diff options
context:
space:
mode:
authorMai <mai.iam2048@gmail.com>2023-01-24 17:22:11 +0000
committerGitHub <noreply@github.com>2023-01-24 17:22:11 +0000
commitba6ee9d7ba9730e5b2165ff0ee18cbc23762b129 (patch)
treec0ec8b1ce200ffc35b5d8592773fdb86ff7ff547 /Source/Android
parentf4a8f80228e6286f47d19a111a721abfbe1efce1 (diff)
parent937e08980ecf7289d86e2e7fd83f09b78f7a52ac (diff)
Merge pull request #11413 from t895/sample-window-slider
Android: Add slider for Performance Sample Window
Diffstat (limited to 'Source/Android')
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/IntSetting.java2
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsAdapter.java13
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java3
-rw-r--r--Source/Android/app/src/main/res/layout/dialog_slider.xml4
-rw-r--r--Source/Android/app/src/main/res/values/strings.xml2
5 files changed, 21 insertions, 3 deletions
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/IntSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/IntSetting.java
index c7f2b0c54c..69b422ce54 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/IntSetting.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/IntSetting.java
@@ -67,6 +67,8 @@ public enum IntSetting implements AbstractIntSetting
GFX_STEREO_CONVERGENCE_PERCENTAGE(Settings.FILE_GFX, Settings.SECTION_STEREOSCOPY,
"StereoConvergencePercentage", 100),
+ GFX_PERF_SAMP_WINDOW(Settings.FILE_GFX, Settings.SECTION_GFX_SETTINGS, "PerfSampWindowMS", 1000),
+
LOGGER_VERBOSITY(Settings.FILE_LOGGER, Settings.SECTION_LOGGER_OPTIONS, "Verbosity", 1),
WIIMOTE_1_SOURCE(Settings.FILE_WIIMOTE, "Wiimote1", "Source", 1),
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsAdapter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsAdapter.java
index b51d87e5a9..c15c0d4498 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsAdapter.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsAdapter.java
@@ -286,7 +286,18 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
slider.setValueFrom(item.getMin());
slider.setValueTo(item.getMax());
slider.setValue(mSeekbarProgress);
- slider.setStepSize(1);
+
+ // Sliders can get frustrating to use with a small step size and large ranges
+ int maxRange = item.getMax();
+ if (maxRange <= 100)
+ {
+ slider.setStepSize(1);
+ }
+ else
+ {
+ slider.setStepSize((int) Math.pow(10, Math.ceil(Math.log10(maxRange)) - 2));
+ }
+
slider.addOnChangeListener(this);
mDialog = new MaterialAlertDialogBuilder(mView.getActivity())
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java
index 8818ae57ba..93bd5bbf2e 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java
@@ -907,6 +907,9 @@ public final class SettingsFragmentPresenter
sl.add(new SwitchSetting(mContext, BooleanSetting.GFX_LOG_RENDER_TIME_TO_FILE,
R.string.log_render_time_to_file,
R.string.log_render_time_to_file_description));
+ sl.add(new IntSliderSetting(mContext, IntSetting.GFX_PERF_SAMP_WINDOW,
+ R.string.performance_sample_window, R.string.performance_sample_window_description, 0,
+ 10000, "ms"));
}
private void addAdvancedGraphicsSettings(ArrayList<SettingsItem> sl)
diff --git a/Source/Android/app/src/main/res/layout/dialog_slider.xml b/Source/Android/app/src/main/res/layout/dialog_slider.xml
index a83befbb8c..fdb2ffdecb 100644
--- a/Source/Android/app/src/main/res/layout/dialog_slider.xml
+++ b/Source/Android/app/src/main/res/layout/dialog_slider.xml
@@ -17,7 +17,7 @@
<TextView
android:id="@+id/text_value"
- android:layout_width="26dp"
+ android:layout_width="40dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spacing_medlarge"
android:gravity="end"
@@ -25,7 +25,7 @@
app:layout_constraintEnd_toStartOf="@id/text_units"
app:layout_constraintStart_toEndOf="@id/slider"
app:layout_constraintTop_toTopOf="parent"
- tools:text="100" />
+ tools:text="10000" />
<TextView
android:id="@+id/text_units"
diff --git a/Source/Android/app/src/main/res/values/strings.xml b/Source/Android/app/src/main/res/values/strings.xml
index 280c7d0d1f..e29acd6227 100644
--- a/Source/Android/app/src/main/res/values/strings.xml
+++ b/Source/Android/app/src/main/res/values/strings.xml
@@ -330,6 +330,8 @@
<string name="show_vtimes_description">Shows the average time in ms between each rendered frame alongside the standard deviation.</string>
<string name="show_graphs">Show Performance Graphs</string>
<string name="show_graphs_description">Shows frametime graph along with statistics as a representation of emulation performance.</string>
+ <string name="performance_sample_window">Performance Sample Window</string>
+ <string name="performance_sample_window_description">The amount of time the FPS and VPS counters will sample over. The higher the value, the more stable the FPS/VPS counter will be, but the slower it will be to update.</string>
<string name="show_speed">Show % Speed</string>
<string name="show_speed_description">Shows the % speed of emulation compared to full speed.</string>
<string name="show_speed_colors">Show Speed Color</string>