From 4197f59f926fafd631f4cb97fa20549840ebfb08 Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Fri, 9 Jul 2021 03:27:40 +0200 Subject: [PATCH] early-access version 1864 --- README.md | 2 +- dist/qt_themes/default/style.qss | 20 ++++ dist/qt_themes/qdarkstyle/style.qss | 21 +++++ .../qdarkstyle_midnight_blue/style.qss | 21 +++++ src/common/settings.cpp | 2 +- src/common/settings.h | 11 ++- src/core/arm/dynarmic/arm_dynarmic_32.cpp | 18 +++- src/core/arm/dynarmic/arm_dynarmic_64.cpp | 18 +++- src/yuzu/CMakeLists.txt | 3 + src/yuzu/configuration/config.cpp | 11 ++- src/yuzu/configuration/configure.ui | 50 +++++----- src/yuzu/configuration/configure_cpu.cpp | 18 ---- src/yuzu/configuration/configure_cpu.h | 1 - src/yuzu/configuration/configure_cpu.ui | 18 ++-- src/yuzu/configuration/configure_cpu_debug.h | 1 - src/yuzu/configuration/configure_cpu_debug.ui | 94 +++++++++---------- src/yuzu/configuration/configure_debug.cpp | 3 + src/yuzu/configuration/configure_debug.ui | 63 +++++++------ .../configuration/configure_debug_tab.cpp | 38 ++++++++ src/yuzu/configuration/configure_debug_tab.h | 32 +++++++ src/yuzu/configuration/configure_debug_tab.ui | 52 ++++++++++ src/yuzu/configuration/configure_dialog.cpp | 6 +- src/yuzu/main.cpp | 82 ++++++++-------- src/yuzu/main.h | 4 +- 24 files changed, 400 insertions(+), 189 deletions(-) create mode 100755 src/yuzu/configuration/configure_debug_tab.cpp create mode 100755 src/yuzu/configuration/configure_debug_tab.h create mode 100755 src/yuzu/configuration/configure_debug_tab.ui diff --git a/README.md b/README.md index d080218f1..ba8d2bd97 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 1863. +This is the source code for early-access 1864. ## Legal Notice diff --git a/dist/qt_themes/default/style.qss b/dist/qt_themes/default/style.qss index cee219374..9915a40ba 100755 --- a/dist/qt_themes/default/style.qss +++ b/dist/qt_themes/default/style.qss @@ -38,6 +38,26 @@ QPushButton#RendererStatusBarButton:!checked { color: #0066ff; } +QPushButton#GPUStatusBarButton { + color: #656565; + border: 1px solid transparent; + background-color: transparent; + padding: 0px 3px 0px 3px; + text-align: center; +} + +QPushButton#GPUStatusBarButton:hover { + border: 1px solid #76797C; +} + +QPushButton#GPUStatusBarButton:checked { + color: #ff8040; +} + +QPushButton#GPUStatusBarButton:!checked { + color: #40dd40; +} + QPushButton#buttonRefreshDevices { min-width: 21px; min-height: 21px; diff --git a/dist/qt_themes/qdarkstyle/style.qss b/dist/qt_themes/qdarkstyle/style.qss index 3d0ccbb9e..dac2dba86 100755 --- a/dist/qt_themes/qdarkstyle/style.qss +++ b/dist/qt_themes/qdarkstyle/style.qss @@ -1283,6 +1283,27 @@ QPushButton#RendererStatusBarButton:!checked { color: #00ccdd; } +QPushButton#GPUStatusBarButton { + min-width: 0px; + color: #656565; + border: 1px solid transparent; + background-color: transparent; + padding: 0px 3px 0px 3px; + text-align: center; +} + +QPushButton#GPUStatusBarButton:hover { + border: 1px solid #76797C; +} + +QPushButton#GPUStatusBarButton:checked { + color: #ff8040; +} + +QPushButton#GPUStatusBarButton:!checked { + color: #40dd40; +} + QPushButton#buttonRefreshDevices { min-width: 23px; min-height: 23px; diff --git a/dist/qt_themes/qdarkstyle_midnight_blue/style.qss b/dist/qt_themes/qdarkstyle_midnight_blue/style.qss index 51bec2fd7..032d05ec6 100755 --- a/dist/qt_themes/qdarkstyle_midnight_blue/style.qss +++ b/dist/qt_themes/qdarkstyle_midnight_blue/style.qss @@ -2186,6 +2186,27 @@ QPushButton#RendererStatusBarButton:!checked { color: #00ccdd; } +QPushButton#GPUStatusBarButton { + min-width: 0px; + color: #656565; + border: 1px solid transparent; + background-color: transparent; + padding: 0px 3px 0px 3px; + text-align: center; +} + +QPushButton#GPUStatusBarButton:hover { + border: 1px solid #76797C; +} + +QPushButton#GPUStatusBarButton:checked { + color: #ff8040; +} + +QPushButton#GPUStatusBarButton:!checked { + color: #40dd40; +} + QPushButton#buttonRefreshDevices { min-width: 19px; min-height: 19px; diff --git a/src/common/settings.cpp b/src/common/settings.cpp index 0061e29cc..e1973af85 100755 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp @@ -93,7 +93,7 @@ bool IsGPULevelHigh() { } bool IsFastmemEnabled() { - if (values.cpu_accuracy.GetValue() == CPUAccuracy::DebugMode) { + if (values.cpu_debug_mode) { return static_cast(values.cpuopt_fastmem); } return true; diff --git a/src/common/settings.h b/src/common/settings.h index bf83186f5..d2e91a2c9 100755 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -31,9 +31,9 @@ enum class GPUAccuracy : u32 { }; enum class CPUAccuracy : u32 { - Accurate = 0, - Unsafe = 1, - DebugMode = 2, + Auto = 0, + Accurate = 1, + Unsafe = 2, }; /** The BasicSetting class is a simple resource manager. It defines a label and default value @@ -284,7 +284,10 @@ struct Values { Setting use_multi_core{true, "use_multi_core"}; // Cpu - Setting cpu_accuracy{CPUAccuracy::Accurate, "cpu_accuracy"}; + Setting cpu_accuracy{CPUAccuracy::Auto, "cpu_accuracy"}; + // TODO: remove cpu_accuracy_first_time, migration setting added 8 July 2021 + BasicSetting cpu_accuracy_first_time{true, "cpu_accuracy_first_time"}; + BasicSetting cpu_debug_mode{false, "cpu_debug_mode"}; BasicSetting cpuopt_page_tables{true, "cpuopt_page_tables"}; BasicSetting cpuopt_block_linking{true, "cpuopt_block_linking"}; diff --git a/src/core/arm/dynarmic/arm_dynarmic_32.cpp b/src/core/arm/dynarmic/arm_dynarmic_32.cpp index 77a44f862..b0d89c539 100755 --- a/src/core/arm/dynarmic/arm_dynarmic_32.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic_32.cpp @@ -150,7 +150,7 @@ std::shared_ptr ARM_Dynarmic_32::MakeJit(Common::PageTable* config.far_code_offset = 400_MiB; // Safe optimizations - if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::DebugMode) { + if (Settings::values.cpu_debug_mode) { if (!Settings::values.cpuopt_page_tables) { config.page_table = nullptr; } @@ -183,20 +183,28 @@ std::shared_ptr ARM_Dynarmic_32::MakeJit(Common::PageTable* // Unsafe optimizations if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::Unsafe) { config.unsafe_optimizations = true; - if (Settings::values.cpuopt_unsafe_unfuse_fma.GetValue()) { + if (Settings::values.cpuopt_unsafe_unfuse_fma) { config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_UnfuseFMA; } - if (Settings::values.cpuopt_unsafe_reduce_fp_error.GetValue()) { + if (Settings::values.cpuopt_unsafe_reduce_fp_error) { config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_ReducedErrorFP; } - if (Settings::values.cpuopt_unsafe_ignore_standard_fpcr.GetValue()) { + if (Settings::values.cpuopt_unsafe_ignore_standard_fpcr) { config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_IgnoreStandardFPCRValue; } - if (Settings::values.cpuopt_unsafe_inaccurate_nan.GetValue()) { + if (Settings::values.cpuopt_unsafe_inaccurate_nan) { config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_InaccurateNaN; } } + // Curated optimizations + if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::Auto) { + config.unsafe_optimizations = true; + config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_UnfuseFMA; + config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_IgnoreStandardFPCRValue; + config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_InaccurateNaN; + } + return std::make_unique(config); } diff --git a/src/core/arm/dynarmic/arm_dynarmic_64.cpp b/src/core/arm/dynarmic/arm_dynarmic_64.cpp index 75332e348..bf27ffe71 100755 --- a/src/core/arm/dynarmic/arm_dynarmic_64.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic_64.cpp @@ -190,7 +190,7 @@ std::shared_ptr ARM_Dynarmic_64::MakeJit(Common::PageTable* config.far_code_offset = 400_MiB; // Safe optimizations - if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::DebugMode) { + if (Settings::values.cpu_debug_mode) { if (!Settings::values.cpuopt_page_tables) { config.page_table = nullptr; } @@ -223,20 +223,28 @@ std::shared_ptr ARM_Dynarmic_64::MakeJit(Common::PageTable* // Unsafe optimizations if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::Unsafe) { config.unsafe_optimizations = true; - if (Settings::values.cpuopt_unsafe_unfuse_fma.GetValue()) { + if (Settings::values.cpuopt_unsafe_unfuse_fma) { config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_UnfuseFMA; } - if (Settings::values.cpuopt_unsafe_reduce_fp_error.GetValue()) { + if (Settings::values.cpuopt_unsafe_reduce_fp_error) { config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_ReducedErrorFP; } - if (Settings::values.cpuopt_unsafe_inaccurate_nan.GetValue()) { + if (Settings::values.cpuopt_unsafe_inaccurate_nan) { config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_InaccurateNaN; } - if (Settings::values.cpuopt_unsafe_fastmem_check.GetValue()) { + if (Settings::values.cpuopt_unsafe_fastmem_check) { config.fastmem_address_space_bits = 64; } } + // Curated optimizations + if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::Auto) { + config.unsafe_optimizations = true; + config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_UnfuseFMA; + config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_InaccurateNaN; + config.fastmem_address_space_bits = 64; + } + return std::make_shared(config); } diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt index 634fe66a5..f870b33b1 100755 --- a/src/yuzu/CMakeLists.txt +++ b/src/yuzu/CMakeLists.txt @@ -52,6 +52,9 @@ add_executable(yuzu configuration/configure_debug_controller.cpp configuration/configure_debug_controller.h configuration/configure_debug_controller.ui + configuration/configure_debug_tab.cpp + configuration/configure_debug_tab.h + configuration/configure_debug_tab.ui configuration/configure_dialog.cpp configuration/configure_dialog.h configuration/configure_filesystem.cpp diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 1a0f75373..e3ed75fe3 100755 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -793,7 +793,13 @@ void Config::ReadPathValues() { void Config::ReadCpuValues() { qt_config->beginGroup(QStringLiteral("Cpu")); - ReadGlobalSetting(Settings::values.cpu_accuracy); + ReadBasicSetting(Settings::values.cpu_accuracy_first_time); + if (Settings::values.cpu_accuracy_first_time) { + Settings::values.cpu_accuracy.SetValue(Settings::values.cpu_accuracy.GetDefault()); + Settings::values.cpu_accuracy_first_time.SetValue(false); + } else { + ReadGlobalSetting(Settings::values.cpu_accuracy); + } ReadGlobalSetting(Settings::values.cpuopt_unsafe_unfuse_fma); ReadGlobalSetting(Settings::values.cpuopt_unsafe_reduce_fp_error); @@ -802,6 +808,7 @@ void Config::ReadCpuValues() { ReadGlobalSetting(Settings::values.cpuopt_unsafe_fastmem_check); if (global) { + ReadBasicSetting(Settings::values.cpu_debug_mode); ReadBasicSetting(Settings::values.cpuopt_page_tables); ReadBasicSetting(Settings::values.cpuopt_block_linking); ReadBasicSetting(Settings::values.cpuopt_return_stack_buffer); @@ -1309,6 +1316,7 @@ void Config::SavePathValues() { void Config::SaveCpuValues() { qt_config->beginGroup(QStringLiteral("Cpu")); + WriteBasicSetting(Settings::values.cpu_accuracy_first_time); WriteSetting(QStringLiteral("cpu_accuracy"), static_cast(Settings::values.cpu_accuracy.GetValue(global)), static_cast(Settings::values.cpu_accuracy.GetDefault()), @@ -1321,6 +1329,7 @@ void Config::SaveCpuValues() { WriteGlobalSetting(Settings::values.cpuopt_unsafe_fastmem_check); if (global) { + WriteBasicSetting(Settings::values.cpu_debug_mode); WriteBasicSetting(Settings::values.cpuopt_page_tables); WriteBasicSetting(Settings::values.cpuopt_block_linking); WriteBasicSetting(Settings::values.cpuopt_return_stack_buffer); diff --git a/src/yuzu/configuration/configure.ui b/src/yuzu/configuration/configure.ui index f92c3aff3..fca9aed5f 100755 --- a/src/yuzu/configuration/configure.ui +++ b/src/yuzu/configuration/configure.ui @@ -41,7 +41,7 @@ - 0 + 11 @@ -107,14 +107,6 @@ CPU - - - Debug - - - Debug - - Graphics @@ -139,7 +131,7 @@ Audio - + Debug @@ -207,24 +199,12 @@
configuration/configure_audio.h
1 - - ConfigureDebug - QWidget -
configuration/configure_debug.h
- 1 -
ConfigureCpu QWidget
configuration/configure_cpu.h
1
- - ConfigureCpuDebug - QWidget -
configuration/configure_cpu_debug.h
- 1 -
ConfigureGraphics QWidget @@ -267,6 +247,12 @@
configuration/configure_service.h
1
+ + ConfigureDebugTab + QWidget +
configuration/configure_debug_tab.h
+ 1 +
@@ -275,12 +261,32 @@ accepted() ConfigureDialog accept() + + + 20 + 20 + + + 20 + 20 + + buttonBox rejected() ConfigureDialog reject() + + + 20 + 20 + + + 20 + 20 + + diff --git a/src/yuzu/configuration/configure_cpu.cpp b/src/yuzu/configuration/configure_cpu.cpp index 13db2ba98..8d7171487 100755 --- a/src/yuzu/configuration/configure_cpu.cpp +++ b/src/yuzu/configuration/configure_cpu.cpp @@ -20,8 +20,6 @@ ConfigureCpu::ConfigureCpu(QWidget* parent) : QWidget(parent), ui(new Ui::Config SetConfiguration(); - connect(ui->accuracy, qOverload(&QComboBox::activated), this, - &ConfigureCpu::AccuracyUpdated); connect(ui->accuracy, qOverload(&QComboBox::currentIndexChanged), this, &ConfigureCpu::UpdateGroup); } @@ -58,20 +56,6 @@ void ConfigureCpu::SetConfiguration() { UpdateGroup(ui->accuracy->currentIndex()); } -void ConfigureCpu::AccuracyUpdated(int index) { - if (Settings::IsConfiguringGlobal() && - 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)); - UpdateGroup(static_cast(Settings::CPUAccuracy::Accurate)); - } - } -} - void ConfigureCpu::UpdateGroup(int index) { if (!Settings::IsConfiguringGlobal()) { index -= ConfigurationShared::USE_GLOBAL_OFFSET; @@ -134,8 +118,6 @@ void ConfigureCpu::SetupPerGameUI() { ConfigurationShared::SetColoredComboBox( ui->accuracy, ui->widget_accuracy, static_cast(Settings::values.cpu_accuracy.GetValue(true))); - ui->accuracy->removeItem(static_cast(Settings::CPUAccuracy::DebugMode) + - ConfigurationShared::USE_GLOBAL_OFFSET); ConfigurationShared::SetColoredTristate(ui->cpuopt_unsafe_unfuse_fma, Settings::values.cpuopt_unsafe_unfuse_fma, diff --git a/src/yuzu/configuration/configure_cpu.h b/src/yuzu/configuration/configure_cpu.h index b2b5f1671..154931482 100755 --- a/src/yuzu/configuration/configure_cpu.h +++ b/src/yuzu/configuration/configure_cpu.h @@ -29,7 +29,6 @@ private: void changeEvent(QEvent* event) override; void RetranslateUI(); - void AccuracyUpdated(int index); void UpdateGroup(int index); void SetConfiguration(); diff --git a/src/yuzu/configuration/configure_cpu.ui b/src/yuzu/configuration/configure_cpu.ui index 0e296d4e5..5b9457faf 100755 --- a/src/yuzu/configuration/configure_cpu.ui +++ b/src/yuzu/configuration/configure_cpu.ui @@ -6,8 +6,8 @@ 0 0 - 400 - 321 + 448 + 433 @@ -17,7 +17,7 @@ - + General @@ -34,6 +34,11 @@ + + + Auto + + Accurate @@ -44,11 +49,6 @@ Unsafe - - - Enable Debug Mode - - @@ -57,7 +57,7 @@ - We recommend setting accuracy to "Accurate". + We recommend setting accuracy to "Auto". false diff --git a/src/yuzu/configuration/configure_cpu_debug.h b/src/yuzu/configuration/configure_cpu_debug.h index 10de55099..1b0d8050c 100755 --- a/src/yuzu/configuration/configure_cpu_debug.h +++ b/src/yuzu/configuration/configure_cpu_debug.h @@ -6,7 +6,6 @@ #include #include -#include "common/settings.h" namespace Ui { class ConfigureCpuDebug; diff --git a/src/yuzu/configuration/configure_cpu_debug.ui b/src/yuzu/configuration/configure_cpu_debug.ui index c43f89a5a..abf469b55 100755 --- a/src/yuzu/configuration/configure_cpu_debug.ui +++ b/src/yuzu/configuration/configure_cpu_debug.ui @@ -6,8 +6,8 @@ 0 0 - 400 - 321 + 592 + 503 @@ -17,140 +17,132 @@ - + 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, when disabled, only take effect when CPU Accuracy is "Debug Mode". - </div> - + <html><head/><body><p><span style=" font-weight:600;">For debugging only.</span><br/>If you're not sure what these do, keep all of these enabled. <br/>These settings, when disabled, only take effect when CPU Debugging is enabled. </p></body></html> + + + false - - 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> + <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 inline page tables + - - 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 block linking + - - 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 return stack buffer + - - 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 fast dispatcher + - - Enable context elimination - <div>Enables an IR optimization that reduces unnecessary accesses to the CPU context structure.</div> + + Enable context elimination + - - Enable constant propagation - <div>Enables IR optimizations that involve constant propagation.</div> + + Enable constant propagation + - - Enable miscellaneous optimizations - <div>Enables miscellaneous IR optimizations.</div> + + Enable miscellaneous optimizations + - - 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> + <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> + + Enable misalignment check reduction + - - Enable Host MMU Emulation - - <div style="white-space: nowrap">This optimization speeds up memory accesses by the guest program.</div> - <div style="white-space: nowrap">Enabling it causes guest memory reads/writes to be done directly into memory and make use of Host's MMU.</div> - <div style="white-space: nowrap">Disabling this forces all memory accesses to use Software MMU Emulation.</div> + <div style="white-space: nowrap">This optimization speeds up memory accesses by the guest program.</div> + <div style="white-space: nowrap">Enabling it causes guest memory reads/writes to be done directly into memory and make use of Host's MMU.</div> + <div style="white-space: nowrap">Disabling this forces all memory accesses to use Software MMU Emulation.</div> + + Enable Host MMU Emulation + diff --git a/src/yuzu/configuration/configure_debug.cpp b/src/yuzu/configuration/configure_debug.cpp index cbe45a305..8fceb3878 100755 --- a/src/yuzu/configuration/configure_debug.cpp +++ b/src/yuzu/configuration/configure_debug.cpp @@ -43,6 +43,8 @@ void ConfigureDebug::SetConfiguration() { ui->use_auto_stub->setChecked(Settings::values.use_auto_stub.GetValue()); ui->enable_graphics_debugging->setEnabled(runtime_lock); ui->enable_graphics_debugging->setChecked(Settings::values.renderer_debug.GetValue()); + ui->enable_cpu_debugging->setEnabled(runtime_lock); + ui->enable_cpu_debugging->setChecked(Settings::values.cpu_debug_mode.GetValue()); ui->disable_macro_jit->setEnabled(runtime_lock); ui->disable_macro_jit->setChecked(Settings::values.disable_macro_jit.GetValue()); ui->extended_logging->setChecked(Settings::values.extended_logging.GetValue()); @@ -58,6 +60,7 @@ void ConfigureDebug::ApplyConfiguration() { Settings::values.use_debug_asserts = ui->use_debug_asserts->isChecked(); Settings::values.use_auto_stub = ui->use_auto_stub->isChecked(); Settings::values.renderer_debug = ui->enable_graphics_debugging->isChecked(); + Settings::values.cpu_debug_mode = ui->enable_cpu_debugging->isChecked(); Settings::values.disable_macro_jit = ui->disable_macro_jit->isChecked(); Settings::values.extended_logging = ui->extended_logging->isChecked(); Debugger::ToggleConsole(); diff --git a/src/yuzu/configuration/configure_debug.ui b/src/yuzu/configuration/configure_debug.ui index c8087542f..1260ad6f0 100755 --- a/src/yuzu/configuration/configure_debug.ui +++ b/src/yuzu/configuration/configure_debug.ui @@ -7,7 +7,7 @@ 0 0 400 - 486 + 777 @@ -192,34 +192,41 @@ - - - - Enable Debug Asserts - - - - - - - Enable Auto-Stub - - - - - - - true - - - - This will be reset automatically when yuzu closes. - - - 20 - - + + + Enable CPU Debugging + + + + + + + Enable Debug Asserts + + + + + + + Enable Auto-Stub + + + + + + + + true + + + + This will be reset automatically when yuzu closes. + + + 20 + +
diff --git a/src/yuzu/configuration/configure_debug_tab.cpp b/src/yuzu/configuration/configure_debug_tab.cpp new file mode 100755 index 000000000..67d369249 --- /dev/null +++ b/src/yuzu/configuration/configure_debug_tab.cpp @@ -0,0 +1,38 @@ +// Copyright 2021 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "ui_configure_debug_tab.h" +#include "yuzu/configuration/configure_debug_tab.h" + +ConfigureDebugTab::ConfigureDebugTab(QWidget* parent) + : QWidget(parent), ui(new Ui::ConfigureDebugTab) { + ui->setupUi(this); + + SetConfiguration(); +} + +ConfigureDebugTab::~ConfigureDebugTab() = default; + +void ConfigureDebugTab::ApplyConfiguration() { + ui->debugTab->ApplyConfiguration(); + ui->cpuDebugTab->ApplyConfiguration(); +} + +void ConfigureDebugTab::SetCurrentIndex(int index) { + ui->tabWidget->setCurrentIndex(index); +} + +void ConfigureDebugTab::changeEvent(QEvent* event) { + if (event->type() == QEvent::LanguageChange) { + RetranslateUI(); + } + + QWidget::changeEvent(event); +} + +void ConfigureDebugTab::RetranslateUI() { + ui->retranslateUi(this); +} + +void ConfigureDebugTab::SetConfiguration() {} diff --git a/src/yuzu/configuration/configure_debug_tab.h b/src/yuzu/configuration/configure_debug_tab.h new file mode 100755 index 000000000..0a96d43d0 --- /dev/null +++ b/src/yuzu/configuration/configure_debug_tab.h @@ -0,0 +1,32 @@ +// Copyright 2021 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include +#include + +namespace Ui { +class ConfigureDebugTab; +} + +class ConfigureDebugTab : public QWidget { + Q_OBJECT + +public: + explicit ConfigureDebugTab(QWidget* parent = nullptr); + ~ConfigureDebugTab() override; + + void ApplyConfiguration(); + + void SetCurrentIndex(int index); + +private: + void changeEvent(QEvent* event) override; + void RetranslateUI(); + + void SetConfiguration(); + + std::unique_ptr ui; +}; diff --git a/src/yuzu/configuration/configure_debug_tab.ui b/src/yuzu/configuration/configure_debug_tab.ui new file mode 100755 index 000000000..7dc6dd704 --- /dev/null +++ b/src/yuzu/configuration/configure_debug_tab.ui @@ -0,0 +1,52 @@ + + + ConfigureDebugTab + + + + 0 + 0 + 320 + 240 + + + + Form + + + + + + 1 + + + + General + + + + + CPU + + + + + + + + + ConfigureDebug + QWidget +
configuration/configure_debug.h
+ 1 +
+ + ConfigureCpuDebug + QWidget +
configuration/configure_cpu_debug.h
+ 1 +
+
+ + +
diff --git a/src/yuzu/configuration/configure_dialog.cpp b/src/yuzu/configuration/configure_dialog.cpp index 371bc01b1..bc009b6b3 100755 --- a/src/yuzu/configuration/configure_dialog.cpp +++ b/src/yuzu/configuration/configure_dialog.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include "common/settings.h" #include "core/core.h" #include "ui_configure.h" @@ -32,6 +33,8 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry, SetConfiguration(); PopulateSelectionList(); + connect(ui->tabWidget, &QTabWidget::currentChanged, this, + [this]() { ui->debugTab->SetCurrentIndex(0); }); connect(ui->uiTab, &ConfigureUi::LanguageChanged, this, &ConfigureDialog::OnLanguageChanged); connect(ui->selectorList, &QListWidget::itemSelectionChanged, this, &ConfigureDialog::UpdateVisibleTabs); @@ -59,7 +62,6 @@ 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(); @@ -102,7 +104,7 @@ void ConfigureDialog::PopulateSelectionList() { const std::array>, 6> items{ {{tr("General"), {ui->generalTab, ui->hotkeysTab, ui->uiTab, ui->webTab, ui->debugTab}}, {tr("System"), {ui->systemTab, ui->profileManagerTab, ui->serviceTab, ui->filesystemTab}}, - {tr("CPU"), {ui->cpuTab, ui->cpuDebugTab}}, + {tr("CPU"), {ui->cpuTab}}, {tr("Graphics"), {ui->graphicsTab, ui->graphicsAdvancedTab}}, {tr("Audio"), {ui->audioTab}}, {tr("Controls"), ui->inputTab->GetSubTabs()}}, diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 5ed3b90b8..1e6f0e4a7 100755 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -789,41 +789,28 @@ void GMainWindow::InitializeWidgets() { dock_status_button->setChecked(Settings::values.use_docked_mode.GetValue()); statusBar()->insertPermanentWidget(0, dock_status_button); - // Setup ASync button - async_status_button = new QPushButton(); - async_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton")); - async_status_button->setFocusPolicy(Qt::NoFocus); - connect(async_status_button, &QPushButton::clicked, [&] { - if (emulation_running) { - return; + gpu_accuracy_button = new QPushButton(); + gpu_accuracy_button->setObjectName(QStringLiteral("GPUStatusBarButton")); + gpu_accuracy_button->setCheckable(true); + gpu_accuracy_button->setFocusPolicy(Qt::NoFocus); + connect(gpu_accuracy_button, &QPushButton::clicked, [this] { + switch (Settings::values.gpu_accuracy.GetValue()) { + case Settings::GPUAccuracy::High: { + Settings::values.gpu_accuracy.SetValue(Settings::GPUAccuracy::Normal); + break; + } + case Settings::GPUAccuracy::Normal: + case Settings::GPUAccuracy::Extreme: + default: { + Settings::values.gpu_accuracy.SetValue(Settings::GPUAccuracy::High); } - Settings::values.use_asynchronous_gpu_emulation.SetValue( - !Settings::values.use_asynchronous_gpu_emulation.GetValue()); - async_status_button->setChecked(Settings::values.use_asynchronous_gpu_emulation.GetValue()); - Core::System::GetInstance().ApplySettings(); - }); - async_status_button->setText(tr("ASYNC")); - async_status_button->setCheckable(true); - async_status_button->setChecked(Settings::values.use_asynchronous_gpu_emulation.GetValue()); - - // Setup Multicore button - multicore_status_button = new QPushButton(); - multicore_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton")); - multicore_status_button->setFocusPolicy(Qt::NoFocus); - connect(multicore_status_button, &QPushButton::clicked, [&] { - if (emulation_running) { - return; } - Settings::values.use_multi_core.SetValue(!Settings::values.use_multi_core.GetValue()); - multicore_status_button->setChecked(Settings::values.use_multi_core.GetValue()); - Core::System::GetInstance().ApplySettings(); - }); - multicore_status_button->setText(tr("MULTICORE")); - multicore_status_button->setCheckable(true); - multicore_status_button->setChecked(Settings::values.use_multi_core.GetValue()); - statusBar()->insertPermanentWidget(0, multicore_status_button); - statusBar()->insertPermanentWidget(0, async_status_button); + Core::System::GetInstance().ApplySettings(); + UpdateGPUAccuracyButton(); + }); + UpdateGPUAccuracyButton(); + statusBar()->insertPermanentWidget(0, gpu_accuracy_button); // Setup Renderer API button renderer_status_button = new QPushButton(); @@ -1397,8 +1384,6 @@ void GMainWindow::BootGame(const QString& filename, std::size_t program_index, S game_list_placeholder->hide(); } status_bar_update_timer.start(500); - async_status_button->setDisabled(true); - multicore_status_button->setDisabled(true); renderer_status_button->setDisabled(true); if (UISettings::values.hide_mouse || Settings::values.mouse_panning) { @@ -1500,8 +1485,6 @@ void GMainWindow::ShutdownGame() { emu_speed_label->setVisible(false); game_fps_label->setVisible(false); emu_frametime_label->setVisible(false); - async_status_button->setEnabled(true); - multicore_status_button->setEnabled(true); renderer_status_button->setEnabled(true); emulation_running = false; @@ -2921,12 +2904,35 @@ void GMainWindow::UpdateStatusBar() { emu_frametime_label->setVisible(true); } +void GMainWindow::UpdateGPUAccuracyButton() { + switch (Settings::values.gpu_accuracy.GetValue()) { + case Settings::GPUAccuracy::Normal: { + gpu_accuracy_button->setText(tr("GPU NORMAL ")); + gpu_accuracy_button->setChecked(false); + break; + } + case Settings::GPUAccuracy::High: { + gpu_accuracy_button->setText(tr("GPU HIGH ")); + gpu_accuracy_button->setChecked(true); + break; + } + case Settings::GPUAccuracy::Extreme: { + gpu_accuracy_button->setText(tr("GPU EXTREME")); + gpu_accuracy_button->setChecked(true); + break; + } + default: { + gpu_accuracy_button->setText(tr("GPU ERROR")); + gpu_accuracy_button->setChecked(true); + } + } +} + void GMainWindow::UpdateStatusButtons() { dock_status_button->setChecked(Settings::values.use_docked_mode.GetValue()); - multicore_status_button->setChecked(Settings::values.use_multi_core.GetValue()); - async_status_button->setChecked(Settings::values.use_asynchronous_gpu_emulation.GetValue()); renderer_status_button->setChecked(Settings::values.renderer_backend.GetValue() == Settings::RendererBackend::Vulkan); + UpdateGPUAccuracyButton(); } void GMainWindow::UpdateUISettings() { diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 45c8310e1..15e4deab9 100755 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h @@ -291,6 +291,7 @@ private: void UpdateWindowTitle(std::string_view title_name = {}, std::string_view title_version = {}, std::string_view gpu_vendor = {}); void UpdateStatusBar(); + void UpdateGPUAccuracyButton(); void UpdateStatusButtons(); void UpdateUISettings(); void HideMouseCursor(); @@ -316,8 +317,7 @@ private: QLabel* emu_speed_label = nullptr; QLabel* game_fps_label = nullptr; QLabel* emu_frametime_label = nullptr; - QPushButton* async_status_button = nullptr; - QPushButton* multicore_status_button = nullptr; + QPushButton* gpu_accuracy_button = nullptr; QPushButton* renderer_status_button = nullptr; QPushButton* dock_status_button = nullptr; QTimer status_bar_update_timer;