Android: fx setting

This commit is contained in:
weihuoya 2018-11-13 10:04:44 +08:00
parent 8bb6cf2cc4
commit c4f065611e
3 changed files with 21 additions and 15 deletions

View File

@ -44,8 +44,7 @@ public final class SliderSetting extends SettingsItem
else if (setting instanceof FloatSetting) else if (setting instanceof FloatSetting)
{ {
FloatSetting floatSetting = (FloatSetting) setting; FloatSetting floatSetting = (FloatSetting) setting;
if (floatSetting.getKey().equals(SettingsFile.KEY_OVERCLOCK_PERCENT) if (isPercentSetting())
|| floatSetting.getKey().equals(SettingsFile.KEY_SPEED_LIMIT))
{ {
return Math.round(floatSetting.getValue() * 100); return Math.round(floatSetting.getValue() * 100);
} }
@ -61,6 +60,12 @@ public final class SliderSetting extends SettingsItem
} }
} }
public boolean isPercentSetting()
{
return getKey().equals(SettingsFile.KEY_OVERCLOCK_PERCENT)
|| getKey().equals(SettingsFile.KEY_SPEED_LIMIT);
}
/** /**
* Write a value to the backing int. If that int was previously null, * 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. * initializes a new one and returns it, so it can be added to the Hashmap.

View File

@ -309,12 +309,11 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
else if (mClickedItem instanceof SliderSetting) else if (mClickedItem instanceof SliderSetting)
{ {
SliderSetting sliderSetting = (SliderSetting) mClickedItem; SliderSetting sliderSetting = (SliderSetting) mClickedItem;
if (sliderSetting.getSetting() instanceof FloatSetting) if (sliderSetting.isPercentSetting() || sliderSetting.getSetting() instanceof FloatSetting)
{ {
float value; float value;
if (sliderSetting.getKey().equals(SettingsFile.KEY_OVERCLOCK_PERCENT) if (sliderSetting.isPercentSetting())
|| sliderSetting.getKey().equals(SettingsFile.KEY_SPEED_LIMIT))
{ {
value = mSeekbarProgress / 100.0f; value = mSeekbarProgress / 100.0f;
} }

View File

@ -399,11 +399,11 @@ public final class SettingsFragmentPresenter
Setting perPixel = gfxSection.getSetting(SettingsFile.KEY_PER_PIXEL); Setting perPixel = gfxSection.getSetting(SettingsFile.KEY_PER_PIXEL);
Setting forceFilter = enhancementSection.getSetting(SettingsFile.KEY_FORCE_FILTERING); Setting forceFilter = enhancementSection.getSetting(SettingsFile.KEY_FORCE_FILTERING);
Setting disableFog = gfxSection.getSetting(SettingsFile.KEY_DISABLE_FOG); Setting disableFog = gfxSection.getSetting(SettingsFile.KEY_DISABLE_FOG);
Setting disableCopyFilter = gfxSection.getSetting(SettingsFile.KEY_DISABLE_COPY_FILTER); Setting disableCopyFilter = enhancementSection.getSetting(SettingsFile.KEY_DISABLE_COPY_FILTER);
Setting arbitraryMipmapDetection = Setting arbitraryMipmapDetection =
gfxSection.getSetting(SettingsFile.KEY_ARBITRARY_MIPMAP_DETECTION); enhancementSection.getSetting(SettingsFile.KEY_ARBITRARY_MIPMAP_DETECTION);
Setting wideScreenHack = enhancementSection.getSetting(SettingsFile.KEY_WIDE_SCREEN_HACK); Setting wideScreenHack = gfxSection.getSetting(SettingsFile.KEY_WIDE_SCREEN_HACK);
Setting force24BitColor = gfxSection.getSetting(SettingsFile.KEY_FORCE_24_BIT_COLOR); Setting force24BitColor = enhancementSection.getSetting(SettingsFile.KEY_FORCE_24_BIT_COLOR);
sl.add(new SingleChoiceSetting(SettingsFile.KEY_INTERNAL_RES, Settings.SECTION_GFX_SETTINGS, sl.add(new SingleChoiceSetting(SettingsFile.KEY_INTERNAL_RES, Settings.SECTION_GFX_SETTINGS,
R.string.internal_resolution, R.string.internal_resolution_description, R.string.internal_resolution, R.string.internal_resolution_description,
@ -437,18 +437,20 @@ public final class SettingsFragmentPresenter
sl.add(new CheckBoxSetting(SettingsFile.KEY_FORCE_FILTERING, Settings.SECTION_GFX_ENHANCEMENTS, sl.add(new CheckBoxSetting(SettingsFile.KEY_FORCE_FILTERING, Settings.SECTION_GFX_ENHANCEMENTS,
R.string.force_texture_filtering, R.string.force_texture_filtering_description, false, R.string.force_texture_filtering, R.string.force_texture_filtering_description, false,
forceFilter)); forceFilter));
sl.add(new CheckBoxSetting(SettingsFile.KEY_FORCE_24_BIT_COLOR, Settings.SECTION_GFX_SETTINGS, sl.add(new CheckBoxSetting(SettingsFile.KEY_FORCE_24_BIT_COLOR,
Settings.SECTION_GFX_ENHANCEMENTS,
R.string.force_24bit_color, R.string.force_24bit_color_description, true, R.string.force_24bit_color, R.string.force_24bit_color_description, true,
force24BitColor)); force24BitColor));
sl.add(new CheckBoxSetting(SettingsFile.KEY_DISABLE_FOG, Settings.SECTION_GFX_SETTINGS, sl.add(new CheckBoxSetting(SettingsFile.KEY_DISABLE_FOG, Settings.SECTION_GFX_SETTINGS,
R.string.disable_fog, R.string.disable_fog_description, false, disableFog)); R.string.disable_fog, R.string.disable_fog_description, false, disableFog));
sl.add(new CheckBoxSetting(SettingsFile.KEY_DISABLE_COPY_FILTER, Settings.SECTION_GFX_SETTINGS, sl.add(new CheckBoxSetting(SettingsFile.KEY_DISABLE_COPY_FILTER,
Settings.SECTION_GFX_ENHANCEMENTS,
R.string.disable_copy_filter, R.string.disable_copy_filter_description, false, R.string.disable_copy_filter, R.string.disable_copy_filter_description, false,
disableCopyFilter)); disableCopyFilter));
sl.add(new CheckBoxSetting(SettingsFile.KEY_ARBITRARY_MIPMAP_DETECTION, sl.add(new CheckBoxSetting(SettingsFile.KEY_ARBITRARY_MIPMAP_DETECTION,
Settings.SECTION_GFX_SETTINGS, R.string.arbitrary_mipmap_detection, Settings.SECTION_GFX_ENHANCEMENTS, R.string.arbitrary_mipmap_detection,
R.string.arbitrary_mipmap_detection_description, true, arbitraryMipmapDetection)); R.string.arbitrary_mipmap_detection_description, true, arbitraryMipmapDetection));
sl.add(new CheckBoxSetting(SettingsFile.KEY_WIDE_SCREEN_HACK, Settings.SECTION_GFX_ENHANCEMENTS, sl.add(new CheckBoxSetting(SettingsFile.KEY_WIDE_SCREEN_HACK, Settings.SECTION_GFX_SETTINGS,
R.string.wide_screen_hack, R.string.wide_screen_hack_description, false, R.string.wide_screen_hack, R.string.wide_screen_hack_description, false,
wideScreenHack)); wideScreenHack));
@ -529,7 +531,7 @@ public final class SettingsFragmentPresenter
Setting gpuTextureDecoding = gfxSection.getSetting(SettingsFile.KEY_GPU_TEXTURE_DECODING); Setting gpuTextureDecoding = gfxSection.getSetting(SettingsFile.KEY_GPU_TEXTURE_DECODING);
Setting xfbToTexture = hacksSection.getSetting(SettingsFile.KEY_XFB_TEXTURE); Setting xfbToTexture = hacksSection.getSetting(SettingsFile.KEY_XFB_TEXTURE);
Setting immediateXfb = hacksSection.getSetting(SettingsFile.KEY_IMMEDIATE_XFB); Setting immediateXfb = hacksSection.getSetting(SettingsFile.KEY_IMMEDIATE_XFB);
Setting fastDepth = hacksSection.getSetting(SettingsFile.KEY_FAST_DEPTH); Setting fastDepth = gfxSection.getSetting(SettingsFile.KEY_FAST_DEPTH);
sl.add(new HeaderSetting(null, null, R.string.embedded_frame_buffer, 0)); sl.add(new HeaderSetting(null, null, R.string.embedded_frame_buffer, 0));
sl.add(new CheckBoxSetting(SettingsFile.KEY_SKIP_EFB, Settings.SECTION_GFX_HACKS, sl.add(new CheckBoxSetting(SettingsFile.KEY_SKIP_EFB, Settings.SECTION_GFX_HACKS,
@ -556,7 +558,7 @@ public final class SettingsFragmentPresenter
R.string.immediate_xfb, R.string.immediate_xfb_description, false, immediateXfb)); R.string.immediate_xfb, R.string.immediate_xfb_description, false, immediateXfb));
sl.add(new HeaderSetting(null, null, R.string.other, 0)); sl.add(new HeaderSetting(null, null, R.string.other, 0));
sl.add(new CheckBoxSetting(SettingsFile.KEY_FAST_DEPTH, Settings.SECTION_GFX_HACKS, sl.add(new CheckBoxSetting(SettingsFile.KEY_FAST_DEPTH, Settings.SECTION_GFX_SETTINGS,
R.string.fast_depth_calculation, R.string.fast_depth_calculation_description, true, R.string.fast_depth_calculation, R.string.fast_depth_calculation_description, true,
fastDepth)); fastDepth));
} }