2024-07-30 11:42:36 +00:00
|
|
|
// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team
|
|
|
|
// SPDX-License-Identifier: GPL-3.0+
|
2023-01-03 05:27:05 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QtCore/QAbstractTableModel>
|
2023-10-15 16:41:10 +00:00
|
|
|
#include <QtWidgets/QHeaderView>
|
|
|
|
|
2023-01-03 05:27:05 +00:00
|
|
|
#include "DebugTools/DebugInterface.h"
|
|
|
|
#include "DebugTools/Breakpoints.h"
|
|
|
|
|
|
|
|
using BreakpointMemcheck = std::variant<BreakPoint, MemCheck>;
|
|
|
|
|
|
|
|
class BreakpointModel : public QAbstractTableModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
enum BreakpointColumns : int
|
|
|
|
{
|
2023-10-26 22:46:41 +00:00
|
|
|
ENABLED = 0,
|
|
|
|
TYPE,
|
2023-01-03 05:27:05 +00:00
|
|
|
OFFSET,
|
|
|
|
SIZE_LABEL,
|
|
|
|
OPCODE,
|
|
|
|
CONDITION,
|
|
|
|
HITS,
|
|
|
|
COLUMN_COUNT
|
|
|
|
};
|
|
|
|
|
2023-10-15 00:54:39 +00:00
|
|
|
enum BreakpointRoles : int
|
|
|
|
{
|
|
|
|
DataRole = Qt::UserRole,
|
|
|
|
ExportRole = Qt::UserRole + 1,
|
|
|
|
};
|
|
|
|
|
2023-10-15 16:41:10 +00:00
|
|
|
static constexpr QHeaderView::ResizeMode HeaderResizeModes[BreakpointColumns::COLUMN_COUNT] =
|
|
|
|
{
|
|
|
|
QHeaderView::ResizeMode::ResizeToContents,
|
|
|
|
QHeaderView::ResizeMode::ResizeToContents,
|
|
|
|
QHeaderView::ResizeMode::ResizeToContents,
|
|
|
|
QHeaderView::ResizeMode::Stretch,
|
|
|
|
QHeaderView::ResizeMode::Stretch,
|
|
|
|
QHeaderView::ResizeMode::ResizeToContents,
|
|
|
|
QHeaderView::ResizeMode::ResizeToContents,
|
|
|
|
};
|
|
|
|
|
2023-01-03 05:27:05 +00:00
|
|
|
explicit BreakpointModel(DebugInterface& cpu, QObject* parent = nullptr);
|
|
|
|
|
|
|
|
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
|
|
|
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
|
|
|
|
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
|
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
|
|
|
Qt::ItemFlags flags(const QModelIndex& index) const override;
|
|
|
|
bool setData(const QModelIndex& index, const QVariant& value, int role) override;
|
|
|
|
bool removeRows(int row, int count, const QModelIndex& index = QModelIndex()) override;
|
2023-01-12 09:15:55 +00:00
|
|
|
bool insertBreakpointRows(int row, int count, std::vector<BreakpointMemcheck> breakpoints, const QModelIndex& index = QModelIndex());
|
2024-01-19 01:15:40 +00:00
|
|
|
void loadBreakpointFromFieldList(QStringList breakpointFields);
|
2023-01-03 05:27:05 +00:00
|
|
|
|
|
|
|
BreakpointMemcheck at(int row) const { return m_breakpoints.at(row); };
|
2023-01-04 07:11:28 +00:00
|
|
|
|
2023-01-03 05:27:05 +00:00
|
|
|
void refreshData();
|
2024-01-19 01:15:40 +00:00
|
|
|
void clear();
|
2023-01-03 05:27:05 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
DebugInterface& m_cpu;
|
|
|
|
std::vector<BreakpointMemcheck> m_breakpoints;
|
|
|
|
};
|