mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Merge pull request #13063 from TryTwo/PR_GameSettings
Add ability to edit game-specific GFX settings from game properties tab.
This commit is contained in:
@@ -52,6 +52,7 @@ add_executable(dolphin-emu
|
||||
Config/ConfigControls/ConfigBool.h
|
||||
Config/ConfigControls/ConfigChoice.cpp
|
||||
Config/ConfigControls/ConfigChoice.h
|
||||
Config/ConfigControls/ConfigControl.h
|
||||
Config/ConfigControls/ConfigInteger.cpp
|
||||
Config/ConfigControls/ConfigInteger.h
|
||||
Config/ConfigControls/ConfigRadio.cpp
|
||||
|
||||
@@ -3,31 +3,28 @@
|
||||
|
||||
#include "DolphinQt/Config/ConfigControls/ConfigBool.h"
|
||||
|
||||
#include <QEvent>
|
||||
#include <QFont>
|
||||
#include <QSignalBlocker>
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
|
||||
#include "DolphinQt/Settings.h"
|
||||
|
||||
ConfigBool::ConfigBool(const QString& label, const Config::Info<bool>& setting, bool reverse)
|
||||
: ToolTipCheckBox(label), m_setting(setting), m_reverse(reverse)
|
||||
: ConfigBool(label, setting, nullptr, reverse)
|
||||
{
|
||||
}
|
||||
|
||||
ConfigBool::ConfigBool(const QString& label, const Config::Info<bool>& setting,
|
||||
Config::Layer* layer, bool reverse)
|
||||
: ConfigControl(label, setting.GetLocation(), layer), m_setting(setting), m_reverse(reverse)
|
||||
{
|
||||
setChecked(ReadValue(setting) ^ reverse);
|
||||
|
||||
connect(this, &QCheckBox::toggled, this, &ConfigBool::Update);
|
||||
setChecked(Config::Get(m_setting) ^ reverse);
|
||||
|
||||
connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this] {
|
||||
QFont bf = font();
|
||||
bf.setBold(Config::GetActiveLayerForConfig(m_setting) != Config::LayerType::Base);
|
||||
setFont(bf);
|
||||
|
||||
const QSignalBlocker blocker(this);
|
||||
setChecked(Config::Get(m_setting) ^ m_reverse);
|
||||
});
|
||||
}
|
||||
|
||||
void ConfigBool::Update()
|
||||
{
|
||||
Config::SetBaseOrCurrent(m_setting, static_cast<bool>(isChecked() ^ m_reverse));
|
||||
const bool value = static_cast<bool>(isChecked() ^ m_reverse);
|
||||
|
||||
SaveValue(m_setting, value);
|
||||
}
|
||||
|
||||
void ConfigBool::OnConfigChanged()
|
||||
{
|
||||
setChecked(ReadValue(m_setting) ^ m_reverse);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "DolphinQt/Config/ConfigControls/ConfigControl.h"
|
||||
#include "DolphinQt/Config/ToolTipControls/ToolTipCheckBox.h"
|
||||
|
||||
namespace Config
|
||||
@@ -11,11 +12,16 @@ template <typename T>
|
||||
class Info;
|
||||
}
|
||||
|
||||
class ConfigBool : public ToolTipCheckBox
|
||||
class ConfigBool final : public ConfigControl<ToolTipCheckBox>
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConfigBool(const QString& label, const Config::Info<bool>& setting, bool reverse = false);
|
||||
ConfigBool(const QString& label, const Config::Info<bool>& setting, Config::Layer* layer,
|
||||
bool reverse = false);
|
||||
|
||||
protected:
|
||||
void OnConfigChanged() override;
|
||||
|
||||
private:
|
||||
void Update();
|
||||
|
||||
@@ -5,85 +5,168 @@
|
||||
|
||||
#include <QSignalBlocker>
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
|
||||
#include "DolphinQt/Settings.h"
|
||||
|
||||
ConfigChoice::ConfigChoice(const QStringList& options, const Config::Info<int>& setting)
|
||||
: m_setting(setting)
|
||||
ConfigChoice::ConfigChoice(const QStringList& options, const Config::Info<int>& setting,
|
||||
Config::Layer* layer)
|
||||
: ConfigControl(setting.GetLocation(), layer), m_setting(setting)
|
||||
{
|
||||
addItems(options);
|
||||
setCurrentIndex(ReadValue(setting));
|
||||
|
||||
connect(this, &QComboBox::currentIndexChanged, this, &ConfigChoice::Update);
|
||||
setCurrentIndex(Config::Get(m_setting));
|
||||
|
||||
connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this] {
|
||||
QFont bf = font();
|
||||
bf.setBold(Config::GetActiveLayerForConfig(m_setting) != Config::LayerType::Base);
|
||||
setFont(bf);
|
||||
|
||||
const QSignalBlocker blocker(this);
|
||||
setCurrentIndex(Config::Get(m_setting));
|
||||
});
|
||||
}
|
||||
|
||||
void ConfigChoice::Update(int choice)
|
||||
{
|
||||
Config::SetBaseOrCurrent(m_setting, choice);
|
||||
SaveValue(m_setting, choice);
|
||||
}
|
||||
|
||||
void ConfigChoice::OnConfigChanged()
|
||||
{
|
||||
setCurrentIndex(ReadValue(m_setting));
|
||||
}
|
||||
|
||||
ConfigStringChoice::ConfigStringChoice(const std::vector<std::string>& options,
|
||||
const Config::Info<std::string>& setting)
|
||||
: m_setting(setting), m_text_is_data(true)
|
||||
const Config::Info<std::string>& setting,
|
||||
Config::Layer* layer)
|
||||
: ConfigControl(setting.GetLocation(), layer), m_setting(setting), m_text_is_data(true)
|
||||
{
|
||||
for (const auto& op : options)
|
||||
addItem(QString::fromStdString(op));
|
||||
|
||||
Connect();
|
||||
Load();
|
||||
connect(this, &QComboBox::currentIndexChanged, this, &ConfigStringChoice::Update);
|
||||
}
|
||||
|
||||
ConfigStringChoice::ConfigStringChoice(const std::vector<std::pair<QString, QString>>& options,
|
||||
const Config::Info<std::string>& setting)
|
||||
: m_setting(setting), m_text_is_data(false)
|
||||
const Config::Info<std::string>& setting,
|
||||
Config::Layer* layer)
|
||||
: ConfigControl(setting.GetLocation(), layer), m_setting(setting), m_text_is_data(false)
|
||||
{
|
||||
for (const auto& [option_text, option_data] : options)
|
||||
addItem(option_text, option_data);
|
||||
|
||||
Connect();
|
||||
Load();
|
||||
}
|
||||
|
||||
void ConfigStringChoice::Connect()
|
||||
{
|
||||
const auto on_config_changed = [this]() {
|
||||
QFont bf = font();
|
||||
bf.setBold(Config::GetActiveLayerForConfig(m_setting) != Config::LayerType::Base);
|
||||
setFont(bf);
|
||||
|
||||
Load();
|
||||
};
|
||||
|
||||
connect(&Settings::Instance(), &Settings::ConfigChanged, this, on_config_changed);
|
||||
connect(this, &QComboBox::currentIndexChanged, this, &ConfigStringChoice::Update);
|
||||
Load();
|
||||
}
|
||||
|
||||
void ConfigStringChoice::Update(int index)
|
||||
{
|
||||
if (m_text_is_data)
|
||||
{
|
||||
Config::SetBaseOrCurrent(m_setting, itemText(index).toStdString());
|
||||
}
|
||||
SaveValue(m_setting, itemText(index).toStdString());
|
||||
else
|
||||
{
|
||||
Config::SetBaseOrCurrent(m_setting, itemData(index).toString().toStdString());
|
||||
}
|
||||
SaveValue(m_setting, itemData(index).toString().toStdString());
|
||||
}
|
||||
|
||||
void ConfigStringChoice::Load()
|
||||
{
|
||||
const QString setting_value = QString::fromStdString(Config::Get(m_setting));
|
||||
|
||||
const QString setting_value = QString::fromStdString(ReadValue(m_setting));
|
||||
const int index = m_text_is_data ? findText(setting_value) : findData(setting_value);
|
||||
|
||||
// This can be called publicly.
|
||||
const QSignalBlocker block(this);
|
||||
setCurrentIndex(index);
|
||||
}
|
||||
|
||||
void ConfigStringChoice::OnConfigChanged()
|
||||
{
|
||||
Load();
|
||||
}
|
||||
|
||||
ConfigComplexChoice::ConfigComplexChoice(const InfoVariant setting1, const InfoVariant setting2,
|
||||
Config::Layer* layer)
|
||||
: m_setting1(setting1), m_setting2(setting2), m_layer(layer)
|
||||
{
|
||||
connect(&Settings::Instance(), &Settings::ConfigChanged, this, &ConfigComplexChoice::Refresh);
|
||||
connect(this, &QComboBox::currentIndexChanged, this, &ConfigComplexChoice::SaveValue);
|
||||
}
|
||||
|
||||
void ConfigComplexChoice::Refresh()
|
||||
{
|
||||
auto& location = GetLocation();
|
||||
|
||||
QFont bf = font();
|
||||
if (m_layer != nullptr)
|
||||
{
|
||||
bf.setBold(m_layer->Exists(location.first) || m_layer->Exists(location.second));
|
||||
}
|
||||
else
|
||||
{
|
||||
bf.setBold(Config::GetActiveLayerForConfig(location.first) != Config::LayerType::Base ||
|
||||
Config::GetActiveLayerForConfig(location.second) != Config::LayerType::Base);
|
||||
}
|
||||
|
||||
setFont(bf);
|
||||
UpdateComboIndex();
|
||||
}
|
||||
|
||||
void ConfigComplexChoice::Add(const QString& name, const OptionVariant option1,
|
||||
const OptionVariant option2)
|
||||
{
|
||||
const QSignalBlocker blocker(this);
|
||||
addItem(name);
|
||||
m_options.push_back(std::make_pair(option1, option2));
|
||||
}
|
||||
|
||||
void ConfigComplexChoice::Reset()
|
||||
{
|
||||
clear();
|
||||
m_options.clear();
|
||||
}
|
||||
|
||||
void ConfigComplexChoice::SaveValue(int choice)
|
||||
{
|
||||
auto Set = [this, choice](auto& setting, auto& value) {
|
||||
if (m_layer != nullptr)
|
||||
{
|
||||
m_layer->Set(setting.GetLocation(), value);
|
||||
Config::OnConfigChanged();
|
||||
return;
|
||||
}
|
||||
|
||||
Config::SetBaseOrCurrent(setting, value);
|
||||
};
|
||||
|
||||
std::visit(Set, m_setting1, m_options[choice].first);
|
||||
std::visit(Set, m_setting2, m_options[choice].second);
|
||||
}
|
||||
|
||||
void ConfigComplexChoice::UpdateComboIndex()
|
||||
{
|
||||
auto Get = [this](auto& setting) {
|
||||
if (m_layer != nullptr)
|
||||
return static_cast<OptionVariant>(m_layer->Get(setting));
|
||||
|
||||
return static_cast<OptionVariant>(Config::Get(setting));
|
||||
};
|
||||
|
||||
std::pair<OptionVariant, OptionVariant> values =
|
||||
std::make_pair(std::visit(Get, m_setting1), std::visit(Get, m_setting2));
|
||||
|
||||
auto it = std::find(m_options.begin(), m_options.end(), values);
|
||||
int index = static_cast<int>(std::distance(m_options.begin(), it));
|
||||
|
||||
const QSignalBlocker blocker(this);
|
||||
setCurrentIndex(index);
|
||||
}
|
||||
|
||||
const std::pair<Config::Location, Config::Location> ConfigComplexChoice::GetLocation() const
|
||||
{
|
||||
auto visit = [](auto& v) { return v.GetLocation(); };
|
||||
|
||||
return {std::visit(visit, m_setting1), std::visit(visit, m_setting2)};
|
||||
}
|
||||
|
||||
void ConfigComplexChoice::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
if (event->button() == Qt::RightButton && m_layer != nullptr)
|
||||
{
|
||||
auto& location = GetLocation();
|
||||
m_layer->DeleteKey(location.first);
|
||||
m_layer->DeleteKey(location.second);
|
||||
Config::OnConfigChanged();
|
||||
}
|
||||
else
|
||||
{
|
||||
QComboBox::mousePressEvent(event);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -7,15 +7,24 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "DolphinQt/Config/ConfigControls/ConfigControl.h"
|
||||
#include "DolphinQt/Config/ToolTipControls/ToolTipComboBox.h"
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
namespace Config
|
||||
{
|
||||
template <typename T>
|
||||
class Info;
|
||||
}
|
||||
|
||||
class ConfigChoice : public ToolTipComboBox
|
||||
class ConfigChoice final : public ConfigControl<ToolTipComboBox>
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConfigChoice(const QStringList& options, const Config::Info<int>& setting);
|
||||
ConfigChoice(const QStringList& options, const Config::Info<int>& setting,
|
||||
Config::Layer* layer = nullptr);
|
||||
|
||||
protected:
|
||||
void OnConfigChanged() override;
|
||||
|
||||
private:
|
||||
void Update(int choice);
|
||||
@@ -23,20 +32,49 @@ private:
|
||||
Config::Info<int> m_setting;
|
||||
};
|
||||
|
||||
class ConfigStringChoice : public ToolTipComboBox
|
||||
class ConfigStringChoice final : public ConfigControl<ToolTipComboBox>
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConfigStringChoice(const std::vector<std::string>& options,
|
||||
const Config::Info<std::string>& setting);
|
||||
const Config::Info<std::string>& setting, Config::Layer* layer = nullptr);
|
||||
ConfigStringChoice(const std::vector<std::pair<QString, QString>>& options,
|
||||
const Config::Info<std::string>& setting);
|
||||
|
||||
private:
|
||||
void Connect();
|
||||
void Update(int index);
|
||||
const Config::Info<std::string>& setting, Config::Layer* layer = nullptr);
|
||||
void Load();
|
||||
|
||||
Config::Info<std::string> m_setting;
|
||||
protected:
|
||||
void OnConfigChanged() override;
|
||||
|
||||
private:
|
||||
void Update(int index);
|
||||
|
||||
const Config::Info<std::string>& m_setting;
|
||||
bool m_text_is_data = false;
|
||||
};
|
||||
|
||||
class ConfigComplexChoice final : public ToolTipComboBox
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
using InfoVariant = std::variant<Config::Info<u32>, Config::Info<int>, Config::Info<bool>>;
|
||||
using OptionVariant = std::variant<u32, int, bool>;
|
||||
|
||||
public:
|
||||
ConfigComplexChoice(const InfoVariant setting1, const InfoVariant setting2,
|
||||
Config::Layer* layer = nullptr);
|
||||
|
||||
void Add(const QString& name, const OptionVariant option1, const OptionVariant option2);
|
||||
void Refresh();
|
||||
void Reset();
|
||||
const std::pair<Config::Location, Config::Location> GetLocation() const;
|
||||
|
||||
private:
|
||||
void SaveValue(int choice);
|
||||
void UpdateComboIndex();
|
||||
void mousePressEvent(QMouseEvent* event) override;
|
||||
|
||||
Config::Layer* m_layer;
|
||||
const InfoVariant m_setting1;
|
||||
const InfoVariant m_setting2;
|
||||
std::vector<std::pair<OptionVariant, OptionVariant>> m_options;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
// Copyright 2024 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QFont>
|
||||
#include <QMouseEvent>
|
||||
#include <QSignalBlocker>
|
||||
|
||||
#include "Common/Config/Enums.h"
|
||||
#include "Common/Config/Layer.h"
|
||||
#include "DolphinQt/Settings.h"
|
||||
|
||||
namespace Config
|
||||
{
|
||||
template <typename T>
|
||||
class Info;
|
||||
struct Location;
|
||||
} // namespace Config
|
||||
|
||||
template <class Derived>
|
||||
class ConfigControl : public Derived
|
||||
{
|
||||
public:
|
||||
ConfigControl(const Config::Location& location, Config::Layer* layer)
|
||||
: m_location(location), m_layer(layer)
|
||||
{
|
||||
ConnectConfig();
|
||||
}
|
||||
ConfigControl(const QString& label, const Config::Location& location, Config::Layer* layer)
|
||||
: Derived(label), m_location(location), m_layer(layer)
|
||||
{
|
||||
ConnectConfig();
|
||||
}
|
||||
ConfigControl(const Qt::Orientation& orient, const Config::Location& location,
|
||||
Config::Layer* layer)
|
||||
: Derived(orient), m_location(location), m_layer(layer)
|
||||
{
|
||||
ConnectConfig();
|
||||
}
|
||||
|
||||
const Config::Location GetLocation() const { return m_location; }
|
||||
|
||||
protected:
|
||||
void ConnectConfig()
|
||||
{
|
||||
Derived::connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this] {
|
||||
QFont bf = Derived::font();
|
||||
bf.setBold(IsConfigLocal());
|
||||
Derived::setFont(bf);
|
||||
|
||||
const QSignalBlocker blocker(this);
|
||||
OnConfigChanged();
|
||||
});
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void SaveValue(const Config::Info<T>& setting, const T& value)
|
||||
{
|
||||
if (m_layer != nullptr)
|
||||
{
|
||||
m_layer->Set(m_location, value);
|
||||
Config::OnConfigChanged();
|
||||
return;
|
||||
}
|
||||
|
||||
Config::SetBaseOrCurrent(setting, value);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
const T ReadValue(const Config::Info<T>& setting) const
|
||||
{
|
||||
if (m_layer != nullptr)
|
||||
return m_layer->Get(setting);
|
||||
|
||||
return Config::Get(setting);
|
||||
}
|
||||
|
||||
virtual void OnConfigChanged(){};
|
||||
|
||||
private:
|
||||
bool IsConfigLocal() const
|
||||
{
|
||||
if (m_layer != nullptr)
|
||||
return m_layer->Exists(m_location);
|
||||
else
|
||||
return Config::GetActiveLayerForConfig(m_location) != Config::LayerType::Base;
|
||||
}
|
||||
|
||||
void mousePressEvent(QMouseEvent* event) override
|
||||
{
|
||||
if (m_layer != nullptr && event->button() == Qt::RightButton)
|
||||
{
|
||||
m_layer->DeleteKey(m_location);
|
||||
Config::OnConfigChanged();
|
||||
}
|
||||
else
|
||||
{
|
||||
Derived::mousePressEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
const Config::Location m_location;
|
||||
Config::Layer* m_layer;
|
||||
};
|
||||
@@ -3,20 +3,16 @@
|
||||
|
||||
#include "DolphinQt/Config/ConfigControls/ConfigFloatSlider.h"
|
||||
|
||||
#include <QSignalBlocker>
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
|
||||
#include "DolphinQt/Settings.h"
|
||||
|
||||
ConfigFloatSlider::ConfigFloatSlider(float minimum, float maximum,
|
||||
const Config::Info<float>& setting, float step)
|
||||
: ToolTipSlider(Qt::Horizontal), m_minimum(minimum), m_step(step), m_setting(setting)
|
||||
const Config::Info<float>& setting, float step,
|
||||
Config::Layer* layer)
|
||||
: ConfigControl(Qt::Horizontal, setting.GetLocation(), layer), m_minimum(minimum), m_step(step),
|
||||
m_setting(setting)
|
||||
{
|
||||
const float range = maximum - minimum;
|
||||
const int steps = std::round(range / step);
|
||||
const int interval = std::round(range / steps);
|
||||
const int current_value = std::round((Config::Get(m_setting) - minimum) / step);
|
||||
const int current_value = std::round((ReadValue(setting) - minimum) / step);
|
||||
|
||||
setMinimum(0);
|
||||
setMaximum(steps);
|
||||
@@ -24,25 +20,21 @@ ConfigFloatSlider::ConfigFloatSlider(float minimum, float maximum,
|
||||
setValue(current_value);
|
||||
|
||||
connect(this, &ConfigFloatSlider::valueChanged, this, &ConfigFloatSlider::Update);
|
||||
|
||||
connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this] {
|
||||
QFont bf = font();
|
||||
bf.setBold(Config::GetActiveLayerForConfig(m_setting) != Config::LayerType::Base);
|
||||
setFont(bf);
|
||||
|
||||
const QSignalBlocker blocker(this);
|
||||
const int value = std::round((Config::Get(m_setting) - m_minimum) / m_step);
|
||||
setValue(value);
|
||||
});
|
||||
}
|
||||
|
||||
void ConfigFloatSlider::Update(int value)
|
||||
{
|
||||
const float current_value = (m_step * value) + m_minimum;
|
||||
Config::SetBaseOrCurrent(m_setting, current_value);
|
||||
|
||||
SaveValue(m_setting, current_value);
|
||||
}
|
||||
|
||||
float ConfigFloatSlider::GetValue() const
|
||||
{
|
||||
return (m_step * value()) + m_minimum;
|
||||
}
|
||||
|
||||
void ConfigFloatSlider::OnConfigChanged()
|
||||
{
|
||||
setValue(std::round((ReadValue(m_setting) - m_minimum) / m_step));
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "DolphinQt/Config/ConfigControls/ConfigControl.h"
|
||||
#include "DolphinQt/Config/ToolTipControls/ToolTipSlider.h"
|
||||
|
||||
namespace Config
|
||||
@@ -13,16 +14,20 @@ class Info;
|
||||
|
||||
// Automatically converts an int slider into a float one.
|
||||
// Do not read the int values or ranges directly from it.
|
||||
class ConfigFloatSlider : public ToolTipSlider
|
||||
class ConfigFloatSlider final : public ConfigControl<ToolTipSlider>
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConfigFloatSlider(float minimum, float maximum, const Config::Info<float>& setting, float step);
|
||||
ConfigFloatSlider(float minimum, float maximum, const Config::Info<float>& setting, float step,
|
||||
Config::Layer* layer = nullptr);
|
||||
void Update(int value);
|
||||
|
||||
// Returns the adjusted float value
|
||||
float GetValue() const;
|
||||
|
||||
protected:
|
||||
void OnConfigChanged() override;
|
||||
|
||||
private:
|
||||
float m_minimum;
|
||||
float m_step;
|
||||
|
||||
@@ -3,33 +3,39 @@
|
||||
|
||||
#include "DolphinQt/Config/ConfigControls/ConfigInteger.h"
|
||||
|
||||
#include <QSignalBlocker>
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
|
||||
#include "DolphinQt/Settings.h"
|
||||
|
||||
ConfigInteger::ConfigInteger(int minimum, int maximum, const Config::Info<int>& setting, int step)
|
||||
: ToolTipSpinBox(), m_setting(setting)
|
||||
: ConfigInteger(minimum, maximum, setting, nullptr, step)
|
||||
{
|
||||
}
|
||||
|
||||
ConfigInteger::ConfigInteger(int minimum, int maximum, const Config::Info<int>& setting,
|
||||
Config::Layer* layer, int step)
|
||||
: ConfigControl(setting.GetLocation(), layer), m_setting(setting)
|
||||
{
|
||||
setMinimum(minimum);
|
||||
setMaximum(maximum);
|
||||
setSingleStep(step);
|
||||
|
||||
setValue(Config::Get(setting));
|
||||
setValue(ReadValue(setting));
|
||||
|
||||
connect(this, &ConfigInteger::valueChanged, this, &ConfigInteger::Update);
|
||||
connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this] {
|
||||
QFont bf = font();
|
||||
bf.setBold(Config::GetActiveLayerForConfig(m_setting) != Config::LayerType::Base);
|
||||
setFont(bf);
|
||||
|
||||
const QSignalBlocker blocker(this);
|
||||
setValue(Config::Get(m_setting));
|
||||
});
|
||||
}
|
||||
|
||||
void ConfigInteger::Update(int value)
|
||||
{
|
||||
Config::SetBaseOrCurrent(m_setting, value);
|
||||
SaveValue(m_setting, value);
|
||||
}
|
||||
|
||||
void ConfigInteger::OnConfigChanged()
|
||||
{
|
||||
setValue(ReadValue(m_setting));
|
||||
}
|
||||
|
||||
ConfigIntegerLabel::ConfigIntegerLabel(const QString& text, ConfigInteger* widget)
|
||||
: QLabel(text), m_widget(QPointer<ConfigInteger>(widget))
|
||||
{
|
||||
connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this]() {
|
||||
// Label shares font changes with ConfigInteger to mark game ini settings.
|
||||
if (m_widget)
|
||||
setFont(m_widget->font());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QLabel>
|
||||
#include <QPointer>
|
||||
|
||||
#include "DolphinQt/Config/ConfigControls/ConfigControl.h"
|
||||
#include "DolphinQt/Config/ToolTipControls/ToolTipSpinBox.h"
|
||||
|
||||
namespace Config
|
||||
@@ -11,13 +15,30 @@ template <typename T>
|
||||
class Info;
|
||||
}
|
||||
|
||||
class ConfigInteger : public ToolTipSpinBox
|
||||
class ConfigInteger final : public ConfigControl<ToolTipSpinBox>
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConfigInteger(int minimum, int maximum, const Config::Info<int>& setting, int step = 1);
|
||||
ConfigInteger(int minimum, int maximum, const Config::Info<int>& setting, Config::Layer* layer,
|
||||
int step = 1);
|
||||
|
||||
void Update(int value);
|
||||
|
||||
protected:
|
||||
void OnConfigChanged() override;
|
||||
|
||||
private:
|
||||
const Config::Info<int>& m_setting;
|
||||
};
|
||||
|
||||
class ConfigIntegerLabel final : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ConfigIntegerLabel(const QString& text, ConfigInteger* widget);
|
||||
|
||||
private:
|
||||
QPointer<ConfigInteger> m_widget;
|
||||
};
|
||||
|
||||
@@ -3,33 +3,21 @@
|
||||
|
||||
#include "DolphinQt/Config/ConfigControls/ConfigRadio.h"
|
||||
|
||||
#include <QSignalBlocker>
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
|
||||
#include "DolphinQt/Settings.h"
|
||||
|
||||
ConfigRadioInt::ConfigRadioInt(const QString& label, const Config::Info<int>& setting, int value)
|
||||
: ToolTipRadioButton(label), m_setting(setting), m_value(value)
|
||||
ConfigRadioInt::ConfigRadioInt(const QString& label, const Config::Info<int>& setting, int value,
|
||||
Config::Layer* layer)
|
||||
: ConfigControl(label, setting.GetLocation(), layer), m_setting(setting), m_value(value)
|
||||
{
|
||||
setChecked(Config::Get(m_setting) == m_value);
|
||||
setChecked(ReadValue(setting) == value);
|
||||
|
||||
connect(this, &QRadioButton::toggled, this, &ConfigRadioInt::Update);
|
||||
|
||||
connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this] {
|
||||
QFont bf = font();
|
||||
bf.setBold(Config::GetActiveLayerForConfig(m_setting) != Config::LayerType::Base);
|
||||
setFont(bf);
|
||||
|
||||
const QSignalBlocker blocker(this);
|
||||
setChecked(Config::Get(m_setting) == m_value);
|
||||
});
|
||||
}
|
||||
|
||||
void ConfigRadioInt::Update()
|
||||
{
|
||||
if (isChecked())
|
||||
{
|
||||
Config::SetBaseOrCurrent(m_setting, m_value);
|
||||
SaveValue(m_setting, m_value);
|
||||
|
||||
emit OnSelected(m_value);
|
||||
}
|
||||
else
|
||||
@@ -37,3 +25,8 @@ void ConfigRadioInt::Update()
|
||||
emit OnDeselected(m_value);
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigRadioInt::OnConfigChanged()
|
||||
{
|
||||
setChecked(ReadValue(m_setting) == m_value);
|
||||
}
|
||||
|
||||
@@ -3,15 +3,21 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "DolphinQt/Config/ConfigControls/ConfigControl.h"
|
||||
#include "DolphinQt/Config/ToolTipControls/ToolTipRadioButton.h"
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
namespace Config
|
||||
{
|
||||
template <typename T>
|
||||
class Info;
|
||||
}
|
||||
|
||||
class ConfigRadioInt : public ToolTipRadioButton
|
||||
class ConfigRadioInt final : public ConfigControl<ToolTipRadioButton>
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConfigRadioInt(const QString& label, const Config::Info<int>& setting, int value);
|
||||
ConfigRadioInt(const QString& label, const Config::Info<int>& setting, int value,
|
||||
Config::Layer* layer = nullptr);
|
||||
|
||||
signals:
|
||||
// Since selecting a new radio button deselects the old one, ::toggled will generate two signals.
|
||||
@@ -19,9 +25,12 @@ signals:
|
||||
void OnSelected(int new_value);
|
||||
void OnDeselected(int old_value);
|
||||
|
||||
protected:
|
||||
void OnConfigChanged() override;
|
||||
|
||||
private:
|
||||
void Update();
|
||||
|
||||
Config::Info<int> m_setting;
|
||||
const Config::Info<int>& m_setting;
|
||||
int m_value;
|
||||
};
|
||||
|
||||
@@ -1,36 +1,45 @@
|
||||
// Copyright 2017 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <QFont>
|
||||
|
||||
#include "DolphinQt/Config/ConfigControls/ConfigSlider.h"
|
||||
|
||||
#include <QSignalBlocker>
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
|
||||
#include "DolphinQt/Settings.h"
|
||||
|
||||
ConfigSlider::ConfigSlider(int minimum, int maximum, const Config::Info<int>& setting, int tick)
|
||||
: ToolTipSlider(Qt::Horizontal), m_setting(setting)
|
||||
: ConfigSlider(minimum, maximum, setting, nullptr, tick)
|
||||
{
|
||||
}
|
||||
|
||||
ConfigSlider::ConfigSlider(int minimum, int maximum, const Config::Info<int>& setting,
|
||||
Config::Layer* layer, int tick)
|
||||
: ConfigControl(Qt::Horizontal, setting.GetLocation(), layer), m_setting(setting)
|
||||
|
||||
{
|
||||
setMinimum(minimum);
|
||||
setMaximum(maximum);
|
||||
setTickInterval(tick);
|
||||
|
||||
setValue(Config::Get(setting));
|
||||
setValue(ReadValue(setting));
|
||||
|
||||
connect(this, &ConfigSlider::valueChanged, this, &ConfigSlider::Update);
|
||||
|
||||
connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this] {
|
||||
QFont bf = font();
|
||||
bf.setBold(Config::GetActiveLayerForConfig(m_setting) != Config::LayerType::Base);
|
||||
setFont(bf);
|
||||
|
||||
const QSignalBlocker blocker(this);
|
||||
setValue(Config::Get(m_setting));
|
||||
});
|
||||
}
|
||||
|
||||
void ConfigSlider::Update(int value)
|
||||
{
|
||||
Config::SetBaseOrCurrent(m_setting, value);
|
||||
SaveValue(m_setting, value);
|
||||
}
|
||||
|
||||
void ConfigSlider::OnConfigChanged()
|
||||
{
|
||||
setValue(ReadValue(m_setting));
|
||||
}
|
||||
|
||||
ConfigSliderLabel::ConfigSliderLabel(const QString& text, ConfigSlider* slider)
|
||||
: QLabel(text), m_slider(QPointer<ConfigSlider>(slider))
|
||||
{
|
||||
connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this]() {
|
||||
// Label shares font changes with slider to mark game ini settings.
|
||||
if (m_slider)
|
||||
setFont(m_slider->font());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QLabel>
|
||||
#include <QPointer>
|
||||
|
||||
#include "DolphinQt/Config/ConfigControls/ConfigControl.h"
|
||||
#include "DolphinQt/Config/ToolTipControls/ToolTipSlider.h"
|
||||
|
||||
namespace Config
|
||||
@@ -11,13 +15,30 @@ template <typename T>
|
||||
class Info;
|
||||
}
|
||||
|
||||
class ConfigSlider : public ToolTipSlider
|
||||
class ConfigSlider final : public ConfigControl<ToolTipSlider>
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConfigSlider(int minimum, int maximum, const Config::Info<int>& setting, int tick = 0);
|
||||
ConfigSlider(int minimum, int maximum, const Config::Info<int>& setting, Config::Layer* layer,
|
||||
int tick = 0);
|
||||
|
||||
void Update(int value);
|
||||
|
||||
protected:
|
||||
void OnConfigChanged() override;
|
||||
|
||||
private:
|
||||
const Config::Info<int>& m_setting;
|
||||
};
|
||||
|
||||
class ConfigSliderLabel final : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ConfigSliderLabel(const QString& text, ConfigSlider* slider);
|
||||
|
||||
private:
|
||||
QPointer<ConfigSlider> m_slider;
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -7,19 +7,21 @@
|
||||
|
||||
#include <QString>
|
||||
#include <QWidget>
|
||||
|
||||
#include "Common/IniFile.h"
|
||||
|
||||
namespace UICommon
|
||||
{
|
||||
class GameFile;
|
||||
}
|
||||
|
||||
class QCheckBox;
|
||||
class QComboBox;
|
||||
namespace Config
|
||||
{
|
||||
class Layer;
|
||||
} // namespace Config
|
||||
|
||||
class ConfigBool;
|
||||
class ConfigInteger;
|
||||
class ConfigSlider;
|
||||
class ConfigStringChoice;
|
||||
class QPushButton;
|
||||
class QSlider;
|
||||
class QSpinBox;
|
||||
class QTabWidget;
|
||||
|
||||
class GameConfigWidget : public QWidget
|
||||
@@ -27,45 +29,33 @@ class GameConfigWidget : public QWidget
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GameConfigWidget(const UICommon::GameFile& game);
|
||||
~GameConfigWidget();
|
||||
|
||||
private:
|
||||
void CreateWidgets();
|
||||
void ConnectWidgets();
|
||||
|
||||
void LoadSettings();
|
||||
void SaveSettings();
|
||||
void SetItalics();
|
||||
|
||||
void SaveCheckBox(QCheckBox* checkbox, const std::string& section, const std::string& key,
|
||||
bool reverse = false);
|
||||
void LoadCheckBox(QCheckBox* checkbox, const std::string& section, const std::string& key,
|
||||
bool reverse = false);
|
||||
|
||||
QString m_gameini_sys_path;
|
||||
QString m_gameini_local_path;
|
||||
|
||||
QTabWidget* m_default_tab;
|
||||
QTabWidget* m_local_tab;
|
||||
|
||||
QCheckBox* m_enable_dual_core;
|
||||
QCheckBox* m_enable_mmu;
|
||||
QCheckBox* m_enable_fprf;
|
||||
QCheckBox* m_sync_gpu;
|
||||
QCheckBox* m_emulate_disc_speed;
|
||||
QCheckBox* m_use_dsp_hle;
|
||||
QCheckBox* m_use_monoscopic_shadows;
|
||||
QCheckBox* m_manual_texture_sampling;
|
||||
ConfigBool* m_enable_dual_core;
|
||||
ConfigBool* m_enable_mmu;
|
||||
ConfigBool* m_enable_fprf;
|
||||
ConfigBool* m_sync_gpu;
|
||||
ConfigBool* m_emulate_disc_speed;
|
||||
ConfigBool* m_use_dsp_hle;
|
||||
ConfigBool* m_use_monoscopic_shadows;
|
||||
|
||||
QPushButton* m_refresh_config;
|
||||
|
||||
QComboBox* m_deterministic_dual_core;
|
||||
|
||||
QSlider* m_depth_slider;
|
||||
|
||||
QSpinBox* m_convergence_spin;
|
||||
ConfigStringChoice* m_deterministic_dual_core;
|
||||
ConfigSlider* m_depth_slider;
|
||||
ConfigInteger* m_convergence_spin;
|
||||
|
||||
const UICommon::GameFile& m_game;
|
||||
std::string m_game_id;
|
||||
|
||||
Common::IniFile m_gameini_local;
|
||||
Common::IniFile m_gameini_default;
|
||||
std::unique_ptr<Config::Layer> m_layer;
|
||||
std::unique_ptr<Config::Layer> m_global_layer;
|
||||
int m_prev_tab_index = 0;
|
||||
};
|
||||
|
||||
@@ -3,11 +3,9 @@
|
||||
|
||||
#include "DolphinQt/Config/Graphics/AdvancedWidget.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QGridLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QLabel>
|
||||
#include <QSpinBox>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "Core/Config/GraphicsSettings.h"
|
||||
@@ -19,6 +17,7 @@
|
||||
#include "DolphinQt/Config/ConfigControls/ConfigBool.h"
|
||||
#include "DolphinQt/Config/ConfigControls/ConfigChoice.h"
|
||||
#include "DolphinQt/Config/ConfigControls/ConfigInteger.h"
|
||||
#include "DolphinQt/Config/GameConfigWidget.h"
|
||||
#include "DolphinQt/Config/Graphics/GraphicsWindow.h"
|
||||
#include "DolphinQt/Config/ToolTipControls/ToolTipCheckBox.h"
|
||||
#include "DolphinQt/QtUtils/SignalBlocking.h"
|
||||
@@ -29,7 +28,6 @@
|
||||
AdvancedWidget::AdvancedWidget(GraphicsWindow* parent)
|
||||
{
|
||||
CreateWidgets();
|
||||
LoadSettings();
|
||||
ConnectWidgets();
|
||||
AddDescriptions();
|
||||
|
||||
@@ -37,17 +35,30 @@ AdvancedWidget::AdvancedWidget(GraphicsWindow* parent)
|
||||
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [this](Core::State state) {
|
||||
OnEmulationStateChanged(state != Core::State::Uninitialized);
|
||||
});
|
||||
connect(m_manual_texture_sampling, &QCheckBox::toggled, [this, parent] {
|
||||
SaveSettings();
|
||||
emit parent->UseFastTextureSamplingChanged();
|
||||
});
|
||||
connect(m_manual_texture_sampling, &QCheckBox::toggled,
|
||||
[this, parent] { emit parent->UseFastTextureSamplingChanged(); });
|
||||
|
||||
OnBackendChanged();
|
||||
OnEmulationStateChanged(!Core::IsUninitialized(Core::System::GetInstance()));
|
||||
}
|
||||
|
||||
AdvancedWidget::AdvancedWidget(GameConfigWidget* parent, Config::Layer* layer) : m_game_layer(layer)
|
||||
{
|
||||
CreateWidgets();
|
||||
ConnectWidgets();
|
||||
AddDescriptions();
|
||||
|
||||
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [this](Core::State state) {
|
||||
OnEmulationStateChanged(state != Core::State::Uninitialized);
|
||||
});
|
||||
OnEmulationStateChanged(Core::GetState(Core::System::GetInstance()) !=
|
||||
Core::State::Uninitialized);
|
||||
}
|
||||
|
||||
void AdvancedWidget::CreateWidgets()
|
||||
{
|
||||
const bool local_edit = m_game_layer != nullptr;
|
||||
|
||||
auto* main_layout = new QVBoxLayout;
|
||||
|
||||
// Performance
|
||||
@@ -55,17 +66,19 @@ void AdvancedWidget::CreateWidgets()
|
||||
auto* performance_layout = new QGridLayout();
|
||||
performance_box->setLayout(performance_layout);
|
||||
|
||||
m_show_fps = new ConfigBool(tr("Show FPS"), Config::GFX_SHOW_FPS);
|
||||
m_show_ftimes = new ConfigBool(tr("Show Frame Times"), Config::GFX_SHOW_FTIMES);
|
||||
m_show_vps = new ConfigBool(tr("Show VPS"), Config::GFX_SHOW_VPS);
|
||||
m_show_vtimes = new ConfigBool(tr("Show VBlank Times"), Config::GFX_SHOW_VTIMES);
|
||||
m_show_graphs = new ConfigBool(tr("Show Performance Graphs"), Config::GFX_SHOW_GRAPHS);
|
||||
m_show_speed = new ConfigBool(tr("Show % Speed"), Config::GFX_SHOW_SPEED);
|
||||
m_show_speed_colors = new ConfigBool(tr("Show Speed Colors"), Config::GFX_SHOW_SPEED_COLORS);
|
||||
m_perf_samp_window = new ConfigInteger(0, 10000, Config::GFX_PERF_SAMP_WINDOW, 100);
|
||||
m_show_fps = new ConfigBool(tr("Show FPS"), Config::GFX_SHOW_FPS, m_game_layer);
|
||||
m_show_ftimes = new ConfigBool(tr("Show Frame Times"), Config::GFX_SHOW_FTIMES, m_game_layer);
|
||||
m_show_vps = new ConfigBool(tr("Show VPS"), Config::GFX_SHOW_VPS, m_game_layer);
|
||||
m_show_vtimes = new ConfigBool(tr("Show VBlank Times"), Config::GFX_SHOW_VTIMES, m_game_layer);
|
||||
m_show_graphs =
|
||||
new ConfigBool(tr("Show Performance Graphs"), Config::GFX_SHOW_GRAPHS, m_game_layer);
|
||||
m_show_speed = new ConfigBool(tr("Show % Speed"), Config::GFX_SHOW_SPEED, m_game_layer);
|
||||
m_show_speed_colors =
|
||||
new ConfigBool(tr("Show Speed Colors"), Config::GFX_SHOW_SPEED_COLORS, m_game_layer);
|
||||
m_perf_samp_window = new ConfigInteger(0, 10000, Config::GFX_PERF_SAMP_WINDOW, m_game_layer, 100);
|
||||
m_perf_samp_window->SetTitle(tr("Performance Sample Window (ms)"));
|
||||
m_log_render_time =
|
||||
new ConfigBool(tr("Log Render Time to File"), Config::GFX_LOG_RENDER_TIME_TO_FILE);
|
||||
m_log_render_time = new ConfigBool(tr("Log Render Time to File"),
|
||||
Config::GFX_LOG_RENDER_TIME_TO_FILE, m_game_layer);
|
||||
|
||||
performance_layout->addWidget(m_show_fps, 0, 0);
|
||||
performance_layout->addWidget(m_show_ftimes, 0, 1);
|
||||
@@ -83,14 +96,16 @@ void AdvancedWidget::CreateWidgets()
|
||||
auto* debugging_layout = new QGridLayout();
|
||||
debugging_box->setLayout(debugging_layout);
|
||||
|
||||
m_enable_wireframe = new ConfigBool(tr("Enable Wireframe"), Config::GFX_ENABLE_WIREFRAME);
|
||||
m_show_statistics = new ConfigBool(tr("Show Statistics"), Config::GFX_OVERLAY_STATS);
|
||||
m_show_proj_statistics =
|
||||
new ConfigBool(tr("Show Projection Statistics"), Config::GFX_OVERLAY_PROJ_STATS);
|
||||
m_enable_wireframe =
|
||||
new ConfigBool(tr("Enable Wireframe"), Config::GFX_ENABLE_WIREFRAME, m_game_layer);
|
||||
m_show_statistics =
|
||||
new ConfigBool(tr("Show Statistics"), Config::GFX_OVERLAY_STATS, m_game_layer);
|
||||
m_show_proj_statistics = new ConfigBool(tr("Show Projection Statistics"),
|
||||
Config::GFX_OVERLAY_PROJ_STATS, m_game_layer);
|
||||
m_enable_format_overlay =
|
||||
new ConfigBool(tr("Texture Format Overlay"), Config::GFX_TEXFMT_OVERLAY_ENABLE);
|
||||
m_enable_api_validation =
|
||||
new ConfigBool(tr("Enable API Validation Layers"), Config::GFX_ENABLE_VALIDATION_LAYER);
|
||||
new ConfigBool(tr("Texture Format Overlay"), Config::GFX_TEXFMT_OVERLAY_ENABLE, m_game_layer);
|
||||
m_enable_api_validation = new ConfigBool(tr("Enable API Validation Layers"),
|
||||
Config::GFX_ENABLE_VALIDATION_LAYER, m_game_layer);
|
||||
|
||||
debugging_layout->addWidget(m_enable_wireframe, 0, 0);
|
||||
debugging_layout->addWidget(m_show_statistics, 0, 1);
|
||||
@@ -103,14 +118,25 @@ void AdvancedWidget::CreateWidgets()
|
||||
auto* utility_layout = new QGridLayout();
|
||||
utility_box->setLayout(utility_layout);
|
||||
|
||||
m_load_custom_textures = new ConfigBool(tr("Load Custom Textures"), Config::GFX_HIRES_TEXTURES);
|
||||
m_prefetch_custom_textures =
|
||||
new ConfigBool(tr("Prefetch Custom Textures"), Config::GFX_CACHE_HIRES_TEXTURES);
|
||||
m_load_custom_textures =
|
||||
new ConfigBool(tr("Load Custom Textures"), Config::GFX_HIRES_TEXTURES, m_game_layer);
|
||||
m_prefetch_custom_textures = new ConfigBool(tr("Prefetch Custom Textures"),
|
||||
Config::GFX_CACHE_HIRES_TEXTURES, m_game_layer);
|
||||
m_prefetch_custom_textures->setEnabled(m_load_custom_textures->isChecked());
|
||||
m_dump_efb_target = new ConfigBool(tr("Dump EFB Target"), Config::GFX_DUMP_EFB_TARGET);
|
||||
m_dump_xfb_target = new ConfigBool(tr("Dump XFB Target"), Config::GFX_DUMP_XFB_TARGET);
|
||||
m_disable_vram_copies =
|
||||
new ConfigBool(tr("Disable EFB VRAM Copies"), Config::GFX_HACK_DISABLE_COPY_TO_VRAM);
|
||||
m_enable_graphics_mods = new ToolTipCheckBox(tr("Enable Graphics Mods"));
|
||||
|
||||
if (local_edit)
|
||||
{
|
||||
// It's hazardous to accidentally set these in a game ini.
|
||||
m_dump_efb_target->setEnabled(false);
|
||||
m_dump_xfb_target->setEnabled(false);
|
||||
}
|
||||
|
||||
m_disable_vram_copies = new ConfigBool(tr("Disable EFB VRAM Copies"),
|
||||
Config::GFX_HACK_DISABLE_COPY_TO_VRAM, m_game_layer);
|
||||
m_enable_graphics_mods =
|
||||
new ConfigBool(tr("Enable Graphics Mods"), Config::GFX_MODS_ENABLE, m_game_layer);
|
||||
|
||||
utility_layout->addWidget(m_load_custom_textures, 0, 0);
|
||||
utility_layout->addWidget(m_prefetch_custom_textures, 0, 1);
|
||||
@@ -128,6 +154,16 @@ void AdvancedWidget::CreateWidgets()
|
||||
m_dump_textures = new ConfigBool(tr("Enable"), Config::GFX_DUMP_TEXTURES);
|
||||
m_dump_base_textures = new ConfigBool(tr("Dump Base Textures"), Config::GFX_DUMP_BASE_TEXTURES);
|
||||
m_dump_mip_textures = new ConfigBool(tr("Dump Mip Maps"), Config::GFX_DUMP_MIP_TEXTURES);
|
||||
m_dump_mip_textures->setEnabled(m_dump_textures->isChecked());
|
||||
m_dump_base_textures->setEnabled(m_dump_textures->isChecked());
|
||||
|
||||
if (local_edit)
|
||||
{
|
||||
// It's hazardous to accidentally set dumping in a game ini.
|
||||
m_dump_textures->setEnabled(false);
|
||||
m_dump_base_textures->setEnabled(false);
|
||||
m_dump_mip_textures->setEnabled(false);
|
||||
}
|
||||
|
||||
texture_dump_layout->addWidget(m_dump_textures, 0, 0);
|
||||
|
||||
@@ -142,18 +178,22 @@ void AdvancedWidget::CreateWidgets()
|
||||
m_frame_dumps_resolution_type =
|
||||
new ConfigChoice({tr("Window Resolution"), tr("Aspect Ratio Corrected Internal Resolution"),
|
||||
tr("Raw Internal Resolution")},
|
||||
Config::GFX_FRAME_DUMPS_RESOLUTION_TYPE);
|
||||
m_dump_use_ffv1 = new ConfigBool(tr("Use Lossless Codec (FFV1)"), Config::GFX_USE_FFV1);
|
||||
m_dump_bitrate = new ConfigInteger(0, 1000000, Config::GFX_BITRATE_KBPS, 1000);
|
||||
m_png_compression_level = new ConfigInteger(0, 9, Config::GFX_PNG_COMPRESSION_LEVEL);
|
||||
|
||||
Config::GFX_FRAME_DUMPS_RESOLUTION_TYPE, m_game_layer);
|
||||
m_png_compression_level =
|
||||
new ConfigInteger(0, 9, Config::GFX_PNG_COMPRESSION_LEVEL, m_game_layer);
|
||||
dump_layout->addWidget(new QLabel(tr("Resolution Type:")), 0, 0);
|
||||
dump_layout->addWidget(m_frame_dumps_resolution_type, 0, 1);
|
||||
|
||||
#if defined(HAVE_FFMPEG)
|
||||
m_dump_use_ffv1 =
|
||||
new ConfigBool(tr("Use Lossless Codec (FFV1)"), Config::GFX_USE_FFV1, m_game_layer);
|
||||
m_dump_bitrate = new ConfigInteger(0, 1000000, Config::GFX_BITRATE_KBPS, m_game_layer, 1000);
|
||||
m_dump_bitrate->setEnabled(!m_dump_use_ffv1->isChecked());
|
||||
dump_layout->addWidget(m_dump_use_ffv1, 1, 0);
|
||||
dump_layout->addWidget(new QLabel(tr("Bitrate (kbps):")), 2, 0);
|
||||
dump_layout->addWidget(m_dump_bitrate, 2, 1);
|
||||
#endif
|
||||
|
||||
dump_layout->addWidget(new QLabel(tr("PNG Compression Level:")), 3, 0);
|
||||
m_png_compression_level->SetTitle(tr("PNG Compression Level"));
|
||||
dump_layout->addWidget(m_png_compression_level, 3, 1);
|
||||
@@ -163,14 +203,16 @@ void AdvancedWidget::CreateWidgets()
|
||||
auto* misc_layout = new QGridLayout();
|
||||
misc_box->setLayout(misc_layout);
|
||||
|
||||
m_enable_cropping = new ConfigBool(tr("Crop"), Config::GFX_CROP);
|
||||
m_enable_prog_scan = new ToolTipCheckBox(tr("Enable Progressive Scan"));
|
||||
m_backend_multithreading =
|
||||
new ConfigBool(tr("Backend Multithreading"), Config::GFX_BACKEND_MULTITHREADING);
|
||||
m_enable_cropping = new ConfigBool(tr("Crop"), Config::GFX_CROP, m_game_layer);
|
||||
m_enable_prog_scan =
|
||||
new ConfigBool(tr("Enable Progressive Scan"), Config::SYSCONF_PROGRESSIVE_SCAN, m_game_layer);
|
||||
m_backend_multithreading = new ConfigBool(tr("Backend Multithreading"),
|
||||
Config::GFX_BACKEND_MULTITHREADING, m_game_layer);
|
||||
m_prefer_vs_for_point_line_expansion = new ConfigBool(
|
||||
// i18n: VS is short for vertex shaders.
|
||||
tr("Prefer VS for Point/Line Expansion"), Config::GFX_PREFER_VS_FOR_LINE_POINT_EXPANSION);
|
||||
m_cpu_cull = new ConfigBool(tr("Cull Vertices on the CPU"), Config::GFX_CPU_CULL);
|
||||
tr("Prefer VS for Point/Line Expansion"), Config::GFX_PREFER_VS_FOR_LINE_POINT_EXPANSION,
|
||||
m_game_layer);
|
||||
m_cpu_cull = new ConfigBool(tr("Cull Vertices on the CPU"), Config::GFX_CPU_CULL, m_game_layer);
|
||||
|
||||
misc_layout->addWidget(m_enable_cropping, 0, 0);
|
||||
misc_layout->addWidget(m_enable_prog_scan, 0, 1);
|
||||
@@ -179,7 +221,7 @@ void AdvancedWidget::CreateWidgets()
|
||||
misc_layout->addWidget(m_cpu_cull, 2, 0);
|
||||
#ifdef _WIN32
|
||||
m_borderless_fullscreen =
|
||||
new ConfigBool(tr("Borderless Fullscreen"), Config::GFX_BORDERLESS_FULLSCREEN);
|
||||
new ConfigBool(tr("Borderless Fullscreen"), Config::GFX_BORDERLESS_FULLSCREEN, m_game_layer);
|
||||
|
||||
misc_layout->addWidget(m_borderless_fullscreen, 2, 1);
|
||||
#endif
|
||||
@@ -189,10 +231,10 @@ void AdvancedWidget::CreateWidgets()
|
||||
auto* experimental_layout = new QGridLayout();
|
||||
experimental_box->setLayout(experimental_layout);
|
||||
|
||||
m_defer_efb_access_invalidation =
|
||||
new ConfigBool(tr("Defer EFB Cache Invalidation"), Config::GFX_HACK_EFB_DEFER_INVALIDATION);
|
||||
m_manual_texture_sampling =
|
||||
new ConfigBool(tr("Manual Texture Sampling"), Config::GFX_HACK_FAST_TEXTURE_SAMPLING, true);
|
||||
m_defer_efb_access_invalidation = new ConfigBool(
|
||||
tr("Defer EFB Cache Invalidation"), Config::GFX_HACK_EFB_DEFER_INVALIDATION, m_game_layer);
|
||||
m_manual_texture_sampling = new ConfigBool(
|
||||
tr("Manual Texture Sampling"), Config::GFX_HACK_FAST_TEXTURE_SAMPLING, m_game_layer, true);
|
||||
|
||||
experimental_layout->addWidget(m_defer_efb_access_invalidation, 0, 0);
|
||||
experimental_layout->addWidget(m_manual_texture_sampling, 0, 1);
|
||||
@@ -211,34 +253,19 @@ void AdvancedWidget::CreateWidgets()
|
||||
|
||||
void AdvancedWidget::ConnectWidgets()
|
||||
{
|
||||
connect(m_load_custom_textures, &QCheckBox::toggled, this, &AdvancedWidget::SaveSettings);
|
||||
connect(m_dump_use_ffv1, &QCheckBox::toggled, this, &AdvancedWidget::SaveSettings);
|
||||
connect(m_enable_prog_scan, &QCheckBox::toggled, this, &AdvancedWidget::SaveSettings);
|
||||
connect(m_dump_textures, &QCheckBox::toggled, this, &AdvancedWidget::SaveSettings);
|
||||
connect(m_enable_graphics_mods, &QCheckBox::toggled, this, &AdvancedWidget::SaveSettings);
|
||||
}
|
||||
connect(m_load_custom_textures, &QCheckBox::toggled, this,
|
||||
[this](bool checked) { m_prefetch_custom_textures->setEnabled(checked); });
|
||||
connect(m_dump_textures, &QCheckBox::toggled, this, [this](bool checked) {
|
||||
m_dump_mip_textures->setEnabled(checked);
|
||||
m_dump_base_textures->setEnabled(checked);
|
||||
});
|
||||
connect(m_enable_graphics_mods, &QCheckBox::toggled, this,
|
||||
[this](bool checked) { emit Settings::Instance().EnableGfxModsChanged(checked); });
|
||||
|
||||
void AdvancedWidget::LoadSettings()
|
||||
{
|
||||
m_prefetch_custom_textures->setEnabled(Config::Get(Config::GFX_HIRES_TEXTURES));
|
||||
m_dump_bitrate->setEnabled(!Config::Get(Config::GFX_USE_FFV1));
|
||||
|
||||
m_enable_prog_scan->setChecked(Config::Get(Config::SYSCONF_PROGRESSIVE_SCAN));
|
||||
m_dump_mip_textures->setEnabled(Config::Get(Config::GFX_DUMP_TEXTURES));
|
||||
m_dump_base_textures->setEnabled(Config::Get(Config::GFX_DUMP_TEXTURES));
|
||||
|
||||
SignalBlocking(m_enable_graphics_mods)->setChecked(Settings::Instance().GetGraphicModsEnabled());
|
||||
}
|
||||
|
||||
void AdvancedWidget::SaveSettings()
|
||||
{
|
||||
m_prefetch_custom_textures->setEnabled(Config::Get(Config::GFX_HIRES_TEXTURES));
|
||||
m_dump_bitrate->setEnabled(!Config::Get(Config::GFX_USE_FFV1));
|
||||
|
||||
Config::SetBase(Config::SYSCONF_PROGRESSIVE_SCAN, m_enable_prog_scan->isChecked());
|
||||
m_dump_mip_textures->setEnabled(Config::Get(Config::GFX_DUMP_TEXTURES));
|
||||
m_dump_base_textures->setEnabled(Config::Get(Config::GFX_DUMP_TEXTURES));
|
||||
Settings::Instance().SetGraphicModsEnabled(m_enable_graphics_mods->isChecked());
|
||||
#if defined(HAVE_FFMPEG)
|
||||
connect(m_dump_use_ffv1, &QCheckBox::toggled, this,
|
||||
[this](bool checked) { m_dump_bitrate->setEnabled(!checked); });
|
||||
#endif
|
||||
}
|
||||
|
||||
void AdvancedWidget::OnBackendChanged()
|
||||
|
||||
@@ -8,22 +8,22 @@
|
||||
class ConfigBool;
|
||||
class ConfigChoice;
|
||||
class ConfigInteger;
|
||||
class GameConfigWidget;
|
||||
class GraphicsWindow;
|
||||
class QCheckBox;
|
||||
class QComboBox;
|
||||
class QSpinBox;
|
||||
class ToolTipCheckBox;
|
||||
|
||||
namespace Config
|
||||
{
|
||||
class Layer;
|
||||
} // namespace Config
|
||||
|
||||
class AdvancedWidget final : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit AdvancedWidget(GraphicsWindow* parent);
|
||||
AdvancedWidget(GameConfigWidget* parent, Config::Layer* layer);
|
||||
|
||||
private:
|
||||
void LoadSettings();
|
||||
void SaveSettings();
|
||||
|
||||
void CreateWidgets();
|
||||
void ConnectWidgets();
|
||||
void AddDescriptions();
|
||||
@@ -52,7 +52,7 @@ private:
|
||||
ConfigBool* m_dump_xfb_target;
|
||||
ConfigBool* m_disable_vram_copies;
|
||||
ConfigBool* m_load_custom_textures;
|
||||
ToolTipCheckBox* m_enable_graphics_mods;
|
||||
ConfigBool* m_enable_graphics_mods;
|
||||
|
||||
// Texture dumping
|
||||
ConfigBool* m_dump_textures;
|
||||
@@ -67,7 +67,7 @@ private:
|
||||
|
||||
// Misc
|
||||
ConfigBool* m_enable_cropping;
|
||||
ToolTipCheckBox* m_enable_prog_scan;
|
||||
ConfigBool* m_enable_prog_scan;
|
||||
ConfigBool* m_backend_multithreading;
|
||||
ConfigBool* m_prefer_vs_for_point_line_expansion;
|
||||
ConfigBool* m_cpu_cull;
|
||||
@@ -76,4 +76,6 @@ private:
|
||||
// Experimental
|
||||
ConfigBool* m_defer_efb_access_invalidation;
|
||||
ConfigBool* m_manual_texture_sampling;
|
||||
|
||||
Config::Layer* m_game_layer = nullptr;
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -9,39 +9,52 @@
|
||||
|
||||
class ConfigBool;
|
||||
class ConfigChoice;
|
||||
class ConfigComplexChoice;
|
||||
class ConfigStringChoice;
|
||||
class ConfigSlider;
|
||||
class GameConfigWidget;
|
||||
class GraphicsWindow;
|
||||
class QCheckBox;
|
||||
class QComboBox;
|
||||
class QPushButton;
|
||||
class QSlider;
|
||||
class ToolTipComboBox;
|
||||
class ToolTipPushButton;
|
||||
enum class StereoMode : int;
|
||||
|
||||
namespace Config
|
||||
{
|
||||
template <typename T>
|
||||
class Info;
|
||||
class Layer;
|
||||
} // namespace Config
|
||||
|
||||
class EnhancementsWidget final : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit EnhancementsWidget(GraphicsWindow* parent);
|
||||
EnhancementsWidget(GameConfigWidget* parent, Config::Layer* layer);
|
||||
|
||||
private:
|
||||
void LoadSettings();
|
||||
void SaveSettings();
|
||||
template <typename T>
|
||||
T ReadSetting(const Config::Info<T>& setting) const;
|
||||
|
||||
void CreateWidgets();
|
||||
void ConnectWidgets();
|
||||
void AddDescriptions();
|
||||
|
||||
void OnBackendChanged();
|
||||
void UpdateAAOptions();
|
||||
void LoadPPShaders();
|
||||
void ShaderChanged();
|
||||
void OnConfigChanged();
|
||||
|
||||
void ConfigureColorCorrection();
|
||||
void ConfigurePostProcessingShader();
|
||||
void LoadPPShaders(StereoMode stereo_mode);
|
||||
|
||||
// Enhancements
|
||||
ConfigChoice* m_ir_combo;
|
||||
ToolTipComboBox* m_aa_combo;
|
||||
ToolTipComboBox* m_texture_filtering_combo;
|
||||
ToolTipComboBox* m_output_resampling_combo;
|
||||
ToolTipComboBox* m_pp_effect;
|
||||
ConfigComplexChoice* m_aa_combo;
|
||||
ConfigComplexChoice* m_texture_filtering_combo;
|
||||
ConfigChoice* m_output_resampling_combo;
|
||||
ConfigStringChoice* m_pp_effect;
|
||||
ToolTipPushButton* m_configure_color_correction;
|
||||
QPushButton* m_configure_pp_effect;
|
||||
ConfigBool* m_scaled_efb_copy;
|
||||
@@ -60,6 +73,5 @@ private:
|
||||
ConfigBool* m_3d_swap_eyes;
|
||||
ConfigBool* m_3d_per_eye_resolution;
|
||||
|
||||
int m_msaa_modes;
|
||||
bool m_block_save;
|
||||
Config::Layer* m_game_layer = nullptr;
|
||||
};
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user