early-access version 3817
This commit is contained in:
parent
3e922c262d
commit
af220eff75
15 changed files with 244 additions and 30 deletions
|
@ -1,7 +1,7 @@
|
||||||
yuzu emulator early access
|
yuzu emulator early access
|
||||||
=============
|
=============
|
||||||
|
|
||||||
This is the source code for early-access 3816.
|
This is the source code for early-access 3817.
|
||||||
|
|
||||||
## Legal Notice
|
## Legal Notice
|
||||||
|
|
||||||
|
|
|
@ -211,9 +211,7 @@ const char* TranslateCategory(Category category) {
|
||||||
return "Miscellaneous";
|
return "Miscellaneous";
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateRescalingInfo() {
|
void TranslateResolutionInfo(ResolutionSetup setup, ResolutionScalingInfo& info) {
|
||||||
const auto setup = values.resolution_setup.GetValue();
|
|
||||||
auto& info = values.resolution_info;
|
|
||||||
info.downscale = false;
|
info.downscale = false;
|
||||||
switch (setup) {
|
switch (setup) {
|
||||||
case ResolutionSetup::Res1_2X:
|
case ResolutionSetup::Res1_2X:
|
||||||
|
@ -273,6 +271,12 @@ void UpdateRescalingInfo() {
|
||||||
info.active = info.up_scale != 1 || info.down_shift != 0;
|
info.active = info.up_scale != 1 || info.down_shift != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UpdateRescalingInfo() {
|
||||||
|
const auto setup = values.resolution_setup.GetValue();
|
||||||
|
auto& info = values.resolution_info;
|
||||||
|
TranslateResolutionInfo(setup, info);
|
||||||
|
}
|
||||||
|
|
||||||
void RestoreGlobalState(bool is_powered_on) {
|
void RestoreGlobalState(bool is_powered_on) {
|
||||||
// If a game is running, DO NOT restore the global settings state
|
// If a game is running, DO NOT restore the global settings state
|
||||||
if (is_powered_on) {
|
if (is_powered_on) {
|
||||||
|
|
|
@ -527,6 +527,7 @@ std::string GetTimeZoneString(TimeZone time_zone);
|
||||||
|
|
||||||
void LogSettings();
|
void LogSettings();
|
||||||
|
|
||||||
|
void TranslateResolutionInfo(ResolutionSetup setup, ResolutionScalingInfo& info);
|
||||||
void UpdateRescalingInfo();
|
void UpdateRescalingInfo();
|
||||||
|
|
||||||
// Restore the global state of all applicable settings in the Values struct
|
// Restore the global state of all applicable settings in the Values struct
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
#include <glad/glad.h>
|
#include <glad/glad.h>
|
||||||
|
|
||||||
#include <QtCore/qglobal.h>
|
#include <QtCore/qglobal.h>
|
||||||
|
#include "common/settings_enums.h"
|
||||||
|
#include "uisettings.h"
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) && YUZU_USE_QT_MULTIMEDIA
|
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) && YUZU_USE_QT_MULTIMEDIA
|
||||||
#include <QCamera>
|
#include <QCamera>
|
||||||
#include <QCameraImageCapture>
|
#include <QCameraImageCapture>
|
||||||
|
@ -916,7 +918,6 @@ void GRenderWindow::ReleaseRenderTarget() {
|
||||||
|
|
||||||
void GRenderWindow::CaptureScreenshot(const QString& screenshot_path) {
|
void GRenderWindow::CaptureScreenshot(const QString& screenshot_path) {
|
||||||
auto& renderer = system.Renderer();
|
auto& renderer = system.Renderer();
|
||||||
const f32 res_scale = Settings::values.resolution_info.up_factor;
|
|
||||||
|
|
||||||
if (renderer.IsScreenshotPending()) {
|
if (renderer.IsScreenshotPending()) {
|
||||||
LOG_WARNING(Render,
|
LOG_WARNING(Render,
|
||||||
|
@ -924,7 +925,18 @@ void GRenderWindow::CaptureScreenshot(const QString& screenshot_path) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Layout::FramebufferLayout layout{Layout::FrameLayoutFromResolutionScale(res_scale)};
|
const Layout::FramebufferLayout layout{[]() {
|
||||||
|
u32 height = UISettings::values.screenshot_height.GetValue();
|
||||||
|
if (height == 0) {
|
||||||
|
height = Settings::values.use_docked_mode.GetValue() ? Layout::ScreenDocked::Height
|
||||||
|
: Layout::ScreenUndocked::Height;
|
||||||
|
height *= Settings::values.resolution_info.up_factor;
|
||||||
|
}
|
||||||
|
const u32 width =
|
||||||
|
UISettings::CalculateWidth(height, Settings::values.aspect_ratio.GetValue());
|
||||||
|
return Layout::DefaultFrameLayout(width, height);
|
||||||
|
}()};
|
||||||
|
|
||||||
screenshot_image = QImage(QSize(layout.width, layout.height), QImage::Format_RGB32);
|
screenshot_image = QImage(QSize(layout.width, layout.height), QImage::Format_RGB32);
|
||||||
renderer.RequestScreenshot(
|
renderer.RequestScreenshot(
|
||||||
screenshot_image.bits(),
|
screenshot_image.bits(),
|
||||||
|
|
|
@ -592,8 +592,7 @@ void Config::ReadRendererValues() {
|
||||||
void Config::ReadScreenshotValues() {
|
void Config::ReadScreenshotValues() {
|
||||||
qt_config->beginGroup(QStringLiteral("Screenshots"));
|
qt_config->beginGroup(QStringLiteral("Screenshots"));
|
||||||
|
|
||||||
UISettings::values.enable_screenshot_save_as =
|
ReadCategory(Settings::Category::Screenshots);
|
||||||
ReadSetting(QStringLiteral("enable_screenshot_save_as"), true).toBool();
|
|
||||||
FS::SetYuzuPath(
|
FS::SetYuzuPath(
|
||||||
FS::YuzuPath::ScreenshotsDir,
|
FS::YuzuPath::ScreenshotsDir,
|
||||||
qt_config
|
qt_config
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
|
#include "common/settings_enums.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "ui_configure.h"
|
#include "ui_configure.h"
|
||||||
#include "vk_device_info.h"
|
#include "vk_device_info.h"
|
||||||
|
@ -41,16 +42,19 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry_,
|
||||||
general_tab{std::make_unique<ConfigureGeneral>(system_, nullptr, *builder, this)},
|
general_tab{std::make_unique<ConfigureGeneral>(system_, nullptr, *builder, this)},
|
||||||
graphics_advanced_tab{
|
graphics_advanced_tab{
|
||||||
std::make_unique<ConfigureGraphicsAdvanced>(system_, nullptr, *builder, this)},
|
std::make_unique<ConfigureGraphicsAdvanced>(system_, nullptr, *builder, this)},
|
||||||
|
ui_tab{std::make_unique<ConfigureUi>(system_, this)},
|
||||||
graphics_tab{std::make_unique<ConfigureGraphics>(
|
graphics_tab{std::make_unique<ConfigureGraphics>(
|
||||||
system_, vk_device_records, [&]() { graphics_advanced_tab->ExposeComputeOption(); },
|
system_, vk_device_records, [&]() { graphics_advanced_tab->ExposeComputeOption(); },
|
||||||
|
[this](Settings::AspectRatio ratio, Settings::ResolutionSetup setup) {
|
||||||
|
ui_tab->UpdateScreenshotInfo(ratio, setup);
|
||||||
|
},
|
||||||
nullptr, *builder, this)},
|
nullptr, *builder, this)},
|
||||||
hotkeys_tab{std::make_unique<ConfigureHotkeys>(system_.HIDCore(), this)},
|
hotkeys_tab{std::make_unique<ConfigureHotkeys>(system_.HIDCore(), this)},
|
||||||
input_tab{std::make_unique<ConfigureInput>(system_, this)},
|
input_tab{std::make_unique<ConfigureInput>(system_, this)},
|
||||||
network_tab{std::make_unique<ConfigureNetwork>(system_, this)},
|
network_tab{std::make_unique<ConfigureNetwork>(system_, this)},
|
||||||
profile_tab{std::make_unique<ConfigureProfileManager>(system_, this)},
|
profile_tab{std::make_unique<ConfigureProfileManager>(system_, this)},
|
||||||
system_tab{std::make_unique<ConfigureSystem>(system_, nullptr, *builder, this)},
|
system_tab{std::make_unique<ConfigureSystem>(system_, nullptr, *builder, this)},
|
||||||
ui_tab{std::make_unique<ConfigureUi>(system_, this)}, web_tab{std::make_unique<ConfigureWeb>(
|
web_tab{std::make_unique<ConfigureWeb>(this)} {
|
||||||
this)} {
|
|
||||||
Settings::SetConfiguringGlobal(true);
|
Settings::SetConfiguringGlobal(true);
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
|
@ -81,12 +81,12 @@ private:
|
||||||
std::unique_ptr<ConfigureFilesystem> filesystem_tab;
|
std::unique_ptr<ConfigureFilesystem> filesystem_tab;
|
||||||
std::unique_ptr<ConfigureGeneral> general_tab;
|
std::unique_ptr<ConfigureGeneral> general_tab;
|
||||||
std::unique_ptr<ConfigureGraphicsAdvanced> graphics_advanced_tab;
|
std::unique_ptr<ConfigureGraphicsAdvanced> graphics_advanced_tab;
|
||||||
|
std::unique_ptr<ConfigureUi> ui_tab;
|
||||||
std::unique_ptr<ConfigureGraphics> graphics_tab;
|
std::unique_ptr<ConfigureGraphics> graphics_tab;
|
||||||
std::unique_ptr<ConfigureHotkeys> hotkeys_tab;
|
std::unique_ptr<ConfigureHotkeys> hotkeys_tab;
|
||||||
std::unique_ptr<ConfigureInput> input_tab;
|
std::unique_ptr<ConfigureInput> input_tab;
|
||||||
std::unique_ptr<ConfigureNetwork> network_tab;
|
std::unique_ptr<ConfigureNetwork> network_tab;
|
||||||
std::unique_ptr<ConfigureProfileManager> profile_tab;
|
std::unique_ptr<ConfigureProfileManager> profile_tab;
|
||||||
std::unique_ptr<ConfigureSystem> system_tab;
|
std::unique_ptr<ConfigureSystem> system_tab;
|
||||||
std::unique_ptr<ConfigureUi> ui_tab;
|
|
||||||
std::unique_ptr<ConfigureWeb> web_tab;
|
std::unique_ptr<ConfigureWeb> web_tab;
|
||||||
};
|
};
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <QtCore/qobjectdefs.h>
|
#include <QtCore/qobjectdefs.h>
|
||||||
#include <qabstractbutton.h>
|
#include <qabstractbutton.h>
|
||||||
#include <qboxlayout.h>
|
#include <qboxlayout.h>
|
||||||
|
#include <qcombobox.h>
|
||||||
#include <qcoreevent.h>
|
#include <qcoreevent.h>
|
||||||
#include <qglobal.h>
|
#include <qglobal.h>
|
||||||
#include <qgridlayout.h>
|
#include <qgridlayout.h>
|
||||||
|
@ -77,13 +78,16 @@ static constexpr Settings::VSyncMode PresentModeToSetting(VkPresentModeKHR mode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigureGraphics::ConfigureGraphics(const Core::System& system_,
|
ConfigureGraphics::ConfigureGraphics(
|
||||||
std::vector<VkDeviceInfo::Record>& records_,
|
const Core::System& system_, std::vector<VkDeviceInfo::Record>& records_,
|
||||||
const std::function<void()>& expose_compute_option_,
|
const std::function<void()>& expose_compute_option_,
|
||||||
std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group_,
|
const std::function<void(Settings::AspectRatio, Settings::ResolutionSetup)>&
|
||||||
const ConfigurationShared::Builder& builder, QWidget* parent)
|
update_aspect_ratio_,
|
||||||
|
std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group_,
|
||||||
|
const ConfigurationShared::Builder& builder, QWidget* parent)
|
||||||
: ConfigurationShared::Tab(group_, parent), ui{std::make_unique<Ui::ConfigureGraphics>()},
|
: ConfigurationShared::Tab(group_, parent), ui{std::make_unique<Ui::ConfigureGraphics>()},
|
||||||
records{records_}, expose_compute_option{expose_compute_option_}, system{system_},
|
records{records_}, expose_compute_option{expose_compute_option_},
|
||||||
|
update_aspect_ratio{update_aspect_ratio_}, system{system_},
|
||||||
combobox_translations{builder.ComboboxTranslations()},
|
combobox_translations{builder.ComboboxTranslations()},
|
||||||
shader_mapping{
|
shader_mapping{
|
||||||
combobox_translations.at(Settings::EnumMetadata<Settings::ShaderBackend>::Index())} {
|
combobox_translations.at(Settings::EnumMetadata<Settings::ShaderBackend>::Index())} {
|
||||||
|
@ -140,6 +144,26 @@ ConfigureGraphics::ConfigureGraphics(const Core::System& system_,
|
||||||
UpdateBackgroundColorButton(new_bg_color);
|
UpdateBackgroundColorButton(new_bg_color);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const auto& update_screenshot_info = [this, &builder]() {
|
||||||
|
const auto& combobox_enumerations = builder.ComboboxTranslations().at(
|
||||||
|
Settings::EnumMetadata<Settings::AspectRatio>::Index());
|
||||||
|
const auto index = aspect_ratio_combobox->currentIndex();
|
||||||
|
const auto ratio = static_cast<Settings::AspectRatio>(combobox_enumerations[index].first);
|
||||||
|
|
||||||
|
const auto& combobox_enumerations_resolution = builder.ComboboxTranslations().at(
|
||||||
|
Settings::EnumMetadata<Settings::ResolutionSetup>::Index());
|
||||||
|
const auto res_index = resolution_combobox->currentIndex();
|
||||||
|
const auto setup = static_cast<Settings::ResolutionSetup>(
|
||||||
|
combobox_enumerations_resolution[res_index].first);
|
||||||
|
|
||||||
|
update_aspect_ratio(ratio, setup);
|
||||||
|
};
|
||||||
|
|
||||||
|
connect(aspect_ratio_combobox, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||||
|
update_screenshot_info);
|
||||||
|
connect(resolution_combobox, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||||
|
update_screenshot_info);
|
||||||
|
|
||||||
api_combobox->setEnabled(!UISettings::values.has_broken_vulkan && api_combobox->isEnabled());
|
api_combobox->setEnabled(!UISettings::values.has_broken_vulkan && api_combobox->isEnabled());
|
||||||
ui->api_widget->setEnabled(
|
ui->api_widget->setEnabled(
|
||||||
(!UISettings::values.has_broken_vulkan || Settings::IsConfiguringGlobal()) &&
|
(!UISettings::values.has_broken_vulkan || Settings::IsConfiguringGlobal()) &&
|
||||||
|
@ -280,6 +304,14 @@ void ConfigureGraphics::Setup(const ConfigurationShared::Builder& builder) {
|
||||||
// Keep track of vsync_mode's combobox so we can populate it
|
// Keep track of vsync_mode's combobox so we can populate it
|
||||||
vsync_mode_combobox = widget->combobox;
|
vsync_mode_combobox = widget->combobox;
|
||||||
hold_graphics.emplace(setting->Id(), widget);
|
hold_graphics.emplace(setting->Id(), widget);
|
||||||
|
} else if (setting->Id() == Settings::values.aspect_ratio.Id()) {
|
||||||
|
// Keep track of the aspect ratio combobox to update other UI tabs that need it
|
||||||
|
aspect_ratio_combobox = widget->combobox;
|
||||||
|
hold_graphics.emplace(setting->Id(), widget);
|
||||||
|
} else if (setting->Id() == Settings::values.resolution_setup.Id()) {
|
||||||
|
// Keep track of the resolution combobox to update other UI tabs that need it
|
||||||
|
resolution_combobox = widget->combobox;
|
||||||
|
hold_graphics.emplace(setting->Id(), widget);
|
||||||
} else {
|
} else {
|
||||||
hold_graphics.emplace(setting->Id(), widget);
|
hold_graphics.emplace(setting->Id(), widget);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include <qobjectdefs.h>
|
#include <qobjectdefs.h>
|
||||||
#include <vulkan/vulkan_core.h>
|
#include <vulkan/vulkan_core.h>
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
#include "common/settings_enums.h"
|
||||||
#include "configuration/shared_translation.h"
|
#include "configuration/shared_translation.h"
|
||||||
#include "vk_device_info.h"
|
#include "vk_device_info.h"
|
||||||
#include "yuzu/configuration/configuration_shared.h"
|
#include "yuzu/configuration/configuration_shared.h"
|
||||||
|
@ -43,12 +44,13 @@ class Builder;
|
||||||
|
|
||||||
class ConfigureGraphics : public ConfigurationShared::Tab {
|
class ConfigureGraphics : public ConfigurationShared::Tab {
|
||||||
public:
|
public:
|
||||||
explicit ConfigureGraphics(const Core::System& system_,
|
explicit ConfigureGraphics(
|
||||||
std::vector<VkDeviceInfo::Record>& records,
|
const Core::System& system_, std::vector<VkDeviceInfo::Record>& records,
|
||||||
const std::function<void()>& expose_compute_option_,
|
const std::function<void()>& expose_compute_option,
|
||||||
std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group,
|
const std::function<void(Settings::AspectRatio, Settings::ResolutionSetup)>&
|
||||||
const ConfigurationShared::Builder& builder,
|
update_aspect_ratio,
|
||||||
QWidget* parent = nullptr);
|
std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group,
|
||||||
|
const ConfigurationShared::Builder& builder, QWidget* parent = nullptr);
|
||||||
~ConfigureGraphics() override;
|
~ConfigureGraphics() override;
|
||||||
|
|
||||||
void ApplyConfiguration() override;
|
void ApplyConfiguration() override;
|
||||||
|
@ -91,6 +93,7 @@ private:
|
||||||
u32 vulkan_device{};
|
u32 vulkan_device{};
|
||||||
Settings::ShaderBackend shader_backend{};
|
Settings::ShaderBackend shader_backend{};
|
||||||
const std::function<void()>& expose_compute_option;
|
const std::function<void()>& expose_compute_option;
|
||||||
|
const std::function<void(Settings::AspectRatio, Settings::ResolutionSetup)> update_aspect_ratio;
|
||||||
|
|
||||||
const Core::System& system;
|
const Core::System& system;
|
||||||
const ConfigurationShared::ComboboxTranslationMap& combobox_translations;
|
const ConfigurationShared::ComboboxTranslationMap& combobox_translations;
|
||||||
|
@ -104,4 +107,6 @@ private:
|
||||||
QWidget* vulkan_device_widget;
|
QWidget* vulkan_device_widget;
|
||||||
QWidget* api_widget;
|
QWidget* api_widget;
|
||||||
QWidget* shader_backend_widget;
|
QWidget* shader_backend_widget;
|
||||||
|
QComboBox* aspect_ratio_combobox;
|
||||||
|
QComboBox* resolution_combobox;
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
#include "common/fs/fs_util.h"
|
#include "common/fs/fs_util.h"
|
||||||
|
#include "common/settings_enums.h"
|
||||||
#include "configuration/shared_widget.h"
|
#include "configuration/shared_widget.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/file_sys/control_metadata.h"
|
#include "core/file_sys/control_metadata.h"
|
||||||
|
@ -57,7 +58,7 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const std::st
|
||||||
std::make_unique<ConfigureGraphicsAdvanced>(system_, tab_group, *builder, this);
|
std::make_unique<ConfigureGraphicsAdvanced>(system_, tab_group, *builder, this);
|
||||||
graphics_tab = std::make_unique<ConfigureGraphics>(
|
graphics_tab = std::make_unique<ConfigureGraphics>(
|
||||||
system_, vk_device_records, [&]() { graphics_advanced_tab->ExposeComputeOption(); },
|
system_, vk_device_records, [&]() { graphics_advanced_tab->ExposeComputeOption(); },
|
||||||
tab_group, *builder, this);
|
[](Settings::AspectRatio, Settings::ResolutionSetup) {}, tab_group, *builder, this);
|
||||||
input_tab = std::make_unique<ConfigureInputPerGame>(system_, game_config.get(), this);
|
input_tab = std::make_unique<ConfigureInputPerGame>(system_, game_config.get(), this);
|
||||||
system_tab = std::make_unique<ConfigureSystem>(system_, tab_group, *builder, this);
|
system_tab = std::make_unique<ConfigureSystem>(system_, tab_group, *builder, this);
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,31 @@
|
||||||
// SPDX-FileCopyrightText: 2016 Citra Emulator Project
|
// SPDX-FileCopyrightText: 2016 Citra Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include <array>
|
#include "yuzu/configuration/configure_ui.h"
|
||||||
#include <utility>
|
|
||||||
#include <QFileDialog>
|
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
#include <set>
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
#include <QCheckBox>
|
||||||
|
#include <QComboBox>
|
||||||
|
#include <QCoreApplication>
|
||||||
#include <QDirIterator>
|
#include <QDirIterator>
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include <QString>
|
||||||
|
#include <QToolButton>
|
||||||
|
#include <QVariant>
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/fs/path_util.h"
|
#include "common/fs/path_util.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
|
#include "common/settings_enums.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
|
#include "core/frontend/framebuffer_layout.h"
|
||||||
#include "ui_configure_ui.h"
|
#include "ui_configure_ui.h"
|
||||||
#include "yuzu/configuration/configure_ui.h"
|
|
||||||
#include "yuzu/uisettings.h"
|
#include "yuzu/uisettings.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -54,8 +67,44 @@ QString GetTranslatedRowTextName(size_t index) {
|
||||||
}
|
}
|
||||||
} // Anonymous namespace
|
} // Anonymous namespace
|
||||||
|
|
||||||
|
static float GetUpFactor(Settings::ResolutionSetup res_setup) {
|
||||||
|
Settings::ResolutionScalingInfo info{};
|
||||||
|
Settings::TranslateResolutionInfo(res_setup, info);
|
||||||
|
return info.up_factor;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void PopulateResolutionComboBox(QComboBox* screenshot_height, QWidget* parent) {
|
||||||
|
screenshot_height->clear();
|
||||||
|
|
||||||
|
const auto& enumeration =
|
||||||
|
Settings::EnumMetadata<Settings::ResolutionSetup>::Canonicalizations();
|
||||||
|
std::set<u32> resolutions{};
|
||||||
|
for (const auto& [name, value] : enumeration) {
|
||||||
|
const float up_factor = GetUpFactor(value);
|
||||||
|
u32 height_undocked = Layout::ScreenUndocked::Height * up_factor;
|
||||||
|
u32 height_docked = Layout::ScreenDocked::Height * up_factor;
|
||||||
|
resolutions.emplace(height_undocked);
|
||||||
|
resolutions.emplace(height_docked);
|
||||||
|
}
|
||||||
|
|
||||||
|
screenshot_height->addItem(parent->tr("Auto", "Screenshot height option"));
|
||||||
|
for (const auto res : resolutions) {
|
||||||
|
screenshot_height->addItem(QString::fromStdString(std::to_string(res)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static u32 ScreenshotDimensionToInt(const QString& height) {
|
||||||
|
try {
|
||||||
|
return std::stoi(height.toStdString());
|
||||||
|
} catch (std::invalid_argument&) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ConfigureUi::ConfigureUi(Core::System& system_, QWidget* parent)
|
ConfigureUi::ConfigureUi(Core::System& system_, QWidget* parent)
|
||||||
: QWidget(parent), ui{std::make_unique<Ui::ConfigureUi>()}, system{system_} {
|
: QWidget(parent), ui{std::make_unique<Ui::ConfigureUi>()},
|
||||||
|
ratio{Settings::values.aspect_ratio.GetValue()},
|
||||||
|
resolution_setting{Settings::values.resolution_setup.GetValue()}, system{system_} {
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
InitializeLanguageComboBox();
|
InitializeLanguageComboBox();
|
||||||
|
@ -68,6 +117,8 @@ ConfigureUi::ConfigureUi(Core::System& system_, QWidget* parent)
|
||||||
InitializeIconSizeComboBox();
|
InitializeIconSizeComboBox();
|
||||||
InitializeRowComboBoxes();
|
InitializeRowComboBoxes();
|
||||||
|
|
||||||
|
PopulateResolutionComboBox(ui->screenshot_height, this);
|
||||||
|
|
||||||
SetConfiguration();
|
SetConfiguration();
|
||||||
|
|
||||||
// Force game list reload if any of the relevant settings are changed.
|
// Force game list reload if any of the relevant settings are changed.
|
||||||
|
@ -104,6 +155,10 @@ ConfigureUi::ConfigureUi(Core::System& system_, QWidget* parent)
|
||||||
ui->screenshot_path_edit->setText(dir);
|
ui->screenshot_path_edit->setText(dir);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
connect(ui->screenshot_height, &QComboBox::currentTextChanged, [this]() { UpdateWidthText(); });
|
||||||
|
|
||||||
|
UpdateWidthText();
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigureUi::~ConfigureUi() = default;
|
ConfigureUi::~ConfigureUi() = default;
|
||||||
|
@ -123,6 +178,10 @@ void ConfigureUi::ApplyConfiguration() {
|
||||||
UISettings::values.enable_screenshot_save_as = ui->enable_screenshot_save_as->isChecked();
|
UISettings::values.enable_screenshot_save_as = ui->enable_screenshot_save_as->isChecked();
|
||||||
Common::FS::SetYuzuPath(Common::FS::YuzuPath::ScreenshotsDir,
|
Common::FS::SetYuzuPath(Common::FS::YuzuPath::ScreenshotsDir,
|
||||||
ui->screenshot_path_edit->text().toStdString());
|
ui->screenshot_path_edit->text().toStdString());
|
||||||
|
|
||||||
|
const u32 height = ScreenshotDimensionToInt(ui->screenshot_height->currentText());
|
||||||
|
UISettings::values.screenshot_height.SetValue(height);
|
||||||
|
|
||||||
system.ApplySettings();
|
system.ApplySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,6 +206,13 @@ void ConfigureUi::SetConfiguration() {
|
||||||
UISettings::values.enable_screenshot_save_as.GetValue());
|
UISettings::values.enable_screenshot_save_as.GetValue());
|
||||||
ui->screenshot_path_edit->setText(QString::fromStdString(
|
ui->screenshot_path_edit->setText(QString::fromStdString(
|
||||||
Common::FS::GetYuzuPathString(Common::FS::YuzuPath::ScreenshotsDir)));
|
Common::FS::GetYuzuPathString(Common::FS::YuzuPath::ScreenshotsDir)));
|
||||||
|
|
||||||
|
const auto height = UISettings::values.screenshot_height.GetValue();
|
||||||
|
if (height == 0) {
|
||||||
|
ui->screenshot_height->setCurrentIndex(0);
|
||||||
|
} else {
|
||||||
|
ui->screenshot_height->setCurrentText(QStringLiteral("%1").arg(height));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureUi::changeEvent(QEvent* event) {
|
void ConfigureUi::changeEvent(QEvent* event) {
|
||||||
|
@ -317,3 +383,29 @@ void ConfigureUi::OnLanguageChanged(int index) {
|
||||||
|
|
||||||
emit LanguageChanged(ui->language_combobox->itemData(index).toString());
|
emit LanguageChanged(ui->language_combobox->itemData(index).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConfigureUi::UpdateWidthText() {
|
||||||
|
const u32 height = ScreenshotDimensionToInt(ui->screenshot_height->currentText());
|
||||||
|
const u32 width = UISettings::CalculateWidth(height, ratio);
|
||||||
|
if (height == 0) {
|
||||||
|
const auto up_factor = GetUpFactor(resolution_setting);
|
||||||
|
const u32 height_docked = Layout::ScreenDocked::Height * up_factor;
|
||||||
|
const u32 width_docked = UISettings::CalculateWidth(height_docked, ratio);
|
||||||
|
const u32 height_undocked = Layout::ScreenUndocked::Height * up_factor;
|
||||||
|
const u32 width_undocked = UISettings::CalculateWidth(height_undocked, ratio);
|
||||||
|
ui->screenshot_width->setText(tr("Auto (%1 x %2, %3 x %4)", "Screenshot width value")
|
||||||
|
.arg(width_undocked)
|
||||||
|
.arg(height_undocked)
|
||||||
|
.arg(width_docked)
|
||||||
|
.arg(height_docked));
|
||||||
|
} else {
|
||||||
|
ui->screenshot_width->setText(QStringLiteral("%1 x").arg(width));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfigureUi::UpdateScreenshotInfo(Settings::AspectRatio ratio_,
|
||||||
|
Settings::ResolutionSetup resolution_setting_) {
|
||||||
|
ratio = ratio_;
|
||||||
|
resolution_setting = resolution_setting_;
|
||||||
|
UpdateWidthText();
|
||||||
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include "common/settings_enums.h"
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
class System;
|
class System;
|
||||||
|
@ -23,6 +24,9 @@ public:
|
||||||
|
|
||||||
void ApplyConfiguration();
|
void ApplyConfiguration();
|
||||||
|
|
||||||
|
void UpdateScreenshotInfo(Settings::AspectRatio ratio,
|
||||||
|
Settings::ResolutionSetup resolution_info);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void OnLanguageChanged(int index);
|
void OnLanguageChanged(int index);
|
||||||
|
|
||||||
|
@ -44,7 +48,11 @@ private:
|
||||||
void UpdateFirstRowComboBox(bool init = false);
|
void UpdateFirstRowComboBox(bool init = false);
|
||||||
void UpdateSecondRowComboBox(bool init = false);
|
void UpdateSecondRowComboBox(bool init = false);
|
||||||
|
|
||||||
|
void UpdateWidthText();
|
||||||
|
|
||||||
std::unique_ptr<Ui::ConfigureUi> ui;
|
std::unique_ptr<Ui::ConfigureUi> ui;
|
||||||
|
|
||||||
|
Settings::AspectRatio ratio;
|
||||||
|
Settings::ResolutionSetup resolution_setting;
|
||||||
Core::System& system;
|
Core::System& system;
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>363</width>
|
<width>363</width>
|
||||||
<height>562</height>
|
<height>603</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -201,6 +201,41 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="screenshot_width">
|
||||||
|
<property name="text">
|
||||||
|
<string>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="screenshot_height">
|
||||||
|
<property name="editable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Resolution:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
|
@ -36,4 +36,20 @@ bool IsDarkTheme() {
|
||||||
|
|
||||||
Values values = {};
|
Values values = {};
|
||||||
|
|
||||||
|
u32 CalculateWidth(u32 height, Settings::AspectRatio ratio) {
|
||||||
|
switch (ratio) {
|
||||||
|
case Settings::AspectRatio::R4_3:
|
||||||
|
return height * 4 / 3;
|
||||||
|
case Settings::AspectRatio::R21_9:
|
||||||
|
return height * 21 / 9;
|
||||||
|
case Settings::AspectRatio::R16_10:
|
||||||
|
return height * 16 / 10;
|
||||||
|
case Settings::AspectRatio::R16_9:
|
||||||
|
case Settings::AspectRatio::Stretch:
|
||||||
|
// TODO: Move this function wherever appropriate to implement Stretched aspect
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return height * 16 / 9;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace UISettings
|
} // namespace UISettings
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
|
#include "common/settings_enums.h"
|
||||||
|
|
||||||
using Settings::Category;
|
using Settings::Category;
|
||||||
using Settings::Setting;
|
using Settings::Setting;
|
||||||
|
@ -127,8 +128,10 @@ struct Values {
|
||||||
// logging
|
// logging
|
||||||
Setting<bool> show_console{linkage, false, "showConsole", Category::Ui};
|
Setting<bool> show_console{linkage, false, "showConsole", Category::Ui};
|
||||||
|
|
||||||
|
// Screenshots
|
||||||
Setting<bool> enable_screenshot_save_as{linkage, true, "enable_screenshot_save_as",
|
Setting<bool> enable_screenshot_save_as{linkage, true, "enable_screenshot_save_as",
|
||||||
Category::Screenshots};
|
Category::Screenshots};
|
||||||
|
Setting<u32> screenshot_height{linkage, 0, "screenshot_height", Category::Screenshots};
|
||||||
|
|
||||||
QString roms_path;
|
QString roms_path;
|
||||||
QString symbols_path;
|
QString symbols_path;
|
||||||
|
@ -187,6 +190,8 @@ struct Values {
|
||||||
|
|
||||||
extern Values values;
|
extern Values values;
|
||||||
|
|
||||||
|
u32 CalculateWidth(u32 height, Settings::AspectRatio ratio);
|
||||||
|
|
||||||
} // namespace UISettings
|
} // namespace UISettings
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(UISettings::GameDir*);
|
Q_DECLARE_METATYPE(UISettings::GameDir*);
|
||||||
|
|
Loading…
Reference in a new issue