diff options
Diffstat (limited to 'src/yuzu')
21 files changed, 169 insertions, 517 deletions
diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt index ff1c1d985..a3fb91d29 100644 --- a/src/yuzu/CMakeLists.txt +++ b/src/yuzu/CMakeLists.txt @@ -36,9 +36,6 @@ add_executable(yuzu configuration/configure_filesystem.cpp configuration/configure_filesystem.h configuration/configure_filesystem.ui - configuration/configure_gamelist.cpp - configuration/configure_gamelist.h - configuration/configure_gamelist.ui configuration/configure_general.cpp configuration/configure_general.h configuration/configure_general.ui @@ -75,14 +72,12 @@ add_executable(yuzu configuration/configure_touchscreen_advanced.cpp configuration/configure_touchscreen_advanced.h configuration/configure_touchscreen_advanced.ui + configuration/configure_ui.cpp + configuration/configure_ui.h + configuration/configure_ui.ui configuration/configure_web.cpp configuration/configure_web.h configuration/configure_web.ui - debugger/graphics/graphics_breakpoint_observer.cpp - debugger/graphics/graphics_breakpoint_observer.h - debugger/graphics/graphics_breakpoints.cpp - debugger/graphics/graphics_breakpoints.h - debugger/graphics/graphics_breakpoints_p.h debugger/console.cpp debugger/console.h debugger/profiler.cpp diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index 07a720494..7490fb718 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp @@ -215,18 +215,11 @@ void GRenderWindow::moveContext() { } void GRenderWindow::SwapBuffers() { - // In our multi-threaded QWidget use case we shouldn't need to call `makeCurrent`, - // since we never call `doneCurrent` in this thread. - // However: - // - The Qt debug runtime prints a bogus warning on the console if `makeCurrent` wasn't called - // since the last time `swapBuffers` was executed; - // - On macOS, if `makeCurrent` isn't called explicitly, resizing the buffer breaks. - context->makeCurrent(child); - context->swapBuffers(child); + if (!first_frame) { - emit FirstFrameDisplayed(); first_frame = true; + emit FirstFrameDisplayed(); } } diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index f92a4b3c3..59918847a 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -10,6 +10,7 @@ #include "core/hle/service/acc/profile_manager.h" #include "core/hle/service/hid/controllers/npad.h" #include "input_common/main.h" +#include "input_common/udp/client.h" #include "yuzu/configuration/config.h" #include "yuzu/uisettings.h" @@ -429,6 +430,16 @@ void Config::ReadControlValues() { QStringLiteral("engine:motion_emu,update_period:100,sensitivity:0.01")) .toString() .toStdString(); + Settings::values.udp_input_address = + ReadSetting(QStringLiteral("udp_input_address"), + QString::fromUtf8(InputCommon::CemuhookUDP::DEFAULT_ADDR)) + .toString() + .toStdString(); + Settings::values.udp_input_port = static_cast<u16>( + ReadSetting(QStringLiteral("udp_input_port"), InputCommon::CemuhookUDP::DEFAULT_PORT) + .toInt()); + Settings::values.udp_pad_index = + static_cast<u8>(ReadSetting(QStringLiteral("udp_pad_index"), 0).toUInt()); qt_config->endGroup(); } @@ -911,6 +922,12 @@ void Config::SaveControlValues() { QString::fromStdString(Settings::values.motion_device), QStringLiteral("engine:motion_emu,update_period:100,sensitivity:0.01")); WriteSetting(QStringLiteral("keyboard_enabled"), Settings::values.keyboard_enabled, false); + WriteSetting(QStringLiteral("udp_input_address"), + QString::fromStdString(Settings::values.udp_input_address), + QString::fromUtf8(InputCommon::CemuhookUDP::DEFAULT_ADDR)); + WriteSetting(QStringLiteral("udp_input_port"), Settings::values.udp_input_port, + InputCommon::CemuhookUDP::DEFAULT_PORT); + WriteSetting(QStringLiteral("udp_pad_index"), Settings::values.udp_pad_index, 0); qt_config->endGroup(); } diff --git a/src/yuzu/configuration/configure.ui b/src/yuzu/configuration/configure.ui index 372427ae2..67b990f1a 100644 --- a/src/yuzu/configuration/configure.ui +++ b/src/yuzu/configuration/configure.ui @@ -48,7 +48,7 @@ <string>General</string> </attribute> </widget> - <widget class="ConfigureGameList" name="gameListTab"> + <widget class="ConfigureUi" name="uiTab"> <attribute name="title"> <string>Game List</string> </attribute> @@ -166,9 +166,9 @@ <container>1</container> </customwidget> <customwidget> - <class>ConfigureGameList</class> + <class>ConfigureUi</class> <extends>QWidget</extends> - <header>configuration/configure_gamelist.h</header> + <header>configuration/configure_ui.h</header> <container>1</container> </customwidget> <customwidget> diff --git a/src/yuzu/configuration/configure_dialog.cpp b/src/yuzu/configuration/configure_dialog.cpp index 25b2e1b05..db3b19352 100644 --- a/src/yuzu/configuration/configure_dialog.cpp +++ b/src/yuzu/configuration/configure_dialog.cpp @@ -34,7 +34,7 @@ void ConfigureDialog::SetConfiguration() {} void ConfigureDialog::ApplyConfiguration() { ui->generalTab->ApplyConfiguration(); - ui->gameListTab->ApplyConfiguration(); + ui->uiTab->ApplyConfiguration(); ui->systemTab->ApplyConfiguration(); ui->profileManagerTab->ApplyConfiguration(); ui->filesystemTab->applyConfiguration(); @@ -73,11 +73,11 @@ void ConfigureDialog::RetranslateUI() { Q_DECLARE_METATYPE(QList<QWidget*>); void ConfigureDialog::PopulateSelectionList() { - const std::array<std::pair<QString, QList<QWidget*>>, 4> items{ - {{tr("General"), {ui->generalTab, ui->webTab, ui->debugTab, ui->gameListTab}}, - {tr("System"), - {ui->systemTab, ui->profileManagerTab, ui->serviceTab, ui->filesystemTab, ui->audioTab}}, + const std::array<std::pair<QString, QList<QWidget*>>, 5> items{ + {{tr("General"), {ui->generalTab, ui->webTab, ui->debugTab, ui->uiTab}}, + {tr("System"), {ui->systemTab, ui->profileManagerTab, ui->serviceTab, ui->filesystemTab}}, {tr("Graphics"), {ui->graphicsTab}}, + {tr("Audio"), {ui->audioTab}}, {tr("Controls"), {ui->inputTab, ui->hotkeysTab}}}, }; @@ -108,7 +108,7 @@ void ConfigureDialog::UpdateVisibleTabs() { {ui->audioTab, tr("Audio")}, {ui->debugTab, tr("Debug")}, {ui->webTab, tr("Web")}, - {ui->gameListTab, tr("Game List")}, + {ui->uiTab, tr("UI")}, {ui->filesystemTab, tr("Filesystem")}, {ui->serviceTab, tr("Services")}, }; diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp index 34e1d7fea..5ef927114 100644 --- a/src/yuzu/configuration/configure_general.cpp +++ b/src/yuzu/configuration/configure_general.cpp @@ -15,11 +15,6 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent) ui->setupUi(this); - for (const auto& theme : UISettings::themes) { - ui->theme_combobox->addItem(QString::fromUtf8(theme.first), - QString::fromUtf8(theme.second)); - } - SetConfiguration(); connect(ui->toggle_frame_limit, &QCheckBox::toggled, ui->frame_limit, &QSpinBox::setEnabled); @@ -30,7 +25,6 @@ ConfigureGeneral::~ConfigureGeneral() = default; void ConfigureGeneral::SetConfiguration() { ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing); ui->toggle_user_on_boot->setChecked(UISettings::values.select_user_on_boot); - ui->theme_combobox->setCurrentIndex(ui->theme_combobox->findData(UISettings::values.theme)); ui->toggle_background_pause->setChecked(UISettings::values.pause_when_in_background); ui->toggle_frame_limit->setChecked(Settings::values.use_frame_limit); @@ -41,8 +35,6 @@ void ConfigureGeneral::SetConfiguration() { void ConfigureGeneral::ApplyConfiguration() { UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked(); UISettings::values.select_user_on_boot = ui->toggle_user_on_boot->isChecked(); - UISettings::values.theme = - ui->theme_combobox->itemData(ui->theme_combobox->currentIndex()).toString(); UISettings::values.pause_when_in_background = ui->toggle_background_pause->isChecked(); Settings::values.use_frame_limit = ui->toggle_frame_limit->isChecked(); diff --git a/src/yuzu/configuration/configure_general.ui b/src/yuzu/configuration/configure_general.ui index 26b3486ff..857119bb3 100644 --- a/src/yuzu/configuration/configure_general.ui +++ b/src/yuzu/configuration/configure_general.ui @@ -65,39 +65,12 @@ </property> </widget> </item> - <item> - <widget class="QCheckBox" name="toggle_background_pause"> - <property name="text"> - <string>Pause emulation when in background</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="theme_group_box"> - <property name="title"> - <string>Theme</string> - </property> - <layout class="QHBoxLayout" name="theme_qhbox_layout"> - <item> - <layout class="QVBoxLayout" name="theme_qvbox_layout"> <item> - <layout class="QHBoxLayout" name="theme_qhbox_layout_2"> - <item> - <widget class="QLabel" name="theme_label"> - <property name="text"> - <string>Theme:</string> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="theme_combobox"/> - </item> - </layout> + <widget class="QCheckBox" name="toggle_background_pause"> + <property name="text"> + <string>Pause emulation when in background</string> + </property> + </widget> </item> </layout> </item> diff --git a/src/yuzu/configuration/configure_hotkeys.cpp b/src/yuzu/configuration/configure_hotkeys.cpp index 3ea0b8d67..fa9052136 100644 --- a/src/yuzu/configuration/configure_hotkeys.cpp +++ b/src/yuzu/configuration/configure_hotkeys.cpp @@ -48,6 +48,7 @@ void ConfigureHotkeys::Populate(const HotkeyRegistry& registry) { } ui->hotkey_list->expandAll(); + ui->hotkey_list->resizeColumnToContents(0); } void ConfigureHotkeys::changeEvent(QEvent* event) { diff --git a/src/yuzu/configuration/configure_gamelist.cpp b/src/yuzu/configuration/configure_ui.cpp index daedbc33e..c4a84cc67 100644 --- a/src/yuzu/configuration/configure_gamelist.cpp +++ b/src/yuzu/configuration/configure_ui.cpp @@ -7,8 +7,8 @@ #include "common/common_types.h" #include "core/settings.h" -#include "ui_configure_gamelist.h" -#include "yuzu/configuration/configure_gamelist.h" +#include "ui_configure_ui.h" +#include "yuzu/configuration/configure_ui.h" #include "yuzu/uisettings.h" namespace { @@ -21,36 +21,45 @@ constexpr std::array default_icon_sizes{ }; constexpr std::array row_text_names{ - QT_TR_NOOP("Filename"), - QT_TR_NOOP("Filetype"), - QT_TR_NOOP("Title ID"), - QT_TR_NOOP("Title Name"), + QT_TR_NOOP("Filename"), QT_TR_NOOP("Filetype"), QT_TR_NOOP("Title ID"), + QT_TR_NOOP("Title Name"), QT_TR_NOOP("None"), }; } // Anonymous namespace -ConfigureGameList::ConfigureGameList(QWidget* parent) - : QWidget(parent), ui(new Ui::ConfigureGameList) { +ConfigureUi::ConfigureUi(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureUi) { ui->setupUi(this); + for (const auto& theme : UISettings::themes) { + ui->theme_combobox->addItem(QString::fromUtf8(theme.first), + QString::fromUtf8(theme.second)); + } + InitializeIconSizeComboBox(); InitializeRowComboBoxes(); SetConfiguration(); // Force game list reload if any of the relevant settings are changed. - connect(ui->show_unknown, &QCheckBox::stateChanged, this, - &ConfigureGameList::RequestGameListUpdate); + connect(ui->show_unknown, &QCheckBox::stateChanged, this, &ConfigureUi::RequestGameListUpdate); connect(ui->icon_size_combobox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, - &ConfigureGameList::RequestGameListUpdate); + &ConfigureUi::RequestGameListUpdate); connect(ui->row_1_text_combobox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, - &ConfigureGameList::RequestGameListUpdate); + &ConfigureUi::RequestGameListUpdate); connect(ui->row_2_text_combobox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, - &ConfigureGameList::RequestGameListUpdate); + &ConfigureUi::RequestGameListUpdate); + + // Update text ComboBoxes after user interaction. + connect(ui->row_1_text_combobox, QOverload<int>::of(&QComboBox::activated), + [=]() { ConfigureUi::UpdateSecondRowComboBox(); }); + connect(ui->row_2_text_combobox, QOverload<int>::of(&QComboBox::activated), + [=]() { ConfigureUi::UpdateFirstRowComboBox(); }); } -ConfigureGameList::~ConfigureGameList() = default; +ConfigureUi::~ConfigureUi() = default; -void ConfigureGameList::ApplyConfiguration() { +void ConfigureUi::ApplyConfiguration() { + UISettings::values.theme = + ui->theme_combobox->itemData(ui->theme_combobox->currentIndex()).toString(); UISettings::values.show_unknown = ui->show_unknown->isChecked(); UISettings::values.show_add_ons = ui->show_add_ons->isChecked(); UISettings::values.icon_size = ui->icon_size_combobox->currentData().toUInt(); @@ -59,22 +68,19 @@ void ConfigureGameList::ApplyConfiguration() { Settings::Apply(); } -void ConfigureGameList::RequestGameListUpdate() { +void ConfigureUi::RequestGameListUpdate() { UISettings::values.is_game_list_reload_pending.exchange(true); } -void ConfigureGameList::SetConfiguration() { +void ConfigureUi::SetConfiguration() { + ui->theme_combobox->setCurrentIndex(ui->theme_combobox->findData(UISettings::values.theme)); ui->show_unknown->setChecked(UISettings::values.show_unknown); ui->show_add_ons->setChecked(UISettings::values.show_add_ons); ui->icon_size_combobox->setCurrentIndex( ui->icon_size_combobox->findData(UISettings::values.icon_size)); - ui->row_1_text_combobox->setCurrentIndex( - ui->row_1_text_combobox->findData(UISettings::values.row_1_text_id)); - ui->row_2_text_combobox->setCurrentIndex( - ui->row_2_text_combobox->findData(UISettings::values.row_2_text_id)); } -void ConfigureGameList::changeEvent(QEvent* event) { +void ConfigureUi::changeEvent(QEvent* event) { if (event->type() == QEvent::LanguageChange) { RetranslateUI(); } @@ -82,7 +88,7 @@ void ConfigureGameList::changeEvent(QEvent* event) { QWidget::changeEvent(event); } -void ConfigureGameList::RetranslateUI() { +void ConfigureUi::RetranslateUI() { ui->retranslateUi(this); for (int i = 0; i < ui->icon_size_combobox->count(); i++) { @@ -97,17 +103,50 @@ void ConfigureGameList::RetranslateUI() { } } -void ConfigureGameList::InitializeIconSizeComboBox() { +void ConfigureUi::InitializeIconSizeComboBox() { for (const auto& size : default_icon_sizes) { ui->icon_size_combobox->addItem(QString::fromUtf8(size.second), size.first); } } -void ConfigureGameList::InitializeRowComboBoxes() { - for (std::size_t i = 0; i < row_text_names.size(); ++i) { - const QString row_text_name = QString::fromUtf8(row_text_names[i]); +void ConfigureUi::InitializeRowComboBoxes() { + UpdateFirstRowComboBox(true); + UpdateSecondRowComboBox(true); +} + +void ConfigureUi::UpdateFirstRowComboBox(bool init) { + const int currentIndex = + init ? UISettings::values.row_1_text_id + : ui->row_1_text_combobox->findData(ui->row_1_text_combobox->currentData()); + + ui->row_1_text_combobox->clear(); + for (std::size_t i = 0; i < row_text_names.size(); i++) { + const QString row_text_name = QString::fromUtf8(row_text_names[i]); ui->row_1_text_combobox->addItem(row_text_name, QVariant::fromValue(i)); + } + + ui->row_1_text_combobox->setCurrentIndex(ui->row_1_text_combobox->findData(currentIndex)); + + ui->row_1_text_combobox->removeItem(4); // None + ui->row_1_text_combobox->removeItem( + ui->row_1_text_combobox->findData(ui->row_2_text_combobox->currentData())); +} + +void ConfigureUi::UpdateSecondRowComboBox(bool init) { + const int currentIndex = + init ? UISettings::values.row_2_text_id + : ui->row_2_text_combobox->findData(ui->row_2_text_combobox->currentData()); + + ui->row_2_text_combobox->clear(); + + for (std::size_t i = 0; i < row_text_names.size(); ++i) { + const QString row_text_name = QString::fromUtf8(row_text_names[i]); ui->row_2_text_combobox->addItem(row_text_name, QVariant::fromValue(i)); } + + ui->row_2_text_combobox->setCurrentIndex(ui->row_2_text_combobox->findData(currentIndex)); + + ui->row_2_text_combobox->removeItem( + ui->row_2_text_combobox->findData(ui->row_1_text_combobox->currentData())); } diff --git a/src/yuzu/configuration/configure_gamelist.h b/src/yuzu/configuration/configure_ui.h index e11822919..d471afe99 100644 --- a/src/yuzu/configuration/configure_gamelist.h +++ b/src/yuzu/configuration/configure_ui.h @@ -8,15 +8,15 @@ #include <QWidget> namespace Ui { -class ConfigureGameList; +class ConfigureUi; } -class ConfigureGameList : public QWidget { +class ConfigureUi : public QWidget { Q_OBJECT public: - explicit ConfigureGameList(QWidget* parent = nullptr); - ~ConfigureGameList() override; + explicit ConfigureUi(QWidget* parent = nullptr); + ~ConfigureUi() override; void ApplyConfiguration(); @@ -31,5 +31,8 @@ private: void InitializeIconSizeComboBox(); void InitializeRowComboBoxes(); - std::unique_ptr<Ui::ConfigureGameList> ui; + void UpdateFirstRowComboBox(bool init = false); + void UpdateSecondRowComboBox(bool init = false); + + std::unique_ptr<Ui::ConfigureUi> ui; }; diff --git a/src/yuzu/configuration/configure_gamelist.ui b/src/yuzu/configuration/configure_ui.ui index 7a69377e7..aa36bd112 100644 --- a/src/yuzu/configuration/configure_gamelist.ui +++ b/src/yuzu/configuration/configure_ui.ui @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>ConfigureGameList</class> - <widget class="QWidget" name="ConfigureGameList"> + <class>ConfigureUi</class> + <widget class="QWidget" name="ConfigureUi"> <property name="geometry"> <rect> <x>0</x> @@ -21,7 +21,34 @@ <property name="title"> <string>General</string> </property> - <layout class="QHBoxLayout" name="GeneralHorizontalLayout"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QLabel" name="theme_label"> + <property name="text"> + <string>Theme:</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="theme_combobox"/> + </item> + </layout> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="GameListGroupBox"> + <property name="title"> + <string>Game List</string> + </property> + <layout class="QHBoxLayout" name="GameListHorizontalLayout"> <item> <layout class="QVBoxLayout" name="GeneralVerticalLayout"> <item> @@ -38,19 +65,6 @@ </property> </widget> </item> - </layout> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="IconSizeGroupBox"> - <property name="title"> - <string>Icon Size</string> - </property> - <layout class="QHBoxLayout" name="icon_size_qhbox_layout"> - <item> - <layout class="QVBoxLayout" name="icon_size_qvbox_layout"> <item> <layout class="QHBoxLayout" name="icon_size_qhbox_layout_2"> <item> @@ -65,19 +79,6 @@ </item> </layout> </item> - </layout> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="RowGroupBox"> - <property name="title"> - <string>Row Text</string> - </property> - <layout class="QHBoxLayout" name="RowHorizontalLayout"> - <item> - <layout class="QVBoxLayout" name="RowVerticalLayout"> <item> <layout class="QHBoxLayout" name="row_1_qhbox_layout"> <item> diff --git a/src/yuzu/debugger/graphics/graphics_breakpoint_observer.cpp b/src/yuzu/debugger/graphics/graphics_breakpoint_observer.cpp deleted file mode 100644 index 5f459ccfb..000000000 --- a/src/yuzu/debugger/graphics/graphics_breakpoint_observer.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2014 Citra Emulator Project -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#include <QMetaType> -#include "yuzu/debugger/graphics/graphics_breakpoint_observer.h" - -BreakPointObserverDock::BreakPointObserverDock(std::shared_ptr<Tegra::DebugContext> debug_context, - const QString& title, QWidget* parent) - : QDockWidget(title, parent), BreakPointObserver(debug_context) { - qRegisterMetaType<Tegra::DebugContext::Event>("Tegra::DebugContext::Event"); - - connect(this, &BreakPointObserverDock::Resumed, this, &BreakPointObserverDock::OnResumed); - - // NOTE: This signal is emitted from a non-GUI thread, but connect() takes - // care of delaying its handling to the GUI thread. - connect(this, &BreakPointObserverDock::BreakPointHit, this, - &BreakPointObserverDock::OnBreakPointHit, Qt::BlockingQueuedConnection); -} - -void BreakPointObserverDock::OnMaxwellBreakPointHit(Tegra::DebugContext::Event event, void* data) { - emit BreakPointHit(event, data); -} - -void BreakPointObserverDock::OnMaxwellResume() { - emit Resumed(); -} diff --git a/src/yuzu/debugger/graphics/graphics_breakpoint_observer.h b/src/yuzu/debugger/graphics/graphics_breakpoint_observer.h deleted file mode 100644 index ab32f0115..000000000 --- a/src/yuzu/debugger/graphics/graphics_breakpoint_observer.h +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2014 Citra Emulator Project -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#pragma once - -#include <QDockWidget> -#include "video_core/debug_utils/debug_utils.h" - -/** - * Utility class which forwards calls to OnMaxwellBreakPointHit and OnMaxwellResume to public slots. - * This is because the Maxwell breakpoint callbacks are called from a non-GUI thread, while - * the widget usually wants to perform reactions in the GUI thread. - */ -class BreakPointObserverDock : public QDockWidget, - protected Tegra::DebugContext::BreakPointObserver { - Q_OBJECT - -public: - BreakPointObserverDock(std::shared_ptr<Tegra::DebugContext> debug_context, const QString& title, - QWidget* parent = nullptr); - - void OnMaxwellBreakPointHit(Tegra::DebugContext::Event event, void* data) override; - void OnMaxwellResume() override; - -signals: - void Resumed(); - void BreakPointHit(Tegra::DebugContext::Event event, void* data); - -private: - virtual void OnBreakPointHit(Tegra::DebugContext::Event event, void* data) = 0; - virtual void OnResumed() = 0; -}; diff --git a/src/yuzu/debugger/graphics/graphics_breakpoints.cpp b/src/yuzu/debugger/graphics/graphics_breakpoints.cpp deleted file mode 100644 index 1c80082a4..000000000 --- a/src/yuzu/debugger/graphics/graphics_breakpoints.cpp +++ /dev/null @@ -1,221 +0,0 @@ -// Copyright 2014 Citra Emulator Project -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#include <QLabel> -#include <QMetaType> -#include <QPushButton> -#include <QTreeView> -#include <QVBoxLayout> -#include "common/assert.h" -#include "yuzu/debugger/graphics/graphics_breakpoints.h" -#include "yuzu/debugger/graphics/graphics_breakpoints_p.h" - -BreakPointModel::BreakPointModel(std::shared_ptr<Tegra::DebugContext> debug_context, - QObject* parent) - : QAbstractListModel(parent), context_weak(debug_context), - at_breakpoint(debug_context->at_breakpoint), - active_breakpoint(debug_context->active_breakpoint) {} - -int BreakPointModel::columnCount(const QModelIndex& parent) const { - return 1; -} - -int BreakPointModel::rowCount(const QModelIndex& parent) const { - return static_cast<int>(Tegra::DebugContext::Event::NumEvents); -} - -QVariant BreakPointModel::data(const QModelIndex& index, int role) const { - const auto event = static_cast<Tegra::DebugContext::Event>(index.row()); - - switch (role) { - case Qt::DisplayRole: { - if (index.column() == 0) { - return DebugContextEventToString(event); - } - break; - } - - case Qt::CheckStateRole: { - if (index.column() == 0) - return data(index, Role_IsEnabled).toBool() ? Qt::Checked : Qt::Unchecked; - break; - } - - case Qt::BackgroundRole: { - if (at_breakpoint && index.row() == static_cast<int>(active_breakpoint)) { - return QBrush(QColor(0xE0, 0xE0, 0x10)); - } - break; - } - - case Role_IsEnabled: { - auto context = context_weak.lock(); - return context && context->breakpoints[(int)event].enabled; - } - - default: - break; - } - return QVariant(); -} - -Qt::ItemFlags BreakPointModel::flags(const QModelIndex& index) const { - if (!index.isValid()) - return 0; - - Qt::ItemFlags flags = Qt::ItemIsEnabled; - if (index.column() == 0) - flags |= Qt::ItemIsUserCheckable; - return flags; -} - -bool BreakPointModel::setData(const QModelIndex& index, const QVariant& value, int role) { - const auto event = static_cast<Tegra::DebugContext::Event>(index.row()); - - switch (role) { - case Qt::CheckStateRole: { - if (index.column() != 0) - return false; - - auto context = context_weak.lock(); - if (!context) - return false; - - context->breakpoints[(int)event].enabled = value == Qt::Checked; - QModelIndex changed_index = createIndex(index.row(), 0); - emit dataChanged(changed_index, changed_index); - return true; - } - } - - return false; -} - -void BreakPointModel::OnBreakPointHit(Tegra::DebugContext::Event event) { - auto context = context_weak.lock(); - if (!context) - return; - - active_breakpoint = context->active_breakpoint; - at_breakpoint = context->at_breakpoint; - emit dataChanged(createIndex(static_cast<int>(event), 0), - createIndex(static_cast<int>(event), 0)); -} - -void BreakPointModel::OnResumed() { - auto context = context_weak.lock(); - if (!context) - return; - - at_breakpoint = context->at_breakpoint; - emit dataChanged(createIndex(static_cast<int>(active_breakpoint), 0), - createIndex(static_cast<int>(active_breakpoint), 0)); - active_breakpoint = context->active_breakpoint; -} - -QString BreakPointModel::DebugContextEventToString(Tegra::DebugContext::Event event) { - switch (event) { - case Tegra::DebugContext::Event::MaxwellCommandLoaded: - return tr("Maxwell command loaded"); - case Tegra::DebugContext::Event::MaxwellCommandProcessed: - return tr("Maxwell command processed"); - case Tegra::DebugContext::Event::IncomingPrimitiveBatch: - return tr("Incoming primitive batch"); - case Tegra::DebugContext::Event::FinishedPrimitiveBatch: - return tr("Finished primitive batch"); - case Tegra::DebugContext::Event::NumEvents: - break; - } - - return tr("Unknown debug context event"); -} - -GraphicsBreakPointsWidget::GraphicsBreakPointsWidget( - std::shared_ptr<Tegra::DebugContext> debug_context, QWidget* parent) - : QDockWidget(tr("Maxwell Breakpoints"), parent), Tegra::DebugContext::BreakPointObserver( - debug_context) { - setObjectName(QStringLiteral("TegraBreakPointsWidget")); - - status_text = new QLabel(tr("Emulation running")); - resume_button = new QPushButton(tr("Resume")); - resume_button->setEnabled(false); - - breakpoint_model = new BreakPointModel(debug_context, this); - breakpoint_list = new QTreeView; - breakpoint_list->setRootIsDecorated(false); - breakpoint_list->setHeaderHidden(true); - breakpoint_list->setModel(breakpoint_model); - - qRegisterMetaType<Tegra::DebugContext::Event>("Tegra::DebugContext::Event"); - - connect(breakpoint_list, &QTreeView::doubleClicked, this, - &GraphicsBreakPointsWidget::OnItemDoubleClicked); - - connect(resume_button, &QPushButton::clicked, this, - &GraphicsBreakPointsWidget::OnResumeRequested); - - connect(this, &GraphicsBreakPointsWidget::BreakPointHit, this, - &GraphicsBreakPointsWidget::OnBreakPointHit, Qt::BlockingQueuedConnection); - connect(this, &GraphicsBreakPointsWidget::Resumed, this, &GraphicsBreakPointsWidget::OnResumed); - - connect(this, &GraphicsBreakPointsWidget::BreakPointHit, breakpoint_model, - &BreakPointModel::OnBreakPointHit, Qt::BlockingQueuedConnection); - connect(this, &GraphicsBreakPointsWidget::Resumed, breakpoint_model, - &BreakPointModel::OnResumed); - - connect(this, &GraphicsBreakPointsWidget::BreakPointsChanged, - [this](const QModelIndex& top_left, const QModelIndex& bottom_right) { - breakpoint_model->dataChanged(top_left, bottom_right); - }); - - QWidget* main_widget = new QWidget; - auto main_layout = new QVBoxLayout; - { - auto sub_layout = new QHBoxLayout; - sub_layout->addWidget(status_text); - sub_layout->addWidget(resume_button); - main_layout->addLayout(sub_layout); - } - main_layout->addWidget(breakpoint_list); - main_widget->setLayout(main_layout); - - setWidget(main_widget); -} - -void GraphicsBreakPointsWidget::OnMaxwellBreakPointHit(Event event, void* data) { - // Process in GUI thread - emit BreakPointHit(event, data); -} - -void GraphicsBreakPointsWidget::OnBreakPointHit(Tegra::DebugContext::Event event, void* data) { - status_text->setText(tr("Emulation halted at breakpoint")); - resume_button->setEnabled(true); -} - -void GraphicsBreakPointsWidget::OnMaxwellResume() { - // Process in GUI thread - emit Resumed(); -} - -void GraphicsBreakPointsWidget::OnResumed() { - status_text->setText(tr("Emulation running")); - resume_button->setEnabled(false); -} - -void GraphicsBreakPointsWidget::OnResumeRequested() { - if (auto context = context_weak.lock()) - context->Resume(); -} - -void GraphicsBreakPointsWidget::OnItemDoubleClicked(const QModelIndex& index) { - if (!index.isValid()) - return; - - QModelIndex check_index = breakpoint_list->model()->index(index.row(), 0); - QVariant enabled = breakpoint_list->model()->data(check_index, Qt::CheckStateRole); - QVariant new_state = Qt::Unchecked; - if (enabled == Qt::Unchecked) - new_state = Qt::Checked; - breakpoint_list->model()->setData(check_index, new_state, Qt::CheckStateRole); -} diff --git a/src/yuzu/debugger/graphics/graphics_breakpoints.h b/src/yuzu/debugger/graphics/graphics_breakpoints.h deleted file mode 100644 index a920a2ae5..000000000 --- a/src/yuzu/debugger/graphics/graphics_breakpoints.h +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2014 Citra Emulator Project -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#pragma once - -#include <memory> -#include <QDockWidget> -#include "video_core/debug_utils/debug_utils.h" - -class QLabel; -class QPushButton; -class QTreeView; - -class BreakPointModel; - -class GraphicsBreakPointsWidget : public QDockWidget, Tegra::DebugContext::BreakPointObserver { - Q_OBJECT - - using Event = Tegra::DebugContext::Event; - -public: - explicit GraphicsBreakPointsWidget(std::shared_ptr<Tegra::DebugContext> debug_context, - QWidget* parent = nullptr); - - void OnMaxwellBreakPointHit(Tegra::DebugContext::Event event, void* data) override; - void OnMaxwellResume() override; - -signals: - void Resumed(); - void BreakPointHit(Tegra::DebugContext::Event event, void* data); - void BreakPointsChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight); - -private: - void OnBreakPointHit(Tegra::DebugContext::Event event, void* data); - void OnItemDoubleClicked(const QModelIndex&); - void OnResumeRequested(); - void OnResumed(); - - QLabel* status_text; - QPushButton* resume_button; - - BreakPointModel* breakpoint_model; - QTreeView* breakpoint_list; -}; diff --git a/src/yuzu/debugger/graphics/graphics_breakpoints_p.h b/src/yuzu/debugger/graphics/graphics_breakpoints_p.h deleted file mode 100644 index fb488e38f..000000000 --- a/src/yuzu/debugger/graphics/graphics_breakpoints_p.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2014 Citra Emulator Project -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#pragma once - -#include <memory> -#include <QAbstractListModel> -#include "video_core/debug_utils/debug_utils.h" - -class BreakPointModel : public QAbstractListModel { - Q_OBJECT - -public: - enum { - Role_IsEnabled = Qt::UserRole, - }; - - BreakPointModel(std::shared_ptr<Tegra::DebugContext> context, QObject* parent); - - int columnCount(const QModelIndex& parent = QModelIndex()) const override; - int rowCount(const QModelIndex& parent = QModelIndex()) const override; - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; - Qt::ItemFlags flags(const QModelIndex& index) const override; - - bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override; - - void OnBreakPointHit(Tegra::DebugContext::Event event); - void OnResumed(); - -private: - static QString DebugContextEventToString(Tegra::DebugContext::Event event); - - std::weak_ptr<Tegra::DebugContext> context_weak; - bool at_breakpoint; - Tegra::DebugContext::Event active_breakpoint; -}; diff --git a/src/yuzu/game_list_p.h b/src/yuzu/game_list_p.h index 1c2b37afd..7cde72d1b 100644 --- a/src/yuzu/game_list_p.h +++ b/src/yuzu/game_list_p.h @@ -108,11 +108,14 @@ public: }}; const auto& row1 = row_data.at(UISettings::values.row_1_text_id); - const auto& row2 = row_data.at(UISettings::values.row_2_text_id); + const int row2_id = UISettings::values.row_2_text_id; - if (row1.isEmpty() || row1 == row2) - return row2; - if (row2.isEmpty()) + if (row2_id == 4) // None + return row1; + + const auto& row2 = row_data.at(row2_id); + + if (row1 == row2) return row1; return QString(row1 + QStringLiteral("\n ") + row2); diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 867f8e913..b5dd3e0d6 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -93,7 +93,6 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual #include "core/perf_stats.h" #include "core/settings.h" #include "core/telemetry_session.h" -#include "video_core/debug_utils/debug_utils.h" #include "yuzu/about_dialog.h" #include "yuzu/bootmanager.h" #include "yuzu/compatdb.h" @@ -101,7 +100,6 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual #include "yuzu/configuration/config.h" #include "yuzu/configuration/configure_dialog.h" #include "yuzu/debugger/console.h" -#include "yuzu/debugger/graphics/graphics_breakpoints.h" #include "yuzu/debugger/profiler.h" #include "yuzu/debugger/wait_tree.h" #include "yuzu/discord.h" @@ -187,8 +185,6 @@ GMainWindow::GMainWindow() provider(std::make_unique<FileSys::ManualContentProvider>()) { InitializeLogging(); - debug_context = Tegra::DebugContext::Construct(); - setAcceptDrops(true); ui.setupUi(this); statusBar()->hide(); @@ -495,11 +491,6 @@ void GMainWindow::InitializeDebugWidgets() { debug_menu->addAction(microProfileDialog->toggleViewAction()); #endif - graphicsBreakpointsWidget = new GraphicsBreakPointsWidget(debug_context, this); - addDockWidget(Qt::RightDockWidgetArea, graphicsBreakpointsWidget); - graphicsBreakpointsWidget->hide(); - debug_menu->addAction(graphicsBreakpointsWidget->toggleViewAction()); - waitTreeWidget = new WaitTreeWidget(this); addDockWidget(Qt::LeftDockWidgetArea, waitTreeWidget); waitTreeWidget->hide(); @@ -535,19 +526,30 @@ void GMainWindow::InitializeHotkeys() { const QString main_window = QStringLiteral("Main Window"); const QString load_file = QStringLiteral("Load File"); + const QString load_amiibo = QStringLiteral("Load Amiibo"); const QString exit_yuzu = QStringLiteral("Exit yuzu"); + const QString restart_emulation = QStringLiteral("Restart Emulation"); const QString stop_emulation = QStringLiteral("Stop Emulation"); const QString toggle_filter_bar = QStringLiteral("Toggle Filter Bar"); const QString toggle_status_bar = QStringLiteral("Toggle Status Bar"); const QString fullscreen = QStringLiteral("Fullscreen"); + const QString capture_screenshot = QStringLiteral("Capture Screenshot"); ui.action_Load_File->setShortcut(hotkey_registry.GetKeySequence(main_window, load_file)); ui.action_Load_File->setShortcutContext( hotkey_registry.GetShortcutContext(main_window, load_file)); + ui.action_Load_Amiibo->setShortcut(hotkey_registry.GetKeySequence(main_window, load_amiibo)); + ui.action_Load_Amiibo->setShortcutContext( + hotkey_registry.GetShortcutContext(main_window, load_amiibo)); + ui.action_Exit->setShortcut(hotkey_registry.GetKeySequence(main_window, exit_yuzu)); ui.action_Exit->setShortcutContext(hotkey_registry.GetShortcutContext(main_window, exit_yuzu)); + ui.action_Restart->setShortcut(hotkey_registry.GetKeySequence(main_window, restart_emulation)); + ui.action_Restart->setShortcutContext( + hotkey_registry.GetShortcutContext(main_window, restart_emulation)); + ui.action_Stop->setShortcut(hotkey_registry.GetKeySequence(main_window, stop_emulation)); ui.action_Stop->setShortcutContext( hotkey_registry.GetShortcutContext(main_window, stop_emulation)); @@ -562,6 +564,11 @@ void GMainWindow::InitializeHotkeys() { ui.action_Show_Status_Bar->setShortcutContext( hotkey_registry.GetShortcutContext(main_window, toggle_status_bar)); + ui.action_Capture_Screenshot->setShortcut( + hotkey_registry.GetKeySequence(main_window, capture_screenshot)); + ui.action_Capture_Screenshot->setShortcutContext( + hotkey_registry.GetShortcutContext(main_window, capture_screenshot)); + connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Load File"), this), &QShortcut::activated, this, &GMainWindow::OnMenuLoadFile); connect( @@ -869,8 +876,6 @@ bool GMainWindow::LoadROM(const QString& filename) { Core::System& system{Core::System::GetInstance()}; system.SetFilesystem(vfs); - system.SetGPUDebugContext(debug_context); - system.SetAppletFrontendSet({ nullptr, // Parental Controls std::make_unique<QtErrorDisplay>(*this), // diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 7f46bea2b..a56f9a981 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h @@ -22,7 +22,6 @@ class Config; class EmuThread; class GameList; class GImageInfo; -class GraphicsBreakPointsWidget; class GRenderWindow; class LoadingScreen; class MicroProfileDialog; @@ -42,10 +41,6 @@ class ManualContentProvider; class VfsFilesystem; } // namespace FileSys -namespace Tegra { -class DebugContext; -} - enum class EmulatedDirectoryTarget { NAND, SDMC, @@ -223,8 +218,6 @@ private: Ui::MainWindow ui; - std::shared_ptr<Tegra::DebugContext> debug_context; - GRenderWindow* render_window; GameList* game_list; LoadingScreen* loading_screen; @@ -255,7 +248,6 @@ private: // Debugger panes ProfilerWidget* profilerWidget; MicroProfileDialog* microProfileDialog; - GraphicsBreakPointsWidget* graphicsBreakpointsWidget; WaitTreeWidget* waitTreeWidget; QAction* actions_recent_files[max_recent_files_item]; diff --git a/src/yuzu/main.ui b/src/yuzu/main.ui index 21f422500..a2c9e4547 100644 --- a/src/yuzu/main.ui +++ b/src/yuzu/main.ui @@ -15,7 +15,7 @@ </property> <property name="windowIcon"> <iconset> - <normaloff>src/pcafe/res/icon3_64x64.ico</normaloff>src/pcafe/res/icon3_64x64.ico</iconset> + <normaloff>../dist/yuzu.ico</normaloff>../dist/yuzu.ico</iconset> </property> <property name="tabShape"> <enum>QTabWidget::Rounded</enum> @@ -98,6 +98,7 @@ <addaction name="action_Display_Dock_Widget_Headers"/> <addaction name="action_Show_Filter_Bar"/> <addaction name="action_Show_Status_Bar"/> + <addaction name="separator"/> <addaction name="menu_View_Debugging"/> </widget> <widget class="QMenu" name="menu_Tools"> diff --git a/src/yuzu/uisettings.cpp b/src/yuzu/uisettings.cpp index 43bad9678..738c4b2fc 100644 --- a/src/yuzu/uisettings.cpp +++ b/src/yuzu/uisettings.cpp @@ -7,10 +7,10 @@ namespace UISettings { const Themes themes{{ - {"Default", "default"}, + {"Light", "default"}, + {"Light Colorful", "colorful"}, {"Dark", "qdarkstyle"}, - {"Colorful", "colorful"}, - {"Colorful Dark", "colorful_dark"}, + {"Dark Colorful", "colorful_dark"}, }}; Values values = {}; |
