diff options
-rw-r--r-- | src/common/settings.cpp | 2 | ||||
-rw-r--r-- | src/common/settings.h | 10 | ||||
-rw-r--r-- | src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp | 85 | ||||
-rw-r--r-- | src/input_common/mouse/mouse_poller.cpp | 2 | ||||
-rw-r--r-- | src/video_core/command_classes/vic.cpp | 21 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/renderer_opengl.cpp | 8 | ||||
-rw-r--r-- | src/video_core/renderer_vulkan/vk_blit_screen.cpp | 5 | ||||
-rw-r--r-- | src/video_core/renderer_vulkan/vk_rasterizer.cpp | 6 | ||||
-rw-r--r-- | src/yuzu/bootmanager.cpp | 9 | ||||
-rw-r--r-- | src/yuzu/configuration/config.cpp | 25 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_audio.cpp | 13 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_graphics.cpp | 18 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_input_advanced.ui | 15 | ||||
-rw-r--r-- | src/yuzu_cmd/config.cpp | 6 | ||||
-rw-r--r-- | src/yuzu_cmd/default_ini.h | 4 |
15 files changed, 99 insertions, 130 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() { if (values.audio_muted) { return 0.0f; } - return values.volume.GetValue(); + return values.volume.GetValue() / 100.0f; } void RestoreGlobalState(bool is_powered_on) { diff --git a/src/common/settings.h b/src/common/settings.h index 71d0f864f..ce1bc647d 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -278,7 +278,7 @@ struct Values { BasicSetting<std::string> sink_id{"auto", "output_engine"}; BasicSetting<bool> audio_muted{false, "audio_muted"}; Setting<bool> enable_audio_stretching{true, "enable_audio_stretching"}; - Setting<float> volume{1.0f, "volume"}; + Setting<u8> volume{100, "volume"}; // Core Setting<bool> use_multi_core{true, "use_multi_core"}; @@ -336,9 +336,9 @@ struct Values { Setting<bool> use_fast_gpu_time{true, "use_fast_gpu_time"}; Setting<bool> use_caches_gc{false, "use_caches_gc"}; - Setting<float> bg_red{0.0f, "bg_red"}; - Setting<float> bg_green{0.0f, "bg_green"}; - Setting<float> bg_blue{0.0f, "bg_blue"}; + Setting<u8> bg_red{0, "bg_red"}; + Setting<u8> bg_green{0, "bg_green"}; + Setting<u8> bg_blue{0, "bg_blue"}; // System Setting<std::optional<u32>> rng_seed{std::optional<u32>(), "rng_seed"}; @@ -368,7 +368,7 @@ struct Values { "udp_input_servers"}; BasicSetting<bool> mouse_panning{false, "mouse_panning"}; - BasicSetting<float> mouse_panning_sensitivity{1.0f, "mouse_panning_sensitivity"}; + BasicSetting<u8> mouse_panning_sensitivity{10, "mouse_panning_sensitivity"}; BasicSetting<bool> mouse_enabled{false, "mouse_enabled"}; std::string mouse_device; MouseButtonsRaw mouse_buttons; diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp index 98e6296f1..1403a39d0 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp @@ -19,26 +19,29 @@ namespace Service::Nvidia::Devices { namespace { -// Splice vectors will copy count amount of type T from the input vector into the dst vector. +// Copies count amount of type T from the input vector into the dst vector. +// Returns the number of bytes written into dst. template <typename T> -std::size_t SpliceVectors(const std::vector<u8>& input, std::vector<T>& dst, std::size_t count, - std::size_t offset) { - if (!dst.empty()) { - std::memcpy(dst.data(), input.data() + offset, count * sizeof(T)); +std::size_t SliceVectors(const std::vector<u8>& input, std::vector<T>& dst, std::size_t count, + std::size_t offset) { + if (dst.empty()) { + return 0; } - return 0; + const size_t bytes_copied = count * sizeof(T); + std::memcpy(dst.data(), input.data() + offset, bytes_copied); + return bytes_copied; } -// Write vectors will write data to the output buffer +// Writes the data in src to an offset into the dst vector. The offset is specified in bytes +// Returns the number of bytes written into dst. template <typename T> std::size_t WriteVectors(std::vector<u8>& dst, const std::vector<T>& src, std::size_t offset) { if (src.empty()) { return 0; - } else { - std::memcpy(dst.data() + offset, src.data(), src.size() * sizeof(T)); - offset += src.size() * sizeof(T); - return offset; } + const size_t bytes_copied = src.size() * sizeof(T); + std::memcpy(dst.data() + offset, src.data(), bytes_copied); + return bytes_copied; } } // Anonymous namespace @@ -62,7 +65,6 @@ NvResult nvhost_nvdec_common::Submit(const std::vector<u8>& input, std::vector<u LOG_DEBUG(Service_NVDRV, "called NVDEC Submit, cmd_buffer_count={}", params.cmd_buffer_count); // Instantiate param buffers - std::size_t offset = sizeof(IoctlSubmit); std::vector<CommandBuffer> command_buffers(params.cmd_buffer_count); std::vector<Reloc> relocs(params.relocation_count); std::vector<u32> reloc_shifts(params.relocation_count); @@ -70,13 +72,14 @@ NvResult nvhost_nvdec_common::Submit(const std::vector<u8>& input, std::vector<u std::vector<SyncptIncr> wait_checks(params.syncpoint_count); std::vector<Fence> fences(params.fence_count); - // Splice input into their respective buffers - offset = SpliceVectors(input, command_buffers, params.cmd_buffer_count, offset); - offset = SpliceVectors(input, relocs, params.relocation_count, offset); - offset = SpliceVectors(input, reloc_shifts, params.relocation_count, offset); - offset = SpliceVectors(input, syncpt_increments, params.syncpoint_count, offset); - offset = SpliceVectors(input, wait_checks, params.syncpoint_count, offset); - offset = SpliceVectors(input, fences, params.fence_count, offset); + // Slice input into their respective buffers + std::size_t offset = sizeof(IoctlSubmit); + offset += SliceVectors(input, command_buffers, params.cmd_buffer_count, offset); + offset += SliceVectors(input, relocs, params.relocation_count, offset); + offset += SliceVectors(input, reloc_shifts, params.relocation_count, offset); + offset += SliceVectors(input, syncpt_increments, params.syncpoint_count, offset); + offset += SliceVectors(input, wait_checks, params.syncpoint_count, offset); + offset += SliceVectors(input, fences, params.fence_count, offset); auto& gpu = system.GPU(); if (gpu.UseNvdec()) { @@ -88,35 +91,27 @@ NvResult nvhost_nvdec_common::Submit(const std::vector<u8>& input, std::vector<u } } for (const auto& cmd_buffer : command_buffers) { - auto object = nvmap_dev->GetObject(cmd_buffer.memory_id); + const auto object = nvmap_dev->GetObject(cmd_buffer.memory_id); ASSERT_OR_EXECUTE(object, return NvResult::InvalidState;); - const auto map = FindBufferMap(object->dma_map_addr); - if (!map) { - LOG_ERROR(Service_NVDRV, "Tried to submit an invalid offset 0x{:X} dma 0x{:X}", - object->addr, object->dma_map_addr); - return NvResult::Success; - } Tegra::ChCommandHeaderList cmdlist(cmd_buffer.word_count); - gpu.MemoryManager().ReadBlock(map->StartAddr() + cmd_buffer.offset, cmdlist.data(), - cmdlist.size() * sizeof(u32)); + system.Memory().ReadBlock(object->addr + cmd_buffer.offset, cmdlist.data(), + cmdlist.size() * sizeof(u32)); gpu.PushCommandBuffer(cmdlist); } if (gpu.UseNvdec()) { - fences[0].value = syncpoint_manager.IncreaseSyncpoint(fences[0].id, 1); - Tegra::ChCommandHeaderList cmdlist{{(4 << 28) | fences[0].id}}; gpu.PushCommandBuffer(cmdlist); } std::memcpy(output.data(), ¶ms, sizeof(IoctlSubmit)); // Some games expect command_buffers to be written back offset = sizeof(IoctlSubmit); - offset = WriteVectors(output, command_buffers, offset); - offset = WriteVectors(output, relocs, offset); - offset = WriteVectors(output, reloc_shifts, offset); - offset = WriteVectors(output, syncpt_increments, offset); - offset = WriteVectors(output, wait_checks, offset); - offset = WriteVectors(output, fences, offset); + offset += WriteVectors(output, command_buffers, offset); + offset += WriteVectors(output, relocs, offset); + offset += WriteVectors(output, reloc_shifts, offset); + offset += WriteVectors(output, syncpt_increments, offset); + offset += WriteVectors(output, wait_checks, offset); + offset += WriteVectors(output, fences, offset); return NvResult::Success; } @@ -148,14 +143,14 @@ NvResult nvhost_nvdec_common::MapBuffer(const std::vector<u8>& input, std::vecto std::memcpy(¶ms, input.data(), sizeof(IoctlMapBuffer)); std::vector<MapBufferEntry> cmd_buffer_handles(params.num_entries); - SpliceVectors(input, cmd_buffer_handles, params.num_entries, sizeof(IoctlMapBuffer)); + SliceVectors(input, cmd_buffer_handles, params.num_entries, sizeof(IoctlMapBuffer)); auto& gpu = system.GPU(); - for (auto& cmf_buff : cmd_buffer_handles) { - auto object{nvmap_dev->GetObject(cmf_buff.map_handle)}; + for (auto& cmd_buffer : cmd_buffer_handles) { + auto object{nvmap_dev->GetObject(cmd_buffer.map_handle)}; if (!object) { - LOG_ERROR(Service_NVDRV, "invalid cmd_buffer nvmap_handle={:X}", cmf_buff.map_handle); + LOG_ERROR(Service_NVDRV, "invalid cmd_buffer nvmap_handle={:X}", cmd_buffer.map_handle); std::memcpy(output.data(), ¶ms, output.size()); return NvResult::InvalidState; } @@ -170,7 +165,7 @@ NvResult nvhost_nvdec_common::MapBuffer(const std::vector<u8>& input, std::vecto if (!object->dma_map_addr) { LOG_ERROR(Service_NVDRV, "failed to map size={}", object->size); } else { - cmf_buff.map_address = object->dma_map_addr; + cmd_buffer.map_address = object->dma_map_addr; AddBufferMap(object->dma_map_addr, object->size, object->addr, object->status == nvmap::Object::Status::Allocated); } @@ -186,14 +181,14 @@ NvResult nvhost_nvdec_common::UnmapBuffer(const std::vector<u8>& input, std::vec IoctlMapBuffer params{}; std::memcpy(¶ms, input.data(), sizeof(IoctlMapBuffer)); std::vector<MapBufferEntry> cmd_buffer_handles(params.num_entries); - SpliceVectors(input, cmd_buffer_handles, params.num_entries, sizeof(IoctlMapBuffer)); + SliceVectors(input, cmd_buffer_handles, params.num_entries, sizeof(IoctlMapBuffer)); auto& gpu = system.GPU(); - for (auto& cmf_buff : cmd_buffer_handles) { - const auto object{nvmap_dev->GetObject(cmf_buff.map_handle)}; + for (auto& cmd_buffer : cmd_buffer_handles) { + const auto object{nvmap_dev->GetObject(cmd_buffer.map_handle)}; if (!object) { - LOG_ERROR(Service_NVDRV, "invalid cmd_buffer nvmap_handle={:X}", cmf_buff.map_handle); + LOG_ERROR(Service_NVDRV, "invalid cmd_buffer nvmap_handle={:X}", cmd_buffer.map_handle); std::memcpy(output.data(), ¶ms, output.size()); return NvResult::InvalidState; } diff --git a/src/input_common/mouse/mouse_poller.cpp b/src/input_common/mouse/mouse_poller.cpp index 45b3d7340..efcdd85d2 100644 --- a/src/input_common/mouse/mouse_poller.cpp +++ b/src/input_common/mouse/mouse_poller.cpp @@ -84,7 +84,7 @@ public: std::lock_guard lock{mutex}; const auto axis_value = static_cast<float>(mouse_input->GetMouseState(button).axis.at(axis)); - const float sensitivity = Settings::values.mouse_panning_sensitivity.GetValue(); + const float sensitivity = Settings::values.mouse_panning_sensitivity.GetValue() * 0.10f; return axis_value * sensitivity / (100.0f * range); } diff --git a/src/video_core/command_classes/vic.cpp b/src/video_core/command_classes/vic.cpp index ff3db0aee..ffb7c82a1 100644 --- a/src/video_core/command_classes/vic.cpp +++ b/src/video_core/command_classes/vic.cpp @@ -129,28 +129,27 @@ void Vic::Execute() { const std::size_t surface_width = config.surface_width_minus1 + 1; const std::size_t surface_height = config.surface_height_minus1 + 1; - const std::size_t half_width = surface_width / 2; - const std::size_t half_height = config.surface_height_minus1 / 2; + const auto frame_width = std::min(surface_width, static_cast<size_t>(frame->width)); + const auto frame_height = std::min(surface_height, static_cast<size_t>(frame->height)); + const std::size_t half_width = frame_width / 2; + const std::size_t half_height = frame_height / 2; const std::size_t aligned_width = (surface_width + 0xff) & ~0xff; const auto* luma_ptr = frame->data[0]; const auto* chroma_b_ptr = frame->data[1]; const auto* chroma_r_ptr = frame->data[2]; - const auto stride = frame->linesize[0]; - const auto half_stride = frame->linesize[1]; + const auto stride = static_cast<size_t>(frame->linesize[0]); + const auto half_stride = static_cast<size_t>(frame->linesize[1]); luma_buffer.resize(aligned_width * surface_height); - chroma_buffer.resize(aligned_width * half_height); + chroma_buffer.resize(aligned_width * surface_height / 2); // Populate luma buffer - for (std::size_t y = 0; y < surface_height - 1; ++y) { + for (std::size_t y = 0; y < frame_height; ++y) { const std::size_t src = y * stride; const std::size_t dst = y * aligned_width; - - const std::size_t size = surface_width; - - for (std::size_t offset = 0; offset < size; ++offset) { - luma_buffer[dst + offset] = luma_ptr[src + offset]; + for (std::size_t x = 0; x < frame_width; ++x) { + luma_buffer[dst + x] = luma_ptr[src + x]; } } gpu.MemoryManager().WriteBlock(output_surface_luma_address, luma_buffer.data(), 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/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index e378a5679..a8ffbe6ba 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp @@ -357,11 +357,13 @@ void RasterizerVulkan::Clear() { .height = std::min(clear_rect.rect.extent.height, render_area.height), }; - if (use_color) { + const u32 color_attachment = regs.clear_buffers.RT; + const auto attachment_aspect_mask = framebuffer->ImageRanges()[color_attachment].aspectMask; + const bool is_color_rt = (attachment_aspect_mask & VK_IMAGE_ASPECT_COLOR_BIT) != 0; + if (use_color && is_color_rt) { VkClearValue clear_value; std::memcpy(clear_value.color.float32, regs.clear_color, sizeof(regs.clear_color)); - const u32 color_attachment = regs.clear_buffers.RT; scheduler.Record([color_attachment, clear_value, clear_rect](vk::CommandBuffer cmdbuf) { const VkClearAttachment attachment{ .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT, diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index 7524e3c40..bfae73b60 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp @@ -411,8 +411,9 @@ void GRenderWindow::mousePressEvent(QMouseEvent* event) { if (event->source() == Qt::MouseEventSynthesizedBySystem) { return; } - - auto pos = event->pos(); + // Qt sometimes returns the parent coordinates. To avoid this we read the global mouse + // coordinates and map them to the current render area + const auto pos = mapFromGlobal(QCursor::pos()); const auto [x, y] = ScaleTouch(pos); const auto button = QtButtonToMouseButton(event->button()); input_subsystem->GetMouse()->PressButton(x, y, button); @@ -429,7 +430,9 @@ void GRenderWindow::mouseMoveEvent(QMouseEvent* event) { if (event->source() == Qt::MouseEventSynthesizedBySystem) { return; } - auto pos = event->pos(); + // Qt sometimes returns the parent coordinates. To avoid this we read the global mouse + // coordinates and map them to the current render area + const auto pos = mapFromGlobal(QCursor::pos()); const auto [x, y] = ScaleTouch(pos); const int center_x = width() / 2; const int center_y = height() / 2; 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 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<float>& 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 <typename Type> void Config::WriteBasicSetting(const Settings::BasicSetting<Type>& setting) { const QString name = QString::fromStdString(setting.GetLabel()); @@ -329,21 +319,6 @@ void Config::WriteBasicSetting(const Settings::BasicSetting<Type>& 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<float>& 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 <typename Type> void Config::WriteGlobalSetting(const Settings::Setting<Type>& setting) { 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..1d84bf4ed 100644 --- a/src/yuzu/configuration/configure_audio.cpp +++ b/src/yuzu/configuration/configure_audio.cpp @@ -47,7 +47,8 @@ void ConfigureAudio::SetConfiguration() { SetAudioDeviceFromDeviceID(); - ui->volume_slider->setValue(Settings::values.volume.GetValue() * ui->volume_slider->maximum()); + const auto volume_value = static_cast<int>(Settings::values.volume.GetValue()); + ui->volume_slider->setValue(volume_value); ui->toggle_audio_stretching->setChecked(Settings::values.enable_audio_stretching.GetValue()); @@ -112,18 +113,16 @@ void ConfigureAudio::ApplyConfiguration() { // Guard if during game and set to game-specific value if (Settings::values.volume.UsingGlobal()) { - Settings::values.volume.SetValue( - static_cast<float>(ui->volume_slider->sliderPosition()) / - ui->volume_slider->maximum()); + const auto volume = static_cast<u8>(ui->volume_slider->value()); + Settings::values.volume.SetValue(volume); } } else { if (ui->volume_combo_box->currentIndex() == 0) { Settings::values.volume.SetGlobal(true); } else { Settings::values.volume.SetGlobal(false); - Settings::values.volume.SetValue( - static_cast<float>(ui->volume_slider->sliderPosition()) / - ui->volume_slider->maximum()); + const auto volume = static_cast<u8>(ui->volume_slider->value()); + Settings::values.volume.SetValue(volume); } } } 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<float>(bg_color.redF())); - Settings::values.bg_green.SetValue(static_cast<float>(bg_color.greenF())); - Settings::values.bg_blue.SetValue(static_cast<float>(bg_color.blueF())); + Settings::values.bg_red.SetValue(static_cast<u8>(bg_color.red())); + Settings::values.bg_green.SetValue(static_cast<u8>(bg_color.green())); + Settings::values.bg_blue.SetValue(static_cast<u8>(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<float>(bg_color.redF())); - Settings::values.bg_green.SetValue(static_cast<float>(bg_color.greenF())); - Settings::values.bg_blue.SetValue(static_cast<float>(bg_color.blueF())); + Settings::values.bg_red.SetValue(static_cast<u8>(bg_color.red())); + Settings::values.bg_green.SetValue(static_cast<u8>(bg_color.green())); + Settings::values.bg_blue.SetValue(static_cast<u8>(bg_color.blue())); } } } 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 @@ </widget> </item> <item row="2" column="2"> - <widget class="QDoubleSpinBox" name="mouse_panning_sensitivity"> + <widget class="QSpinBox" name="mouse_panning_sensitivity"> <property name="toolTip"> <string>Mouse sensitivity</string> </property> <property name="alignment"> <set>Qt::AlignCenter</set> </property> - <property name="decimals"> - <number>2</number> + <property name="suffix"> + <string>%</string> </property> <property name="minimum"> - <double>0.100000000000000</double> + <number>1</number> </property> <property name="maximum"> - <double>16.000000000000000</double> - </property> - <property name="singleStep"> - <double>0.010000000000000</double> + <number>100</number> </property> <property name="value"> - <double>1.000000000000000</double> + <number>100</number> </property> </widget> </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{ }; template <> -void Config::ReadSetting(const std::string& group, Settings::BasicSetting<float>& setting) { - setting = sdl2_config->GetReal(group, setting.GetLabel(), setting.GetDefault()); -} -template <> void Config::ReadSetting(const std::string& group, Settings::BasicSetting<std::string>& setting) { setting = sdl2_config->Get(group, setting.GetLabel(), setting.GetDefault()); } + template <> void Config::ReadSetting(const std::string& group, Settings::BasicSetting<bool>& setting) { setting = sdl2_config->GetBoolean(group, setting.GetLabel(), setting.GetDefault()); } + template <typename Type> void Config::ReadSetting(const std::string& group, Settings::BasicSetting<Type>& setting) { 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 = 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 = @@ -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] |