From 386cd45f07b83824fc539f8a72429ebf73f5daf4 Mon Sep 17 00:00:00 2001 From: ameerj <52414509+ameerj@users.noreply.github.com> Date: Thu, 8 Jul 2021 20:58:38 -0400 Subject: configure_audio: Use u8 for volume value --- src/yuzu_cmd/default_ini.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/yuzu_cmd') diff --git a/src/yuzu_cmd/default_ini.h b/src/yuzu_cmd/default_ini.h index cc9850aad..d2a7cd024 100644 --- a/src/yuzu_cmd/default_ini.h +++ b/src/yuzu_cmd/default_ini.h @@ -281,7 +281,7 @@ enable_audio_stretching = output_device = # Output volume. -# 1.0 (default): 100%, 0.0; mute +# 100 (default): 100%, 0; mute volume = [Data Storage] -- cgit v1.2.3 From 8284658bac04837756287d2f6b36485c8a2833dc Mon Sep 17 00:00:00 2001 From: ameerj <52414509+ameerj@users.noreply.github.com> Date: Thu, 8 Jul 2021 21:45:01 -0400 Subject: configure_graphics: Use u8 for bg_color values --- src/common/settings.h | 6 +++--- src/video_core/renderer_opengl/renderer_opengl.cpp | 8 +++----- src/video_core/renderer_vulkan/vk_blit_screen.cpp | 5 ++++- src/yuzu/configuration/configure_graphics.cpp | 18 +++++++++--------- src/yuzu_cmd/default_ini.h | 2 +- 5 files changed, 20 insertions(+), 19 deletions(-) (limited to 'src/yuzu_cmd') diff --git a/src/common/settings.h b/src/common/settings.h index 5305f1ed8..898798212 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -333,9 +333,9 @@ struct Values { Setting use_fast_gpu_time{true, "use_fast_gpu_time"}; Setting use_caches_gc{false, "use_caches_gc"}; - Setting bg_red{0.0f, "bg_red"}; - Setting bg_green{0.0f, "bg_green"}; - Setting bg_blue{0.0f, "bg_blue"}; + Setting bg_red{0, "bg_red"}; + Setting bg_green{0, "bg_green"}; + Setting bg_blue{0, "bg_blue"}; // System Setting> rng_seed{std::optional(), "rng_seed"}; diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index a718bff7a..c12929de6 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp @@ -229,9 +229,6 @@ void RendererOpenGL::LoadColorToActiveGLTexture(u8 color_r, u8 color_g, u8 color } void RendererOpenGL::InitOpenGLObjects() { - glClearColor(Settings::values.bg_red.GetValue(), Settings::values.bg_green.GetValue(), - Settings::values.bg_blue.GetValue(), 0.0f); - // Create shader programs OGLShader vertex_shader; vertex_shader.Create(HostShaders::OPENGL_PRESENT_VERT, GL_VERTEX_SHADER); @@ -337,8 +334,9 @@ void RendererOpenGL::ConfigureFramebufferTexture(TextureInfo& texture, void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) { if (renderer_settings.set_background_color) { // Update background color before drawing - glClearColor(Settings::values.bg_red.GetValue(), Settings::values.bg_green.GetValue(), - Settings::values.bg_blue.GetValue(), 0.0f); + glClearColor(Settings::values.bg_red.GetValue() / 255.0f, + Settings::values.bg_green.GetValue() / 255.0f, + Settings::values.bg_blue.GetValue() / 255.0f, 1.0f); } // Set projection matrix diff --git a/src/video_core/renderer_vulkan/vk_blit_screen.cpp b/src/video_core/renderer_vulkan/vk_blit_screen.cpp index a1a32aabe..363134129 100644 --- a/src/video_core/renderer_vulkan/vk_blit_screen.cpp +++ b/src/video_core/renderer_vulkan/vk_blit_screen.cpp @@ -225,8 +225,11 @@ VkSemaphore VKBlitScreen::Draw(const Tegra::FramebufferConfig& framebuffer, bool descriptor_set = descriptor_sets[image_index], buffer = *buffer, size = swapchain.GetSize(), pipeline = *pipeline, layout = *pipeline_layout](vk::CommandBuffer cmdbuf) { + const f32 bg_red = Settings::values.bg_red.GetValue() / 255.0f; + const f32 bg_green = Settings::values.bg_green.GetValue() / 255.0f; + const f32 bg_blue = Settings::values.bg_blue.GetValue() / 255.0f; const VkClearValue clear_color{ - .color = {.float32 = {0.0f, 0.0f, 0.0f, 0.0f}}, + .color = {.float32 = {bg_red, bg_green, bg_blue, 1.0f}}, }; const VkRenderPassBeginInfo renderpass_bi{ .sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO, diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index 41a69d9b8..4d5b4c0e6 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp @@ -101,9 +101,9 @@ void ConfigureGraphics::SetConfiguration() { ConfigurationShared::SetHighlight(ui->bg_layout, !Settings::values.bg_red.UsingGlobal()); } - UpdateBackgroundColorButton(QColor::fromRgbF(Settings::values.bg_red.GetValue(), - Settings::values.bg_green.GetValue(), - Settings::values.bg_blue.GetValue())); + UpdateBackgroundColorButton(QColor::fromRgb(Settings::values.bg_red.GetValue(), + Settings::values.bg_green.GetValue(), + Settings::values.bg_blue.GetValue())); UpdateDeviceComboBox(); } @@ -132,9 +132,9 @@ void ConfigureGraphics::ApplyConfiguration() { Settings::values.vulkan_device.SetValue(vulkan_device); } if (Settings::values.bg_red.UsingGlobal()) { - Settings::values.bg_red.SetValue(static_cast(bg_color.redF())); - Settings::values.bg_green.SetValue(static_cast(bg_color.greenF())); - Settings::values.bg_blue.SetValue(static_cast(bg_color.blueF())); + Settings::values.bg_red.SetValue(static_cast(bg_color.red())); + Settings::values.bg_green.SetValue(static_cast(bg_color.green())); + Settings::values.bg_blue.SetValue(static_cast(bg_color.blue())); } } else { if (ui->api->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { @@ -159,9 +159,9 @@ void ConfigureGraphics::ApplyConfiguration() { Settings::values.bg_red.SetGlobal(false); Settings::values.bg_green.SetGlobal(false); Settings::values.bg_blue.SetGlobal(false); - Settings::values.bg_red.SetValue(static_cast(bg_color.redF())); - Settings::values.bg_green.SetValue(static_cast(bg_color.greenF())); - Settings::values.bg_blue.SetValue(static_cast(bg_color.blueF())); + Settings::values.bg_red.SetValue(static_cast(bg_color.red())); + Settings::values.bg_green.SetValue(static_cast(bg_color.green())); + Settings::values.bg_blue.SetValue(static_cast(bg_color.blue())); } } } diff --git a/src/yuzu_cmd/default_ini.h b/src/yuzu_cmd/default_ini.h index d2a7cd024..7d6bcccc7 100644 --- a/src/yuzu_cmd/default_ini.h +++ b/src/yuzu_cmd/default_ini.h @@ -232,7 +232,7 @@ use_vsync = use_caches_gc = # The clear color for the renderer. What shows up on the sides of the bottom screen. -# Must be in range of 0.0-1.0. Defaults to 1.0 for all. +# Must be in range of 0-255. Defaults to 0 for all. bg_red = bg_blue = bg_green = -- cgit v1.2.3 From f9139ddab78d5995c981228c33e32c52a22170df Mon Sep 17 00:00:00 2001 From: ameerj <52414509+ameerj@users.noreply.github.com> Date: Thu, 8 Jul 2021 22:04:24 -0400 Subject: config: Remove float {Read,Write}Setting variants --- src/yuzu/configuration/config.cpp | 25 ------------------------- src/yuzu_cmd/config.cpp | 6 ++---- 2 files changed, 2 insertions(+), 29 deletions(-) (limited to 'src/yuzu_cmd') diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 1a0f75373..6ea529171 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -311,16 +311,6 @@ void Config::WriteBasicSetting(const Settings::BasicSetting& settin qt_config->setValue(name, QString::fromStdString(value)); } -// Explicit float definition: use a double as Qt doesn't write legible floats to config files -template <> -void Config::WriteBasicSetting(const Settings::BasicSetting& setting) { - const QString name = QString::fromStdString(setting.GetLabel()); - const double value = setting.GetValue(); - qt_config->setValue(name + QStringLiteral("/default"), - setting.GetValue() == setting.GetDefault()); - qt_config->setValue(name, value); -} - template void Config::WriteBasicSetting(const Settings::BasicSetting& setting) { const QString name = QString::fromStdString(setting.GetLabel()); @@ -329,21 +319,6 @@ void Config::WriteBasicSetting(const Settings::BasicSetting& setting) { qt_config->setValue(name, value); } -// Explicit float definition: use a double as Qt doesn't write legible floats to config files -template <> -void Config::WriteGlobalSetting(const Settings::Setting& setting) { - const QString name = QString::fromStdString(setting.GetLabel()); - const double value = setting.GetValue(global); - if (!global) { - qt_config->setValue(name + QStringLiteral("/use_global"), setting.UsingGlobal()); - } - if (global || !setting.UsingGlobal()) { - qt_config->setValue(name + QStringLiteral("/default"), - setting.GetValue(global) == setting.GetDefault()); - qt_config->setValue(name, value); - } -} - template void Config::WriteGlobalSetting(const Settings::Setting& setting) { const QString name = QString::fromStdString(setting.GetLabel()); diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp index 325584a1a..23ada3f92 100644 --- a/src/yuzu_cmd/config.cpp +++ b/src/yuzu_cmd/config.cpp @@ -241,18 +241,16 @@ static const std::array keyboard_mods{ SDL_SCANCODE_RCTRL, SDL_SCANCODE_RSHIFT, SDL_SCANCODE_RALT, SDL_SCANCODE_RGUI, }; -template <> -void Config::ReadSetting(const std::string& group, Settings::BasicSetting& setting) { - setting = sdl2_config->GetReal(group, setting.GetLabel(), setting.GetDefault()); -} template <> void Config::ReadSetting(const std::string& group, Settings::BasicSetting& setting) { setting = sdl2_config->Get(group, setting.GetLabel(), setting.GetDefault()); } + template <> void Config::ReadSetting(const std::string& group, Settings::BasicSetting& setting) { setting = sdl2_config->GetBoolean(group, setting.GetLabel(), setting.GetDefault()); } + template void Config::ReadSetting(const std::string& group, Settings::BasicSetting& setting) { setting = static_cast(sdl2_config->GetInteger(group, setting.GetLabel(), -- cgit v1.2.3