mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-26 23:55:40 +00:00
Qt: Turn tweaks/hacks into a table
Also move PGXP CPU mode/vertex cache to advanced options
This commit is contained in:
parent
b61b173ed4
commit
e731c87757
|
@ -1,8 +1,60 @@
|
|||
#include "advancedsettingswidget.h"
|
||||
#include "mainwindow.h"
|
||||
#include "qtutils.h"
|
||||
#include "settingsdialog.h"
|
||||
#include "settingwidgetbinder.h"
|
||||
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
AdvancedSettingsWidget::AdvancedSettingsWidget(QtHostInterface* host_interface, QWidget* parent, SettingsDialog* dialog)
|
||||
: QWidget(parent), m_host_interface(host_interface)
|
||||
{
|
||||
|
@ -20,39 +72,46 @@ AdvancedSettingsWidget::AdvancedSettingsWidget(QtHostInterface* host_interface,
|
|||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.logToWindow, "Logging", "LogToWindow");
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.logToFile, "Logging", "LogToFile");
|
||||
|
||||
// Tweaks/Hacks section
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(m_host_interface, m_ui.dmaMaxSliceTicks, "Hacks", "DMAMaxSliceTicks");
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(m_host_interface, m_ui.dmaHaltTicks, "Hacks", "DMAHaltTicks");
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(m_host_interface, m_ui.gpuFIFOSize, "Hacks", "GPUFIFOSize");
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(m_host_interface, m_ui.gpuMaxRunAhead, "Hacks", "GPUMaxRunAhead");
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.cpuRecompilerMemoryExceptions, "CPU",
|
||||
"RecompilerMemoryExceptions", false);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.cpuRecompilerICache, "CPU", "RecompilerICache",
|
||||
false);
|
||||
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.showDebugMenu, "Main", "ShowDebugMenu");
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.gpuUseDebugDevice, "GPU", "UseDebugDevice");
|
||||
|
||||
connect(m_ui.resetToDefaultButton, &QPushButton::clicked, this, &AdvancedSettingsWidget::onResetToDefaultClicked);
|
||||
connect(m_ui.showDebugMenu, &QCheckBox::toggled, m_host_interface->getMainWindow(),
|
||||
&MainWindow::updateDebugMenuVisibility, Qt::QueuedConnection);
|
||||
|
||||
dialog->registerWidgetHelp(m_ui.gpuUseDebugDevice, tr("Use Debug Host GPU Device"), tr("Unchecked"),
|
||||
tr("Enables the usage of debug devices and shaders for rendering APIs which support them. "
|
||||
"Should only be used when debugging the emulator."));
|
||||
dialog->registerWidgetHelp(
|
||||
m_ui.cpuRecompilerICache, tr("Enable Recompiler ICache"), tr("Unchecked"),
|
||||
tr("Determines whether the CPU's instruction cache is simulated in the recompiler. Improves accuracy at a small "
|
||||
"cost to performance. If games are running too fast, try enabling this option."));
|
||||
m_ui.tweakOptionTable->setColumnWidth(0, 380);
|
||||
|
||||
addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("PGXP Vertex Cache"), "GPU", "PGXPVertexCache",
|
||||
false);
|
||||
addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("PGXP CPU Mode"), "GPU", "PGXPCPUMode", false);
|
||||
|
||||
addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Enable Recompiler Memory Exceptions"), "CPU",
|
||||
"RecompilerMemoryExceptions", false);
|
||||
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);
|
||||
}
|
||||
|
||||
AdvancedSettingsWidget::~AdvancedSettingsWidget() = default;
|
||||
|
||||
void AdvancedSettingsWidget::onResetToDefaultClicked()
|
||||
{
|
||||
m_ui.dmaMaxSliceTicks->setValue(static_cast<int>(Settings::DEFAULT_DMA_MAX_SLICE_TICKS));
|
||||
m_ui.dmaHaltTicks->setValue(static_cast<int>(Settings::DEFAULT_DMA_HALT_TICKS));
|
||||
m_ui.gpuFIFOSize->setValue(static_cast<int>(Settings::DEFAULT_GPU_FIFO_SIZE));
|
||||
m_ui.gpuMaxRunAhead->setValue(static_cast<int>(Settings::DEFAULT_GPU_MAX_RUN_AHEAD));
|
||||
m_ui.cpuRecompilerMemoryExceptions->setChecked(false);
|
||||
setBooleanTweakOption(m_ui.tweakOptionTable, 0, false);
|
||||
setBooleanTweakOption(m_ui.tweakOptionTable, 1, false);
|
||||
setBooleanTweakOption(m_ui.tweakOptionTable, 2, false);
|
||||
setBooleanTweakOption(m_ui.tweakOptionTable, 3, false);
|
||||
setIntRangeTweakOption(m_ui.tweakOptionTable, 4, static_cast<int>(Settings::DEFAULT_DMA_MAX_SLICE_TICKS));
|
||||
setIntRangeTweakOption(m_ui.tweakOptionTable, 5, static_cast<int>(Settings::DEFAULT_DMA_HALT_TICKS));
|
||||
setIntRangeTweakOption(m_ui.tweakOptionTable, 6, static_cast<int>(Settings::DEFAULT_GPU_FIFO_SIZE));
|
||||
setIntRangeTweakOption(m_ui.tweakOptionTable, 7, static_cast<int>(Settings::DEFAULT_GPU_MAX_RUN_AHEAD));
|
||||
setBooleanTweakOption(m_ui.tweakOptionTable, 8, false);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#include <QtCore/QVector>
|
||||
#include <QtWidgets/QWidget>
|
||||
|
||||
#include "ui_advancedsettingswidget.h"
|
||||
|
@ -16,9 +16,40 @@ public:
|
|||
~AdvancedSettingsWidget();
|
||||
|
||||
private:
|
||||
struct TweakOption
|
||||
{
|
||||
enum class Type
|
||||
{
|
||||
Boolean,
|
||||
IntRange
|
||||
};
|
||||
|
||||
Type type;
|
||||
QString description;
|
||||
std::string key;
|
||||
std::string section;
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
bool default_value;
|
||||
} boolean;
|
||||
|
||||
struct
|
||||
{
|
||||
int min_value;
|
||||
int max_value;
|
||||
int default_value;
|
||||
} int_range;
|
||||
};
|
||||
};
|
||||
|
||||
Ui::AdvancedSettingsWidget m_ui;
|
||||
|
||||
void onResetToDefaultClicked();
|
||||
|
||||
QtHostInterface* m_host_interface;
|
||||
|
||||
QVector<TweakOption> m_tweak_options;
|
||||
};
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>502</width>
|
||||
<height>623</height>
|
||||
<width>973</width>
|
||||
<height>507</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -91,129 +91,12 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Tweaks/Hacks</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_6">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>These options are tweakable to improve performance/game compatibility. Use at your own risk, modified values will not be supported.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>DMA Max Slice Ticks:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="dmaMaxSliceTicks">
|
||||
<property name="minimum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>DMA Halt Ticks:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="dmaHaltTicks">
|
||||
<property name="minimum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>100</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QSpinBox" name="gpuFIFOSize">
|
||||
<property name="minimum">
|
||||
<number>16</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>4096</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>16</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>GPU FIFO Size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>GPU Max Run-Ahead:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QSpinBox" name="gpuMaxRunAhead">
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>128</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QCheckBox" name="cpuRecompilerMemoryExceptions">
|
||||
<property name="text">
|
||||
<string>Enable Recompiler Memory Exceptions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QCheckBox" name="cpuRecompilerICache">
|
||||
<property name="text">
|
||||
<string>Enable Recompiler ICache</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="QPushButton" name="resetToDefaultButton">
|
||||
<property name="text">
|
||||
<string>Reset To Default</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>System Settings</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<layout class="QGridLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="showDebugMenu">
|
||||
<property name="text">
|
||||
|
@ -221,10 +104,54 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="gpuUseDebugDevice">
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Tweaks/Hacks</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<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 row="0" column="0">
|
||||
<widget class="QTableWidget" name="tweakOptionTable">
|
||||
<property name="cornerButtonEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Use Debug Host GPU Device</string>
|
||||
<string>Option</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Value</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="resetToDefaultButton">
|
||||
<property name="text">
|
||||
<string>Reset To Default</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -44,8 +44,6 @@ GPUSettingsWidget::GPUSettingsWidget(QtHostInterface* host_interface, QWidget* p
|
|||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.pgxpCulling, "GPU", "PGXPCulling", true);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.pgxpTextureCorrection, "GPU",
|
||||
"PGXPTextureCorrection", true);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.pgxpVertexCache, "GPU", "PGXPVertexCache", false);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.pgxpCPUMode, "GPU", "PGXPCPUMode", false);
|
||||
|
||||
connect(m_ui.resolutionScale, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&GPUSettingsWidget::updateScaledDitheringEnabled);
|
||||
|
@ -144,13 +142,6 @@ GPUSettingsWidget::GPUSettingsWidget(QtHostInterface* host_interface, QWidget* p
|
|||
dialog->registerWidgetHelp(m_ui.pgxpTextureCorrection, tr("Texture Correction"), tr("Checked"),
|
||||
tr("Uses perspective-correct interpolation for texture coordinates and colors, "
|
||||
"straightening out warped textures. Requires geometry correction enabled."));
|
||||
dialog->registerWidgetHelp(m_ui.pgxpVertexCache, tr("Vertex Cache"), tr("Unchecked"),
|
||||
tr("Uses screen coordinates as a fallback when tracking vertices through memory fails. "
|
||||
"May improve PGXP compatibility."));
|
||||
dialog->registerWidgetHelp(
|
||||
m_ui.pgxpCPUMode, tr("CPU Mode"), tr("Unchecked"),
|
||||
tr("Tries to track vertex manipulation through the CPU. Some games require this option for PGXP to be effective. "
|
||||
"Very slow, and incompatible with the recompiler."));
|
||||
}
|
||||
|
||||
GPUSettingsWidget::~GPUSettingsWidget() = default;
|
||||
|
@ -244,6 +235,4 @@ void GPUSettingsWidget::updatePGXPSettingsEnabled()
|
|||
const bool enabled = m_ui.pgxpEnable->isChecked();
|
||||
m_ui.pgxpCulling->setEnabled(enabled);
|
||||
m_ui.pgxpTextureCorrection->setEnabled(enabled);
|
||||
m_ui.pgxpVertexCache->setEnabled(enabled);
|
||||
m_ui.pgxpCPUMode->setEnabled(enabled);
|
||||
}
|
||||
|
|
|
@ -208,20 +208,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="pgxpVertexCache">
|
||||
<property name="text">
|
||||
<string>Vertex Cache</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="pgxpCPUMode">
|
||||
<property name="text">
|
||||
<string>CPU Mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
Loading…
Reference in a new issue