2022-12-04 11:03:45 +00:00
|
|
|
// SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin <stenzek@gmail.com>
|
|
|
|
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
|
|
|
|
2020-04-30 14:59:31 +00:00
|
|
|
#include "advancedsettingswidget.h"
|
2020-12-25 14:08:04 +00:00
|
|
|
#include "core/gpu_types.h"
|
2020-08-22 03:01:52 +00:00
|
|
|
#include "mainwindow.h"
|
2020-09-06 10:49:13 +00:00
|
|
|
#include "qtutils.h"
|
2023-11-06 13:01:38 +00:00
|
|
|
#include "settingswindow.h"
|
2020-04-30 14:59:31 +00:00
|
|
|
#include "settingwidgetbinder.h"
|
|
|
|
|
2023-11-06 13:01:38 +00:00
|
|
|
static QCheckBox* addBooleanTweakOption(SettingsWindow* dialog, QTableWidget* table, QString name, std::string section,
|
2022-07-11 13:03:29 +00:00
|
|
|
std::string key, bool default_value)
|
2020-09-06 10:49:13 +00:00
|
|
|
{
|
|
|
|
const int row = table->rowCount();
|
|
|
|
|
|
|
|
table->insertRow(row);
|
|
|
|
|
|
|
|
QTableWidgetItem* name_item = new QTableWidgetItem(name);
|
2020-09-07 11:13:32 +00:00
|
|
|
name_item->setFlags(name_item->flags() & ~(Qt::ItemIsEditable | Qt::ItemIsSelectable));
|
2020-09-06 10:49:13 +00:00
|
|
|
table->setItem(row, 0, name_item);
|
|
|
|
|
|
|
|
QCheckBox* cb = new QCheckBox(table);
|
2021-08-25 10:05:31 +00:00
|
|
|
if (!section.empty() || !key.empty())
|
2022-07-11 13:03:29 +00:00
|
|
|
{
|
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(dialog->getSettingsInterface(), cb, std::move(section), std::move(key),
|
|
|
|
default_value);
|
|
|
|
}
|
2021-08-25 10:05:31 +00:00
|
|
|
|
2020-09-06 10:49:13 +00:00
|
|
|
table->setCellWidget(row, 1, cb);
|
2021-08-25 10:05:31 +00:00
|
|
|
return cb;
|
2020-09-06 10:49:13 +00:00
|
|
|
}
|
|
|
|
|
2021-08-25 10:05:31 +00:00
|
|
|
static QCheckBox* setBooleanTweakOption(QTableWidget* table, int row, bool value)
|
2020-09-06 10:49:13 +00:00
|
|
|
{
|
|
|
|
QWidget* widget = table->cellWidget(row, 1);
|
|
|
|
QCheckBox* cb = qobject_cast<QCheckBox*>(widget);
|
|
|
|
Assert(cb);
|
|
|
|
cb->setChecked(value);
|
2021-08-25 10:05:31 +00:00
|
|
|
return cb;
|
2020-09-06 10:49:13 +00:00
|
|
|
}
|
|
|
|
|
2023-11-06 13:01:38 +00:00
|
|
|
static QSpinBox* addIntRangeTweakOption(SettingsWindow* dialog, QTableWidget* table, QString name, std::string section,
|
2022-07-11 13:03:29 +00:00
|
|
|
std::string key, int min_value, int max_value, int default_value)
|
2020-09-06 10:49:13 +00:00
|
|
|
{
|
|
|
|
const int row = table->rowCount();
|
|
|
|
|
|
|
|
table->insertRow(row);
|
|
|
|
|
|
|
|
QTableWidgetItem* name_item = new QTableWidgetItem(name);
|
2020-10-02 14:56:21 +00:00
|
|
|
name_item->setFlags(name_item->flags() & ~(Qt::ItemIsEditable | Qt::ItemIsSelectable));
|
2020-09-06 10:49:13 +00:00
|
|
|
table->setItem(row, 0, name_item);
|
|
|
|
|
|
|
|
QSpinBox* cb = new QSpinBox(table);
|
|
|
|
cb->setMinimum(min_value);
|
|
|
|
cb->setMaximum(max_value);
|
2021-08-25 10:05:31 +00:00
|
|
|
if (!section.empty() || !key.empty())
|
2022-07-11 13:03:29 +00:00
|
|
|
{
|
|
|
|
SettingWidgetBinder::BindWidgetToIntSetting(dialog->getSettingsInterface(), cb, std::move(section), std::move(key),
|
|
|
|
default_value);
|
|
|
|
}
|
2021-08-25 10:05:31 +00:00
|
|
|
|
2020-09-06 10:49:13 +00:00
|
|
|
table->setCellWidget(row, 1, cb);
|
2021-08-25 10:05:31 +00:00
|
|
|
return cb;
|
2020-09-06 10:49:13 +00:00
|
|
|
}
|
|
|
|
|
2021-08-25 10:05:31 +00:00
|
|
|
static QSpinBox* setIntRangeTweakOption(QTableWidget* table, int row, int value)
|
2020-09-06 10:49:13 +00:00
|
|
|
{
|
|
|
|
QWidget* widget = table->cellWidget(row, 1);
|
|
|
|
QSpinBox* cb = qobject_cast<QSpinBox*>(widget);
|
|
|
|
Assert(cb);
|
|
|
|
cb->setValue(value);
|
2021-08-25 10:05:31 +00:00
|
|
|
return cb;
|
2020-09-06 10:49:13 +00:00
|
|
|
}
|
|
|
|
|
2023-11-06 13:01:38 +00:00
|
|
|
static QDoubleSpinBox* addFloatRangeTweakOption(SettingsWindow* dialog, QTableWidget* table, QString name,
|
2021-08-25 10:05:31 +00:00
|
|
|
std::string section, std::string key, float min_value, float max_value,
|
|
|
|
float step_value, float default_value)
|
2020-11-26 14:02:13 +00:00
|
|
|
{
|
|
|
|
const int row = table->rowCount();
|
|
|
|
|
|
|
|
table->insertRow(row);
|
|
|
|
|
|
|
|
QTableWidgetItem* name_item = new QTableWidgetItem(name);
|
|
|
|
name_item->setFlags(name_item->flags() & ~(Qt::ItemIsEditable | Qt::ItemIsSelectable));
|
|
|
|
table->setItem(row, 0, name_item);
|
|
|
|
|
|
|
|
QDoubleSpinBox* cb = new QDoubleSpinBox(table);
|
|
|
|
cb->setMinimum(min_value);
|
|
|
|
cb->setMaximum(max_value);
|
|
|
|
cb->setSingleStep(step_value);
|
2021-08-25 10:05:31 +00:00
|
|
|
|
|
|
|
if (!section.empty() || !key.empty())
|
|
|
|
{
|
2022-07-11 13:03:29 +00:00
|
|
|
SettingWidgetBinder::BindWidgetToFloatSetting(dialog->getSettingsInterface(), cb, std::move(section),
|
|
|
|
std::move(key), default_value);
|
2021-08-25 10:05:31 +00:00
|
|
|
}
|
|
|
|
|
2020-11-26 14:02:13 +00:00
|
|
|
table->setCellWidget(row, 1, cb);
|
2021-08-25 10:05:31 +00:00
|
|
|
return cb;
|
2020-11-26 14:02:13 +00:00
|
|
|
}
|
|
|
|
|
2021-08-25 10:05:31 +00:00
|
|
|
static QDoubleSpinBox* setFloatRangeTweakOption(QTableWidget* table, int row, float value)
|
2020-11-26 14:02:13 +00:00
|
|
|
{
|
|
|
|
QWidget* widget = table->cellWidget(row, 1);
|
|
|
|
QDoubleSpinBox* cb = qobject_cast<QDoubleSpinBox*>(widget);
|
|
|
|
Assert(cb);
|
|
|
|
cb->setValue(value);
|
2021-08-25 10:05:31 +00:00
|
|
|
return cb;
|
2020-11-26 14:02:13 +00:00
|
|
|
}
|
|
|
|
|
2020-11-22 15:06:25 +00:00
|
|
|
template<typename T>
|
2023-11-06 13:01:38 +00:00
|
|
|
static QComboBox* addChoiceTweakOption(SettingsWindow* dialog, QTableWidget* table, QString name, std::string section,
|
2022-07-11 13:03:29 +00:00
|
|
|
std::string key, std::optional<T> (*parse_callback)(const char*),
|
2021-08-25 10:05:31 +00:00
|
|
|
const char* (*get_value_callback)(T), const char* (*get_display_callback)(T),
|
2023-08-20 03:25:43 +00:00
|
|
|
u32 num_values, T default_value)
|
2020-11-22 15:06:25 +00:00
|
|
|
{
|
|
|
|
const int row = table->rowCount();
|
|
|
|
|
|
|
|
table->insertRow(row);
|
|
|
|
|
|
|
|
QTableWidgetItem* name_item = new QTableWidgetItem(name);
|
|
|
|
name_item->setFlags(name_item->flags() & ~(Qt::ItemIsEditable | Qt::ItemIsSelectable));
|
|
|
|
table->setItem(row, 0, name_item);
|
|
|
|
|
|
|
|
QComboBox* cb = new QComboBox(table);
|
|
|
|
for (u32 i = 0; i < num_values; i++)
|
2023-08-20 03:25:43 +00:00
|
|
|
cb->addItem(QString::fromUtf8(get_display_callback(static_cast<T>(i))));
|
2020-11-22 15:06:25 +00:00
|
|
|
|
2021-08-25 10:05:31 +00:00
|
|
|
if (!section.empty() || !key.empty())
|
|
|
|
{
|
2022-07-11 13:03:29 +00:00
|
|
|
SettingWidgetBinder::BindWidgetToEnumSetting(dialog->getSettingsInterface(), cb, std::move(section), std::move(key),
|
|
|
|
parse_callback, get_value_callback, default_value);
|
2021-08-25 10:05:31 +00:00
|
|
|
}
|
|
|
|
|
2020-11-22 15:06:25 +00:00
|
|
|
table->setCellWidget(row, 1, cb);
|
2021-08-25 10:05:31 +00:00
|
|
|
return cb;
|
2020-11-22 15:06:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
static void setChoiceTweakOption(QTableWidget* table, int row, T value)
|
|
|
|
{
|
|
|
|
QWidget* widget = table->cellWidget(row, 1);
|
|
|
|
QComboBox* cb = qobject_cast<QComboBox*>(widget);
|
|
|
|
Assert(cb);
|
|
|
|
cb->setCurrentIndex(static_cast<int>(value));
|
|
|
|
}
|
|
|
|
|
2023-11-06 13:01:38 +00:00
|
|
|
static void addMSAATweakOption(SettingsWindow* dialog, QTableWidget* table, const QString& name)
|
2021-08-26 11:11:58 +00:00
|
|
|
{
|
|
|
|
const int row = table->rowCount();
|
|
|
|
|
|
|
|
table->insertRow(row);
|
|
|
|
|
|
|
|
QTableWidgetItem* name_item = new QTableWidgetItem(name);
|
|
|
|
name_item->setFlags(name_item->flags() & ~(Qt::ItemIsEditable | Qt::ItemIsSelectable));
|
|
|
|
table->setItem(row, 0, name_item);
|
|
|
|
|
|
|
|
QComboBox* msaa = new QComboBox(table);
|
|
|
|
QtUtils::FillComboBoxWithMSAAModes(msaa);
|
2022-07-11 13:03:29 +00:00
|
|
|
const QVariant current_msaa_mode(
|
|
|
|
QtUtils::GetMSAAModeValue(static_cast<uint>(dialog->getEffectiveIntValue("GPU", "Multisamples", 1)),
|
|
|
|
dialog->getEffectiveBoolValue("GPU", "PerSampleShading", false)));
|
2021-08-26 11:11:58 +00:00
|
|
|
const int current_msaa_index = msaa->findData(current_msaa_mode);
|
|
|
|
if (current_msaa_index >= 0)
|
|
|
|
msaa->setCurrentIndex(current_msaa_index);
|
2022-07-11 13:03:29 +00:00
|
|
|
msaa->connect(msaa, QOverload<int>::of(&QComboBox::currentIndexChanged), [dialog, msaa](int index) {
|
2021-08-26 11:11:58 +00:00
|
|
|
uint multisamples;
|
|
|
|
bool ssaa;
|
|
|
|
QtUtils::DecodeMSAAModeValue(msaa->itemData(index), &multisamples, &ssaa);
|
2022-07-11 13:03:29 +00:00
|
|
|
dialog->setIntSettingValue("GPU", "Multisamples", static_cast<int>(multisamples));
|
|
|
|
dialog->setBoolSettingValue("GPU", "PerSampleShading", ssaa);
|
|
|
|
g_emu_thread->applySettings(false);
|
2021-08-26 11:11:58 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
table->setCellWidget(row, 1, msaa);
|
|
|
|
}
|
|
|
|
|
2023-11-06 13:01:38 +00:00
|
|
|
static void addDirectoryOption(SettingsWindow* dialog, QTableWidget* table, const QString& name, std::string section,
|
2023-04-29 10:53:34 +00:00
|
|
|
std::string key)
|
|
|
|
{
|
|
|
|
const int row = table->rowCount();
|
|
|
|
|
|
|
|
table->insertRow(row);
|
|
|
|
|
|
|
|
QTableWidgetItem* name_item = new QTableWidgetItem(name);
|
|
|
|
name_item->setFlags(name_item->flags() & ~(Qt::ItemIsEditable | Qt::ItemIsSelectable));
|
|
|
|
table->setItem(row, 0, name_item);
|
|
|
|
|
|
|
|
QWidget* container = new QWidget(table);
|
|
|
|
|
|
|
|
QHBoxLayout* layout = new QHBoxLayout(container);
|
|
|
|
layout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
|
|
|
|
QLineEdit* value = new QLineEdit(container);
|
|
|
|
value->setObjectName(QStringLiteral("value"));
|
|
|
|
SettingWidgetBinder::BindWidgetToStringSetting(dialog->getSettingsInterface(), value, std::move(section),
|
|
|
|
std::move(key));
|
|
|
|
layout->addWidget(value, 1);
|
|
|
|
|
|
|
|
QPushButton* browse = new QPushButton(container);
|
|
|
|
browse->setText(QStringLiteral("..."));
|
|
|
|
browse->setMaximumWidth(32);
|
|
|
|
QObject::connect(browse, &QPushButton::clicked, browse, [browse, value, name]() {
|
|
|
|
const QString path(QDir::toNativeSeparators(QFileDialog::getExistingDirectory(
|
|
|
|
QtUtils::GetRootWidget(browse), qApp->translate("AdvancedSettingsWidget", "Select folder for %1").arg(name),
|
|
|
|
value->text())));
|
|
|
|
if (!path.isEmpty())
|
|
|
|
value->setText(path);
|
|
|
|
});
|
|
|
|
layout->addWidget(browse, 0);
|
|
|
|
|
|
|
|
table->setCellWidget(row, 1, container);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void setDirectoryOption(QTableWidget* table, int row, const char* value)
|
|
|
|
{
|
|
|
|
QWidget* widget = table->cellWidget(row, 1);
|
|
|
|
Assert(widget);
|
|
|
|
QLineEdit* valuew = widget->findChild<QLineEdit*>(QStringLiteral("value"));
|
|
|
|
Assert(valuew);
|
|
|
|
valuew->setText(QString::fromUtf8(value));
|
|
|
|
}
|
|
|
|
|
2023-11-06 13:01:38 +00:00
|
|
|
AdvancedSettingsWidget::AdvancedSettingsWidget(SettingsWindow* dialog, QWidget* parent)
|
2022-07-11 13:03:29 +00:00
|
|
|
: QWidget(parent), m_dialog(dialog)
|
2020-04-30 14:59:31 +00:00
|
|
|
{
|
2022-07-11 13:03:29 +00:00
|
|
|
SettingsInterface* sif = dialog->getSettingsInterface();
|
|
|
|
|
2020-04-30 14:59:31 +00:00
|
|
|
m_ui.setupUi(this);
|
|
|
|
|
|
|
|
for (u32 i = 0; i < static_cast<u32>(LOGLEVEL_COUNT); i++)
|
2023-08-20 03:25:43 +00:00
|
|
|
m_ui.logLevel->addItem(QString::fromUtf8(Settings::GetLogLevelDisplayName(static_cast<LOGLEVEL>(i))));
|
2020-04-30 14:59:31 +00:00
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
SettingWidgetBinder::BindWidgetToEnumSetting(sif, m_ui.logLevel, "Logging", "LogLevel", &Settings::ParseLogLevelName,
|
|
|
|
&Settings::GetLogLevelName, Settings::DEFAULT_LOG_LEVEL);
|
|
|
|
SettingWidgetBinder::BindWidgetToStringSetting(sif, m_ui.logFilter, "Logging", "LogFilter");
|
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.logToConsole, "Logging", "LogToConsole", false);
|
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.logToDebug, "Logging", "LogToDebug", false);
|
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.logToWindow, "Logging", "LogToWindow", false);
|
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.logToFile, "Logging", "LogToFile", false);
|
2020-06-14 21:43:16 +00:00
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.showDebugMenu, "Main", "ShowDebugMenu", false);
|
2020-08-08 14:03:07 +00:00
|
|
|
|
2020-06-14 21:43:16 +00:00
|
|
|
connect(m_ui.resetToDefaultButton, &QPushButton::clicked, this, &AdvancedSettingsWidget::onResetToDefaultClicked);
|
2022-07-11 13:03:29 +00:00
|
|
|
connect(m_ui.showDebugMenu, &QCheckBox::toggled, g_main_window, &MainWindow::updateDebugMenuVisibility,
|
|
|
|
Qt::QueuedConnection);
|
2020-08-08 14:03:07 +00:00
|
|
|
|
2020-09-06 10:49:13 +00:00
|
|
|
m_ui.tweakOptionTable->setColumnWidth(0, 380);
|
2022-07-22 11:51:00 +00:00
|
|
|
m_ui.tweakOptionTable->setColumnWidth(1, 170);
|
2020-09-06 10:49:13 +00:00
|
|
|
|
2022-09-17 03:47:46 +00:00
|
|
|
addTweakOptions();
|
|
|
|
|
|
|
|
dialog->registerWidgetHelp(m_ui.logLevel, tr("Log Level"), tr("Information"),
|
|
|
|
tr("Sets the verbosity of messages logged. Higher levels will log more messages."));
|
|
|
|
dialog->registerWidgetHelp(m_ui.logToConsole, tr("Log To System Console"), tr("User Preference"),
|
|
|
|
tr("Logs messages to the console window."));
|
|
|
|
dialog->registerWidgetHelp(m_ui.logToDebug, tr("Log To Debug Console"), tr("User Preference"),
|
|
|
|
tr("Logs messages to the debug console where supported."));
|
|
|
|
dialog->registerWidgetHelp(m_ui.logToWindow, tr("Log To Window"), tr("User Preference"),
|
|
|
|
tr("Logs messages to the window."));
|
|
|
|
dialog->registerWidgetHelp(m_ui.logToFile, tr("Log To File"), tr("User Preference"),
|
|
|
|
tr("Logs messages to duckstation.log in the user directory."));
|
|
|
|
dialog->registerWidgetHelp(m_ui.showDebugMenu, tr("Show Debug Menu"), tr("Unchecked"),
|
|
|
|
tr("Shows a debug menu bar with additional statistics and quick settings."));
|
|
|
|
}
|
|
|
|
|
|
|
|
AdvancedSettingsWidget::~AdvancedSettingsWidget() = default;
|
|
|
|
|
|
|
|
void AdvancedSettingsWidget::addTweakOptions()
|
|
|
|
{
|
|
|
|
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Disable All Enhancements"), "Main",
|
|
|
|
"DisableAllEnhancements", false);
|
|
|
|
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Show Status Indicators"), "Display",
|
|
|
|
"ShowStatusIndicators", true);
|
2023-01-12 07:01:02 +00:00
|
|
|
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Show Frame Times"), "Display", "ShowFrameTimes", false);
|
2022-09-17 03:47:46 +00:00
|
|
|
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Apply Compatibility Settings"), "Main",
|
2022-07-22 14:13:55 +00:00
|
|
|
"ApplyCompatibilitySettings", true);
|
2022-09-17 03:47:46 +00:00
|
|
|
addIntRangeTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Display FPS Limit"), "Display", "MaxFPS", 0, 1000, 0);
|
2020-12-25 07:42:07 +00:00
|
|
|
|
2022-09-17 03:47:46 +00:00
|
|
|
addMSAATweakOption(m_dialog, m_ui.tweakOptionTable, tr("Multisample Antialiasing"));
|
2021-08-26 11:11:58 +00:00
|
|
|
|
2023-09-02 12:26:03 +00:00
|
|
|
addChoiceTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Wireframe Mode"), "GPU", "WireframeMode",
|
|
|
|
Settings::ParseGPUWireframeMode, Settings::GetGPUWireframeModeName,
|
|
|
|
Settings::GetGPUWireframeModeDisplayName, static_cast<u32>(GPUWireframeMode::Count),
|
|
|
|
GPUWireframeMode::Disabled);
|
|
|
|
|
2022-09-24 03:19:56 +00:00
|
|
|
if (m_dialog->isPerGameSettings())
|
|
|
|
{
|
|
|
|
addIntRangeTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Display Active Start Offset"), "Display",
|
|
|
|
"ActiveStartOffset", -5000, 5000, 0);
|
|
|
|
addIntRangeTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Display Active End Offset"), "Display",
|
|
|
|
"ActiveEndOffset", -5000, 5000, 0);
|
|
|
|
addIntRangeTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Display Line Start Offset"), "Display",
|
|
|
|
"LineStartOffset", -128, 127, 0);
|
|
|
|
addIntRangeTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Display Line End Offset"), "Display", "LineEndOffset",
|
|
|
|
-128, 127, 0);
|
|
|
|
}
|
|
|
|
|
2022-09-17 03:47:46 +00:00
|
|
|
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("PGXP Vertex Cache"), "GPU", "PGXPVertexCache", false);
|
|
|
|
addFloatRangeTweakOption(m_dialog, m_ui.tweakOptionTable, tr("PGXP Geometry Tolerance"), "GPU", "PGXPTolerance",
|
|
|
|
-1.0f, 100.0f, 0.25f, -1.0f);
|
|
|
|
addFloatRangeTweakOption(m_dialog, m_ui.tweakOptionTable, tr("PGXP Depth Clear Threshold"), "GPU",
|
2020-12-22 15:17:10 +00:00
|
|
|
"PGXPDepthClearThreshold", 0.0f, 4096.0f, 1.0f, Settings::DEFAULT_GPU_PGXP_DEPTH_THRESHOLD);
|
2020-09-06 10:49:13 +00:00
|
|
|
|
2022-09-17 03:47:46 +00:00
|
|
|
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Enable Recompiler Memory Exceptions"), "CPU",
|
2020-09-06 10:49:13 +00:00
|
|
|
"RecompilerMemoryExceptions", false);
|
2022-09-17 03:47:46 +00:00
|
|
|
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Enable Recompiler Block Linking"), "CPU",
|
2021-05-22 04:55:25 +00:00
|
|
|
"RecompilerBlockLinking", true);
|
2022-09-17 03:47:46 +00:00
|
|
|
addChoiceTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Enable Recompiler Fast Memory Access"), "CPU",
|
|
|
|
"FastmemMode", Settings::ParseCPUFastmemMode, Settings::GetCPUFastmemModeName,
|
2023-08-20 03:25:43 +00:00
|
|
|
Settings::GetCPUFastmemModeDisplayName, static_cast<u32>(CPUFastmemMode::Count),
|
|
|
|
Settings::DEFAULT_CPU_FASTMEM_MODE);
|
2020-09-06 10:49:13 +00:00
|
|
|
|
2023-01-12 07:01:02 +00:00
|
|
|
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Use Old MDEC Routines"), "Hacks", "UseOldMDECRoutines",
|
|
|
|
false);
|
2022-09-17 03:47:46 +00:00
|
|
|
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Enable VRAM Write Texture Replacement"),
|
2020-12-25 14:08:04 +00:00
|
|
|
"TextureReplacements", "EnableVRAMWriteReplacements", false);
|
2022-09-17 03:47:46 +00:00
|
|
|
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Preload Texture Replacements"), "TextureReplacements",
|
2022-07-11 13:03:29 +00:00
|
|
|
"PreloadTextures", false);
|
2022-09-17 03:47:46 +00:00
|
|
|
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Dump Replaceable VRAM Writes"), "TextureReplacements",
|
2022-07-11 13:03:29 +00:00
|
|
|
"DumpVRAMWrites", false);
|
2022-09-17 03:47:46 +00:00
|
|
|
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Set Dumped VRAM Write Alpha Channel"),
|
|
|
|
"TextureReplacements", "DumpVRAMWriteForceAlphaChannel", true);
|
|
|
|
addIntRangeTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Minimum Dumped VRAM Write Width"), "TextureReplacements",
|
2022-07-11 13:03:29 +00:00
|
|
|
"DumpVRAMWriteWidthThreshold", 1, VRAM_WIDTH,
|
2020-12-25 14:08:04 +00:00
|
|
|
Settings::DEFAULT_VRAM_WRITE_DUMP_WIDTH_THRESHOLD);
|
2022-09-17 03:47:46 +00:00
|
|
|
addIntRangeTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Minimum Dumped VRAM Write Height"), "TextureReplacements",
|
2022-07-11 13:03:29 +00:00
|
|
|
"DumpVRAMWriteHeightThreshold", 1, VRAM_HEIGHT,
|
2020-12-25 14:08:04 +00:00
|
|
|
Settings::DEFAULT_VRAM_WRITE_DUMP_HEIGHT_THRESHOLD);
|
|
|
|
|
2022-09-17 03:47:46 +00:00
|
|
|
addIntRangeTweakOption(m_dialog, m_ui.tweakOptionTable, tr("DMA Max Slice Ticks"), "Hacks", "DMAMaxSliceTicks", 100,
|
2022-07-11 13:03:29 +00:00
|
|
|
10000, Settings::DEFAULT_DMA_MAX_SLICE_TICKS);
|
2022-09-17 03:47:46 +00:00
|
|
|
addIntRangeTweakOption(m_dialog, m_ui.tweakOptionTable, tr("DMA Halt Ticks"), "Hacks", "DMAHaltTicks", 100, 10000,
|
2022-07-11 13:03:29 +00:00
|
|
|
Settings::DEFAULT_DMA_HALT_TICKS);
|
2022-09-17 03:47:46 +00:00
|
|
|
addIntRangeTweakOption(m_dialog, m_ui.tweakOptionTable, tr("GPU FIFO Size"), "Hacks", "GPUFIFOSize", 16, 4096,
|
2020-09-06 10:49:13 +00:00
|
|
|
Settings::DEFAULT_GPU_FIFO_SIZE);
|
2022-09-17 03:47:46 +00:00
|
|
|
addIntRangeTweakOption(m_dialog, m_ui.tweakOptionTable, tr("GPU Max Run-Ahead"), "Hacks", "GPUMaxRunAhead", 0, 1000,
|
2022-07-11 13:03:29 +00:00
|
|
|
Settings::DEFAULT_GPU_MAX_RUN_AHEAD);
|
2022-09-17 03:47:46 +00:00
|
|
|
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Use Debug Host GPU Device"), "GPU", "UseDebugDevice",
|
|
|
|
false);
|
2023-08-13 03:42:02 +00:00
|
|
|
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Disable Shader Cache"), "GPU", "DisableShaderCache",
|
|
|
|
false);
|
2020-12-25 07:42:07 +00:00
|
|
|
|
2023-01-23 17:44:44 +00:00
|
|
|
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Stretch Display Vertically"), "Display",
|
|
|
|
"StretchVertically", false);
|
2023-01-21 18:51:55 +00:00
|
|
|
|
2022-09-17 03:47:46 +00:00
|
|
|
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Increase Timer Resolution"), "Main",
|
2020-11-03 11:21:11 +00:00
|
|
|
"IncreaseTimerResolution", true);
|
2021-02-06 17:27:48 +00:00
|
|
|
|
2023-11-05 04:43:38 +00:00
|
|
|
addChoiceTweakOption(m_dialog, m_ui.tweakOptionTable, tr("CD-ROM Mechacon Version"), "CDROM", "MechaconVersion",
|
|
|
|
Settings::ParseCDROMMechVersionName, Settings::GetCDROMMechVersionName,
|
|
|
|
Settings::GetCDROMMechVersionDisplayName, static_cast<u8>(CDROMMechaconVersion::Count),
|
|
|
|
Settings::DEFAULT_CDROM_MECHACON_VERSION);
|
2022-09-17 03:47:46 +00:00
|
|
|
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Allow Booting Without SBI File"), "CDROM",
|
2021-04-22 03:39:38 +00:00
|
|
|
"AllowBootingWithoutSBIFile", false);
|
|
|
|
|
2022-09-17 03:47:46 +00:00
|
|
|
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Create Save State Backups"), "General",
|
2021-07-03 06:48:35 +00:00
|
|
|
"CreateSaveStateBackups", false);
|
2023-04-29 10:53:34 +00:00
|
|
|
|
|
|
|
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Enable PCDrv"), "PCDrv", "Enabled", false);
|
|
|
|
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Enable PCDrv Writes"), "PCDrv", "EnableWrites", false);
|
|
|
|
addDirectoryOption(m_dialog, m_ui.tweakOptionTable, tr("PCDrv Root Directory"), "PCDrv", "Root");
|
2020-04-30 14:59:31 +00:00
|
|
|
}
|
|
|
|
|
2020-06-14 21:43:16 +00:00
|
|
|
void AdvancedSettingsWidget::onResetToDefaultClicked()
|
|
|
|
{
|
2022-09-17 03:47:46 +00:00
|
|
|
if (!m_dialog->isPerGameSettings())
|
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Disable all enhancements
|
|
|
|
setBooleanTweakOption(m_ui.tweakOptionTable, i++, true); // Show status indicators
|
2023-01-12 07:01:02 +00:00
|
|
|
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Show frame times
|
2022-09-17 03:47:46 +00:00
|
|
|
setBooleanTweakOption(m_ui.tweakOptionTable, i++, true); // Apply compatibility settings
|
|
|
|
setIntRangeTweakOption(m_ui.tweakOptionTable, i++, 0); // Display FPS limit
|
|
|
|
setChoiceTweakOption(m_ui.tweakOptionTable, i++, 0); // Multisample antialiasing
|
2023-09-02 12:26:03 +00:00
|
|
|
setChoiceTweakOption(m_ui.tweakOptionTable, i++, 0); // Wireframe mode
|
2022-09-17 03:47:46 +00:00
|
|
|
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // PGXP vertex cache
|
|
|
|
setFloatRangeTweakOption(m_ui.tweakOptionTable, i++, -1.0f); // PGXP geometry tolerance
|
|
|
|
setFloatRangeTweakOption(m_ui.tweakOptionTable, i++,
|
|
|
|
Settings::DEFAULT_GPU_PGXP_DEPTH_THRESHOLD); // PGXP depth clear threshold
|
|
|
|
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Recompiler memory exceptions
|
|
|
|
setBooleanTweakOption(m_ui.tweakOptionTable, i++, true); // Recompiler block linking
|
|
|
|
setChoiceTweakOption(m_ui.tweakOptionTable, i++, Settings::DEFAULT_CPU_FASTMEM_MODE); // Recompiler fastmem mode
|
2023-01-12 07:01:02 +00:00
|
|
|
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Use Old MDEC Routines
|
2022-09-17 03:47:46 +00:00
|
|
|
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // VRAM write texture replacement
|
|
|
|
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Preload texture replacements
|
|
|
|
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Dump replacable VRAM writes
|
2023-01-16 14:52:32 +00:00
|
|
|
setBooleanTweakOption(m_ui.tweakOptionTable, i++, true); // Set dumped VRAM write alpha channel
|
2022-09-17 03:47:46 +00:00
|
|
|
setIntRangeTweakOption(m_ui.tweakOptionTable, i++,
|
|
|
|
Settings::DEFAULT_VRAM_WRITE_DUMP_WIDTH_THRESHOLD); // Minimum dumped VRAM width
|
|
|
|
setIntRangeTweakOption(m_ui.tweakOptionTable, i++,
|
|
|
|
Settings::DEFAULT_VRAM_WRITE_DUMP_HEIGHT_THRESHOLD); // Minimum dumped VRAm height
|
|
|
|
setIntRangeTweakOption(m_ui.tweakOptionTable, i++,
|
|
|
|
static_cast<int>(Settings::DEFAULT_DMA_MAX_SLICE_TICKS)); // DMA max slice ticks
|
|
|
|
setIntRangeTweakOption(m_ui.tweakOptionTable, i++,
|
|
|
|
static_cast<int>(Settings::DEFAULT_DMA_HALT_TICKS)); // DMA halt ticks
|
|
|
|
setIntRangeTweakOption(m_ui.tweakOptionTable, i++,
|
|
|
|
static_cast<int>(Settings::DEFAULT_GPU_FIFO_SIZE)); // GPU FIFO size
|
|
|
|
setIntRangeTweakOption(m_ui.tweakOptionTable, i++,
|
|
|
|
static_cast<int>(Settings::DEFAULT_GPU_MAX_RUN_AHEAD)); // GPU max run-ahead
|
|
|
|
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Use debug host GPU device
|
2023-08-13 03:42:02 +00:00
|
|
|
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Disable Shader Cache
|
2023-04-29 10:53:34 +00:00
|
|
|
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Stretch Display Vertically
|
|
|
|
setBooleanTweakOption(m_ui.tweakOptionTable, i++, true); // Increase Timer Resolution
|
2023-11-05 04:43:38 +00:00
|
|
|
setChoiceTweakOption(m_ui.tweakOptionTable, i++,
|
|
|
|
Settings::DEFAULT_CDROM_MECHACON_VERSION); // CDROM Mechacon Version
|
|
|
|
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Allow booting without SBI file
|
|
|
|
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Create save state backups
|
|
|
|
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Enable PCDRV
|
|
|
|
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Enable PCDRV Writes
|
|
|
|
setDirectoryOption(m_ui.tweakOptionTable, i++, ""); // PCDrv Root Directory
|
2022-09-17 03:47:46 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// for per-game it's easier to just clear and recreate
|
|
|
|
SettingsInterface* sif = m_dialog->getSettingsInterface();
|
|
|
|
sif->DeleteValue("Main", "DisableAllEnhancements");
|
|
|
|
sif->DeleteValue("Display", "ShowEnhancements");
|
|
|
|
sif->DeleteValue("Display", "ShowStatusIndicators");
|
2023-01-12 07:01:02 +00:00
|
|
|
sif->DeleteValue("Display", "ShowFrameTimes");
|
2022-09-17 03:47:46 +00:00
|
|
|
sif->DeleteValue("Main", "ApplyCompatibilitySettings");
|
|
|
|
sif->DeleteValue("Display", "MaxFPS");
|
2022-09-24 03:19:56 +00:00
|
|
|
sif->DeleteValue("Display", "ActiveStartOffset");
|
|
|
|
sif->DeleteValue("Display", "ActiveEndOffset");
|
|
|
|
sif->DeleteValue("Display", "LineStartOffset");
|
|
|
|
sif->DeleteValue("Display", "LineEndOffset");
|
2023-01-23 17:44:44 +00:00
|
|
|
sif->DeleteValue("Display", "StretchVertically");
|
2022-09-17 03:47:46 +00:00
|
|
|
sif->DeleteValue("GPU", "Multisamples");
|
|
|
|
sif->DeleteValue("GPU", "PerSampleShading");
|
|
|
|
sif->DeleteValue("GPU", "PGXPVertexCache");
|
|
|
|
sif->DeleteValue("GPU", "PGXPTolerance");
|
|
|
|
sif->DeleteValue("GPU", "PGXPDepthClearThreshold");
|
|
|
|
sif->DeleteValue("CPU", "RecompilerMemoryExceptions");
|
|
|
|
sif->DeleteValue("CPU", "RecompilerBlockLinking");
|
|
|
|
sif->DeleteValue("CPU", "FastmemMode");
|
|
|
|
sif->DeleteValue("TextureReplacements", "EnableVRAMWriteReplacements");
|
|
|
|
sif->DeleteValue("TextureReplacements", "PreloadTextures");
|
|
|
|
sif->DeleteValue("TextureReplacements", "DumpVRAMWrites");
|
|
|
|
sif->DeleteValue("TextureReplacements", "DumpVRAMWriteForceAlphaChannel");
|
|
|
|
sif->DeleteValue("TextureReplacements", "DumpVRAMWriteWidthThreshold");
|
|
|
|
sif->DeleteValue("TextureReplacements", "DumpVRAMWriteHeightThreshold");
|
2023-01-12 07:01:02 +00:00
|
|
|
sif->DeleteValue("Hacks", "UseOldMDECRoutines");
|
2022-09-17 03:47:46 +00:00
|
|
|
sif->DeleteValue("Hacks", "DMAMaxSliceTicks");
|
|
|
|
sif->DeleteValue("Hacks", "DMAHaltTicks");
|
|
|
|
sif->DeleteValue("Hacks", "GPUFIFOSize");
|
|
|
|
sif->DeleteValue("Hacks", "GPUMaxRunAhead");
|
|
|
|
sif->DeleteValue("GPU", "UseDebugDevice");
|
2023-04-29 10:53:34 +00:00
|
|
|
sif->DeleteValue("Display", "StretchVertically");
|
2022-09-17 03:47:46 +00:00
|
|
|
sif->DeleteValue("Main", "IncreaseTimerResolution");
|
2023-11-05 04:43:38 +00:00
|
|
|
sif->DeleteValue("CDROM", "MechaconVersion");
|
2022-09-17 03:47:46 +00:00
|
|
|
sif->DeleteValue("CDROM", "AllowBootingWithoutSBIFile");
|
|
|
|
sif->DeleteValue("General", "CreateSaveStateBackups");
|
2023-04-29 10:53:34 +00:00
|
|
|
sif->DeleteValue("PCDrv", "Enabled");
|
|
|
|
sif->DeleteValue("PCDrv", "EnableWrites");
|
|
|
|
sif->DeleteValue("PCDrv", "Root");
|
2022-09-17 03:47:46 +00:00
|
|
|
sif->Save();
|
|
|
|
while (m_ui.tweakOptionTable->rowCount() > 0)
|
|
|
|
m_ui.tweakOptionTable->removeRow(m_ui.tweakOptionTable->rowCount() - 1);
|
|
|
|
addTweakOptions();
|
2021-08-26 11:11:58 +00:00
|
|
|
}
|