summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/Debugger/RegisterWidget.h
blob: 68358911dc3377fcd9e7ffed59ba3a664b1202a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright 2017 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#include <functional>

#include <QDockWidget>

#include "Common/CommonTypes.h"
#include "DolphinQt/Debugger/RegisterColumn.h"

class QTableWidget;
class QCloseEvent;
class QShowEvent;
namespace Core
{
class System;
}

class RegisterWidget : public QDockWidget
{
  Q_OBJECT
public:
  explicit RegisterWidget(QWidget* parent = nullptr);
  ~RegisterWidget() override;

signals:
  void RequestTableUpdate();
  void RequestViewInCode(u32 addr);
  void RequestViewInMemory(u32 addr);
  void RequestMemoryBreakpoint(u32 addr);
  void RequestWatch(QString name, u32 addr);
  void UpdateTable();
  void UpdateValue(QTableWidgetItem* item);
  void UpdateValueType(QTableWidgetItem* item);

protected:
  void closeEvent(QCloseEvent*) override;
  void showEvent(QShowEvent* event) override;

private:
  void CreateWidgets();
  void ConnectWidgets();
  void PopulateTable();

  void ShowContextMenu();
  void OnItemChanged(QTableWidgetItem* item);
  void OnDebugFontChanged(const QFont& font);

  void AddRegister(int row, int column, RegisterType type, const std::string& register_name,
                   std::function<u64()> get_reg, std::function<void(u64)> set_reg);

  void AutoStep(const std::string& reg) const;
  void Update();

  Core::System& m_system;

  QTableWidget* m_table;
  bool m_updating = false;
};