From c8ff1d744ac4b457edbf41e93d495a75c3f1dcee Mon Sep 17 00:00:00 2001 From: Vitor K Date: Fri, 23 Dec 2022 23:17:49 -0300 Subject: [PATCH] Change Monoscopic Render mode to a dropdown (#6215) --- src/citra/config.cpp | 4 +- src/citra/default_ini.h | 4 +- src/citra_qt/configuration/config.cpp | 4 +- .../configuration/configure_enhancements.cpp | 6 ++- .../configuration/configure_enhancements.ui | 41 ++++++++++++------- src/common/settings.cpp | 2 +- src/common/settings.h | 7 +++- src/core/telemetry_session.cpp | 4 +- .../renderer_opengl/renderer_opengl.cpp | 4 +- 9 files changed, 47 insertions(+), 29 deletions(-) diff --git a/src/citra/config.cpp b/src/citra/config.cpp index fb8559c8f..64d33a930 100644 --- a/src/citra/config.cpp +++ b/src/citra/config.cpp @@ -133,8 +133,8 @@ void Config::ReadValues() { Settings::values.texture_filter_name = sdl2_config->GetString("Renderer", "texture_filter_name", "none"); - Settings::values.mono_render_left_eye = - sdl2_config->GetBoolean("Renderer", "mono_render_left_eye", true); + Settings::values.mono_render_option = static_cast( + sdl2_config->GetInteger("Renderer", "mono_render_option", 0)); Settings::values.render_3d = static_cast( sdl2_config->GetInteger("Renderer", "render_3d", 0)); Settings::values.factor_3d = diff --git a/src/citra/default_ini.h b/src/citra/default_ini.h index 3c17d9dce..e84532a3c 100644 --- a/src/citra/default_ini.h +++ b/src/citra/default_ini.h @@ -167,8 +167,8 @@ render_3d = factor_3d = # Change Default Eye to Render When in Monoscopic Mode -# 0 (default): Right, 1: Left -mono_render_left_eye = +# 0 (default): Left, 1: Right +mono_render_option = # The name of the post processing shader to apply. # Loaded from shaders if render_3d is off or side by side. diff --git a/src/citra_qt/configuration/config.cpp b/src/citra_qt/configuration/config.cpp index 212bc351f..744f6422f 100644 --- a/src/citra_qt/configuration/config.cpp +++ b/src/citra_qt/configuration/config.cpp @@ -483,7 +483,7 @@ void Config::ReadLayoutValues() { ReadGlobalSetting(Settings::values.upright_screen); if (global) { - ReadBasicSetting(Settings::values.mono_render_left_eye); + ReadBasicSetting(Settings::values.mono_render_option); ReadBasicSetting(Settings::values.custom_layout); ReadBasicSetting(Settings::values.custom_top_left); ReadBasicSetting(Settings::values.custom_top_top); @@ -991,7 +991,7 @@ void Config::SaveLayoutValues() { WriteGlobalSetting(Settings::values.upright_screen); if (global) { - WriteBasicSetting(Settings::values.mono_render_left_eye); + WriteBasicSetting(Settings::values.mono_render_option); WriteBasicSetting(Settings::values.custom_layout); WriteBasicSetting(Settings::values.custom_top_left); WriteBasicSetting(Settings::values.custom_top_top); diff --git a/src/citra_qt/configuration/configure_enhancements.cpp b/src/citra_qt/configuration/configure_enhancements.cpp index 23f3b62d5..f48612d34 100644 --- a/src/citra_qt/configuration/configure_enhancements.cpp +++ b/src/citra_qt/configuration/configure_enhancements.cpp @@ -54,7 +54,8 @@ void ConfigureEnhancements::SetConfiguration() { ui->render_3d_combobox->setCurrentIndex( static_cast(Settings::values.render_3d.GetValue())); ui->factor_3d->setValue(Settings::values.factor_3d.GetValue()); - ui->mono_render_left_eye->setChecked(Settings::values.mono_render_left_eye.GetValue()); + ui->mono_rendering_eye->setCurrentIndex( + static_cast(Settings::values.mono_render_option.GetValue())); updateShaders(Settings::values.render_3d.GetValue()); ui->toggle_linear_filter->setChecked(Settings::values.filter_mode.GetValue()); int tex_filter_idx = ui->texture_filter_combobox->findText( @@ -111,7 +112,8 @@ void ConfigureEnhancements::ApplyConfiguration() { Settings::values.render_3d = static_cast(ui->render_3d_combobox->currentIndex()); Settings::values.factor_3d = ui->factor_3d->value(); - Settings::values.mono_render_left_eye = ui->mono_render_left_eye->isChecked(); + Settings::values.mono_render_option = + static_cast(ui->mono_rendering_eye->currentIndex()); Settings::values.pp_shader_name = ui->shader_combobox->itemText(ui->shader_combobox->currentIndex()).toStdString(); Settings::values.filter_mode = ui->toggle_linear_filter->isChecked(); diff --git a/src/citra_qt/configuration/configure_enhancements.ui b/src/citra_qt/configuration/configure_enhancements.ui index b218ae9df..0d4ed0161 100644 --- a/src/citra_qt/configuration/configure_enhancements.ui +++ b/src/citra_qt/configuration/configure_enhancements.ui @@ -207,20 +207,31 @@ - - - - - - <html><head/><body><p>If false, right eye will be used. Useful if using ReShade</p></body></html> - - - Render Left Eye in Monoscopic Mode - - - - - + + + + + + Eye to Render in Monoscopic Mode + + + + + + + + Left Eye (default) + + + + + Right Eye + + + + + + @@ -369,7 +380,7 @@ texture_filter_combobox render_3d_combobox factor_3d - mono_render_left_eye + mono_rendering_eye layout_combobox swap_screen upright_screen diff --git a/src/common/settings.cpp b/src/common/settings.cpp index 15eda8ab8..44627a6b7 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp @@ -109,7 +109,7 @@ void LogSettings() { log_setting("Renderer_TextureFilterName", values.texture_filter_name.GetValue()); log_setting("Stereoscopy_Render3d", values.render_3d.GetValue()); log_setting("Stereoscopy_Factor3d", values.factor_3d.GetValue()); - log_setting("Stereoscopy_MonoRenderLeftEye", values.mono_render_left_eye.GetValue()); + log_setting("Stereoscopy_MonoRenderOption", values.mono_render_option.GetValue()); log_setting("Layout_LayoutOption", values.layout_option.GetValue()); log_setting("Layout_SwapScreen", values.swap_screen.GetValue()); log_setting("Layout_UprightScreen", values.upright_screen.GetValue()); diff --git a/src/common/settings.h b/src/common/settings.h index 9cd058f0d..7fec09ba0 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -52,6 +52,10 @@ enum class StereoRenderOption : u32 { CardboardVR = 5 }; +// Which eye to render when 3d is off. 800px wide mode could be added here in the future, when +// implemented +enum class MonoRenderOption : u32 { LeftEye = 0, RightEye = 1 }; + enum class AudioEmulation : u32 { HLE = 0, LLE = 1, LLEMultithreaded = 2 }; namespace NativeButton { @@ -467,8 +471,9 @@ struct Values { SwitchableSetting render_3d{StereoRenderOption::Off, "render_3d"}; SwitchableSetting factor_3d{0, "factor_3d"}; + SwitchableSetting mono_render_option{MonoRenderOption::LeftEye, + "mono_render_option"}; - Setting mono_render_left_eye{false, "mono_render_left_eye"}; Setting cardboard_screen_size{85, "cardboard_screen_size"}; Setting cardboard_x_shift{0, "cardboard_x_shift"}; Setting cardboard_y_shift{0, "cardboard_y_shift"}; diff --git a/src/core/telemetry_session.cpp b/src/core/telemetry_session.cpp index 1092777b1..f7a7754e5 100644 --- a/src/core/telemetry_session.cpp +++ b/src/core/telemetry_session.cpp @@ -149,8 +149,8 @@ void TelemetrySession::AddInitialInfo(Loader::AppLoader& app_loader) { static_cast(Settings::values.render_3d.GetValue())); AddField(Telemetry::FieldType::UserConfig, "Renderer_Factor3d", Settings::values.factor_3d.GetValue()); - AddField(Telemetry::FieldType::UserConfig, "Renderer_MonoRenderLeftEye", - Settings::values.mono_render_left_eye.GetValue()); + AddField(Telemetry::FieldType::UserConfig, "Renderer_MonoRenderOption", + static_cast(Settings::values.mono_render_option.GetValue())); AddField(Telemetry::FieldType::UserConfig, "System_IsNew3ds", Settings::values.is_new_3ds.GetValue()); AddField(Telemetry::FieldType::UserConfig, "System_RegionValue", diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index 1e1126345..5b8b7f060 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp @@ -1005,7 +1005,7 @@ void RendererOpenGL::DrawScreens(const Layout::FramebufferLayout& layout, bool f if (layout.top_screen_enabled) { if (layout.is_rotated) { if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::Off) { - int eye = Settings::values.mono_render_left_eye ? 0 : 1; + int eye = static_cast(Settings::values.mono_render_option.GetValue()); DrawSingleScreenRotated(screen_infos[eye], (float)top_screen.left, (float)top_screen.top, (float)top_screen.GetWidth(), (float)top_screen.GetHeight()); @@ -1037,7 +1037,7 @@ void RendererOpenGL::DrawScreens(const Layout::FramebufferLayout& layout, bool f } } else { if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::Off) { - int eye = Settings::values.mono_render_left_eye.GetValue() ? 0 : 1; + int eye = static_cast(Settings::values.mono_render_option.GetValue()); DrawSingleScreen(screen_infos[eye], (float)top_screen.left, (float)top_screen.top, (float)top_screen.GetWidth(), (float)top_screen.GetHeight()); } else if (Settings::values.render_3d.GetValue() ==