Add Stereoscopy settings UI

This commit is contained in:
SutandoTsukai181 2020-06-10 12:32:37 +03:00 committed by bunnei
parent 98205a3324
commit 8027b7cfe7
7 changed files with 38 additions and 6 deletions

View File

@ -20,6 +20,7 @@ public class Settings {
public static final String SECTION_CAMERA = "Camera";
public static final String SECTION_CONTROLS = "Controls";
public static final String SECTION_RENDERER = "Renderer";
public static final String SECTION_LAYOUT = "Layout";
public static final String SECTION_AUDIO = "Audio";
public static final String SECTION_DEBUG = "Debug";
@ -28,7 +29,7 @@ public class Settings {
private static final Map<String, List<String>> configFileSectionsMap = new HashMap<>();
static {
configFileSectionsMap.put(SettingsFile.FILE_NAME_CONFIG, Arrays.asList(SECTION_PREMIUM, SECTION_CORE, SECTION_SYSTEM, SECTION_CAMERA, SECTION_CONTROLS, SECTION_RENDERER, SECTION_AUDIO, SECTION_DEBUG));
configFileSectionsMap.put(SettingsFile.FILE_NAME_CONFIG, Arrays.asList(SECTION_PREMIUM, SECTION_CORE, SECTION_SYSTEM, SECTION_CAMERA, SECTION_CONTROLS, SECTION_RENDERER, SECTION_LAYOUT, SECTION_AUDIO, SECTION_DEBUG));
}
/**

View File

@ -355,11 +355,18 @@ public final class SettingsFragmentPresenter {
Setting filterMode = rendererSection.getSetting(SettingsFile.KEY_FILTER_MODE);
Setting useAsynchronousGpuEmulation = rendererSection.getSetting(SettingsFile.KEY_USE_ASYNCHRONOUS_GPU_EMULATION);
Setting shadersAccurateMul = rendererSection.getSetting(SettingsFile.KEY_SHADERS_ACCURATE_MUL);
Setting render3dMode = rendererSection.getSetting(SettingsFile.KEY_RENDER_3D);
Setting factor3d = rendererSection.getSetting(SettingsFile.KEY_FACTOR_3D);
sl.add(new HeaderSetting(null, null, R.string.renderer, 0));
sl.add(new SliderSetting(SettingsFile.KEY_RESOLUTION_FACTOR, Settings.SECTION_RENDERER, R.string.internal_resolution, R.string.internal_resolution_description, 1, 4, "x", 1, resolutionFactor));
sl.add(new CheckBoxSetting(SettingsFile.KEY_FILTER_MODE, Settings.SECTION_RENDERER, R.string.linear_filtering, R.string.linear_filtering_description, true, filterMode));
sl.add(new CheckBoxSetting(SettingsFile.KEY_USE_ASYNCHRONOUS_GPU_EMULATION, Settings.SECTION_RENDERER, R.string.asynchronous_gpu, R.string.asynchronous_gpu_description, true, useAsynchronousGpuEmulation));
sl.add(new CheckBoxSetting(SettingsFile.KEY_SHADERS_ACCURATE_MUL, Settings.SECTION_RENDERER, R.string.shaders_accurate_mul, R.string.shaders_accurate_mul_description, false, shadersAccurateMul));
sl.add(new HeaderSetting(null, null, R.string.stereoscopy, 0));
sl.add(new SingleChoiceSetting(SettingsFile.KEY_RENDER_3D, Settings.SECTION_RENDERER, R.string.render3d, 0, R.array.render3dModes, R.array.render3dValues, 0, render3dMode));
sl.add(new SliderSetting(SettingsFile.KEY_FACTOR_3D, Settings.SECTION_RENDERER, R.string.factor3d, R.string.factor3d_description, 0, 100, "%", 0, factor3d));
}
private void addAudioSettings(ArrayList<SettingsItem> sl) {

View File

@ -50,7 +50,9 @@ public final class SettingsFile {
public static final String KEY_BACKGROUND_RED = "bg_red";
public static final String KEY_BACKGROUND_BLUE = "bg_blue";
public static final String KEY_BACKGROUND_GREEN = "bg_green";
public static final String KEY_RENDER_3D = "render_3d";
public static final String KEY_FACTOR_3D = "factor_3d";
public static final String KEY_PP_SHADER_NAME = "pp_shader_name";
public static final String KEY_FILTER_MODE = "filter_mode";
public static final String KEY_TEXTURE_FILTER_NAME = "texture_filter_name";
public static final String KEY_USE_ASYNCHRONOUS_GPU_EMULATION = "use_asynchronous_gpu_emulation";

View File

@ -132,10 +132,13 @@ void Config::ReadValues() {
sdl2_config->GetInteger("Renderer", "render_3d", 0));
Settings::values.factor_3d =
static_cast<u8>(sdl2_config->GetInteger("Renderer", "factor_3d", 0));
Settings::values.pp_shader_name = sdl2_config->GetString(
"Renderer", "pp_shader_name",
(Settings::values.render_3d == Settings::StereoRenderOption::Anaglyph) ? "dubois (builtin)"
: "none (builtin)");
std::string default_shader = "none (builtin)";
if (Settings::values.render_3d == Settings::StereoRenderOption::Anaglyph)
default_shader = "dubois (builtin)";
else if (Settings::values.render_3d == Settings::StereoRenderOption::Interlaced)
default_shader = "horizontal (builtin)";
Settings::values.pp_shader_name =
sdl2_config->GetString("Renderer", "pp_shader_name", default_shader);
Settings::values.filter_mode = sdl2_config->GetBoolean("Renderer", "filter_mode", true);
Settings::values.bg_red = static_cast<float>(sdl2_config->GetReal("Renderer", "bg_red", 0.0));

View File

@ -140,7 +140,7 @@ bg_blue =
bg_green =
# Whether and how Stereoscopic 3D should be rendered
# 0 (default): Off, 1: Side by Side, 2: Anaglyph
# 0 (default): Off, 1: Side by Side, 2: Anaglyph, 3: Interlaced
render_3d =
# Change 3D Intensity

View File

@ -153,4 +153,18 @@
<item>1</item>
<item>2</item>
</integer-array>
<string-array name="render3dModes">
<item>Off</item>
<item>Side by Side</item>
<item>Anaglyph</item>
<item>Interlaced</item>
</string-array>
<integer-array name="render3dValues">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
</integer-array>
</resources>

View File

@ -66,6 +66,7 @@
<string name="image_flip">Image Flip</string>
<!-- Graphics settings strings -->
<string name="renderer">Renderer</string>
<string name="vsync">Enable V-Sync</string>
<string name="vsync_description">Synchronizes the game frame rate to the refresh rate of your device.</string>
<string name="linear_filtering">Enable linear filtering</string>
@ -88,6 +89,10 @@
<string name="internal_resolution_description">Specifies the resolution used to render at. A high resolution will improve visual quality a lot but is also quite heavy on performance and might cause glitches in certain games.</string>
<string name="performance_warning">Turning off this setting will significantly reduce emulation performance! For the best experience, it is recommended that you leave this setting enabled.</string>
<string name="debug_warning">Warning: Modifying these settings will slow emulation</string>
<string name="stereoscopy">Stereoscopy</string>
<string name="render3d">Stereoscopic 3D Mode</string>
<string name="factor3d">Depth</string>
<string name="factor3d_description">Specifies the value of the 3D slider. This should be set to higher than 0% when Stereoscopic 3D is enabled.</string>
<!-- Premium strings -->
<string name="premium_text">Premium</string>