2018-03-16 12:39:53 +01:00
|
|
|
// Copyright 2018 Dolphin Emulator Project
|
2021-07-05 03:22:19 +02:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2018-03-16 12:39:53 +01:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2022-04-25 07:03:26 +02:00
|
|
|
#include <QWidget>
|
2018-03-16 12:39:53 +01:00
|
|
|
|
|
|
|
#include "Common/CommonTypes.h"
|
2019-07-15 23:20:26 -04:00
|
|
|
|
2024-03-22 07:52:52 -07:00
|
|
|
class QFont;
|
2022-04-24 06:25:42 +02:00
|
|
|
class QPoint;
|
2022-04-26 02:13:18 +02:00
|
|
|
class QScrollBar;
|
2022-04-24 06:25:42 +02:00
|
|
|
|
2019-07-15 23:20:26 -04:00
|
|
|
namespace AddressSpace
|
|
|
|
{
|
|
|
|
enum class Type;
|
|
|
|
}
|
2018-03-16 12:39:53 +01:00
|
|
|
|
2023-02-12 11:07:11 +01:00
|
|
|
namespace Core
|
|
|
|
{
|
|
|
|
class CPUThreadGuard;
|
2023-03-28 20:26:52 +02:00
|
|
|
class System;
|
|
|
|
} // namespace Core
|
2023-02-12 11:07:11 +01:00
|
|
|
|
2022-04-25 07:03:26 +02:00
|
|
|
class MemoryViewTable;
|
|
|
|
|
|
|
|
class MemoryViewWidget final : public QWidget
|
2018-03-16 12:39:53 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2022-04-06 02:36:09 -07:00
|
|
|
enum class Type : int
|
2018-03-16 12:39:53 +01:00
|
|
|
{
|
2022-06-29 11:27:44 -07:00
|
|
|
Null = 0,
|
2022-04-06 02:36:09 -07:00
|
|
|
Hex8 = 1,
|
|
|
|
Hex16,
|
|
|
|
Hex32,
|
2022-04-17 00:47:05 -07:00
|
|
|
Hex64,
|
2022-06-29 11:27:44 -07:00
|
|
|
HexString,
|
2022-04-06 02:36:09 -07:00
|
|
|
Unsigned8,
|
|
|
|
Unsigned16,
|
|
|
|
Unsigned32,
|
|
|
|
Signed8,
|
|
|
|
Signed16,
|
|
|
|
Signed32,
|
2018-03-16 12:39:53 +01:00
|
|
|
ASCII,
|
2022-04-06 02:36:09 -07:00
|
|
|
Float32,
|
|
|
|
Double
|
2018-03-16 12:39:53 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
enum class BPType
|
|
|
|
{
|
|
|
|
ReadWrite,
|
|
|
|
ReadOnly,
|
|
|
|
WriteOnly
|
|
|
|
};
|
|
|
|
|
2024-03-01 06:52:03 -08:00
|
|
|
explicit MemoryViewWidget(Core::System& system, QWidget* parent = nullptr);
|
2018-03-16 12:39:53 +01:00
|
|
|
|
2022-09-30 15:01:56 -07:00
|
|
|
void CreateTable();
|
2018-03-16 12:39:53 +01:00
|
|
|
void Update();
|
2024-03-22 07:52:52 -07:00
|
|
|
void UpdateFont(const QFont& font);
|
2022-04-24 06:25:42 +02:00
|
|
|
void ToggleBreakpoint(u32 addr, bool row);
|
2018-03-16 12:39:53 +01:00
|
|
|
|
2023-06-08 12:01:56 -04:00
|
|
|
std::vector<u8> ConvertTextToBytes(Type type, QStringView input_text) const;
|
2019-04-11 01:50:52 -04:00
|
|
|
void SetAddressSpace(AddressSpace::Type address_space);
|
|
|
|
AddressSpace::Type GetAddressSpace() const;
|
2022-04-06 22:50:05 -07:00
|
|
|
void SetDisplay(Type type, int bytes_per_row, int alignment, bool dual_view);
|
2018-03-16 12:39:53 +01:00
|
|
|
void SetBPType(BPType type);
|
|
|
|
void SetAddress(u32 address);
|
2022-10-20 17:58:22 -07:00
|
|
|
void SetFocus() const;
|
2018-03-16 12:39:53 +01:00
|
|
|
|
|
|
|
void SetBPLoggingEnabled(bool enabled);
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void BreakpointsChanged();
|
2018-12-28 19:12:30 +01:00
|
|
|
void ShowCode(u32 address);
|
2021-02-17 21:12:27 +04:00
|
|
|
void RequestWatch(QString name, u32 address);
|
2018-03-16 12:39:53 +01:00
|
|
|
|
|
|
|
private:
|
2022-04-24 06:25:42 +02:00
|
|
|
void OnContextMenu(const QPoint& pos);
|
|
|
|
void OnCopyAddress(u32 addr);
|
|
|
|
void OnCopyHex(u32 addr);
|
2022-04-06 22:50:05 -07:00
|
|
|
void UpdateBreakpointTags();
|
2022-09-30 15:01:56 -07:00
|
|
|
void UpdateColumns();
|
2023-02-12 11:07:11 +01:00
|
|
|
void UpdateColumns(const Core::CPUThreadGuard* guard);
|
2022-04-26 02:13:18 +02:00
|
|
|
void ScrollbarActionTriggered(int action);
|
|
|
|
void ScrollbarSliderReleased();
|
2023-02-12 11:07:11 +01:00
|
|
|
QString ValueToString(const Core::CPUThreadGuard& guard, u32 address, Type type);
|
2018-03-16 12:39:53 +01:00
|
|
|
|
2023-03-28 20:26:52 +02:00
|
|
|
Core::System& m_system;
|
|
|
|
|
2022-04-25 07:03:26 +02:00
|
|
|
MemoryViewTable* m_table;
|
2022-04-26 02:13:18 +02:00
|
|
|
QScrollBar* m_scrollbar;
|
2019-07-15 23:20:26 -04:00
|
|
|
AddressSpace::Type m_address_space{};
|
2022-04-17 00:47:05 -07:00
|
|
|
Type m_type = Type::Hex32;
|
2018-03-16 12:39:53 +01:00
|
|
|
BPType m_bp_type = BPType::ReadWrite;
|
|
|
|
bool m_do_log = true;
|
2022-09-30 15:01:56 -07:00
|
|
|
u32 m_address = 0x80000000;
|
2022-10-20 17:58:22 -07:00
|
|
|
u32 m_address_highlight = 0;
|
2022-03-28 16:08:31 -07:00
|
|
|
int m_font_width = 0;
|
|
|
|
int m_font_vspace = 0;
|
2022-04-06 02:36:09 -07:00
|
|
|
int m_bytes_per_row = 16;
|
|
|
|
int m_alignment = 16;
|
2022-09-30 15:01:56 -07:00
|
|
|
int m_data_columns;
|
2022-04-06 22:50:05 -07:00
|
|
|
bool m_dual_view = false;
|
2022-04-25 07:03:26 +02:00
|
|
|
|
|
|
|
friend class MemoryViewTable;
|
2018-03-16 12:39:53 +01:00
|
|
|
};
|