mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-10 05:28:56 +02:00
[frontend] Remove QDockWidget Wait Tree (#2949)
No one uses it and knows how to use it. So, remove it and replace it later with something more useful :) Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2949 Reviewed-by: crueter <crueter@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: Caio Oliveira <caiooliveirafarias0@gmail.com> Co-authored-by: unknown <sahyno1996@gmail.com> Co-committed-by: unknown <sahyno1996@gmail.com>
This commit is contained in:
parent
86e9c32800
commit
89dd133a2f
7 changed files with 0 additions and 738 deletions
25
dist/qt_themes/qdarkstyle/style.qss
vendored
25
dist/qt_themes/qdarkstyle/style.qss
vendored
|
|
@ -821,31 +821,6 @@ QTabBar QToolButton::left-arrow:disabled {
|
||||||
image: url(:/qss_icons/rc/left_arrow_disabled.png);
|
image: url(:/qss_icons/rc/left_arrow_disabled.png);
|
||||||
}
|
}
|
||||||
|
|
||||||
QDockWidget {
|
|
||||||
background: #31363b;
|
|
||||||
border: 1px solid #403F3F;
|
|
||||||
titlebar-close-icon: url(:/qss_icons/rc/close.png);
|
|
||||||
titlebar-normal-icon: url(:/qss_icons/rc/undock.png);
|
|
||||||
}
|
|
||||||
|
|
||||||
QDockWidget::close-button,
|
|
||||||
QDockWidget::float-button {
|
|
||||||
border: 1px solid transparent;
|
|
||||||
border-radius: 2px;
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDockWidget::close-button:hover,
|
|
||||||
QDockWidget::float-button:hover {
|
|
||||||
background: rgba(255, 255, 255, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
QDockWidget::close-button:pressed,
|
|
||||||
QDockWidget::float-button:pressed {
|
|
||||||
padding: 1px -1px -1px 1px;
|
|
||||||
background: rgba(255, 255, 255, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
QTreeView,
|
QTreeView,
|
||||||
QListView {
|
QListView {
|
||||||
border: 1px solid #54575B;
|
border: 1px solid #54575B;
|
||||||
|
|
|
||||||
|
|
@ -1685,54 +1685,6 @@ QTabBar QToolButton::right-arrow:disabled {
|
||||||
image: url(":/qss_icons/rc/arrow_right_disabled.png");
|
image: url(":/qss_icons/rc/arrow_right_disabled.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* QDockWiget -------------------------------------------------------------
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------- */
|
|
||||||
QDockWidget {
|
|
||||||
outline: 1px solid #32414B;
|
|
||||||
background-color: #19232D;
|
|
||||||
border: 1px solid #32414B;
|
|
||||||
border-radius: 4px;
|
|
||||||
titlebar-close-icon: url(":/qss_icons/rc/window_close.png");
|
|
||||||
titlebar-normal-icon: url(":/qss_icons/rc/window_undock.png");
|
|
||||||
}
|
|
||||||
|
|
||||||
QDockWidget::title {
|
|
||||||
/* Better size for title bar */
|
|
||||||
padding: 6px;
|
|
||||||
spacing: 4px;
|
|
||||||
border: none;
|
|
||||||
background-color: #32414B;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDockWidget::close-button {
|
|
||||||
background-color: #32414B;
|
|
||||||
border-radius: 4px;
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDockWidget::close-button:hover {
|
|
||||||
image: url(":/qss_icons/rc/window_close_focus.png");
|
|
||||||
}
|
|
||||||
|
|
||||||
QDockWidget::close-button:pressed {
|
|
||||||
image: url(":/qss_icons/rc/window_close_pressed.png");
|
|
||||||
}
|
|
||||||
|
|
||||||
QDockWidget::float-button {
|
|
||||||
background-color: #32414B;
|
|
||||||
border-radius: 4px;
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDockWidget::float-button:hover {
|
|
||||||
image: url(":/qss_icons/rc/window_undock_focus.png");
|
|
||||||
}
|
|
||||||
|
|
||||||
QDockWidget::float-button:pressed {
|
|
||||||
image: url(":/qss_icons/rc/window_undock_pressed.png");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* QTreeView QListView QTableView -----------------------------------------
|
/* QTreeView QListView QTableView -----------------------------------------
|
||||||
|
|
||||||
https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qtreeview
|
https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qtreeview
|
||||||
|
|
|
||||||
|
|
@ -156,8 +156,6 @@ add_executable(yuzu
|
||||||
debugger/console.h
|
debugger/console.h
|
||||||
debugger/controller.cpp
|
debugger/controller.cpp
|
||||||
debugger/controller.h
|
debugger/controller.h
|
||||||
debugger/wait_tree.cpp
|
|
||||||
debugger/wait_tree.h
|
|
||||||
|
|
||||||
game_list.cpp
|
game_list.cpp
|
||||||
game_list.h
|
game_list.h
|
||||||
|
|
|
||||||
|
|
@ -1,434 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
// SPDX-FileCopyrightText: 2016 Citra Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#include <array>
|
|
||||||
#include <fmt/ranges.h>
|
|
||||||
|
|
||||||
#include "yuzu/debugger/wait_tree.h"
|
|
||||||
#include "qt_common/config/uisettings.h"
|
|
||||||
|
|
||||||
#include "core/arm/debug.h"
|
|
||||||
#include "core/core.h"
|
|
||||||
#include "core/hle/kernel/k_class_token.h"
|
|
||||||
#include "core/hle/kernel/k_handle_table.h"
|
|
||||||
#include "core/hle/kernel/k_process.h"
|
|
||||||
#include "core/hle/kernel/k_readable_event.h"
|
|
||||||
#include "core/hle/kernel/k_scheduler.h"
|
|
||||||
#include "core/hle/kernel/k_synchronization_object.h"
|
|
||||||
#include "core/hle/kernel/k_thread.h"
|
|
||||||
#include "core/hle/kernel/svc_common.h"
|
|
||||||
#include "core/hle/kernel/svc_types.h"
|
|
||||||
#include "core/memory.h"
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
constexpr std::array<std::array<Qt::GlobalColor, 2>, 10> WaitTreeColors{{
|
|
||||||
{Qt::GlobalColor::darkGreen, Qt::GlobalColor::green},
|
|
||||||
{Qt::GlobalColor::darkBlue, Qt::GlobalColor::cyan},
|
|
||||||
{Qt::GlobalColor::lightGray, Qt::GlobalColor::lightGray},
|
|
||||||
{Qt::GlobalColor::lightGray, Qt::GlobalColor::lightGray},
|
|
||||||
{Qt::GlobalColor::darkRed, Qt::GlobalColor::red},
|
|
||||||
{Qt::GlobalColor::darkYellow, Qt::GlobalColor::yellow},
|
|
||||||
{Qt::GlobalColor::red, Qt::GlobalColor::red},
|
|
||||||
{Qt::GlobalColor::darkCyan, Qt::GlobalColor::cyan},
|
|
||||||
{Qt::GlobalColor::gray, Qt::GlobalColor::gray},
|
|
||||||
}};
|
|
||||||
|
|
||||||
bool IsDarkTheme() {
|
|
||||||
const auto& theme = UISettings::values.theme;
|
|
||||||
return theme == std::string("qdarkstyle") || theme == std::string("qdarkstyle_midnight_blue") ||
|
|
||||||
theme == std::string("colorful_dark") || theme == std::string("colorful_midnight_blue");
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
WaitTreeItem::WaitTreeItem() = default;
|
|
||||||
WaitTreeItem::~WaitTreeItem() = default;
|
|
||||||
|
|
||||||
QColor WaitTreeItem::GetColor() const {
|
|
||||||
if (IsDarkTheme()) {
|
|
||||||
return QColor(Qt::GlobalColor::white);
|
|
||||||
} else {
|
|
||||||
return QColor(Qt::GlobalColor::black);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeItem::GetChildren() const {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
void WaitTreeItem::Expand() {
|
|
||||||
if (IsExpandable() && !expanded) {
|
|
||||||
children = GetChildren();
|
|
||||||
for (std::size_t i = 0; i < children.size(); ++i) {
|
|
||||||
children[i]->parent = this;
|
|
||||||
children[i]->row = i;
|
|
||||||
}
|
|
||||||
expanded = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
WaitTreeItem* WaitTreeItem::Parent() const {
|
|
||||||
return parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::vector<std::unique_ptr<WaitTreeItem>>& WaitTreeItem::Children() const {
|
|
||||||
return children;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool WaitTreeItem::IsExpandable() const {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::size_t WaitTreeItem::Row() const {
|
|
||||||
return row;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::unique_ptr<WaitTreeThread>> WaitTreeItem::MakeThreadItemList(
|
|
||||||
Core::System& system) {
|
|
||||||
std::vector<std::unique_ptr<WaitTreeThread>> item_list;
|
|
||||||
std::size_t row = 0;
|
|
||||||
auto add_threads = [&](const std::vector<Kernel::KThread*>& threads) {
|
|
||||||
for (std::size_t i = 0; i < threads.size(); ++i) {
|
|
||||||
if (threads[i]->GetThreadType() == Kernel::ThreadType::User) {
|
|
||||||
item_list.push_back(std::make_unique<WaitTreeThread>(*threads[i], system));
|
|
||||||
item_list.back()->row = row;
|
|
||||||
}
|
|
||||||
++row;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
add_threads(system.GlobalSchedulerContext().GetThreadList());
|
|
||||||
|
|
||||||
return item_list;
|
|
||||||
}
|
|
||||||
|
|
||||||
WaitTreeText::WaitTreeText(QString t) : text(std::move(t)) {}
|
|
||||||
WaitTreeText::~WaitTreeText() = default;
|
|
||||||
|
|
||||||
QString WaitTreeText::GetText() const {
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
WaitTreeCallstack::WaitTreeCallstack(const Kernel::KThread& thread_, Core::System& system_)
|
|
||||||
: thread{thread_}, system{system_} {}
|
|
||||||
WaitTreeCallstack::~WaitTreeCallstack() = default;
|
|
||||||
|
|
||||||
QString WaitTreeCallstack::GetText() const {
|
|
||||||
return tr("Call stack");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeCallstack::GetChildren() const {
|
|
||||||
std::vector<std::unique_ptr<WaitTreeItem>> list;
|
|
||||||
|
|
||||||
if (thread.GetThreadType() != Kernel::ThreadType::User) {
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (thread.GetOwnerProcess() == nullptr || !thread.GetOwnerProcess()->Is64Bit()) {
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto backtrace = Core::GetBacktraceFromContext(thread.GetOwnerProcess(), thread.GetContext());
|
|
||||||
|
|
||||||
for (auto& entry : backtrace) {
|
|
||||||
std::string s = fmt::format("{:20}{:016X} {:016X} {:016X} {}", entry.module, entry.address,
|
|
||||||
entry.original_address, entry.offset, entry.name);
|
|
||||||
list.push_back(std::make_unique<WaitTreeText>(QString::fromStdString(s)));
|
|
||||||
}
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
WaitTreeSynchronizationObject::WaitTreeSynchronizationObject(
|
|
||||||
const Kernel::KSynchronizationObject& object_, Core::System& system_)
|
|
||||||
: object{object_}, system{system_} {}
|
|
||||||
WaitTreeSynchronizationObject::~WaitTreeSynchronizationObject() = default;
|
|
||||||
|
|
||||||
WaitTreeExpandableItem::WaitTreeExpandableItem() = default;
|
|
||||||
WaitTreeExpandableItem::~WaitTreeExpandableItem() = default;
|
|
||||||
|
|
||||||
bool WaitTreeExpandableItem::IsExpandable() const {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString WaitTreeSynchronizationObject::GetText() const {
|
|
||||||
return tr("[%1] %2")
|
|
||||||
.arg(object.GetId())
|
|
||||||
.arg(QString::fromStdString(object.GetTypeObj().GetName()));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::unique_ptr<WaitTreeSynchronizationObject> WaitTreeSynchronizationObject::make(
|
|
||||||
const Kernel::KSynchronizationObject& object, Core::System& system) {
|
|
||||||
const auto type =
|
|
||||||
static_cast<Kernel::KClassTokenGenerator::ObjectType>(object.GetTypeObj().GetClassToken());
|
|
||||||
switch (type) {
|
|
||||||
case Kernel::KClassTokenGenerator::ObjectType::KReadableEvent:
|
|
||||||
return std::make_unique<WaitTreeEvent>(static_cast<const Kernel::KReadableEvent&>(object),
|
|
||||||
system);
|
|
||||||
case Kernel::KClassTokenGenerator::ObjectType::KThread:
|
|
||||||
return std::make_unique<WaitTreeThread>(static_cast<const Kernel::KThread&>(object),
|
|
||||||
system);
|
|
||||||
default:
|
|
||||||
return std::make_unique<WaitTreeSynchronizationObject>(object, system);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeSynchronizationObject::GetChildren() const {
|
|
||||||
std::vector<std::unique_ptr<WaitTreeItem>> list;
|
|
||||||
|
|
||||||
auto threads = object.GetWaitingThreadsForDebugging();
|
|
||||||
if (threads.empty()) {
|
|
||||||
list.push_back(std::make_unique<WaitTreeText>(tr("waited by no thread")));
|
|
||||||
} else {
|
|
||||||
list.push_back(std::make_unique<WaitTreeThreadList>(std::move(threads), system));
|
|
||||||
}
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
WaitTreeThread::WaitTreeThread(const Kernel::KThread& thread, Core::System& system_)
|
|
||||||
: WaitTreeSynchronizationObject(thread, system_), system{system_} {}
|
|
||||||
WaitTreeThread::~WaitTreeThread() = default;
|
|
||||||
|
|
||||||
QString WaitTreeThread::GetText() const {
|
|
||||||
const auto& thread = static_cast<const Kernel::KThread&>(object);
|
|
||||||
QString status;
|
|
||||||
switch (thread.GetState()) {
|
|
||||||
case Kernel::ThreadState::Runnable:
|
|
||||||
if (!thread.IsSuspended()) {
|
|
||||||
status = tr("runnable");
|
|
||||||
} else {
|
|
||||||
status = tr("paused");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Kernel::ThreadState::Waiting:
|
|
||||||
switch (thread.GetWaitReasonForDebugging()) {
|
|
||||||
case Kernel::ThreadWaitReasonForDebugging::Sleep:
|
|
||||||
status = tr("sleeping");
|
|
||||||
break;
|
|
||||||
case Kernel::ThreadWaitReasonForDebugging::IPC:
|
|
||||||
status = tr("waiting for IPC reply");
|
|
||||||
break;
|
|
||||||
case Kernel::ThreadWaitReasonForDebugging::Synchronization:
|
|
||||||
status = tr("waiting for objects");
|
|
||||||
break;
|
|
||||||
case Kernel::ThreadWaitReasonForDebugging::ConditionVar:
|
|
||||||
status = tr("waiting for condition variable");
|
|
||||||
break;
|
|
||||||
case Kernel::ThreadWaitReasonForDebugging::Arbitration:
|
|
||||||
status = tr("waiting for address arbiter");
|
|
||||||
break;
|
|
||||||
case Kernel::ThreadWaitReasonForDebugging::Suspended:
|
|
||||||
status = tr("waiting for suspend resume");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
status = tr("waiting");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Kernel::ThreadState::Initialized:
|
|
||||||
status = tr("initialized");
|
|
||||||
break;
|
|
||||||
case Kernel::ThreadState::Terminated:
|
|
||||||
status = tr("terminated");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
status = tr("unknown");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto& context = thread.GetContext();
|
|
||||||
const QString pc_info = tr(" PC = 0x%1 LR = 0x%2")
|
|
||||||
.arg(context.pc, 8, 16, QLatin1Char{'0'})
|
|
||||||
.arg(context.lr, 8, 16, QLatin1Char{'0'});
|
|
||||||
return QStringLiteral("%1%2 (%3) ")
|
|
||||||
.arg(WaitTreeSynchronizationObject::GetText(), pc_info, status);
|
|
||||||
}
|
|
||||||
|
|
||||||
QColor WaitTreeThread::GetColor() const {
|
|
||||||
const std::size_t color_index = IsDarkTheme() ? 1 : 0;
|
|
||||||
|
|
||||||
const auto& thread = static_cast<const Kernel::KThread&>(object);
|
|
||||||
switch (thread.GetState()) {
|
|
||||||
case Kernel::ThreadState::Runnable:
|
|
||||||
if (!thread.IsSuspended()) {
|
|
||||||
return QColor(WaitTreeColors[0][color_index]);
|
|
||||||
} else {
|
|
||||||
return QColor(WaitTreeColors[2][color_index]);
|
|
||||||
}
|
|
||||||
case Kernel::ThreadState::Waiting:
|
|
||||||
switch (thread.GetWaitReasonForDebugging()) {
|
|
||||||
case Kernel::ThreadWaitReasonForDebugging::IPC:
|
|
||||||
return QColor(WaitTreeColors[4][color_index]);
|
|
||||||
case Kernel::ThreadWaitReasonForDebugging::Sleep:
|
|
||||||
return QColor(WaitTreeColors[5][color_index]);
|
|
||||||
case Kernel::ThreadWaitReasonForDebugging::Synchronization:
|
|
||||||
case Kernel::ThreadWaitReasonForDebugging::ConditionVar:
|
|
||||||
case Kernel::ThreadWaitReasonForDebugging::Arbitration:
|
|
||||||
case Kernel::ThreadWaitReasonForDebugging::Suspended:
|
|
||||||
return QColor(WaitTreeColors[6][color_index]);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return QColor(WaitTreeColors[3][color_index]);
|
|
||||||
}
|
|
||||||
case Kernel::ThreadState::Initialized:
|
|
||||||
return QColor(WaitTreeColors[7][color_index]);
|
|
||||||
case Kernel::ThreadState::Terminated:
|
|
||||||
return QColor(WaitTreeColors[8][color_index]);
|
|
||||||
default:
|
|
||||||
return WaitTreeItem::GetColor();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeThread::GetChildren() const {
|
|
||||||
std::vector<std::unique_ptr<WaitTreeItem>> list(WaitTreeSynchronizationObject::GetChildren());
|
|
||||||
|
|
||||||
const auto& thread = static_cast<const Kernel::KThread&>(object);
|
|
||||||
|
|
||||||
QString processor;
|
|
||||||
switch (thread.GetActiveCore()) {
|
|
||||||
case Kernel::Svc::IdealCoreUseProcessValue:
|
|
||||||
processor = tr("ideal");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
processor = tr("core %1").arg(thread.GetActiveCore());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
list.push_back(std::make_unique<WaitTreeText>(tr("processor = %1").arg(processor)));
|
|
||||||
list.push_back(std::make_unique<WaitTreeText>(
|
|
||||||
tr("affinity mask = %1").arg(thread.GetAffinityMask().GetAffinityMask())));
|
|
||||||
list.push_back(std::make_unique<WaitTreeText>(tr("thread id = %1").arg(thread.GetThreadId())));
|
|
||||||
list.push_back(std::make_unique<WaitTreeText>(tr("priority = %1(current) / %2(normal)")
|
|
||||||
.arg(thread.GetPriority())
|
|
||||||
.arg(thread.GetBasePriority())));
|
|
||||||
list.push_back(std::make_unique<WaitTreeText>(
|
|
||||||
tr("last running ticks = %1").arg(thread.GetLastScheduledTick())));
|
|
||||||
|
|
||||||
list.push_back(std::make_unique<WaitTreeCallstack>(thread, system));
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
WaitTreeEvent::WaitTreeEvent(const Kernel::KReadableEvent& object_, Core::System& system_)
|
|
||||||
: WaitTreeSynchronizationObject(object_, system_) {}
|
|
||||||
WaitTreeEvent::~WaitTreeEvent() = default;
|
|
||||||
|
|
||||||
WaitTreeThreadList::WaitTreeThreadList(std::vector<Kernel::KThread*>&& list, Core::System& system_)
|
|
||||||
: thread_list(std::move(list)), system{system_} {}
|
|
||||||
WaitTreeThreadList::~WaitTreeThreadList() = default;
|
|
||||||
|
|
||||||
QString WaitTreeThreadList::GetText() const {
|
|
||||||
return tr("waited by thread");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeThreadList::GetChildren() const {
|
|
||||||
std::vector<std::unique_ptr<WaitTreeItem>> list(thread_list.size());
|
|
||||||
std::transform(thread_list.begin(), thread_list.end(), list.begin(),
|
|
||||||
[this](const auto& t) { return std::make_unique<WaitTreeThread>(*t, system); });
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
WaitTreeModel::WaitTreeModel(Core::System& system_, QObject* parent)
|
|
||||||
: QAbstractItemModel(parent), system{system_} {}
|
|
||||||
WaitTreeModel::~WaitTreeModel() = default;
|
|
||||||
|
|
||||||
QModelIndex WaitTreeModel::index(int row, int column, const QModelIndex& parent) const {
|
|
||||||
if (!hasIndex(row, column, parent))
|
|
||||||
return {};
|
|
||||||
|
|
||||||
if (parent.isValid()) {
|
|
||||||
WaitTreeItem* parent_item = static_cast<WaitTreeItem*>(parent.internalPointer());
|
|
||||||
parent_item->Expand();
|
|
||||||
return createIndex(row, column, parent_item->Children()[row].get());
|
|
||||||
}
|
|
||||||
|
|
||||||
return createIndex(row, column, thread_items[row].get());
|
|
||||||
}
|
|
||||||
|
|
||||||
QModelIndex WaitTreeModel::parent(const QModelIndex& index) const {
|
|
||||||
if (!index.isValid())
|
|
||||||
return {};
|
|
||||||
|
|
||||||
WaitTreeItem* parent_item = static_cast<WaitTreeItem*>(index.internalPointer())->Parent();
|
|
||||||
if (!parent_item) {
|
|
||||||
return QModelIndex();
|
|
||||||
}
|
|
||||||
return createIndex(static_cast<int>(parent_item->Row()), 0, parent_item);
|
|
||||||
}
|
|
||||||
|
|
||||||
int WaitTreeModel::rowCount(const QModelIndex& parent) const {
|
|
||||||
if (!parent.isValid())
|
|
||||||
return static_cast<int>(thread_items.size());
|
|
||||||
|
|
||||||
WaitTreeItem* parent_item = static_cast<WaitTreeItem*>(parent.internalPointer());
|
|
||||||
parent_item->Expand();
|
|
||||||
return static_cast<int>(parent_item->Children().size());
|
|
||||||
}
|
|
||||||
|
|
||||||
int WaitTreeModel::columnCount(const QModelIndex&) const {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant WaitTreeModel::data(const QModelIndex& index, int role) const {
|
|
||||||
if (!index.isValid())
|
|
||||||
return {};
|
|
||||||
|
|
||||||
switch (role) {
|
|
||||||
case Qt::DisplayRole:
|
|
||||||
return static_cast<WaitTreeItem*>(index.internalPointer())->GetText();
|
|
||||||
case Qt::ForegroundRole:
|
|
||||||
return static_cast<WaitTreeItem*>(index.internalPointer())->GetColor();
|
|
||||||
default:
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void WaitTreeModel::ClearItems() {
|
|
||||||
thread_items.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void WaitTreeModel::InitItems() {
|
|
||||||
thread_items = WaitTreeItem::MakeThreadItemList(system);
|
|
||||||
}
|
|
||||||
|
|
||||||
WaitTreeWidget::WaitTreeWidget(Core::System& system_, QWidget* parent)
|
|
||||||
: QDockWidget(tr("&Wait Tree"), parent), system{system_} {
|
|
||||||
setObjectName(QStringLiteral("WaitTreeWidget"));
|
|
||||||
view = new QTreeView(this);
|
|
||||||
view->setHeaderHidden(true);
|
|
||||||
setWidget(view);
|
|
||||||
setEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
WaitTreeWidget::~WaitTreeWidget() = default;
|
|
||||||
|
|
||||||
void WaitTreeWidget::OnDebugModeEntered() {
|
|
||||||
if (!system.IsPoweredOn())
|
|
||||||
return;
|
|
||||||
model->InitItems();
|
|
||||||
view->setModel(model);
|
|
||||||
setEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void WaitTreeWidget::OnDebugModeLeft() {
|
|
||||||
setEnabled(false);
|
|
||||||
view->setModel(nullptr);
|
|
||||||
model->ClearItems();
|
|
||||||
}
|
|
||||||
|
|
||||||
void WaitTreeWidget::OnEmulationStarting(EmuThread* emu_thread) {
|
|
||||||
model = new WaitTreeModel(system, this);
|
|
||||||
view->setModel(model);
|
|
||||||
setEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void WaitTreeWidget::OnEmulationStopping() {
|
|
||||||
view->setModel(nullptr);
|
|
||||||
delete model;
|
|
||||||
setEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
@ -1,188 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: 2016 Citra Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <cstddef>
|
|
||||||
#include <memory>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include <QDockWidget>
|
|
||||||
#include <QTreeView>
|
|
||||||
|
|
||||||
#include "common/common_types.h"
|
|
||||||
#include "core/hle/kernel/k_auto_object.h"
|
|
||||||
#include "core/hle/kernel/svc_common.h"
|
|
||||||
|
|
||||||
class EmuThread;
|
|
||||||
|
|
||||||
namespace Core {
|
|
||||||
class System;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Kernel {
|
|
||||||
class KHandleTable;
|
|
||||||
class KReadableEvent;
|
|
||||||
class KSynchronizationObject;
|
|
||||||
class KThread;
|
|
||||||
} // namespace Kernel
|
|
||||||
|
|
||||||
class WaitTreeThread;
|
|
||||||
|
|
||||||
class WaitTreeItem : public QObject {
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
WaitTreeItem();
|
|
||||||
~WaitTreeItem() override;
|
|
||||||
|
|
||||||
virtual bool IsExpandable() const;
|
|
||||||
virtual std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const;
|
|
||||||
virtual QString GetText() const = 0;
|
|
||||||
virtual QColor GetColor() const;
|
|
||||||
|
|
||||||
void Expand();
|
|
||||||
WaitTreeItem* Parent() const;
|
|
||||||
const std::vector<std::unique_ptr<WaitTreeItem>>& Children() const;
|
|
||||||
std::size_t Row() const;
|
|
||||||
static std::vector<std::unique_ptr<WaitTreeThread>> MakeThreadItemList(Core::System& system);
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::size_t row;
|
|
||||||
bool expanded = false;
|
|
||||||
WaitTreeItem* parent = nullptr;
|
|
||||||
std::vector<std::unique_ptr<WaitTreeItem>> children;
|
|
||||||
};
|
|
||||||
|
|
||||||
class WaitTreeText : public WaitTreeItem {
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit WaitTreeText(QString text);
|
|
||||||
~WaitTreeText() override;
|
|
||||||
|
|
||||||
QString GetText() const override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
QString text;
|
|
||||||
};
|
|
||||||
|
|
||||||
class WaitTreeExpandableItem : public WaitTreeItem {
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
WaitTreeExpandableItem();
|
|
||||||
~WaitTreeExpandableItem() override;
|
|
||||||
|
|
||||||
bool IsExpandable() const override;
|
|
||||||
};
|
|
||||||
|
|
||||||
class WaitTreeCallstack : public WaitTreeExpandableItem {
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit WaitTreeCallstack(const Kernel::KThread& thread_, Core::System& system_);
|
|
||||||
~WaitTreeCallstack() override;
|
|
||||||
|
|
||||||
QString GetText() const override;
|
|
||||||
std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
const Kernel::KThread& thread;
|
|
||||||
|
|
||||||
Core::System& system;
|
|
||||||
};
|
|
||||||
|
|
||||||
class WaitTreeSynchronizationObject : public WaitTreeExpandableItem {
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit WaitTreeSynchronizationObject(const Kernel::KSynchronizationObject& object_,
|
|
||||||
Core::System& system_);
|
|
||||||
~WaitTreeSynchronizationObject() override;
|
|
||||||
|
|
||||||
static std::unique_ptr<WaitTreeSynchronizationObject> make(
|
|
||||||
const Kernel::KSynchronizationObject& object, Core::System& system);
|
|
||||||
QString GetText() const override;
|
|
||||||
std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
const Kernel::KSynchronizationObject& object;
|
|
||||||
|
|
||||||
private:
|
|
||||||
Core::System& system;
|
|
||||||
};
|
|
||||||
|
|
||||||
class WaitTreeThread : public WaitTreeSynchronizationObject {
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit WaitTreeThread(const Kernel::KThread& thread, Core::System& system_);
|
|
||||||
~WaitTreeThread() override;
|
|
||||||
|
|
||||||
QString GetText() const override;
|
|
||||||
QColor GetColor() const override;
|
|
||||||
std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
Core::System& system;
|
|
||||||
};
|
|
||||||
|
|
||||||
class WaitTreeEvent : public WaitTreeSynchronizationObject {
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit WaitTreeEvent(const Kernel::KReadableEvent& object_, Core::System& system_);
|
|
||||||
~WaitTreeEvent() override;
|
|
||||||
};
|
|
||||||
|
|
||||||
class WaitTreeThreadList : public WaitTreeExpandableItem {
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit WaitTreeThreadList(std::vector<Kernel::KThread*>&& list, Core::System& system_);
|
|
||||||
~WaitTreeThreadList() override;
|
|
||||||
|
|
||||||
QString GetText() const override;
|
|
||||||
std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::vector<Kernel::KThread*> thread_list;
|
|
||||||
|
|
||||||
Core::System& system;
|
|
||||||
};
|
|
||||||
|
|
||||||
class WaitTreeModel : public QAbstractItemModel {
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit WaitTreeModel(Core::System& system_, QObject* parent = nullptr);
|
|
||||||
~WaitTreeModel() override;
|
|
||||||
|
|
||||||
QVariant data(const QModelIndex& index, int role) const override;
|
|
||||||
QModelIndex index(int row, int column, const QModelIndex& parent) const override;
|
|
||||||
QModelIndex parent(const QModelIndex& index) const override;
|
|
||||||
int rowCount(const QModelIndex& parent) const override;
|
|
||||||
int columnCount(const QModelIndex& parent) const override;
|
|
||||||
|
|
||||||
void ClearItems();
|
|
||||||
void InitItems();
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::vector<std::unique_ptr<WaitTreeThread>> thread_items;
|
|
||||||
|
|
||||||
Core::System& system;
|
|
||||||
};
|
|
||||||
|
|
||||||
class WaitTreeWidget : public QDockWidget {
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit WaitTreeWidget(Core::System& system_, QWidget* parent = nullptr);
|
|
||||||
~WaitTreeWidget() override;
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void OnDebugModeEntered();
|
|
||||||
void OnDebugModeLeft();
|
|
||||||
|
|
||||||
void OnEmulationStarting(EmuThread* emu_thread);
|
|
||||||
void OnEmulationStopping();
|
|
||||||
|
|
||||||
private:
|
|
||||||
QTreeView* view;
|
|
||||||
WaitTreeModel* model;
|
|
||||||
|
|
||||||
Core::System& system;
|
|
||||||
};
|
|
||||||
|
|
@ -161,7 +161,6 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual
|
||||||
#include "qt_common/config/qt_config.h"
|
#include "qt_common/config/qt_config.h"
|
||||||
#include "yuzu/debugger/console.h"
|
#include "yuzu/debugger/console.h"
|
||||||
#include "yuzu/debugger/controller.h"
|
#include "yuzu/debugger/controller.h"
|
||||||
#include "yuzu/debugger/wait_tree.h"
|
|
||||||
#include "yuzu/data_dialog.h"
|
#include "yuzu/data_dialog.h"
|
||||||
#include "yuzu/deps_dialog.h"
|
#include "yuzu/deps_dialog.h"
|
||||||
#include "yuzu/ryujinx_dialog.h"
|
#include "yuzu/ryujinx_dialog.h"
|
||||||
|
|
@ -1373,19 +1372,9 @@ void GMainWindow::InitializeWidgets() {
|
||||||
void GMainWindow::InitializeDebugWidgets() {
|
void GMainWindow::InitializeDebugWidgets() {
|
||||||
QMenu* debug_menu = ui->menu_View_Debugging;
|
QMenu* debug_menu = ui->menu_View_Debugging;
|
||||||
|
|
||||||
waitTreeWidget = new WaitTreeWidget(*QtCommon::system, this);
|
|
||||||
addDockWidget(Qt::LeftDockWidgetArea, waitTreeWidget);
|
|
||||||
waitTreeWidget->hide();
|
|
||||||
debug_menu->addAction(waitTreeWidget->toggleViewAction());
|
|
||||||
|
|
||||||
controller_dialog = new ControllerDialog(QtCommon::system->HIDCore(), input_subsystem, this);
|
controller_dialog = new ControllerDialog(QtCommon::system->HIDCore(), input_subsystem, this);
|
||||||
controller_dialog->hide();
|
controller_dialog->hide();
|
||||||
debug_menu->addAction(controller_dialog->toggleViewAction());
|
debug_menu->addAction(controller_dialog->toggleViewAction());
|
||||||
|
|
||||||
connect(this, &GMainWindow::EmulationStarting, waitTreeWidget,
|
|
||||||
&WaitTreeWidget::OnEmulationStarting);
|
|
||||||
connect(this, &GMainWindow::EmulationStopping, waitTreeWidget,
|
|
||||||
&WaitTreeWidget::OnEmulationStopping);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::InitializeRecentFileMenuActions() {
|
void GMainWindow::InitializeRecentFileMenuActions() {
|
||||||
|
|
@ -1533,7 +1522,6 @@ void GMainWindow::RestoreUIState() {
|
||||||
|
|
||||||
ui->action_Display_Dock_Widget_Headers->setChecked(
|
ui->action_Display_Dock_Widget_Headers->setChecked(
|
||||||
UISettings::values.display_titlebar.GetValue());
|
UISettings::values.display_titlebar.GetValue());
|
||||||
OnDisplayTitleBars(ui->action_Display_Dock_Widget_Headers->isChecked());
|
|
||||||
|
|
||||||
ui->action_Show_Filter_Bar->setChecked(UISettings::values.show_filter_bar.GetValue());
|
ui->action_Show_Filter_Bar->setChecked(UISettings::values.show_filter_bar.GetValue());
|
||||||
game_list->SetFilterVisible(ui->action_Show_Filter_Bar->isChecked());
|
game_list->SetFilterVisible(ui->action_Show_Filter_Bar->isChecked());
|
||||||
|
|
@ -1657,7 +1645,6 @@ void GMainWindow::ConnectMenuEvents() {
|
||||||
// View
|
// View
|
||||||
connect_menu(ui->action_Fullscreen, &GMainWindow::ToggleFullscreen);
|
connect_menu(ui->action_Fullscreen, &GMainWindow::ToggleFullscreen);
|
||||||
connect_menu(ui->action_Single_Window_Mode, &GMainWindow::ToggleWindowMode);
|
connect_menu(ui->action_Single_Window_Mode, &GMainWindow::ToggleWindowMode);
|
||||||
connect_menu(ui->action_Display_Dock_Widget_Headers, &GMainWindow::OnDisplayTitleBars);
|
|
||||||
connect_menu(ui->action_Show_Filter_Bar, &GMainWindow::OnToggleFilterBar);
|
connect_menu(ui->action_Show_Filter_Bar, &GMainWindow::OnToggleFilterBar);
|
||||||
connect_menu(ui->action_Show_Status_Bar, &GMainWindow::OnToggleStatusBar);
|
connect_menu(ui->action_Show_Status_Bar, &GMainWindow::OnToggleStatusBar);
|
||||||
|
|
||||||
|
|
@ -1767,26 +1754,6 @@ void GMainWindow::UpdateMenuState() {
|
||||||
multiplayer_state->UpdateNotificationStatus();
|
multiplayer_state->UpdateNotificationStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnDisplayTitleBars(bool show) {
|
|
||||||
QList<QDockWidget*> widgets = findChildren<QDockWidget*>();
|
|
||||||
|
|
||||||
if (show) {
|
|
||||||
for (QDockWidget* widget : widgets) {
|
|
||||||
QWidget* old = widget->titleBarWidget();
|
|
||||||
widget->setTitleBarWidget(nullptr);
|
|
||||||
if (old != nullptr)
|
|
||||||
delete old;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (QDockWidget* widget : widgets) {
|
|
||||||
QWidget* old = widget->titleBarWidget();
|
|
||||||
widget->setTitleBarWidget(new QWidget());
|
|
||||||
if (old != nullptr)
|
|
||||||
delete old;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void GMainWindow::SetupPrepareForSleep() {
|
void GMainWindow::SetupPrepareForSleep() {
|
||||||
#ifdef __unix__
|
#ifdef __unix__
|
||||||
if (auto bus = QDBusConnection::systemBus(); bus.isConnected()) {
|
if (auto bus = QDBusConnection::systemBus(); bus.isConnected()) {
|
||||||
|
|
@ -2133,12 +2100,6 @@ void GMainWindow::BootGame(const QString& filename, Service::AM::FrontendAppletP
|
||||||
|
|
||||||
connect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame);
|
connect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame);
|
||||||
connect(render_window, &GRenderWindow::MouseActivity, this, &GMainWindow::OnMouseActivity);
|
connect(render_window, &GRenderWindow::MouseActivity, this, &GMainWindow::OnMouseActivity);
|
||||||
// BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views
|
|
||||||
// before the CPU continues
|
|
||||||
connect(emu_thread.get(), &EmuThread::DebugModeEntered, waitTreeWidget,
|
|
||||||
&WaitTreeWidget::OnDebugModeEntered, Qt::BlockingQueuedConnection);
|
|
||||||
connect(emu_thread.get(), &EmuThread::DebugModeLeft, waitTreeWidget,
|
|
||||||
&WaitTreeWidget::OnDebugModeLeft, Qt::BlockingQueuedConnection);
|
|
||||||
|
|
||||||
connect(emu_thread.get(), &EmuThread::LoadProgress, loading_screen,
|
connect(emu_thread.get(), &EmuThread::LoadProgress, loading_screen,
|
||||||
&LoadingScreen::OnLoadProgress, Qt::QueuedConnection);
|
&LoadingScreen::OnLoadProgress, Qt::QueuedConnection);
|
||||||
|
|
|
||||||
|
|
@ -390,7 +390,6 @@ private slots:
|
||||||
void OnToggleFilterBar();
|
void OnToggleFilterBar();
|
||||||
void OnToggleStatusBar();
|
void OnToggleStatusBar();
|
||||||
void OnGameListRefresh();
|
void OnGameListRefresh();
|
||||||
void OnDisplayTitleBars(bool);
|
|
||||||
void InitializeHotkeys();
|
void InitializeHotkeys();
|
||||||
void ToggleFullscreen();
|
void ToggleFullscreen();
|
||||||
bool UsingExclusiveFullscreen();
|
bool UsingExclusiveFullscreen();
|
||||||
|
|
@ -535,7 +534,6 @@ private:
|
||||||
QString startup_icon_theme;
|
QString startup_icon_theme;
|
||||||
|
|
||||||
// Debugger panes
|
// Debugger panes
|
||||||
WaitTreeWidget* waitTreeWidget;
|
|
||||||
ControllerDialog* controller_dialog;
|
ControllerDialog* controller_dialog;
|
||||||
|
|
||||||
QAction* actions_recent_files[max_recent_files_item];
|
QAction* actions_recent_files[max_recent_files_item];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue