Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #11413 from t895/sample-window-slider
Android: Add slider for Performance Sample Window
  • Loading branch information
lioncash committed Jan 24, 2023
2 parents f4a8f80 + 937e089 commit ba6ee9d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
Expand Up @@ -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),
Expand Down
Expand Up @@ -286,7 +286,18 @@ public void onSliderClick(SliderSetting item, int position)
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())
Expand Down
Expand Up @@ -907,6 +907,9 @@ private void addStatisticsSettings(ArrayList<SettingsItem> sl)
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)
Expand Down
4 changes: 2 additions & 2 deletions Source/Android/app/src/main/res/layout/dialog_slider.xml
Expand Up @@ -17,15 +17,15 @@

<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"
app:layout_constraintBottom_toBottomOf="parent"
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"
Expand Down
2 changes: 2 additions & 0 deletions Source/Android/app/src/main/res/values/strings.xml
Expand Up @@ -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>
Expand Down

0 comments on commit ba6ee9d

Please sign in to comment.