-
Notifications
You must be signed in to change notification settings - Fork 2.6k
/
RegisterView.h
88 lines (74 loc) · 2.15 KB
/
RegisterView.h
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// Copyright 2008 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <array>
#include <cstddef>
#include <cstring>
#include <wx/grid.h>
#include "Common/CommonTypes.h"
// New register view:
// R0 0x8000000 F0 0.0000 F0_PS1 0.0000
// R1 0x8000000 F1 0.0000 F1_PS1 0.0000
// R31 0x8000000 F31 0.0000 F31_PS1 0.0000
// PC (specials)
// LR
// CTR
// CR0-7
// XER
// FPSCR
// MSR
// SRR0
// SRR1
// Exceptions
// Interrupt Mask (PI)
// Interrupt Cause(PI)
class CRegTable : public wxGridTableBase
{
public:
enum class FormatSpecifier
{
Hex8,
Hex16,
Float,
Double,
UInt,
Int
};
CRegTable();
int GetNumberCols() override { return 9; }
int GetNumberRows() override { return 32 + NUM_SPECIALS; }
bool IsEmptyCell(int row, int col) override { return row > 31 && col > 2; }
wxString GetValue(int row, int col) override;
void SetValue(int row, int col, const wxString&) override;
wxGridCellAttr* GetAttr(int, int, wxGridCellAttr::wxAttrKind) override;
void SetRegisterFormat(int col, int row, FormatSpecifier specifier);
void UpdateCachedRegs();
private:
static constexpr int NUM_SPECIALS = 15;
std::array<u32, 32> m_CachedRegs{};
std::array<u32, NUM_SPECIALS> m_CachedSpecialRegs{};
std::array<std::array<u64, 2>, 32> m_CachedFRegs{};
std::array<bool, 32> m_CachedRegHasChanged{};
std::array<bool, NUM_SPECIALS> m_CachedSpecialRegHasChanged{};
std::array<std::array<bool, 2>, 32> m_CachedFRegHasChanged{};
std::array<FormatSpecifier, 32> m_formatRegs{};
std::array<std::array<FormatSpecifier, 2>, 32> m_formatFRegs;
wxString FormatGPR(int reg_index);
wxString FormatFPR(int reg_index, int reg_part);
DECLARE_NO_COPY_CLASS(CRegTable);
};
class CRegisterView : public wxGrid
{
public:
CRegisterView(wxWindow* parent, wxWindowID id = wxID_ANY);
void Repopulate();
private:
void OnMouseDownR(wxGridEvent& event);
void OnPopupMenu(wxCommandEvent& event);
u32 m_selectedAddress = 0;
int m_selectedRow = 0;
int m_selectedColumn = 0;
// Owned by wx. Deleted implicitly upon destruction.
CRegTable* m_register_table;
};