From 664562f98879bd6dd4d9d81874b4c6113018cb5c Mon Sep 17 00:00:00 2001 From: Jake Downs Date: Wed, 16 Nov 2022 09:54:26 -0800 Subject: [PATCH] add mono_render_left_eye option (#6140) --- src/citra/config.cpp | 2 ++ src/citra/default_ini.h | 4 ++++ src/citra_qt/configuration/config.cpp | 4 ++++ .../configuration/configure_enhancements.cpp | 2 ++ .../configuration/configure_enhancements.ui | 15 +++++++++++++++ src/core/settings.cpp | 1 + src/core/settings.h | 2 ++ src/core/telemetry_session.cpp | 2 ++ .../renderer_opengl/renderer_opengl.cpp | 6 ++++-- 9 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/citra/config.cpp b/src/citra/config.cpp index 477318ac0..78ce2e00c 100644 --- a/src/citra/config.cpp +++ b/src/citra/config.cpp @@ -137,6 +137,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.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 568ff43be..e8cc6ee03 100644 --- a/src/citra/default_ini.h +++ b/src/citra/default_ini.h @@ -166,6 +166,10 @@ render_3d = # 0 - 100: Intensity. 0 (default) factor_3d = +# Change Default Eye to Render When in Monoscopic Mode +# 0 (default): Right, 1: Left +mono_render_left_eye = + # The name of the post processing shader to apply. # Loaded from shaders if render_3d is off or side by side. # Loaded from shaders/anaglyph if render_3d is anaglyph diff --git a/src/citra_qt/configuration/config.cpp b/src/citra_qt/configuration/config.cpp index 525e2e5b9..d3fc3fbdc 100644 --- a/src/citra_qt/configuration/config.cpp +++ b/src/citra_qt/configuration/config.cpp @@ -345,6 +345,8 @@ void Config::ReadLayoutValues() { Settings::values.render_3d = static_cast( ReadSetting(QStringLiteral("render_3d"), 0).toInt()); Settings::values.factor_3d = ReadSetting(QStringLiteral("factor_3d"), 0).toInt(); + Settings::values.mono_render_left_eye = + ReadSetting(QStringLiteral("mono_render_left_eye"), true).toBool(); Settings::values.pp_shader_name = ReadSetting(QStringLiteral("pp_shader_name"), (Settings::values.render_3d == Settings::StereoRenderOption::Anaglyph) @@ -899,6 +901,8 @@ void Config::SaveLayoutValues() { WriteSetting(QStringLiteral("render_3d"), static_cast(Settings::values.render_3d), 0); WriteSetting(QStringLiteral("factor_3d"), Settings::values.factor_3d.load(), 0); + WriteSetting(QStringLiteral("mono_render_left_eye"), Settings::values.mono_render_left_eye, + false); WriteSetting(QStringLiteral("pp_shader_name"), QString::fromStdString(Settings::values.pp_shader_name), (Settings::values.render_3d == Settings::StereoRenderOption::Anaglyph) diff --git a/src/citra_qt/configuration/configure_enhancements.cpp b/src/citra_qt/configuration/configure_enhancements.cpp index d93155847..0efb86fba 100644 --- a/src/citra_qt/configuration/configure_enhancements.cpp +++ b/src/citra_qt/configuration/configure_enhancements.cpp @@ -53,6 +53,7 @@ void ConfigureEnhancements::SetConfiguration() { ui->resolution_factor_combobox->setCurrentIndex(Settings::values.resolution_factor); ui->render_3d_combobox->setCurrentIndex(static_cast(Settings::values.render_3d)); ui->factor_3d->setValue(Settings::values.factor_3d); + ui->mono_render_left_eye->setChecked(Settings::values.mono_render_left_eye); updateShaders(Settings::values.render_3d); ui->toggle_linear_filter->setChecked(Settings::values.filter_mode); int tex_filter_idx = ui->texture_filter_combobox->findText( @@ -107,6 +108,7 @@ 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.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 2d1453ba7..d96182cf0 100644 --- a/src/citra_qt/configuration/configure_enhancements.ui +++ b/src/citra_qt/configuration/configure_enhancements.ui @@ -207,6 +207,20 @@ + + + + + + <html><head/><body><p>If false, right eye will be used. Useful if using ReShade</p></body></html> + + + Render Left Eye in Monoscopic Mode + + + + + @@ -350,6 +364,7 @@ texture_filter_combobox render_3d_combobox factor_3d + mono_render_left_eye layout_combobox swap_screen upright_screen diff --git a/src/core/settings.cpp b/src/core/settings.cpp index fd1f94bf7..b05389cc1 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp @@ -95,6 +95,7 @@ void LogSettings() { log_setting("Renderer_TextureFilterName", values.texture_filter_name); log_setting("Stereoscopy_Render3d", values.render_3d); log_setting("Stereoscopy_Factor3d", values.factor_3d); + log_setting("Stereoscopy_MonoRenderLeftEye", values.mono_render_left_eye); log_setting("Layout_LayoutOption", values.layout_option); log_setting("Layout_SwapScreen", values.swap_screen); log_setting("Layout_UprightScreen", values.upright_screen); diff --git a/src/core/settings.h b/src/core/settings.h index 518f1a8eb..abb67c404 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -196,6 +196,8 @@ struct Values { StereoRenderOption render_3d; std::atomic factor_3d; + bool mono_render_left_eye; + int cardboard_screen_size; int cardboard_x_shift; int cardboard_y_shift; diff --git a/src/core/telemetry_session.cpp b/src/core/telemetry_session.cpp index c9f7c6841..bd84f50d7 100644 --- a/src/core/telemetry_session.cpp +++ b/src/core/telemetry_session.cpp @@ -149,6 +149,8 @@ void TelemetrySession::AddInitialInfo(Loader::AppLoader& app_loader) { static_cast(Settings::values.render_3d)); AddField(Telemetry::FieldType::UserConfig, "Renderer_Factor3d", Settings::values.factor_3d.load()); + AddField(Telemetry::FieldType::UserConfig, "Renderer_MonoRenderLeftEye", + Settings::values.mono_render_left_eye); AddField(Telemetry::FieldType::UserConfig, "System_IsNew3ds", Settings::values.is_new_3ds); AddField(Telemetry::FieldType::UserConfig, "System_RegionValue", Settings::values.region_value); } diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index 8b66b1978..fe24a7c59 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp @@ -991,7 +991,8 @@ void RendererOpenGL::DrawScreens(const Layout::FramebufferLayout& layout, bool f if (layout.top_screen_enabled) { if (layout.is_rotated) { if (Settings::values.render_3d == Settings::StereoRenderOption::Off) { - DrawSingleScreenRotated(screen_infos[0], (float)top_screen.left, + int eye = Settings::values.mono_render_left_eye ? 0 : 1; + DrawSingleScreenRotated(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 == Settings::StereoRenderOption::SideBySide) { @@ -1020,7 +1021,8 @@ void RendererOpenGL::DrawScreens(const Layout::FramebufferLayout& layout, bool f } } else { if (Settings::values.render_3d == Settings::StereoRenderOption::Off) { - DrawSingleScreen(screen_infos[0], (float)top_screen.left, (float)top_screen.top, + int eye = Settings::values.mono_render_left_eye ? 0 : 1; + 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 == Settings::StereoRenderOption::SideBySide) { DrawSingleScreen(screen_infos[0], (float)top_screen.left / 2, (float)top_screen.top,