pineapple/src/yuzu/configuration/configure_debug.cpp

108 lines
5.1 KiB
C++
Raw Normal View History

2020-12-28 16:15:37 +01:00
// Copyright 2016 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include <QDesktopServices>
#include <QUrl>
2021-05-08 09:49:31 +02:00
#include "common/fs/path_util.h"
2020-12-28 16:15:37 +01:00
#include "common/logging/backend.h"
#include "common/logging/filter.h"
2021-04-15 04:05:28 +02:00
#include "common/settings.h"
2020-12-28 16:15:37 +01:00
#include "core/core.h"
#include "ui_configure_debug.h"
#include "yuzu/configuration/configure_debug.h"
#include "yuzu/debugger/console.h"
#include "yuzu/uisettings.h"
2021-10-09 02:29:53 +02:00
ConfigureDebug::ConfigureDebug(const Core::System& system_, QWidget* parent)
2021-10-16 02:35:29 +02:00
: QWidget(parent), ui{std::make_unique<Ui::ConfigureDebug>()}, system{system_} {
2020-12-28 16:15:37 +01:00
ui->setupUi(this);
SetConfiguration();
connect(ui->open_log_button, &QPushButton::clicked, []() {
const auto path =
2021-05-08 09:49:31 +02:00
QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::LogDir));
2020-12-28 16:15:37 +01:00
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
});
}
ConfigureDebug::~ConfigureDebug() = default;
void ConfigureDebug::SetConfiguration() {
2021-10-09 02:29:53 +02:00
const bool runtime_lock = !system.IsPoweredOn();
2021-06-13 12:31:34 +02:00
ui->toggle_console->setEnabled(runtime_lock);
2021-07-03 11:00:06 +02:00
ui->toggle_console->setChecked(UISettings::values.show_console.GetValue());
ui->log_filter_edit->setText(QString::fromStdString(Settings::values.log_filter.GetValue()));
ui->homebrew_args_edit->setText(
QString::fromStdString(Settings::values.program_args.GetValue()));
2021-06-13 12:31:34 +02:00
ui->fs_access_log->setEnabled(runtime_lock);
2021-07-03 11:00:06 +02:00
ui->fs_access_log->setChecked(Settings::values.enable_fs_access_log.GetValue());
ui->reporting_services->setChecked(Settings::values.reporting_services.GetValue());
ui->quest_flag->setChecked(Settings::values.quest_flag.GetValue());
ui->use_debug_asserts->setChecked(Settings::values.use_debug_asserts.GetValue());
ui->use_auto_stub->setChecked(Settings::values.use_auto_stub.GetValue());
2021-11-28 11:31:20 +01:00
ui->enable_all_controllers->setChecked(Settings::values.enable_all_controllers.GetValue());
2021-06-13 12:31:34 +02:00
ui->enable_graphics_debugging->setEnabled(runtime_lock);
2021-07-03 11:00:06 +02:00
ui->enable_graphics_debugging->setChecked(Settings::values.renderer_debug.GetValue());
2021-07-30 21:16:07 +02:00
ui->enable_shader_feedback->setEnabled(runtime_lock);
ui->enable_shader_feedback->setChecked(Settings::values.renderer_shader_feedback.GetValue());
2021-07-09 03:27:40 +02:00
ui->enable_cpu_debugging->setEnabled(runtime_lock);
ui->enable_cpu_debugging->setChecked(Settings::values.cpu_debug_mode.GetValue());
2021-07-09 23:54:15 +02:00
ui->enable_nsight_aftermath->setEnabled(runtime_lock);
ui->enable_nsight_aftermath->setChecked(Settings::values.enable_nsight_aftermath.GetValue());
2021-11-17 05:15:54 +01:00
ui->dump_shaders->setEnabled(runtime_lock);
ui->dump_shaders->setChecked(Settings::values.dump_shaders.GetValue());
2021-06-13 12:31:34 +02:00
ui->disable_macro_jit->setEnabled(runtime_lock);
2021-07-03 11:00:06 +02:00
ui->disable_macro_jit->setChecked(Settings::values.disable_macro_jit.GetValue());
2021-07-09 23:54:15 +02:00
ui->disable_loop_safety_checks->setEnabled(runtime_lock);
ui->disable_loop_safety_checks->setChecked(
Settings::values.disable_shader_loop_safety_checks.GetValue());
2021-07-03 11:00:06 +02:00
ui->extended_logging->setChecked(Settings::values.extended_logging.GetValue());
2022-03-24 10:07:14 +01:00
#ifdef YUZU_USE_QT_WEB_ENGINE
ui->disable_web_applet->setChecked(UISettings::values.disable_web_applet.GetValue());
#else
ui->disable_web_applet->setEnabled(false);
ui->disable_web_applet->setText(QString::fromUtf8("Web applet not compiled"));
#endif
2020-12-28 16:15:37 +01:00
}
void ConfigureDebug::ApplyConfiguration() {
UISettings::values.show_console = ui->toggle_console->isChecked();
Settings::values.log_filter = ui->log_filter_edit->text().toStdString();
Settings::values.program_args = ui->homebrew_args_edit->text().toStdString();
2021-06-13 12:31:34 +02:00
Settings::values.enable_fs_access_log = ui->fs_access_log->isChecked();
2020-12-28 16:15:37 +01:00
Settings::values.reporting_services = ui->reporting_services->isChecked();
Settings::values.quest_flag = ui->quest_flag->isChecked();
2021-04-14 05:52:45 +02:00
Settings::values.use_debug_asserts = ui->use_debug_asserts->isChecked();
2021-04-05 01:30:07 +02:00
Settings::values.use_auto_stub = ui->use_auto_stub->isChecked();
2021-11-28 11:31:20 +01:00
Settings::values.enable_all_controllers = ui->enable_all_controllers->isChecked();
2020-12-28 16:15:37 +01:00
Settings::values.renderer_debug = ui->enable_graphics_debugging->isChecked();
2021-07-30 21:16:07 +02:00
Settings::values.renderer_shader_feedback = ui->enable_shader_feedback->isChecked();
2021-07-09 03:27:40 +02:00
Settings::values.cpu_debug_mode = ui->enable_cpu_debugging->isChecked();
2021-07-09 23:54:15 +02:00
Settings::values.enable_nsight_aftermath = ui->enable_nsight_aftermath->isChecked();
2021-11-17 05:15:54 +01:00
Settings::values.dump_shaders = ui->dump_shaders->isChecked();
2021-07-09 23:54:15 +02:00
Settings::values.disable_shader_loop_safety_checks =
ui->disable_loop_safety_checks->isChecked();
2020-12-28 16:15:37 +01:00
Settings::values.disable_macro_jit = ui->disable_macro_jit->isChecked();
Settings::values.extended_logging = ui->extended_logging->isChecked();
2022-03-24 10:07:14 +01:00
UISettings::values.disable_web_applet = ui->disable_web_applet->isChecked();
2020-12-28 16:15:37 +01:00
Debugger::ToggleConsole();
2021-04-15 07:16:22 +02:00
Common::Log::Filter filter;
2021-07-03 11:00:06 +02:00
filter.ParseFilterString(Settings::values.log_filter.GetValue());
2021-04-15 07:16:22 +02:00
Common::Log::SetGlobalFilter(filter);
2020-12-28 16:15:37 +01:00
}
void ConfigureDebug::changeEvent(QEvent* event) {
if (event->type() == QEvent::LanguageChange) {
RetranslateUI();
}
QWidget::changeEvent(event);
}
void ConfigureDebug::RetranslateUI() {
ui->retranslateUi(this);
}