diff --git a/pcsx2-qt/Debugger/SymbolTree/SymbolTreeDelegates.cpp b/pcsx2-qt/Debugger/SymbolTree/SymbolTreeDelegates.cpp index c9aaa6be7708a..1905e2ef76883 100644 --- a/pcsx2-qt/Debugger/SymbolTree/SymbolTreeDelegates.cpp +++ b/pcsx2-qt/Debugger/SymbolTree/SymbolTreeDelegates.cpp @@ -13,9 +13,11 @@ SymbolTreeLocationDelegate::SymbolTreeLocationDelegate( SymbolGuardian& guardian, + u32 alignment, QObject* parent) : QStyledItemDelegate(parent) , m_guardian(guardian) + , m_alignment(alignment) { } @@ -75,6 +77,8 @@ void SymbolTreeLocationDelegate::setModelData(QWidget* editor, QAbstractItemMode if (!ok) return; + address -= address % m_alignment; + bool success = false; m_guardian.BlockingReadWrite([&](ccc::SymbolDatabase& database) { if (node->symbol.move_symbol(address, database)) diff --git a/pcsx2-qt/Debugger/SymbolTree/SymbolTreeDelegates.h b/pcsx2-qt/Debugger/SymbolTree/SymbolTreeDelegates.h index 7e0f8e45b541e..3bfcacc4c9ced 100644 --- a/pcsx2-qt/Debugger/SymbolTree/SymbolTreeDelegates.h +++ b/pcsx2-qt/Debugger/SymbolTree/SymbolTreeDelegates.h @@ -14,6 +14,7 @@ class SymbolTreeLocationDelegate : public QStyledItemDelegate public: SymbolTreeLocationDelegate( SymbolGuardian& guardian, + u32 alignment, QObject* parent = nullptr); QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const override; @@ -22,6 +23,7 @@ class SymbolTreeLocationDelegate : public QStyledItemDelegate protected: SymbolGuardian& m_guardian; + u32 m_alignment; }; class SymbolTreeTypeDelegate : public QStyledItemDelegate diff --git a/pcsx2-qt/Debugger/SymbolTree/SymbolTreeWidgets.cpp b/pcsx2-qt/Debugger/SymbolTree/SymbolTreeWidgets.cpp index 2d655836fce3e..010cbfb9535ae 100644 --- a/pcsx2-qt/Debugger/SymbolTree/SymbolTreeWidgets.cpp +++ b/pcsx2-qt/Debugger/SymbolTree/SymbolTreeWidgets.cpp @@ -8,14 +8,14 @@ #include #include -#include "common/Assertions.h" #include "NewSymbolDialogs.h" #include "SymbolTreeDelegates.h" -SymbolTreeWidget::SymbolTreeWidget(u32 flags, DebugInterface& cpu, QWidget* parent) +SymbolTreeWidget::SymbolTreeWidget(u32 flags, s32 symbol_address_alignment, DebugInterface& cpu, QWidget* parent) : QWidget(parent) , m_cpu(cpu) , m_flags(flags) + , m_symbol_address_alignment(symbol_address_alignment) { m_ui.setupUi(this); @@ -66,7 +66,7 @@ void SymbolTreeWidget::setupTree() m_model = new SymbolTreeModel(m_cpu, this); m_ui.treeView->setModel(m_model); - auto location_delegate = new SymbolTreeLocationDelegate(m_cpu.GetSymbolGuardian(), this); + auto location_delegate = new SymbolTreeLocationDelegate(m_cpu.GetSymbolGuardian(), m_symbol_address_alignment, this); m_ui.treeView->setItemDelegateForColumn(SymbolTreeModel::LOCATION, location_delegate); auto type_delegate = new SymbolTreeTypeDelegate(m_cpu.GetSymbolGuardian(), this); @@ -448,7 +448,7 @@ SymbolTreeNode* SymbolTreeWidget::currentNode() } FunctionTreeWidget::FunctionTreeWidget(DebugInterface& cpu, QWidget* parent) - : SymbolTreeWidget(ALLOW_GROUPING, cpu, parent) + : SymbolTreeWidget(ALLOW_GROUPING, 4, cpu, parent) { } @@ -535,7 +535,7 @@ void FunctionTreeWidget::onDeleteButtonPressed() } GlobalVariableTreeWidget::GlobalVariableTreeWidget(DebugInterface& cpu, QWidget* parent) - : SymbolTreeWidget(ALLOW_GROUPING | ALLOW_SORTING_BY_IF_TYPE_IS_KNOWN | ALLOW_TYPE_ACTIONS, cpu, parent) + : SymbolTreeWidget(ALLOW_GROUPING | ALLOW_SORTING_BY_IF_TYPE_IS_KNOWN | ALLOW_TYPE_ACTIONS, 1, cpu, parent) { } @@ -649,7 +649,7 @@ void GlobalVariableTreeWidget::onDeleteButtonPressed() } LocalVariableTreeWidget::LocalVariableTreeWidget(DebugInterface& cpu, QWidget* parent) - : SymbolTreeWidget(ALLOW_TYPE_ACTIONS, cpu, parent) + : SymbolTreeWidget(ALLOW_TYPE_ACTIONS, 1, cpu, parent) { } @@ -747,7 +747,7 @@ void LocalVariableTreeWidget::onDeleteButtonPressed() } ParameterVariableTreeWidget::ParameterVariableTreeWidget(DebugInterface& cpu, QWidget* parent) - : SymbolTreeWidget(ALLOW_TYPE_ACTIONS, cpu, parent) + : SymbolTreeWidget(ALLOW_TYPE_ACTIONS, 1, cpu, parent) { } diff --git a/pcsx2-qt/Debugger/SymbolTree/SymbolTreeWidgets.h b/pcsx2-qt/Debugger/SymbolTree/SymbolTreeWidgets.h index 5ecb01437e163..fc4139d000dad 100644 --- a/pcsx2-qt/Debugger/SymbolTree/SymbolTreeWidgets.h +++ b/pcsx2-qt/Debugger/SymbolTree/SymbolTreeWidgets.h @@ -28,7 +28,7 @@ class SymbolTreeWidget : public QWidget void locationColumnClicked(u32 address); protected: - explicit SymbolTreeWidget(u32 flags, DebugInterface& cpu, QWidget* parent = nullptr); + explicit SymbolTreeWidget(u32 flags, s32 symbol_address_alignment, DebugInterface& cpu, QWidget* parent = nullptr); void setupTree(); void setupMenu(); @@ -89,6 +89,7 @@ class SymbolTreeWidget : public QWidget }; u32 m_flags; + u32 m_symbol_address_alignment; }; class FunctionTreeWidget : public SymbolTreeWidget