diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt
index 39efa962b..5f175b989 100644
--- a/src/yuzu/CMakeLists.txt
+++ b/src/yuzu/CMakeLists.txt
@@ -33,6 +33,9 @@ add_executable(yuzu
configuration/configure_cpu.cpp
configuration/configure_cpu.h
configuration/configure_cpu.ui
+ configuration/configure_cpu_debug.cpp
+ configuration/configure_cpu_debug.h
+ configuration/configure_cpu_debug.ui
configuration/configure_debug.cpp
configuration/configure_debug.h
configuration/configure_debug.ui
diff --git a/src/yuzu/configuration/configure.ui b/src/yuzu/configuration/configure.ui
index a23fd9435..5f5d8e571 100644
--- a/src/yuzu/configuration/configure.ui
+++ b/src/yuzu/configuration/configure.ui
@@ -83,6 +83,11 @@
CPU
+
+
+ Debug
+
+
Graphics
@@ -169,6 +174,12 @@
configuration/configure_cpu.h
1
+
+ ConfigureCpuDebug
+ QWidget
+ configuration/configure_cpu_debug.h
+ 1
+
ConfigureGraphics
QWidget
diff --git a/src/yuzu/configuration/configure_cpu.cpp b/src/yuzu/configuration/configure_cpu.cpp
index 4fc392a7e..7493e5ffb 100644
--- a/src/yuzu/configuration/configure_cpu.cpp
+++ b/src/yuzu/configuration/configure_cpu.cpp
@@ -3,6 +3,7 @@
// Refer to the license.txt file included.
#include
+#include
#include "common/common_types.h"
#include "common/logging/log.h"
@@ -16,8 +17,8 @@ ConfigureCpu::ConfigureCpu(QWidget* parent) : QWidget(parent), ui(new Ui::Config
SetConfiguration();
- connect(ui->accuracy, qOverload(&QComboBox::currentIndexChanged), this,
- &ConfigureCpu::UpdateGroups);
+ connect(ui->accuracy, qOverload(&QComboBox::activated), this,
+ &ConfigureCpu::AccuracyUpdated);
}
ConfigureCpu::~ConfigureCpu() = default;
@@ -27,50 +28,24 @@ void ConfigureCpu::SetConfiguration() {
ui->accuracy->setEnabled(runtime_lock);
ui->accuracy->setCurrentIndex(static_cast(Settings::values.cpu_accuracy));
- UpdateGroups(static_cast(Settings::values.cpu_accuracy));
-
- ui->cpuopt_page_tables->setEnabled(runtime_lock);
- ui->cpuopt_page_tables->setChecked(Settings::values.cpuopt_page_tables);
- ui->cpuopt_block_linking->setEnabled(runtime_lock);
- ui->cpuopt_block_linking->setChecked(Settings::values.cpuopt_block_linking);
- ui->cpuopt_return_stack_buffer->setEnabled(runtime_lock);
- ui->cpuopt_return_stack_buffer->setChecked(Settings::values.cpuopt_return_stack_buffer);
- ui->cpuopt_fast_dispatcher->setEnabled(runtime_lock);
- ui->cpuopt_fast_dispatcher->setChecked(Settings::values.cpuopt_fast_dispatcher);
- ui->cpuopt_context_elimination->setEnabled(runtime_lock);
- ui->cpuopt_context_elimination->setChecked(Settings::values.cpuopt_context_elimination);
- ui->cpuopt_const_prop->setEnabled(runtime_lock);
- ui->cpuopt_const_prop->setChecked(Settings::values.cpuopt_const_prop);
- ui->cpuopt_misc_ir->setEnabled(runtime_lock);
- ui->cpuopt_misc_ir->setChecked(Settings::values.cpuopt_misc_ir);
- ui->cpuopt_reduce_misalign_checks->setEnabled(runtime_lock);
- ui->cpuopt_reduce_misalign_checks->setChecked(Settings::values.cpuopt_reduce_misalign_checks);
}
-void ConfigureCpu::UpdateGroups(int index) {
- switch (index) {
- case 0:
- default:
- ui->group_safe->setVisible(false);
- break;
- case 1:
- ui->group_safe->setVisible(true);
- break;
+void ConfigureCpu::AccuracyUpdated(int index) {
+ if (static_cast(index) == Settings::CPUAccuracy::DebugMode) {
+ const auto result = QMessageBox::warning(this, tr("Setting CPU to Debug Mode"),
+ tr("CPU Debug Mode is only intended for developer "
+ "use. Are you sure you want to enable this?"),
+ QMessageBox::Yes | QMessageBox::No);
+ if (result == QMessageBox::No) {
+ ui->accuracy->setCurrentIndex(static_cast(Settings::CPUAccuracy::Accurate));
+ return;
+ }
}
}
void ConfigureCpu::ApplyConfiguration() {
Settings::values.cpu_accuracy =
static_cast(ui->accuracy->currentIndex());
-
- Settings::values.cpuopt_page_tables = ui->cpuopt_page_tables->isChecked();
- Settings::values.cpuopt_block_linking = ui->cpuopt_block_linking->isChecked();
- Settings::values.cpuopt_return_stack_buffer = ui->cpuopt_return_stack_buffer->isChecked();
- Settings::values.cpuopt_fast_dispatcher = ui->cpuopt_fast_dispatcher->isChecked();
- Settings::values.cpuopt_context_elimination = ui->cpuopt_context_elimination->isChecked();
- Settings::values.cpuopt_const_prop = ui->cpuopt_const_prop->isChecked();
- Settings::values.cpuopt_misc_ir = ui->cpuopt_misc_ir->isChecked();
- Settings::values.cpuopt_reduce_misalign_checks = ui->cpuopt_reduce_misalign_checks->isChecked();
}
void ConfigureCpu::changeEvent(QEvent* event) {
diff --git a/src/yuzu/configuration/configure_cpu.h b/src/yuzu/configuration/configure_cpu.h
index cf55980b0..e4741d3a4 100644
--- a/src/yuzu/configuration/configure_cpu.h
+++ b/src/yuzu/configuration/configure_cpu.h
@@ -25,7 +25,7 @@ private:
void changeEvent(QEvent* event) override;
void RetranslateUI();
- void UpdateGroups(int index);
+ void AccuracyUpdated(int index);
void SetConfiguration();
diff --git a/src/yuzu/configuration/configure_cpu.ui b/src/yuzu/configuration/configure_cpu.ui
index 308e70356..bf6ea79bb 100644
--- a/src/yuzu/configuration/configure_cpu.ui
+++ b/src/yuzu/configuration/configure_cpu.ui
@@ -40,7 +40,7 @@
-
- Debugging Mode (Debugging ONLY)
+ Enable Debug Mode
@@ -62,128 +62,6 @@
- -
-
-
-
-
-
- Safe CPU Optimizations
-
-
-
-
-
-
- 1
-
-
- Keep all of these enabled. For debugging only.
-
-
-
- -
-
-
- Enable inline page tables
-
-
-
- <div style="white-space: nowrap">This optimization speeds up memory accesses by the guest program.</div>
- <div style="white-space: nowrap">Enabling it inlines accesses to PageTable::pointers into emitted code.</div>
- <div style="white-space: nowrap">Disabling this forces all memory accesses to go through the Memory::Read/Memory::Write functions.</div>
-
-
-
-
- -
-
-
- Enable block linking
-
-
-
- <div>This optimization avoids dispatcher lookups by allowing emitted basic blocks to jump directly to other basic blocks if the destination PC is static.</div>
-
-
-
-
- -
-
-
- Enable return stack buffer
-
-
-
- <div>This optimization avoids dispatcher lookups by keeping track potential return addresses of BL instructions. This approximates what happens with a return stack buffer on a real CPU.</div>
-
-
-
-
- -
-
-
- Enable fast dispatcher
-
-
-
- <div>Enable a two-tiered dispatch system. A faster dispatcher written in assembly has a small MRU cache of jump destinations is used first. If that fails, dispatch falls back to the slower C++ dispatcher.</div>
-
-
-
-
- -
-
-
- Enable context elimination
-
-
-
- <div>Enables an IR optimization that reduces unnecessary accesses to the CPU context structure.</div>
-
-
-
-
- -
-
-
- Enable constant propagation
-
-
-
- <div>Enables IR optimizations that involve constant propagation.</div>
-
-
-
-
- -
-
-
- Enable miscellaneous optimizations
-
-
-
- <div>Enables miscellaneous IR optimizations.</div>
-
-
-
-
- -
-
-
- Enable misalignment check reduction
-
-
-
- <div style="white-space: nowrap">When enabled, a misalignment is only triggered when an access crosses a page boundary.</div>
- <div style="white-space: nowrap">When disabled, a misalignment is triggered on all misaligned accesses.</div>
-
-
-
-
-
-
-
-
-
-
diff --git a/src/yuzu/configuration/configure_cpu_debug.cpp b/src/yuzu/configuration/configure_cpu_debug.cpp
new file mode 100644
index 000000000..3385b2cf6
--- /dev/null
+++ b/src/yuzu/configuration/configure_cpu_debug.cpp
@@ -0,0 +1,65 @@
+// Copyright 2020 yuzu Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#include
+
+#include "common/common_types.h"
+#include "common/logging/log.h"
+#include "core/core.h"
+#include "core/settings.h"
+#include "ui_configure_cpu_debug.h"
+#include "yuzu/configuration/configure_cpu_debug.h"
+
+ConfigureCpuDebug::ConfigureCpuDebug(QWidget* parent)
+ : QWidget(parent), ui(new Ui::ConfigureCpuDebug) {
+ ui->setupUi(this);
+
+ SetConfiguration();
+}
+
+ConfigureCpuDebug::~ConfigureCpuDebug() = default;
+
+void ConfigureCpuDebug::SetConfiguration() {
+ const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn();
+
+ ui->cpuopt_page_tables->setEnabled(runtime_lock);
+ ui->cpuopt_page_tables->setChecked(Settings::values.cpuopt_page_tables);
+ ui->cpuopt_block_linking->setEnabled(runtime_lock);
+ ui->cpuopt_block_linking->setChecked(Settings::values.cpuopt_block_linking);
+ ui->cpuopt_return_stack_buffer->setEnabled(runtime_lock);
+ ui->cpuopt_return_stack_buffer->setChecked(Settings::values.cpuopt_return_stack_buffer);
+ ui->cpuopt_fast_dispatcher->setEnabled(runtime_lock);
+ ui->cpuopt_fast_dispatcher->setChecked(Settings::values.cpuopt_fast_dispatcher);
+ ui->cpuopt_context_elimination->setEnabled(runtime_lock);
+ ui->cpuopt_context_elimination->setChecked(Settings::values.cpuopt_context_elimination);
+ ui->cpuopt_const_prop->setEnabled(runtime_lock);
+ ui->cpuopt_const_prop->setChecked(Settings::values.cpuopt_const_prop);
+ ui->cpuopt_misc_ir->setEnabled(runtime_lock);
+ ui->cpuopt_misc_ir->setChecked(Settings::values.cpuopt_misc_ir);
+ ui->cpuopt_reduce_misalign_checks->setEnabled(runtime_lock);
+ ui->cpuopt_reduce_misalign_checks->setChecked(Settings::values.cpuopt_reduce_misalign_checks);
+}
+
+void ConfigureCpuDebug::ApplyConfiguration() {
+ Settings::values.cpuopt_page_tables = ui->cpuopt_page_tables->isChecked();
+ Settings::values.cpuopt_block_linking = ui->cpuopt_block_linking->isChecked();
+ Settings::values.cpuopt_return_stack_buffer = ui->cpuopt_return_stack_buffer->isChecked();
+ Settings::values.cpuopt_fast_dispatcher = ui->cpuopt_fast_dispatcher->isChecked();
+ Settings::values.cpuopt_context_elimination = ui->cpuopt_context_elimination->isChecked();
+ Settings::values.cpuopt_const_prop = ui->cpuopt_const_prop->isChecked();
+ Settings::values.cpuopt_misc_ir = ui->cpuopt_misc_ir->isChecked();
+ Settings::values.cpuopt_reduce_misalign_checks = ui->cpuopt_reduce_misalign_checks->isChecked();
+}
+
+void ConfigureCpuDebug::changeEvent(QEvent* event) {
+ if (event->type() == QEvent::LanguageChange) {
+ RetranslateUI();
+ }
+
+ QWidget::changeEvent(event);
+}
+
+void ConfigureCpuDebug::RetranslateUI() {
+ ui->retranslateUi(this);
+}
diff --git a/src/yuzu/configuration/configure_cpu_debug.h b/src/yuzu/configuration/configure_cpu_debug.h
new file mode 100644
index 000000000..c9941ef3b
--- /dev/null
+++ b/src/yuzu/configuration/configure_cpu_debug.h
@@ -0,0 +1,31 @@
+// Copyright 2020 yuzu Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include
+#include
+#include "core/settings.h"
+
+namespace Ui {
+class ConfigureCpuDebug;
+}
+
+class ConfigureCpuDebug : public QWidget {
+ Q_OBJECT
+
+public:
+ explicit ConfigureCpuDebug(QWidget* parent = nullptr);
+ ~ConfigureCpuDebug() override;
+
+ void ApplyConfiguration();
+
+private:
+ void changeEvent(QEvent* event) override;
+ void RetranslateUI();
+
+ void SetConfiguration();
+
+ std::unique_ptr ui;
+};
diff --git a/src/yuzu/configuration/configure_cpu_debug.ui b/src/yuzu/configuration/configure_cpu_debug.ui
new file mode 100644
index 000000000..a90dc64fe
--- /dev/null
+++ b/src/yuzu/configuration/configure_cpu_debug.ui
@@ -0,0 +1,174 @@
+
+
+ ConfigureCpuDebug
+
+
+
+ 0
+ 0
+ 400
+ 321
+
+
+
+ Form
+
+
+
-
+
+
-
+
+
+ Toggle CPU Optimizations
+
+
+
-
+
+
+ 1
+
+
+
+ <div>
+ <b>For debugging only.</b>
+ <br>
+ If you're not sure what these do, keep all of these enabled.
+ <br>
+ These settings only take effect when CPU Accuracy is "Debug Mode".
+ </div>
+
+
+
+
+ -
+
+
+ Enable inline page tables
+
+
+
+ <div style="white-space: nowrap">This optimization speeds up memory accesses by the guest program.</div>
+ <div style="white-space: nowrap">Enabling it inlines accesses to PageTable::pointers into emitted code.</div>
+ <div style="white-space: nowrap">Disabling this forces all memory accesses to go through the Memory::Read/Memory::Write functions.</div>
+
+
+
+
+ -
+
+
+ Enable block linking
+
+
+
+ <div>This optimization avoids dispatcher lookups by allowing emitted basic blocks to jump directly to other basic blocks if the destination PC is static.</div>
+
+
+
+
+ -
+
+
+ Enable return stack buffer
+
+
+
+ <div>This optimization avoids dispatcher lookups by keeping track potential return addresses of BL instructions. This approximates what happens with a return stack buffer on a real CPU.</div>
+
+
+
+
+ -
+
+
+ Enable fast dispatcher
+
+
+
+ <div>Enable a two-tiered dispatch system. A faster dispatcher written in assembly has a small MRU cache of jump destinations is used first. If that fails, dispatch falls back to the slower C++ dispatcher.</div>
+
+
+
+
+ -
+
+
+ Enable context elimination
+
+
+
+ <div>Enables an IR optimization that reduces unnecessary accesses to the CPU context structure.</div>
+
+
+
+
+ -
+
+
+ Enable constant propagation
+
+
+
+ <div>Enables IR optimizations that involve constant propagation.</div>
+
+
+
+
+ -
+
+
+ Enable miscellaneous optimizations
+
+
+
+ <div>Enables miscellaneous IR optimizations.</div>
+
+
+
+
+ -
+
+
+ Enable misalignment check reduction
+
+
+
+ <div style="white-space: nowrap">When enabled, a misalignment is only triggered when an access crosses a page boundary.</div>
+ <div style="white-space: nowrap">When disabled, a misalignment is triggered on all misaligned accesses.</div>
+
+
+
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
+ CPU settings are available only when game is not running.
+
+
+ true
+
+
+
+
+
+
+
+
diff --git a/src/yuzu/configuration/configure_dialog.cpp b/src/yuzu/configuration/configure_dialog.cpp
index a0f49c282..a5afb354f 100644
--- a/src/yuzu/configuration/configure_dialog.cpp
+++ b/src/yuzu/configuration/configure_dialog.cpp
@@ -43,6 +43,7 @@ void ConfigureDialog::ApplyConfiguration() {
ui->inputTab->ApplyConfiguration();
ui->hotkeysTab->ApplyConfiguration(registry);
ui->cpuTab->ApplyConfiguration();
+ ui->cpuDebugTab->ApplyConfiguration();
ui->graphicsTab->ApplyConfiguration();
ui->graphicsAdvancedTab->ApplyConfiguration();
ui->audioTab->ApplyConfiguration();
@@ -80,7 +81,7 @@ void ConfigureDialog::PopulateSelectionList() {
const std::array>, 6> items{
{{tr("General"), {ui->generalTab, ui->webTab, ui->debugTab, ui->uiTab}},
{tr("System"), {ui->systemTab, ui->profileManagerTab, ui->serviceTab, ui->filesystemTab}},
- {tr("CPU"), {ui->cpuTab}},
+ {tr("CPU"), {ui->cpuTab, ui->cpuDebugTab}},
{tr("Graphics"), {ui->graphicsTab, ui->graphicsAdvancedTab}},
{tr("Audio"), {ui->audioTab}},
{tr("Controls"), {ui->inputTab, ui->hotkeysTab}}},
@@ -110,6 +111,7 @@ void ConfigureDialog::UpdateVisibleTabs() {
{ui->inputTab, tr("Input")},
{ui->hotkeysTab, tr("Hotkeys")},
{ui->cpuTab, tr("CPU")},
+ {ui->cpuDebugTab, tr("Debug")},
{ui->graphicsTab, tr("Graphics")},
{ui->graphicsAdvancedTab, tr("Advanced")},
{ui->audioTab, tr("Audio")},