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();
ReadWebServiceValues();
ReadVideoDumpingValues();
ReadUtilityValues();
}
ReadUIValues();
@ -265,6 +264,7 @@ void Config::ReadValues() {
ReadLayoutValues();
ReadAudioValues();
ReadSystemValues();
ReadUtilityValues();
}
void Config::ReadAudioValues() {
@ -436,9 +436,9 @@ void Config::ReadControlValues() {
void Config::ReadUtilityValues() {
qt_config->beginGroup(QStringLiteral("Utility"));
ReadBasicSetting(Settings::values.dump_textures);
ReadBasicSetting(Settings::values.custom_textures);
ReadBasicSetting(Settings::values.preload_textures);
ReadGlobalSetting(Settings::values.dump_textures);
ReadGlobalSetting(Settings::values.custom_textures);
ReadGlobalSetting(Settings::values.preload_textures);
qt_config->endGroup();
}
@ -497,9 +497,9 @@ void Config::ReadLayoutValues() {
ReadGlobalSetting(Settings::values.render_3d);
ReadGlobalSetting(Settings::values.factor_3d);
ReadGlobalSetting(Settings::values.filter_mode);
ReadGlobalSetting(Settings::values.pp_shader_name);
ReadGlobalSetting(Settings::values.anaglyph_shader_name);
ReadGlobalSetting(Settings::values.filter_mode);
ReadGlobalSetting(Settings::values.layout_option);
ReadGlobalSetting(Settings::values.swap_screen);
ReadGlobalSetting(Settings::values.upright_screen);
@ -830,7 +830,6 @@ void Config::SaveValues() {
SaveDebuggingValues();
SaveWebServiceValues();
SaveVideoDumpingValues();
SaveUtilityValues();
}
SaveUIValues();
@ -839,6 +838,7 @@ void Config::SaveValues() {
SaveLayoutValues();
SaveAudioValues();
SaveSystemValues();
SaveUtilityValues();
qt_config->sync();
}
@ -951,9 +951,9 @@ void Config::SaveControlValues() {
void Config::SaveUtilityValues() {
qt_config->beginGroup(QStringLiteral("Utility"));
WriteBasicSetting(Settings::values.dump_textures);
WriteBasicSetting(Settings::values.custom_textures);
WriteBasicSetting(Settings::values.preload_textures);
WriteGlobalSetting(Settings::values.dump_textures);
WriteGlobalSetting(Settings::values.custom_textures);
WriteGlobalSetting(Settings::values.preload_textures);
qt_config->endGroup();
}
@ -1007,9 +1007,9 @@ void Config::SaveLayoutValues() {
WriteGlobalSetting(Settings::values.render_3d);
WriteGlobalSetting(Settings::values.factor_3d);
WriteGlobalSetting(Settings::values.filter_mode);
WriteGlobalSetting(Settings::values.pp_shader_name);
WriteGlobalSetting(Settings::values.anaglyph_shader_name);
WriteGlobalSetting(Settings::values.filter_mode);
WriteGlobalSetting(Settings::values.layout_option);
WriteGlobalSetting(Settings::values.swap_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) {
if (highlighted) {
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);
}
/// 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
/// is per-game overriden (highlighted) or global (non-highlighted)
void SetHighlight(QWidget* widget, bool highlighted);

View file

@ -3,9 +3,9 @@
// Refer to the license.txt file included.
#include <QColorDialog>
#include "citra_qt/configuration/configuration_shared.h"
#include "citra_qt/configuration/configure_enhancements.h"
#include "common/settings.h"
#include "core/core.h"
#include "ui_configure_enhancements.h"
#include "video_core/renderer_opengl/post_processing_opengl.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())
ui->texture_filter_combobox->addItem(QString::fromStdString(filter.data()));
SetupPerGameUI();
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());
@ -49,15 +50,24 @@ ConfigureEnhancements::ConfigureEnhancements(QWidget* parent)
});
}
ConfigureEnhancements::~ConfigureEnhancements() = default;
void ConfigureEnhancements::SetConfiguration() {
ui->resolution_factor_combobox->setCurrentIndex(Settings::values.resolution_factor.GetValue());
ui->render_3d_combobox->setCurrentIndex(
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());
if (!Settings::IsConfiguringGlobal()) {
ConfigurationShared::SetPerGameSetting(ui->resolution_factor_combobox,
&Settings::values.resolution_factor);
ConfigurationShared::SetPerGameSetting(ui->texture_filter_combobox,
&Settings::values.texture_filter_name);
ConfigurationShared::SetHighlight(ui->widget_texture_filter,
!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(
QString::fromStdString(Settings::values.texture_filter_name.GetValue()));
if (tex_filter_idx == -1) {
@ -65,10 +75,17 @@ void ConfigureEnhancements::SetConfiguration() {
} else {
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->upright_screen->setChecked(Settings::values.upright_screen.GetValue());
}
ui->render_3d_combobox->setCurrentIndex(
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->toggle_dump_textures->setChecked(Settings::values.dump_textures.GetValue());
ui->toggle_custom_textures->setChecked(Settings::values.custom_textures.GetValue());
@ -118,8 +135,8 @@ void ConfigureEnhancements::RetranslateUI() {
}
void ConfigureEnhancements::ApplyConfiguration() {
Settings::values.resolution_factor =
static_cast<u16>(ui->resolution_factor_combobox->currentIndex());
ConfigurationShared::ApplyPerGameSetting(&Settings::values.resolution_factor,
ui->resolution_factor_combobox);
Settings::values.render_3d =
static_cast<Settings::StereoRenderOption>(ui->render_3d_combobox->currentIndex());
Settings::values.factor_3d = ui->factor_3d->value();
@ -132,19 +149,69 @@ void ConfigureEnhancements::ApplyConfiguration() {
Settings::values.pp_shader_name =
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.dump_textures = ui->toggle_dump_textures->isChecked();
Settings::values.custom_textures = ui->toggle_custom_textures->isChecked();
Settings::values.preload_textures = ui->toggle_preload_textures->isChecked();
ConfigurationShared::ApplyPerGameSetting(&Settings::values.filter_mode,
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_green = static_cast<float>(bg_color.greenF());
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;
}
namespace ConfigurationShared {
enum class CheckState;
}
namespace Ui {
class ConfigureEnhancements;
}
@ -27,10 +31,18 @@ public:
void RetranslateUI();
void SetConfiguration();
void SetupPerGameUI();
private:
void updateShaders(Settings::StereoRenderOption stereo_option);
void updateTextureFilter(int index);
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;
};

View file

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

View file

@ -10,6 +10,7 @@
#include "citra_qt/configuration/config.h"
#include "citra_qt/configuration/configure_audio.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_graphics.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);
general_tab = std::make_unique<ConfigureGeneral>(this);
enhancements_tab = std::make_unique<ConfigureEnhancements>(this);
graphics_tab = std::make_unique<ConfigureGraphics>(this);
system_tab = std::make_unique<ConfigureSystem>(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(system_tab.get(), tr("System"));
ui->tabWidget->addTab(enhancements_tab.get(), tr("Enhancements"));
ui->tabWidget->addTab(graphics_tab.get(), tr("Graphics"));
ui->tabWidget->addTab(audio_tab.get(), tr("Audio"));
ui->tabWidget->addTab(debug_tab.get(), tr("Debug"));
@ -81,10 +84,12 @@ void ConfigurePerGame::ResetDefaults() {
void ConfigurePerGame::ApplyConfiguration() {
general_tab->ApplyConfiguration();
system_tab->ApplyConfiguration();
enhancements_tab->ApplyConfiguration();
graphics_tab->ApplyConfiguration();
audio_tab->ApplyConfiguration();
debug_tab->ApplyConfiguration();
Settings::Apply();
Settings::LogSettings();
game_config->Save();

View file

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

View file

@ -20,6 +20,17 @@
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 = {};
static bool configuring_global = true;
@ -86,17 +97,6 @@ void LogSettings() {
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_setting("Core_UseCpuJit", values.use_cpu_jit.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_CustomTextures", values.custom_textures.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_EnableAudioStretching", values.enable_audio_stretching.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.pp_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) {

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
// 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 {
@ -361,38 +368,6 @@ protected:
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 {
std::string name;
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> anaglyph_shader_name{"dubois (builtin)", "anaglyph_shader_name"};
Setting<bool> dump_textures{false, "dump_textures"};
Setting<bool> custom_textures{false, "custom_textures"};
Setting<bool> preload_textures{false, "preload_textures"};
SwitchableSetting<bool> dump_textures{false, "dump_textures"};
SwitchableSetting<bool> custom_textures{false, "custom_textures"};
SwitchableSetting<bool> preload_textures{false, "preload_textures"};
// Audio
bool audio_muted;