summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/settings.cpp2
-rw-r--r--src/common/settings.h10
-rw-r--r--src/input_common/mouse/mouse_poller.cpp2
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.cpp8
-rw-r--r--src/video_core/renderer_vulkan/vk_blit_screen.cpp5
-rw-r--r--src/yuzu/configuration/config.cpp25
-rw-r--r--src/yuzu/configuration/configure_audio.cpp13
-rw-r--r--src/yuzu/configuration/configure_graphics.cpp18
-rw-r--r--src/yuzu/configuration/configure_input_advanced.ui15
-rw-r--r--src/yuzu_cmd/config.cpp6
-rw-r--r--src/yuzu_cmd/default_ini.h4
11 files changed, 39 insertions, 69 deletions
diff --git a/src/common/settings.cpp b/src/common/settings.cpp
index e1973af85..bf5514386 100644
--- a/src/common/settings.cpp
+++ b/src/common/settings.cpp
@@ -103,7 +103,7 @@ float Volume() {
103 if (values.audio_muted) { 103 if (values.audio_muted) {
104 return 0.0f; 104 return 0.0f;
105 } 105 }
106 return values.volume.GetValue(); 106 return values.volume.GetValue() / 100.0f;
107} 107}
108 108
109void RestoreGlobalState(bool is_powered_on) { 109void RestoreGlobalState(bool is_powered_on) {
diff --git a/src/common/settings.h b/src/common/settings.h
index 71d0f864f..832358036 100644
--- a/src/common/settings.h
+++ b/src/common/settings.h
@@ -278,7 +278,7 @@ struct Values {
278 BasicSetting<std::string> sink_id{"auto", "output_engine"}; 278 BasicSetting<std::string> sink_id{"auto", "output_engine"};
279 BasicSetting<bool> audio_muted{false, "audio_muted"}; 279 BasicSetting<bool> audio_muted{false, "audio_muted"};
280 Setting<bool> enable_audio_stretching{true, "enable_audio_stretching"}; 280 Setting<bool> enable_audio_stretching{true, "enable_audio_stretching"};
281 Setting<float> volume{1.0f, "volume"}; 281 Setting<u8> volume{100, "volume"};
282 282
283 // Core 283 // Core
284 Setting<bool> use_multi_core{true, "use_multi_core"}; 284 Setting<bool> use_multi_core{true, "use_multi_core"};
@@ -336,9 +336,9 @@ struct Values {
336 Setting<bool> use_fast_gpu_time{true, "use_fast_gpu_time"}; 336 Setting<bool> use_fast_gpu_time{true, "use_fast_gpu_time"};
337 Setting<bool> use_caches_gc{false, "use_caches_gc"}; 337 Setting<bool> use_caches_gc{false, "use_caches_gc"};
338 338
339 Setting<float> bg_red{0.0f, "bg_red"}; 339 Setting<u8> bg_red{0, "bg_red"};
340 Setting<float> bg_green{0.0f, "bg_green"}; 340 Setting<u8> bg_green{0, "bg_green"};
341 Setting<float> bg_blue{0.0f, "bg_blue"}; 341 Setting<u8> bg_blue{0, "bg_blue"};
342 342
343 // System 343 // System
344 Setting<std::optional<u32>> rng_seed{std::optional<u32>(), "rng_seed"}; 344 Setting<std::optional<u32>> rng_seed{std::optional<u32>(), "rng_seed"};
@@ -368,7 +368,7 @@ struct Values {
368 "udp_input_servers"}; 368 "udp_input_servers"};
369 369
370 BasicSetting<bool> mouse_panning{false, "mouse_panning"}; 370 BasicSetting<bool> mouse_panning{false, "mouse_panning"};
371 BasicSetting<float> mouse_panning_sensitivity{1.0f, "mouse_panning_sensitivity"}; 371 BasicSetting<u8> mouse_panning_sensitivity{1, "mouse_panning_sensitivity"};
372 BasicSetting<bool> mouse_enabled{false, "mouse_enabled"}; 372 BasicSetting<bool> mouse_enabled{false, "mouse_enabled"};
373 std::string mouse_device; 373 std::string mouse_device;
374 MouseButtonsRaw mouse_buttons; 374 MouseButtonsRaw mouse_buttons;
diff --git a/src/input_common/mouse/mouse_poller.cpp b/src/input_common/mouse/mouse_poller.cpp
index 45b3d7340..1e84eaddd 100644
--- a/src/input_common/mouse/mouse_poller.cpp
+++ b/src/input_common/mouse/mouse_poller.cpp
@@ -84,7 +84,7 @@ public:
84 std::lock_guard lock{mutex}; 84 std::lock_guard lock{mutex};
85 const auto axis_value = 85 const auto axis_value =
86 static_cast<float>(mouse_input->GetMouseState(button).axis.at(axis)); 86 static_cast<float>(mouse_input->GetMouseState(button).axis.at(axis));
87 const float sensitivity = Settings::values.mouse_panning_sensitivity.GetValue(); 87 const float sensitivity = Settings::values.mouse_panning_sensitivity.GetValue() * 0.15f;
88 return axis_value * sensitivity / (100.0f * range); 88 return axis_value * sensitivity / (100.0f * range);
89 } 89 }
90 90
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
229} 229}
230 230
231void RendererOpenGL::InitOpenGLObjects() { 231void RendererOpenGL::InitOpenGLObjects() {
232 glClearColor(Settings::values.bg_red.GetValue(), Settings::values.bg_green.GetValue(),
233 Settings::values.bg_blue.GetValue(), 0.0f);
234
235 // Create shader programs 232 // Create shader programs
236 OGLShader vertex_shader; 233 OGLShader vertex_shader;
237 vertex_shader.Create(HostShaders::OPENGL_PRESENT_VERT, GL_VERTEX_SHADER); 234 vertex_shader.Create(HostShaders::OPENGL_PRESENT_VERT, GL_VERTEX_SHADER);
@@ -337,8 +334,9 @@ void RendererOpenGL::ConfigureFramebufferTexture(TextureInfo& texture,
337void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) { 334void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) {
338 if (renderer_settings.set_background_color) { 335 if (renderer_settings.set_background_color) {
339 // Update background color before drawing 336 // Update background color before drawing
340 glClearColor(Settings::values.bg_red.GetValue(), Settings::values.bg_green.GetValue(), 337 glClearColor(Settings::values.bg_red.GetValue() / 255.0f,
341 Settings::values.bg_blue.GetValue(), 0.0f); 338 Settings::values.bg_green.GetValue() / 255.0f,
339 Settings::values.bg_blue.GetValue() / 255.0f, 1.0f);
342 } 340 }
343 341
344 // Set projection matrix 342 // 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
225 descriptor_set = descriptor_sets[image_index], buffer = *buffer, 225 descriptor_set = descriptor_sets[image_index], buffer = *buffer,
226 size = swapchain.GetSize(), pipeline = *pipeline, 226 size = swapchain.GetSize(), pipeline = *pipeline,
227 layout = *pipeline_layout](vk::CommandBuffer cmdbuf) { 227 layout = *pipeline_layout](vk::CommandBuffer cmdbuf) {
228 const f32 bg_red = Settings::values.bg_red.GetValue() / 255.0f;
229 const f32 bg_green = Settings::values.bg_green.GetValue() / 255.0f;
230 const f32 bg_blue = Settings::values.bg_blue.GetValue() / 255.0f;
228 const VkClearValue clear_color{ 231 const VkClearValue clear_color{
229 .color = {.float32 = {0.0f, 0.0f, 0.0f, 0.0f}}, 232 .color = {.float32 = {bg_red, bg_green, bg_blue, 1.0f}},
230 }; 233 };
231 const VkRenderPassBeginInfo renderpass_bi{ 234 const VkRenderPassBeginInfo renderpass_bi{
232 .sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO, 235 .sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO,
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp
index 8c71ad5c1..a5e032959 100644
--- a/src/yuzu/configuration/config.cpp
+++ b/src/yuzu/configuration/config.cpp
@@ -311,16 +311,6 @@ void Config::WriteBasicSetting(const Settings::BasicSetting<std::string>& settin
311 qt_config->setValue(name, QString::fromStdString(value)); 311 qt_config->setValue(name, QString::fromStdString(value));
312} 312}
313 313
314// Explicit float definition: use a double as Qt doesn't write legible floats to config files
315template <>
316void Config::WriteBasicSetting(const Settings::BasicSetting<float>& setting) {
317 const QString name = QString::fromStdString(setting.GetLabel());
318 const double value = setting.GetValue();
319 qt_config->setValue(name + QStringLiteral("/default"),
320 setting.GetValue() == setting.GetDefault());
321 qt_config->setValue(name, value);
322}
323
324template <typename Type> 314template <typename Type>
325void Config::WriteBasicSetting(const Settings::BasicSetting<Type>& setting) { 315void Config::WriteBasicSetting(const Settings::BasicSetting<Type>& setting) {
326 const QString name = QString::fromStdString(setting.GetLabel()); 316 const QString name = QString::fromStdString(setting.GetLabel());
@@ -329,21 +319,6 @@ void Config::WriteBasicSetting(const Settings::BasicSetting<Type>& setting) {
329 qt_config->setValue(name, value); 319 qt_config->setValue(name, value);
330} 320}
331 321
332// Explicit float definition: use a double as Qt doesn't write legible floats to config files
333template <>
334void Config::WriteGlobalSetting(const Settings::Setting<float>& setting) {
335 const QString name = QString::fromStdString(setting.GetLabel());
336 const double value = setting.GetValue(global);
337 if (!global) {
338 qt_config->setValue(name + QStringLiteral("/use_global"), setting.UsingGlobal());
339 }
340 if (global || !setting.UsingGlobal()) {
341 qt_config->setValue(name + QStringLiteral("/default"),
342 setting.GetValue(global) == setting.GetDefault());
343 qt_config->setValue(name, value);
344 }
345}
346
347template <typename Type> 322template <typename Type>
348void Config::WriteGlobalSetting(const Settings::Setting<Type>& setting) { 323void Config::WriteGlobalSetting(const Settings::Setting<Type>& setting) {
349 const QString name = QString::fromStdString(setting.GetLabel()); 324 const QString name = QString::fromStdString(setting.GetLabel());
diff --git a/src/yuzu/configuration/configure_audio.cpp b/src/yuzu/configuration/configure_audio.cpp
index 5aba1a3b2..d8ba939d2 100644
--- a/src/yuzu/configuration/configure_audio.cpp
+++ b/src/yuzu/configuration/configure_audio.cpp
@@ -47,7 +47,8 @@ void ConfigureAudio::SetConfiguration() {
47 47
48 SetAudioDeviceFromDeviceID(); 48 SetAudioDeviceFromDeviceID();
49 49
50 ui->volume_slider->setValue(Settings::values.volume.GetValue() * ui->volume_slider->maximum()); 50 const auto volume_value = Settings::values.volume.GetValue() * ui->volume_slider->maximum();
51 ui->volume_slider->setValue(volume_value / 100);
51 52
52 ui->toggle_audio_stretching->setChecked(Settings::values.enable_audio_stretching.GetValue()); 53 ui->toggle_audio_stretching->setChecked(Settings::values.enable_audio_stretching.GetValue());
53 54
@@ -112,18 +113,16 @@ void ConfigureAudio::ApplyConfiguration() {
112 113
113 // Guard if during game and set to game-specific value 114 // Guard if during game and set to game-specific value
114 if (Settings::values.volume.UsingGlobal()) { 115 if (Settings::values.volume.UsingGlobal()) {
115 Settings::values.volume.SetValue( 116 const s32 volume = ui->volume_slider->sliderPosition() / ui->volume_slider->maximum();
116 static_cast<float>(ui->volume_slider->sliderPosition()) / 117 Settings::values.volume.SetValue(static_cast<u8>(100 * volume));
117 ui->volume_slider->maximum());
118 } 118 }
119 } else { 119 } else {
120 if (ui->volume_combo_box->currentIndex() == 0) { 120 if (ui->volume_combo_box->currentIndex() == 0) {
121 Settings::values.volume.SetGlobal(true); 121 Settings::values.volume.SetGlobal(true);
122 } else { 122 } else {
123 Settings::values.volume.SetGlobal(false); 123 Settings::values.volume.SetGlobal(false);
124 Settings::values.volume.SetValue( 124 const s32 volume = ui->volume_slider->sliderPosition() / ui->volume_slider->maximum();
125 static_cast<float>(ui->volume_slider->sliderPosition()) / 125 Settings::values.volume.SetValue(static_cast<u8>(100 * volume));
126 ui->volume_slider->maximum());
127 } 126 }
128 } 127 }
129} 128}
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() {
101 ConfigurationShared::SetHighlight(ui->bg_layout, !Settings::values.bg_red.UsingGlobal()); 101 ConfigurationShared::SetHighlight(ui->bg_layout, !Settings::values.bg_red.UsingGlobal());
102 } 102 }
103 103
104 UpdateBackgroundColorButton(QColor::fromRgbF(Settings::values.bg_red.GetValue(), 104 UpdateBackgroundColorButton(QColor::fromRgb(Settings::values.bg_red.GetValue(),
105 Settings::values.bg_green.GetValue(), 105 Settings::values.bg_green.GetValue(),
106 Settings::values.bg_blue.GetValue())); 106 Settings::values.bg_blue.GetValue()));
107 UpdateDeviceComboBox(); 107 UpdateDeviceComboBox();
108} 108}
109 109
@@ -132,9 +132,9 @@ void ConfigureGraphics::ApplyConfiguration() {
132 Settings::values.vulkan_device.SetValue(vulkan_device); 132 Settings::values.vulkan_device.SetValue(vulkan_device);
133 } 133 }
134 if (Settings::values.bg_red.UsingGlobal()) { 134 if (Settings::values.bg_red.UsingGlobal()) {
135 Settings::values.bg_red.SetValue(static_cast<float>(bg_color.redF())); 135 Settings::values.bg_red.SetValue(static_cast<u8>(bg_color.red()));
136 Settings::values.bg_green.SetValue(static_cast<float>(bg_color.greenF())); 136 Settings::values.bg_green.SetValue(static_cast<u8>(bg_color.green()));
137 Settings::values.bg_blue.SetValue(static_cast<float>(bg_color.blueF())); 137 Settings::values.bg_blue.SetValue(static_cast<u8>(bg_color.blue()));
138 } 138 }
139 } else { 139 } else {
140 if (ui->api->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { 140 if (ui->api->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) {
@@ -159,9 +159,9 @@ void ConfigureGraphics::ApplyConfiguration() {
159 Settings::values.bg_red.SetGlobal(false); 159 Settings::values.bg_red.SetGlobal(false);
160 Settings::values.bg_green.SetGlobal(false); 160 Settings::values.bg_green.SetGlobal(false);
161 Settings::values.bg_blue.SetGlobal(false); 161 Settings::values.bg_blue.SetGlobal(false);
162 Settings::values.bg_red.SetValue(static_cast<float>(bg_color.redF())); 162 Settings::values.bg_red.SetValue(static_cast<u8>(bg_color.red()));
163 Settings::values.bg_green.SetValue(static_cast<float>(bg_color.greenF())); 163 Settings::values.bg_green.SetValue(static_cast<u8>(bg_color.green()));
164 Settings::values.bg_blue.SetValue(static_cast<float>(bg_color.blueF())); 164 Settings::values.bg_blue.SetValue(static_cast<u8>(bg_color.blue()));
165 } 165 }
166 } 166 }
167} 167}
diff --git a/src/yuzu/configuration/configure_input_advanced.ui b/src/yuzu/configuration/configure_input_advanced.ui
index 173130d8d..d3ef5bd06 100644
--- a/src/yuzu/configuration/configure_input_advanced.ui
+++ b/src/yuzu/configuration/configure_input_advanced.ui
@@ -2573,27 +2573,24 @@
2573 </widget> 2573 </widget>
2574 </item> 2574 </item>
2575 <item row="2" column="2"> 2575 <item row="2" column="2">
2576 <widget class="QDoubleSpinBox" name="mouse_panning_sensitivity"> 2576 <widget class="QSpinBox" name="mouse_panning_sensitivity">
2577 <property name="toolTip"> 2577 <property name="toolTip">
2578 <string>Mouse sensitivity</string> 2578 <string>Mouse sensitivity</string>
2579 </property> 2579 </property>
2580 <property name="alignment"> 2580 <property name="alignment">
2581 <set>Qt::AlignCenter</set> 2581 <set>Qt::AlignCenter</set>
2582 </property> 2582 </property>
2583 <property name="decimals"> 2583 <property name="suffix">
2584 <number>2</number> 2584 <string>%</string>
2585 </property> 2585 </property>
2586 <property name="minimum"> 2586 <property name="minimum">
2587 <double>0.100000000000000</double> 2587 <number>1</number>
2588 </property> 2588 </property>
2589 <property name="maximum"> 2589 <property name="maximum">
2590 <double>16.000000000000000</double> 2590 <number>100</number>
2591 </property>
2592 <property name="singleStep">
2593 <double>0.010000000000000</double>
2594 </property> 2591 </property>
2595 <property name="value"> 2592 <property name="value">
2596 <double>1.000000000000000</double> 2593 <number>100</number>
2597 </property> 2594 </property>
2598 </widget> 2595 </widget>
2599 </item> 2596 </item>
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
@@ -242,17 +242,15 @@ static const std::array<int, 8> keyboard_mods{
242}; 242};
243 243
244template <> 244template <>
245void Config::ReadSetting(const std::string& group, Settings::BasicSetting<float>& setting) {
246 setting = sdl2_config->GetReal(group, setting.GetLabel(), setting.GetDefault());
247}
248template <>
249void Config::ReadSetting(const std::string& group, Settings::BasicSetting<std::string>& setting) { 245void Config::ReadSetting(const std::string& group, Settings::BasicSetting<std::string>& setting) {
250 setting = sdl2_config->Get(group, setting.GetLabel(), setting.GetDefault()); 246 setting = sdl2_config->Get(group, setting.GetLabel(), setting.GetDefault());
251} 247}
248
252template <> 249template <>
253void Config::ReadSetting(const std::string& group, Settings::BasicSetting<bool>& setting) { 250void Config::ReadSetting(const std::string& group, Settings::BasicSetting<bool>& setting) {
254 setting = sdl2_config->GetBoolean(group, setting.GetLabel(), setting.GetDefault()); 251 setting = sdl2_config->GetBoolean(group, setting.GetLabel(), setting.GetDefault());
255} 252}
253
256template <typename Type> 254template <typename Type>
257void Config::ReadSetting(const std::string& group, Settings::BasicSetting<Type>& setting) { 255void Config::ReadSetting(const std::string& group, Settings::BasicSetting<Type>& setting) {
258 setting = static_cast<Type>(sdl2_config->GetInteger(group, setting.GetLabel(), 256 setting = static_cast<Type>(sdl2_config->GetInteger(group, setting.GetLabel(),
diff --git a/src/yuzu_cmd/default_ini.h b/src/yuzu_cmd/default_ini.h
index cc9850aad..7d6bcccc7 100644
--- a/src/yuzu_cmd/default_ini.h
+++ b/src/yuzu_cmd/default_ini.h
@@ -232,7 +232,7 @@ use_vsync =
232use_caches_gc = 232use_caches_gc =
233 233
234# The clear color for the renderer. What shows up on the sides of the bottom screen. 234# The clear color for the renderer. What shows up on the sides of the bottom screen.
235# Must be in range of 0.0-1.0. Defaults to 1.0 for all. 235# Must be in range of 0-255. Defaults to 0 for all.
236bg_red = 236bg_red =
237bg_blue = 237bg_blue =
238bg_green = 238bg_green =
@@ -281,7 +281,7 @@ enable_audio_stretching =
281output_device = 281output_device =
282 282
283# Output volume. 283# Output volume.
284# 1.0 (default): 100%, 0.0; mute 284# 100 (default): 100%, 0; mute
285volume = 285volume =
286 286
287[Data Storage] 287[Data Storage]