2023-01-03 05:27:05 +00:00
|
|
|
/* PCSX2 - PS2 Emulator for PCs
|
|
|
|
* Copyright (C) 2002-2023 PCSX2 Dev Team
|
|
|
|
*
|
|
|
|
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU Lesser General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with PCSX2.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#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());
|
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();
|
|
|
|
|
|
|
|
private:
|
|
|
|
DebugInterface& m_cpu;
|
|
|
|
std::vector<BreakpointMemcheck> m_breakpoints;
|
|
|
|
};
|