citra_qt: Add enhancement options to per-game (#6308)

Co-authored-by: Tobias <thm.frey@gmail.com>
This commit is contained in:
GPUCode 2023-03-21 23:12:13 +02:00 committed by GitHub
parent fbf53686c3
commit 0c3fe272b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 421 additions and 258 deletions

View File

@ -256,7 +256,6 @@ void Config::ReadValues() {
ReadDebuggingValues(); ReadDebuggingValues();
ReadWebServiceValues(); ReadWebServiceValues();
ReadVideoDumpingValues(); ReadVideoDumpingValues();
ReadUtilityValues();
} }
ReadUIValues(); ReadUIValues();
@ -265,6 +264,7 @@ void Config::ReadValues() {
ReadLayoutValues(); ReadLayoutValues();
ReadAudioValues(); ReadAudioValues();
ReadSystemValues(); ReadSystemValues();
ReadUtilityValues();
} }
void Config::ReadAudioValues() { void Config::ReadAudioValues() {
@ -436,9 +436,9 @@ void Config::ReadControlValues() {
void Config::ReadUtilityValues() { void Config::ReadUtilityValues() {
qt_config->beginGroup(QStringLiteral("Utility")); qt_config->beginGroup(QStringLiteral("Utility"));
ReadBasicSetting(Settings::values.dump_textures); ReadGlobalSetting(Settings::values.dump_textures);
ReadBasicSetting(Settings::values.custom_textures); ReadGlobalSetting(Settings::values.custom_textures);
ReadBasicSetting(Settings::values.preload_textures); ReadGlobalSetting(Settings::values.preload_textures);
qt_config->endGroup(); qt_config->endGroup();
} }
@ -497,9 +497,9 @@ void Config::ReadLayoutValues() {
ReadGlobalSetting(Settings::values.render_3d); ReadGlobalSetting(Settings::values.render_3d);
ReadGlobalSetting(Settings::values.factor_3d); ReadGlobalSetting(Settings::values.factor_3d);
ReadGlobalSetting(Settings::values.filter_mode);
ReadGlobalSetting(Settings::values.pp_shader_name); ReadGlobalSetting(Settings::values.pp_shader_name);
ReadGlobalSetting(Settings::values.anaglyph_shader_name); ReadGlobalSetting(Settings::values.anaglyph_shader_name);
ReadGlobalSetting(Settings::values.filter_mode);
ReadGlobalSetting(Settings::values.layout_option); ReadGlobalSetting(Settings::values.layout_option);
ReadGlobalSetting(Settings::values.swap_screen); ReadGlobalSetting(Settings::values.swap_screen);
ReadGlobalSetting(Settings::values.upright_screen); ReadGlobalSetting(Settings::values.upright_screen);
@ -830,7 +830,6 @@ void Config::SaveValues() {
SaveDebuggingValues(); SaveDebuggingValues();
SaveWebServiceValues(); SaveWebServiceValues();
SaveVideoDumpingValues(); SaveVideoDumpingValues();
SaveUtilityValues();
} }
SaveUIValues(); SaveUIValues();
@ -839,6 +838,7 @@ void Config::SaveValues() {
SaveLayoutValues(); SaveLayoutValues();
SaveAudioValues(); SaveAudioValues();
SaveSystemValues(); SaveSystemValues();
SaveUtilityValues();
qt_config->sync(); qt_config->sync();
} }
@ -951,9 +951,9 @@ void Config::SaveControlValues() {
void Config::SaveUtilityValues() { void Config::SaveUtilityValues() {
qt_config->beginGroup(QStringLiteral("Utility")); qt_config->beginGroup(QStringLiteral("Utility"));
WriteBasicSetting(Settings::values.dump_textures); WriteGlobalSetting(Settings::values.dump_textures);
WriteBasicSetting(Settings::values.custom_textures); WriteGlobalSetting(Settings::values.custom_textures);
WriteBasicSetting(Settings::values.preload_textures); WriteGlobalSetting(Settings::values.preload_textures);
qt_config->endGroup(); qt_config->endGroup();
} }
@ -1007,9 +1007,9 @@ void Config::SaveLayoutValues() {
WriteGlobalSetting(Settings::values.render_3d); WriteGlobalSetting(Settings::values.render_3d);
WriteGlobalSetting(Settings::values.factor_3d); WriteGlobalSetting(Settings::values.factor_3d);
WriteGlobalSetting(Settings::values.filter_mode);
WriteGlobalSetting(Settings::values.pp_shader_name); WriteGlobalSetting(Settings::values.pp_shader_name);
WriteGlobalSetting(Settings::values.anaglyph_shader_name); WriteGlobalSetting(Settings::values.anaglyph_shader_name);
WriteGlobalSetting(Settings::values.filter_mode);
WriteGlobalSetting(Settings::values.layout_option); WriteGlobalSetting(Settings::values.layout_option);
WriteGlobalSetting(Settings::values.swap_screen); WriteGlobalSetting(Settings::values.swap_screen);
WriteGlobalSetting(Settings::values.upright_screen); WriteGlobalSetting(Settings::values.upright_screen);

View File

@ -33,6 +33,16 @@ void ConfigurationShared::SetPerGameSetting(QCheckBox* checkbox,
} }
} }
template <>
void ConfigurationShared::SetPerGameSetting(
QComboBox* combobox, const Settings::SwitchableSetting<std::string>* setting) {
const int index =
static_cast<int>(combobox->findText(QString::fromStdString(setting->GetValue())));
combobox->setCurrentIndex(setting->UsingGlobal()
? ConfigurationShared::USE_GLOBAL_INDEX
: index + ConfigurationShared::USE_GLOBAL_OFFSET);
}
void ConfigurationShared::SetHighlight(QWidget* widget, bool highlighted) { void ConfigurationShared::SetHighlight(QWidget* widget, bool highlighted) {
if (highlighted) { if (highlighted) {
widget->setStyleSheet(QStringLiteral("QWidget#%1 { background-color:rgba(0,203,255,0.5) }") widget->setStyleSheet(QStringLiteral("QWidget#%1 { background-color:rgba(0,203,255,0.5) }")

View File

@ -78,6 +78,11 @@ void SetPerGameSetting(QComboBox* combobox,
ConfigurationShared::USE_GLOBAL_OFFSET); ConfigurationShared::USE_GLOBAL_OFFSET);
} }
/// Specialization for string settings
template <>
void SetPerGameSetting(QComboBox* combobox,
const Settings::SwitchableSetting<std::string>* setting);
/// Given a Qt widget sets the background color to indicate whether the setting /// Given a Qt widget sets the background color to indicate whether the setting
/// is per-game overriden (highlighted) or global (non-highlighted) /// is per-game overriden (highlighted) or global (non-highlighted)
void SetHighlight(QWidget* widget, bool highlighted); void SetHighlight(QWidget* widget, bool highlighted);

View File

@ -3,9 +3,9 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <QColorDialog> #include <QColorDialog>
#include "citra_qt/configuration/configuration_shared.h"
#include "citra_qt/configuration/configure_enhancements.h" #include "citra_qt/configuration/configure_enhancements.h"
#include "common/settings.h" #include "common/settings.h"
#include "core/core.h"
#include "ui_configure_enhancements.h" #include "ui_configure_enhancements.h"
#include "video_core/renderer_opengl/post_processing_opengl.h" #include "video_core/renderer_opengl/post_processing_opengl.h"
#include "video_core/renderer_opengl/texture_filters/texture_filterer.h" #include "video_core/renderer_opengl/texture_filters/texture_filterer.h"
@ -17,9 +17,10 @@ ConfigureEnhancements::ConfigureEnhancements(QWidget* parent)
for (const auto& filter : OpenGL::TextureFilterer::GetFilterNames()) for (const auto& filter : OpenGL::TextureFilterer::GetFilterNames())
ui->texture_filter_combobox->addItem(QString::fromStdString(filter.data())); ui->texture_filter_combobox->addItem(QString::fromStdString(filter.data()));
SetupPerGameUI();
SetConfiguration(); SetConfiguration();
ui->layoutBox->setEnabled(!Settings::values.custom_layout); ui->layout_group->setEnabled(!Settings::values.custom_layout);
ui->resolution_factor_combobox->setEnabled(Settings::values.use_hw_renderer.GetValue()); ui->resolution_factor_combobox->setEnabled(Settings::values.use_hw_renderer.GetValue());
@ -49,15 +50,24 @@ ConfigureEnhancements::ConfigureEnhancements(QWidget* parent)
}); });
} }
ConfigureEnhancements::~ConfigureEnhancements() = default;
void ConfigureEnhancements::SetConfiguration() { void ConfigureEnhancements::SetConfiguration() {
ui->resolution_factor_combobox->setCurrentIndex(Settings::values.resolution_factor.GetValue());
ui->render_3d_combobox->setCurrentIndex( if (!Settings::IsConfiguringGlobal()) {
static_cast<int>(Settings::values.render_3d.GetValue())); ConfigurationShared::SetPerGameSetting(ui->resolution_factor_combobox,
ui->factor_3d->setValue(Settings::values.factor_3d.GetValue()); &Settings::values.resolution_factor);
ui->mono_rendering_eye->setCurrentIndex( ConfigurationShared::SetPerGameSetting(ui->texture_filter_combobox,
static_cast<int>(Settings::values.mono_render_option.GetValue())); &Settings::values.texture_filter_name);
updateShaders(Settings::values.render_3d.GetValue()); ConfigurationShared::SetHighlight(ui->widget_texture_filter,
ui->toggle_linear_filter->setChecked(Settings::values.filter_mode.GetValue()); !Settings::values.texture_filter_name.UsingGlobal());
ConfigurationShared::SetPerGameSetting(ui->layout_combobox,
&Settings::values.layout_option);
} else {
ui->resolution_factor_combobox->setCurrentIndex(
Settings::values.resolution_factor.GetValue());
ui->layout_combobox->setCurrentIndex(
static_cast<int>(Settings::values.layout_option.GetValue()));
int tex_filter_idx = ui->texture_filter_combobox->findText( int tex_filter_idx = ui->texture_filter_combobox->findText(
QString::fromStdString(Settings::values.texture_filter_name.GetValue())); QString::fromStdString(Settings::values.texture_filter_name.GetValue()));
if (tex_filter_idx == -1) { if (tex_filter_idx == -1) {
@ -65,10 +75,17 @@ void ConfigureEnhancements::SetConfiguration() {
} else { } else {
ui->texture_filter_combobox->setCurrentIndex(tex_filter_idx); ui->texture_filter_combobox->setCurrentIndex(tex_filter_idx);
} }
ui->layout_combobox->setCurrentIndex( }
static_cast<int>(Settings::values.layout_option.GetValue()));
ui->swap_screen->setChecked(Settings::values.swap_screen.GetValue()); ui->render_3d_combobox->setCurrentIndex(
ui->upright_screen->setChecked(Settings::values.upright_screen.GetValue()); static_cast<int>(Settings::values.render_3d.GetValue()));
ui->factor_3d->setValue(Settings::values.factor_3d.GetValue());
ui->mono_rendering_eye->setCurrentIndex(
static_cast<int>(Settings::values.mono_render_option.GetValue()));
updateShaders(Settings::values.render_3d.GetValue());
ui->toggle_linear_filter->setChecked(Settings::values.filter_mode.GetValue());
ui->toggle_swap_screen->setChecked(Settings::values.swap_screen.GetValue());
ui->toggle_upright_screen->setChecked(Settings::values.upright_screen.GetValue());
ui->large_screen_proportion->setValue(Settings::values.large_screen_proportion.GetValue()); ui->large_screen_proportion->setValue(Settings::values.large_screen_proportion.GetValue());
ui->toggle_dump_textures->setChecked(Settings::values.dump_textures.GetValue()); ui->toggle_dump_textures->setChecked(Settings::values.dump_textures.GetValue());
ui->toggle_custom_textures->setChecked(Settings::values.custom_textures.GetValue()); ui->toggle_custom_textures->setChecked(Settings::values.custom_textures.GetValue());
@ -118,8 +135,8 @@ void ConfigureEnhancements::RetranslateUI() {
} }
void ConfigureEnhancements::ApplyConfiguration() { void ConfigureEnhancements::ApplyConfiguration() {
Settings::values.resolution_factor = ConfigurationShared::ApplyPerGameSetting(&Settings::values.resolution_factor,
static_cast<u16>(ui->resolution_factor_combobox->currentIndex()); ui->resolution_factor_combobox);
Settings::values.render_3d = Settings::values.render_3d =
static_cast<Settings::StereoRenderOption>(ui->render_3d_combobox->currentIndex()); static_cast<Settings::StereoRenderOption>(ui->render_3d_combobox->currentIndex());
Settings::values.factor_3d = ui->factor_3d->value(); Settings::values.factor_3d = ui->factor_3d->value();
@ -132,19 +149,69 @@ void ConfigureEnhancements::ApplyConfiguration() {
Settings::values.pp_shader_name = Settings::values.pp_shader_name =
ui->shader_combobox->itemText(ui->shader_combobox->currentIndex()).toStdString(); ui->shader_combobox->itemText(ui->shader_combobox->currentIndex()).toStdString();
} }
Settings::values.filter_mode = ui->toggle_linear_filter->isChecked();
Settings::values.texture_filter_name = ui->texture_filter_combobox->currentText().toStdString();
Settings::values.layout_option =
static_cast<Settings::LayoutOption>(ui->layout_combobox->currentIndex());
Settings::values.swap_screen = ui->swap_screen->isChecked();
Settings::values.upright_screen = ui->upright_screen->isChecked();
Settings::values.large_screen_proportion = ui->large_screen_proportion->value(); Settings::values.large_screen_proportion = ui->large_screen_proportion->value();
Settings::values.dump_textures = ui->toggle_dump_textures->isChecked();
Settings::values.custom_textures = ui->toggle_custom_textures->isChecked(); ConfigurationShared::ApplyPerGameSetting(&Settings::values.filter_mode,
Settings::values.preload_textures = ui->toggle_preload_textures->isChecked(); ui->toggle_linear_filter, linear_filter);
ConfigurationShared::ApplyPerGameSetting(
&Settings::values.texture_filter_name, ui->texture_filter_combobox,
[this](int index) { return ui->texture_filter_combobox->itemText(index).toStdString(); });
ConfigurationShared::ApplyPerGameSetting(&Settings::values.layout_option, ui->layout_combobox);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.swap_screen, ui->toggle_swap_screen,
swap_screen);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.upright_screen,
ui->toggle_upright_screen, upright_screen);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.dump_textures,
ui->toggle_dump_textures, dump_textures);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.custom_textures,
ui->toggle_custom_textures, custom_textures);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.preload_textures,
ui->toggle_preload_textures, preload_textures);
Settings::values.bg_red = static_cast<float>(bg_color.redF()); Settings::values.bg_red = static_cast<float>(bg_color.redF());
Settings::values.bg_green = static_cast<float>(bg_color.greenF()); Settings::values.bg_green = static_cast<float>(bg_color.greenF());
Settings::values.bg_blue = static_cast<float>(bg_color.blueF()); Settings::values.bg_blue = static_cast<float>(bg_color.blueF());
} }
ConfigureEnhancements::~ConfigureEnhancements() {} void ConfigureEnhancements::SetupPerGameUI() {
// Block the global settings if a game is currently running that overrides them
if (Settings::IsConfiguringGlobal()) {
ui->widget_resolution->setEnabled(Settings::values.resolution_factor.UsingGlobal());
ui->widget_texture_filter->setEnabled(Settings::values.texture_filter_name.UsingGlobal());
ui->toggle_linear_filter->setEnabled(Settings::values.filter_mode.UsingGlobal());
ui->toggle_swap_screen->setEnabled(Settings::values.swap_screen.UsingGlobal());
ui->toggle_upright_screen->setEnabled(Settings::values.upright_screen.UsingGlobal());
ui->toggle_dump_textures->setEnabled(Settings::values.dump_textures.UsingGlobal());
ui->toggle_custom_textures->setEnabled(Settings::values.custom_textures.UsingGlobal());
ui->toggle_preload_textures->setEnabled(Settings::values.preload_textures.UsingGlobal());
return;
}
ui->stereo_group->setVisible(false);
ui->widget_shader->setVisible(false);
ui->bg_color_group->setVisible(false);
ConfigurationShared::SetColoredTristate(ui->toggle_linear_filter, Settings::values.filter_mode,
linear_filter);
ConfigurationShared::SetColoredTristate(ui->toggle_swap_screen, Settings::values.swap_screen,
swap_screen);
ConfigurationShared::SetColoredTristate(ui->toggle_upright_screen,
Settings::values.upright_screen, upright_screen);
ConfigurationShared::SetColoredTristate(ui->toggle_dump_textures,
Settings::values.dump_textures, dump_textures);
ConfigurationShared::SetColoredTristate(ui->toggle_custom_textures,
Settings::values.custom_textures, custom_textures);
ConfigurationShared::SetColoredTristate(ui->toggle_preload_textures,
Settings::values.preload_textures, preload_textures);
ConfigurationShared::SetColoredComboBox(
ui->resolution_factor_combobox, ui->widget_resolution,
static_cast<u32>(Settings::values.resolution_factor.GetValue(true)));
ConfigurationShared::SetColoredComboBox(ui->texture_filter_combobox, ui->widget_texture_filter,
0);
ConfigurationShared::SetColoredComboBox(
ui->layout_combobox, ui->widget_layout,
static_cast<u32>(Settings::values.layout_option.GetValue(true)));
}

View File

@ -12,6 +12,10 @@ namespace Settings {
enum class StereoRenderOption : u32; enum class StereoRenderOption : u32;
} }
namespace ConfigurationShared {
enum class CheckState;
}
namespace Ui { namespace Ui {
class ConfigureEnhancements; class ConfigureEnhancements;
} }
@ -27,10 +31,18 @@ public:
void RetranslateUI(); void RetranslateUI();
void SetConfiguration(); void SetConfiguration();
void SetupPerGameUI();
private: private:
void updateShaders(Settings::StereoRenderOption stereo_option); void updateShaders(Settings::StereoRenderOption stereo_option);
void updateTextureFilter(int index); void updateTextureFilter(int index);
std::unique_ptr<Ui::ConfigureEnhancements> ui; std::unique_ptr<Ui::ConfigureEnhancements> ui;
ConfigurationShared::CheckState linear_filter;
ConfigurationShared::CheckState swap_screen;
ConfigurationShared::CheckState upright_screen;
ConfigurationShared::CheckState dump_textures;
ConfigurationShared::CheckState custom_textures;
ConfigurationShared::CheckState preload_textures;
QColor bg_color; QColor bg_color;
}; };

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>400</width> <width>400</width>
<height>634</height> <height>657</height>
</rect> </rect>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
@ -27,9 +27,22 @@
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_6"> <layout class="QVBoxLayout" name="verticalLayout_6">
<item> <item>
<widget class="QWidget" name="widget_resolution" native="true">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="resolution_label">
<property name="text"> <property name="text">
<string>Internal Resolution</string> <string>Internal Resolution</string>
</property> </property>
@ -95,6 +108,7 @@
</widget> </widget>
</item> </item>
</layout> </layout>
</widget>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="toggle_linear_filter"> <widget class="QCheckBox" name="toggle_linear_filter">
@ -104,9 +118,22 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QWidget" name="widget_shader" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_11"> <layout class="QHBoxLayout" name="horizontalLayout_11">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item> <item>
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="shader_label">
<property name="text"> <property name="text">
<string>Post-Processing Shader</string> <string>Post-Processing Shader</string>
</property> </property>
@ -116,11 +143,25 @@
<widget class="QComboBox" name="shader_combobox"/> <widget class="QComboBox" name="shader_combobox"/>
</item> </item>
</layout> </layout>
</widget>
</item> </item>
<item> <item>
<widget class="QWidget" name="widget_texture_filter" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item> <item>
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="texture_filter_label">
<property name="text"> <property name="text">
<string>Texture Filter</string> <string>Texture Filter</string>
</property> </property>
@ -130,12 +171,13 @@
<widget class="QComboBox" name="texture_filter_combobox"/> <widget class="QComboBox" name="texture_filter_combobox"/>
</item> </item>
</layout> </layout>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="stereo_group">
<property name="title"> <property name="title">
<string>Stereoscopy</string> <string>Stereoscopy</string>
</property> </property>
@ -236,15 +278,28 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="layoutBox"> <widget class="QGroupBox" name="layout_group">
<property name="title"> <property name="title">
<string>Layout</string> <string>Layout</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_3">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <widget class="QWidget" name="widget_layout" native="true">
<layout class="QHBoxLayout" name="screen_layout_group">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item> <item>
<widget class="QLabel" name="label1"> <widget class="QLabel" name="layout_label">
<property name="text"> <property name="text">
<string>Screen Layout:</string> <string>Screen Layout:</string>
</property> </property>
@ -280,23 +335,37 @@
</widget> </widget>
</item> </item>
</layout> </layout>
</widget>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="swap_screen"> <widget class="QCheckBox" name="toggle_swap_screen">
<property name="text"> <property name="text">
<string>Swap Screens</string> <string>Swap Screens</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="upright_screen"> <widget class="QCheckBox" name="toggle_upright_screen">
<property name="text"> <property name="text">
<string>Rotate Screens Upright</string> <string>Rotate Screens Upright</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_7"> <widget class="QWidget" name="" native="true">
<layout class="QHBoxLayout" name="proportion_layout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item> <item>
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
@ -307,20 +376,34 @@
<item> <item>
<widget class="QDoubleSpinBox" name="large_screen_proportion"> <widget class="QDoubleSpinBox" name="large_screen_proportion">
<property name="minimum"> <property name="minimum">
<number>1</number> <double>1.000000000000000</double>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>16</number> <double>16.000000000000000</double>
</property> </property>
<property name="value"> <property name="value">
<number>4</number> <double>4.000000000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_6"> <widget class="QWidget" name="bg_color_group" native="true">
<layout class="QHBoxLayout" name="bg_color_group_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item> <item>
<widget class="QLabel" name="bg_label"> <widget class="QLabel" name="bg_label">
<property name="text"> <property name="text">
@ -339,6 +422,7 @@
</widget> </widget>
</item> </item>
</layout> </layout>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
@ -406,8 +490,8 @@
<tabstop>factor_3d</tabstop> <tabstop>factor_3d</tabstop>
<tabstop>mono_rendering_eye</tabstop> <tabstop>mono_rendering_eye</tabstop>
<tabstop>layout_combobox</tabstop> <tabstop>layout_combobox</tabstop>
<tabstop>swap_screen</tabstop> <tabstop>toggle_swap_screen</tabstop>
<tabstop>upright_screen</tabstop> <tabstop>toggle_upright_screen</tabstop>
<tabstop>large_screen_proportion</tabstop> <tabstop>large_screen_proportion</tabstop>
<tabstop>bg_button</tabstop> <tabstop>bg_button</tabstop>
<tabstop>toggle_custom_textures</tabstop> <tabstop>toggle_custom_textures</tabstop>

View File

@ -10,6 +10,7 @@
#include "citra_qt/configuration/config.h" #include "citra_qt/configuration/config.h"
#include "citra_qt/configuration/configure_audio.h" #include "citra_qt/configuration/configure_audio.h"
#include "citra_qt/configuration/configure_debug.h" #include "citra_qt/configuration/configure_debug.h"
#include "citra_qt/configuration/configure_enhancements.h"
#include "citra_qt/configuration/configure_general.h" #include "citra_qt/configuration/configure_general.h"
#include "citra_qt/configuration/configure_graphics.h" #include "citra_qt/configuration/configure_graphics.h"
#include "citra_qt/configuration/configure_per_game.h" #include "citra_qt/configuration/configure_per_game.h"
@ -30,6 +31,7 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const QString
audio_tab = std::make_unique<ConfigureAudio>(this); audio_tab = std::make_unique<ConfigureAudio>(this);
general_tab = std::make_unique<ConfigureGeneral>(this); general_tab = std::make_unique<ConfigureGeneral>(this);
enhancements_tab = std::make_unique<ConfigureEnhancements>(this);
graphics_tab = std::make_unique<ConfigureGraphics>(this); graphics_tab = std::make_unique<ConfigureGraphics>(this);
system_tab = std::make_unique<ConfigureSystem>(this); system_tab = std::make_unique<ConfigureSystem>(this);
debug_tab = std::make_unique<ConfigureDebug>(this); debug_tab = std::make_unique<ConfigureDebug>(this);
@ -38,6 +40,7 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const QString
ui->tabWidget->addTab(general_tab.get(), tr("General")); ui->tabWidget->addTab(general_tab.get(), tr("General"));
ui->tabWidget->addTab(system_tab.get(), tr("System")); ui->tabWidget->addTab(system_tab.get(), tr("System"));
ui->tabWidget->addTab(enhancements_tab.get(), tr("Enhancements"));
ui->tabWidget->addTab(graphics_tab.get(), tr("Graphics")); ui->tabWidget->addTab(graphics_tab.get(), tr("Graphics"));
ui->tabWidget->addTab(audio_tab.get(), tr("Audio")); ui->tabWidget->addTab(audio_tab.get(), tr("Audio"));
ui->tabWidget->addTab(debug_tab.get(), tr("Debug")); ui->tabWidget->addTab(debug_tab.get(), tr("Debug"));
@ -81,10 +84,12 @@ void ConfigurePerGame::ResetDefaults() {
void ConfigurePerGame::ApplyConfiguration() { void ConfigurePerGame::ApplyConfiguration() {
general_tab->ApplyConfiguration(); general_tab->ApplyConfiguration();
system_tab->ApplyConfiguration(); system_tab->ApplyConfiguration();
enhancements_tab->ApplyConfiguration();
graphics_tab->ApplyConfiguration(); graphics_tab->ApplyConfiguration();
audio_tab->ApplyConfiguration(); audio_tab->ApplyConfiguration();
debug_tab->ApplyConfiguration(); debug_tab->ApplyConfiguration();
Settings::Apply();
Settings::LogSettings(); Settings::LogSettings();
game_config->Save(); game_config->Save();

View File

@ -15,6 +15,7 @@ class System;
class ConfigureAudio; class ConfigureAudio;
class ConfigureGeneral; class ConfigureGeneral;
class ConfigureEnhancements;
class ConfigureGraphics; class ConfigureGraphics;
class ConfigureSystem; class ConfigureSystem;
class ConfigureDebug; class ConfigureDebug;
@ -65,6 +66,7 @@ private:
std::unique_ptr<ConfigureAudio> audio_tab; std::unique_ptr<ConfigureAudio> audio_tab;
std::unique_ptr<ConfigureGeneral> general_tab; std::unique_ptr<ConfigureGeneral> general_tab;
std::unique_ptr<ConfigureEnhancements> enhancements_tab;
std::unique_ptr<ConfigureGraphics> graphics_tab; std::unique_ptr<ConfigureGraphics> graphics_tab;
std::unique_ptr<ConfigureSystem> system_tab; std::unique_ptr<ConfigureSystem> system_tab;
std::unique_ptr<ConfigureDebug> debug_tab; std::unique_ptr<ConfigureDebug> debug_tab;

View File

@ -20,6 +20,17 @@
namespace Settings { namespace Settings {
std::string_view GetAudioEmulationName(AudioEmulation emulation) {
switch (emulation) {
case AudioEmulation::HLE:
return "HLE";
case AudioEmulation::LLE:
return "LLE";
case AudioEmulation::LLEMultithreaded:
return "LLE Multithreaded";
}
};
Values values = {}; Values values = {};
static bool configuring_global = true; static bool configuring_global = true;
@ -86,17 +97,6 @@ void LogSettings() {
LOG_INFO(Config, "{}: {}", name, value); LOG_INFO(Config, "{}: {}", name, value);
}; };
const auto to_string = [](AudioEmulation emulation) -> std::string_view {
switch (emulation) {
case AudioEmulation::HLE:
return "HLE";
case AudioEmulation::LLE:
return "LLE";
case AudioEmulation::LLEMultithreaded:
return "LLE Multithreaded";
}
};
LOG_INFO(Config, "Citra Configuration:"); LOG_INFO(Config, "Citra Configuration:");
log_setting("Core_UseCpuJit", values.use_cpu_jit.GetValue()); log_setting("Core_UseCpuJit", values.use_cpu_jit.GetValue());
log_setting("Core_CPUClockPercentage", values.cpu_clock_percentage.GetValue()); log_setting("Core_CPUClockPercentage", values.cpu_clock_percentage.GetValue());
@ -125,7 +125,7 @@ void LogSettings() {
log_setting("Utility_DumpTextures", values.dump_textures.GetValue()); log_setting("Utility_DumpTextures", values.dump_textures.GetValue());
log_setting("Utility_CustomTextures", values.custom_textures.GetValue()); log_setting("Utility_CustomTextures", values.custom_textures.GetValue());
log_setting("Utility_UseDiskShaderCache", values.use_disk_shader_cache.GetValue()); log_setting("Utility_UseDiskShaderCache", values.use_disk_shader_cache.GetValue());
log_setting("Audio_Emulation", to_string(values.audio_emulation.GetValue())); log_setting("Audio_Emulation", GetAudioEmulationName(values.audio_emulation.GetValue()));
log_setting("Audio_OutputEngine", values.sink_id.GetValue()); log_setting("Audio_OutputEngine", values.sink_id.GetValue());
log_setting("Audio_EnableAudioStretching", values.enable_audio_stretching.GetValue()); log_setting("Audio_EnableAudioStretching", values.enable_audio_stretching.GetValue());
log_setting("Audio_OutputDevice", values.audio_device_id.GetValue()); log_setting("Audio_OutputDevice", values.audio_device_id.GetValue());
@ -207,6 +207,9 @@ void RestoreGlobalState(bool is_powered_on) {
values.filter_mode.SetGlobal(true); values.filter_mode.SetGlobal(true);
values.pp_shader_name.SetGlobal(true); values.pp_shader_name.SetGlobal(true);
values.anaglyph_shader_name.SetGlobal(true); values.anaglyph_shader_name.SetGlobal(true);
values.dump_textures.SetGlobal(true);
values.custom_textures.SetGlobal(true);
values.preload_textures.SetGlobal(true);
} }
void LoadProfile(int index) { void LoadProfile(int index) {

View File

@ -54,9 +54,16 @@ enum class StereoRenderOption : u32 {
// Which eye to render when 3d is off. 800px wide mode could be added here in the future, when // Which eye to render when 3d is off. 800px wide mode could be added here in the future, when
// implemented // implemented
enum class MonoRenderOption : u32 { LeftEye = 0, RightEye = 1 }; enum class MonoRenderOption : u32 {
LeftEye = 0,
RightEye = 1,
};
enum class AudioEmulation : u32 { HLE = 0, LLE = 1, LLEMultithreaded = 2 }; enum class AudioEmulation : u32 {
HLE = 0,
LLE = 1,
LLEMultithreaded = 2,
};
namespace NativeButton { namespace NativeButton {
@ -361,38 +368,6 @@ protected:
Type custom{}; ///< The custom value of the setting Type custom{}; ///< The custom value of the setting
}; };
/**
* The InputSetting class allows for getting a reference to either the global or custom members.
* This is required as we cannot easily modify the values of user-defined types within containers
* using the SetValue() member function found in the Setting class. The primary purpose of this
* class is to store an array of 10 PlayerInput structs for both the global and custom setting and
* allows for easily accessing and modifying both settings.
*/
template <typename Type>
class InputSetting final {
public:
InputSetting() = default;
explicit InputSetting(Type val) : Setting<Type>(val) {}
~InputSetting() = default;
void SetGlobal(bool to_global) {
use_global = to_global;
}
[[nodiscard]] bool UsingGlobal() const {
return use_global;
}
[[nodiscard]] Type& GetValue(bool need_global = false) {
if (use_global || need_global) {
return global;
}
return custom;
}
private:
bool use_global{true}; ///< The setting's global state
Type global{}; ///< The setting
Type custom{}; ///< The custom setting value
};
struct InputProfile { struct InputProfile {
std::string name; std::string name;
std::array<std::string, NativeButton::NumButtons> buttons; std::array<std::string, NativeButton::NumButtons> buttons;
@ -485,9 +460,9 @@ struct Values {
SwitchableSetting<std::string> pp_shader_name{"none (builtin)", "pp_shader_name"}; SwitchableSetting<std::string> pp_shader_name{"none (builtin)", "pp_shader_name"};
SwitchableSetting<std::string> anaglyph_shader_name{"dubois (builtin)", "anaglyph_shader_name"}; SwitchableSetting<std::string> anaglyph_shader_name{"dubois (builtin)", "anaglyph_shader_name"};
Setting<bool> dump_textures{false, "dump_textures"}; SwitchableSetting<bool> dump_textures{false, "dump_textures"};
Setting<bool> custom_textures{false, "custom_textures"}; SwitchableSetting<bool> custom_textures{false, "custom_textures"};
Setting<bool> preload_textures{false, "preload_textures"}; SwitchableSetting<bool> preload_textures{false, "preload_textures"};
// Audio // Audio
bool audio_muted; bool audio_muted;