android: Fix the frame limiter
It was erroneously using the wrong config section and variable type.
This commit is contained in:
parent
d0897d6a76
commit
54051c4981
@ -3,7 +3,6 @@ package org.citra.citra_emu.features.settings.model.view;
|
||||
import org.citra.citra_emu.features.settings.model.FloatSetting;
|
||||
import org.citra.citra_emu.features.settings.model.IntSetting;
|
||||
import org.citra.citra_emu.features.settings.model.Setting;
|
||||
import org.citra.citra_emu.features.settings.utils.SettingsFile;
|
||||
import org.citra.citra_emu.utils.Log;
|
||||
|
||||
public final class SliderSetting extends SettingsItem {
|
||||
@ -46,21 +45,13 @@ public final class SliderSetting extends SettingsItem {
|
||||
return intSetting.getValue();
|
||||
} else if (setting instanceof FloatSetting) {
|
||||
FloatSetting floatSetting = (FloatSetting) setting;
|
||||
if (isPercentSetting()) {
|
||||
return Math.round(floatSetting.getValue() * 100);
|
||||
} else {
|
||||
return Math.round(floatSetting.getValue());
|
||||
}
|
||||
return Math.round(floatSetting.getValue());
|
||||
} else {
|
||||
Log.error("[SliderSetting] Error casting setting type.");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isPercentSetting() {
|
||||
return getKey().equals(SettingsFile.KEY_FRAME_LIMIT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a value to the backing int. If that int was previously null,
|
||||
* initializes a new one and returns it, so it can be added to the Hashmap.
|
||||
|
@ -152,8 +152,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
||||
mDialog = builder.show();
|
||||
}
|
||||
|
||||
public void onStringSingleChoiceClick(StringSingleChoiceSetting item, int position)
|
||||
{
|
||||
public void onStringSingleChoiceClick(StringSingleChoiceSetting item, int position) {
|
||||
mClickedItem = item;
|
||||
mClickedPosition = position;
|
||||
|
||||
@ -320,14 +319,8 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
||||
mView.onSettingChanged();
|
||||
}
|
||||
|
||||
if (sliderSetting.isPercentSetting() || sliderSetting.getSetting() instanceof FloatSetting) {
|
||||
float value;
|
||||
|
||||
if (sliderSetting.isPercentSetting()) {
|
||||
value = mSeekbarProgress / 100.0f;
|
||||
} else {
|
||||
value = (float) mSeekbarProgress;
|
||||
}
|
||||
if (sliderSetting.getSetting() instanceof FloatSetting) {
|
||||
float value = (float) mSeekbarProgress;
|
||||
|
||||
FloatSetting setting = sliderSetting.setSelectedValue(value);
|
||||
if (setting != null) {
|
||||
|
@ -123,12 +123,12 @@ public final class SettingsFragmentPresenter {
|
||||
private void addGeneralSettings(ArrayList<SettingsItem> sl) {
|
||||
mView.getActivity().setTitle(R.string.preferences_general);
|
||||
|
||||
SettingSection coreSection = mSettings.getSection(Settings.SECTION_CORE);
|
||||
Setting frameLimitEnable = coreSection.getSetting(SettingsFile.KEY_FRAME_LIMIT_ENABLED);
|
||||
Setting frameLimitValue = coreSection.getSetting(SettingsFile.KEY_FRAME_LIMIT);
|
||||
SettingSection rendererSection = mSettings.getSection(Settings.SECTION_RENDERER);
|
||||
Setting frameLimitEnable = rendererSection.getSetting(SettingsFile.KEY_FRAME_LIMIT_ENABLED);
|
||||
Setting frameLimitValue = rendererSection.getSetting(SettingsFile.KEY_FRAME_LIMIT);
|
||||
|
||||
sl.add(new CheckBoxSetting(SettingsFile.KEY_FRAME_LIMIT_ENABLED, Settings.SECTION_RENDERER, R.string.frame_limit_enable, R.string.frame_limit_enable_description, true, frameLimitEnable));
|
||||
sl.add(new SliderSetting(SettingsFile.KEY_FRAME_LIMIT, Settings.SECTION_RENDERER, R.string.frame_limit_slider, R.string.frame_limit_slider_description, 0, 200, "%", 100, frameLimitValue));
|
||||
sl.add(new SliderSetting(SettingsFile.KEY_FRAME_LIMIT, Settings.SECTION_RENDERER, R.string.frame_limit_slider, R.string.frame_limit_slider_description, 1, 200, "%", 100, frameLimitValue));
|
||||
}
|
||||
|
||||
private void addSystemSettings(ArrayList<SettingsItem> sl) {
|
||||
|
@ -115,7 +115,7 @@ void Config::ReadValues() {
|
||||
Settings::values.use_vsync_new = sdl2_config->GetBoolean("Renderer", "use_vsync_new", true);
|
||||
Settings::values.use_frame_limit = sdl2_config->GetBoolean("Renderer", "use_frame_limit", true);
|
||||
Settings::values.frame_limit =
|
||||
static_cast<u16>(sdl2_config->GetReal("Renderer", "frame_limit", 1.0) * 100.0);
|
||||
static_cast<u16>(sdl2_config->GetInteger("Renderer", "frame_limit", 100));
|
||||
Settings::values.texture_filter_name =
|
||||
sdl2_config->GetString("Renderer", "texture_filter_name", "none");
|
||||
|
||||
|
@ -125,8 +125,8 @@ vsync_enabled =
|
||||
# 0: Off, 1: On (default)
|
||||
use_frame_limit =
|
||||
|
||||
# Limits the speed of the game to run no faster than this value as a multiplier of target speed
|
||||
# 0.0 - 10.0: Speed limit as a multiplier of target game speed. 1.0 (default)
|
||||
# Limits the speed of the game to run no faster than this value as a percentage of target speed
|
||||
# 1 - 9999: Speed limit as a percentage of target game speed. 100 (default)
|
||||
frame_limit =
|
||||
|
||||
# The clear color for the renderer. What shows up on the sides of the bottom screen.
|
||||
|
Loading…
x
Reference in New Issue
Block a user