2020-04-30 14:59:31 +00:00
|
|
|
#include "advancedsettingswidget.h"
|
2020-08-22 03:01:52 +00:00
|
|
|
#include "mainwindow.h"
|
2020-09-06 10:49:13 +00:00
|
|
|
#include "qtutils.h"
|
2020-08-08 14:03:07 +00:00
|
|
|
#include "settingsdialog.h"
|
2020-04-30 14:59:31 +00:00
|
|
|
#include "settingwidgetbinder.h"
|
|
|
|
|
2020-09-06 10:49:13 +00:00
|
|
|
static void addBooleanTweakOption(QtHostInterface* host_interface, QTableWidget* table, QString name,
|
|
|
|
std::string section, std::string key, bool default_value)
|
|
|
|
{
|
|
|
|
const int row = table->rowCount();
|
|
|
|
const bool current_value = host_interface->GetBoolSettingValue(section.c_str(), key.c_str(), default_value);
|
|
|
|
|
|
|
|
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);
|
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(host_interface, cb, std::move(section), std::move(key), default_value);
|
|
|
|
table->setCellWidget(row, 1, cb);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void setBooleanTweakOption(QTableWidget* table, int row, bool value)
|
|
|
|
{
|
|
|
|
QWidget* widget = table->cellWidget(row, 1);
|
|
|
|
QCheckBox* cb = qobject_cast<QCheckBox*>(widget);
|
|
|
|
Assert(cb);
|
|
|
|
cb->setChecked(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void addIntRangeTweakOption(QtHostInterface* host_interface, QTableWidget* table, QString name,
|
|
|
|
std::string section, std::string key, int min_value, int max_value,
|
|
|
|
int default_value)
|
|
|
|
{
|
|
|
|
const int row = table->rowCount();
|
|
|
|
const bool current_value = host_interface->GetBoolSettingValue(section.c_str(), key.c_str(), default_value);
|
|
|
|
|
|
|
|
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);
|
|
|
|
SettingWidgetBinder::BindWidgetToIntSetting(host_interface, cb, std::move(section), std::move(key), default_value);
|
|
|
|
table->setCellWidget(row, 1, cb);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void setIntRangeTweakOption(QTableWidget* table, int row, int value)
|
|
|
|
{
|
|
|
|
QWidget* widget = table->cellWidget(row, 1);
|
|
|
|
QSpinBox* cb = qobject_cast<QSpinBox*>(widget);
|
|
|
|
Assert(cb);
|
|
|
|
cb->setValue(value);
|
|
|
|
}
|
|
|
|
|
2020-04-30 14:59:31 +00:00
|
|
|
AdvancedSettingsWidget::AdvancedSettingsWidget(QtHostInterface* host_interface, QWidget* parent, SettingsDialog* dialog)
|
|
|
|
: QWidget(parent), m_host_interface(host_interface)
|
|
|
|
{
|
|
|
|
m_ui.setupUi(this);
|
|
|
|
|
|
|
|
for (u32 i = 0; i < static_cast<u32>(LOGLEVEL_COUNT); i++)
|
2020-08-22 03:01:52 +00:00
|
|
|
m_ui.logLevel->addItem(qApp->translate("LogLevel", Settings::GetLogLevelDisplayName(static_cast<LOGLEVEL>(i))));
|
2020-04-30 14:59:31 +00:00
|
|
|
|
2020-07-21 09:49:04 +00:00
|
|
|
SettingWidgetBinder::BindWidgetToEnumSetting(m_host_interface, m_ui.logLevel, "Logging", "LogLevel",
|
|
|
|
&Settings::ParseLogLevelName, &Settings::GetLogLevelName,
|
|
|
|
Settings::DEFAULT_LOG_LEVEL);
|
|
|
|
SettingWidgetBinder::BindWidgetToStringSetting(m_host_interface, m_ui.logFilter, "Logging", "LogFilter");
|
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.logToConsole, "Logging", "LogToConsole");
|
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.logToDebug, "Logging", "LogToDebug");
|
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.logToWindow, "Logging", "LogToWindow");
|
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.logToFile, "Logging", "LogToFile");
|
2020-06-14 21:43:16 +00:00
|
|
|
|
2020-08-18 14:01:57 +00:00
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.showDebugMenu, "Main", "ShowDebugMenu");
|
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);
|
2020-08-18 14:01:57 +00:00
|
|
|
connect(m_ui.showDebugMenu, &QCheckBox::toggled, m_host_interface->getMainWindow(),
|
|
|
|
&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);
|
|
|
|
|
|
|
|
addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("PGXP Vertex Cache"), "GPU", "PGXPVertexCache",
|
|
|
|
false);
|
2020-10-04 13:49:04 +00:00
|
|
|
addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("PGXP CPU Mode"), "GPU", "PGXPCPU", false);
|
2020-10-09 14:07:07 +00:00
|
|
|
addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("PGXP Preserve Projection Precision"), "GPU",
|
|
|
|
"PGXPPreserveProjFP", false);
|
2020-09-06 10:49:13 +00:00
|
|
|
|
|
|
|
addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Enable Recompiler Memory Exceptions"), "CPU",
|
|
|
|
"RecompilerMemoryExceptions", false);
|
2020-10-18 04:43:55 +00:00
|
|
|
addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Enable Recompiler Fast Memory Access"), "CPU",
|
|
|
|
"Fastmem", true);
|
2020-09-06 10:49:13 +00:00
|
|
|
addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Enable Recompiler ICache"), "CPU",
|
|
|
|
"RecompilerICache", false);
|
|
|
|
|
|
|
|
addIntRangeTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("DMA Max Slice Ticks"), "Hacks",
|
|
|
|
"DMAMaxSliceTicks", 100, 10000, Settings::DEFAULT_DMA_MAX_SLICE_TICKS);
|
|
|
|
addIntRangeTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("DMA Halt Ticks"), "Hacks", "DMAHaltTicks", 100,
|
|
|
|
10000, Settings::DEFAULT_DMA_HALT_TICKS);
|
|
|
|
addIntRangeTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("GPU FIFO Size"), "Hacks", "GPUFIFOSize", 16, 4096,
|
|
|
|
Settings::DEFAULT_GPU_FIFO_SIZE);
|
|
|
|
addIntRangeTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("GPU Max Run-Ahead"), "Hacks", "GPUMaxRunAhead", 0,
|
|
|
|
1000, Settings::DEFAULT_GPU_MAX_RUN_AHEAD);
|
|
|
|
addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Use Debug Host GPU Device"), "GPU",
|
|
|
|
"UseDebugDevice", false);
|
2020-11-03 05:58:40 +00:00
|
|
|
addIntRangeTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Display FPS Limit"), "Display", "MaxFPS", 0, 1000,
|
|
|
|
0);
|
2020-11-03 11:21:11 +00:00
|
|
|
addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Increase Timer Resolution"), "Main",
|
|
|
|
"IncreaseTimerResolution", true);
|
2020-04-30 14:59:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
AdvancedSettingsWidget::~AdvancedSettingsWidget() = default;
|
2020-06-14 21:43:16 +00:00
|
|
|
|
|
|
|
void AdvancedSettingsWidget::onResetToDefaultClicked()
|
|
|
|
{
|
2020-09-06 10:49:13 +00:00
|
|
|
setBooleanTweakOption(m_ui.tweakOptionTable, 0, false);
|
|
|
|
setBooleanTweakOption(m_ui.tweakOptionTable, 1, false);
|
|
|
|
setBooleanTweakOption(m_ui.tweakOptionTable, 2, false);
|
|
|
|
setBooleanTweakOption(m_ui.tweakOptionTable, 3, false);
|
2020-10-18 04:43:55 +00:00
|
|
|
setBooleanTweakOption(m_ui.tweakOptionTable, 4, true);
|
|
|
|
setBooleanTweakOption(m_ui.tweakOptionTable, 5, false);
|
|
|
|
setIntRangeTweakOption(m_ui.tweakOptionTable, 6, static_cast<int>(Settings::DEFAULT_DMA_MAX_SLICE_TICKS));
|
|
|
|
setIntRangeTweakOption(m_ui.tweakOptionTable, 7, static_cast<int>(Settings::DEFAULT_DMA_HALT_TICKS));
|
|
|
|
setIntRangeTweakOption(m_ui.tweakOptionTable, 8, static_cast<int>(Settings::DEFAULT_GPU_FIFO_SIZE));
|
|
|
|
setIntRangeTweakOption(m_ui.tweakOptionTable, 9, static_cast<int>(Settings::DEFAULT_GPU_MAX_RUN_AHEAD));
|
|
|
|
setBooleanTweakOption(m_ui.tweakOptionTable, 10, false);
|
2020-11-03 05:58:40 +00:00
|
|
|
setIntRangeTweakOption(m_ui.tweakOptionTable, 11, 0);
|
2020-11-03 11:21:11 +00:00
|
|
|
setBooleanTweakOption(m_ui.tweakOptionTable, 12, true);
|
2020-06-14 21:43:16 +00:00
|
|
|
}
|