2015-05-24 06:55:12 +02:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2015-05-18 01:08:10 +02:00
|
|
|
// Licensed under GPLv2+
|
2013-04-18 05:43:35 +02:00
|
|
|
// Refer to the license.txt file included.
|
2008-12-08 05:46:09 +01:00
|
|
|
|
2014-02-10 19:54:46 +01:00
|
|
|
#pragma once
|
2008-12-08 05:46:09 +01:00
|
|
|
|
2016-09-01 00:31:39 +02:00
|
|
|
#include <array>
|
2016-09-30 06:37:08 +02:00
|
|
|
#include <cstddef>
|
2014-02-22 23:36:30 +01:00
|
|
|
#include <cstring>
|
2008-12-09 06:29:14 +01:00
|
|
|
#include <wx/grid.h>
|
2008-12-08 05:46:09 +01:00
|
|
|
|
2014-09-08 03:06:58 +02:00
|
|
|
#include "Common/CommonTypes.h"
|
2008-12-08 05:46:09 +01:00
|
|
|
|
2009-01-20 20:15:33 +01:00
|
|
|
// 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
|
2009-06-13 16:10:10 +02:00
|
|
|
// CR0-7
|
|
|
|
// FPSCR
|
2009-10-17 09:17:49 +02:00
|
|
|
// MSR
|
2009-01-20 20:15:33 +01:00
|
|
|
// SRR0
|
|
|
|
// SRR1
|
2009-06-13 16:10:10 +02:00
|
|
|
// Exceptions
|
2009-10-17 09:17:49 +02:00
|
|
|
// Interrupt Mask (PI)
|
|
|
|
// Interrupt Cause(PI)
|
2009-01-20 20:15:33 +01:00
|
|
|
|
2009-01-20 14:13:03 +01:00
|
|
|
class CRegTable : public wxGridTableBase
|
2008-12-09 06:29:14 +01:00
|
|
|
{
|
2009-01-20 14:13:03 +01:00
|
|
|
public:
|
2016-09-30 06:16:14 +02:00
|
|
|
enum class FormatSpecifier
|
|
|
|
{
|
|
|
|
Hex8,
|
|
|
|
Hex16,
|
|
|
|
Float,
|
|
|
|
Double,
|
|
|
|
UInt,
|
|
|
|
Int
|
|
|
|
};
|
|
|
|
|
2016-09-01 00:31:39 +02:00
|
|
|
CRegTable();
|
2016-06-24 10:43:46 +02:00
|
|
|
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;
|
2016-09-01 00:31:39 +02:00
|
|
|
void SetRegisterFormat(int col, int row, FormatSpecifier specifier);
|
2016-06-24 10:43:46 +02:00
|
|
|
void UpdateCachedRegs();
|
2009-01-20 14:13:03 +01:00
|
|
|
|
|
|
|
private:
|
2016-10-03 09:29:50 +02:00
|
|
|
static constexpr int NUM_SPECIALS = 14;
|
2016-09-30 06:37:08 +02:00
|
|
|
|
2016-09-30 07:11:52 +02:00
|
|
|
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{};
|
2016-09-01 00:31:39 +02:00
|
|
|
std::array<std::array<FormatSpecifier, 2>, 32> m_formatFRegs;
|
|
|
|
|
|
|
|
wxString FormatGPR(int reg_index);
|
|
|
|
wxString FormatFPR(int reg_index, int reg_part);
|
2009-01-20 20:15:33 +01:00
|
|
|
|
2016-06-24 10:43:46 +02:00
|
|
|
DECLARE_NO_COPY_CLASS(CRegTable);
|
2008-12-09 06:29:14 +01:00
|
|
|
};
|
|
|
|
|
2009-01-20 14:13:03 +01:00
|
|
|
class CRegisterView : public wxGrid
|
2008-12-08 05:46:09 +01:00
|
|
|
{
|
2009-01-20 14:13:03 +01:00
|
|
|
public:
|
2016-06-24 10:43:46 +02:00
|
|
|
CRegisterView(wxWindow* parent, wxWindowID id = wxID_ANY);
|
2016-10-03 09:29:50 +02:00
|
|
|
void Repopulate();
|
2015-04-28 02:36:09 +02:00
|
|
|
|
|
|
|
private:
|
2016-06-24 10:43:46 +02:00
|
|
|
void OnMouseDownR(wxGridEvent& event);
|
|
|
|
void OnPopupMenu(wxCommandEvent& event);
|
2014-10-23 15:47:00 +02:00
|
|
|
|
2016-06-24 10:43:46 +02:00
|
|
|
u32 m_selectedAddress = 0;
|
2016-09-01 00:31:39 +02:00
|
|
|
int m_selectedRow = 0;
|
|
|
|
int m_selectedColumn = 0;
|
2015-03-24 14:37:20 +01:00
|
|
|
|
2016-06-24 10:43:46 +02:00
|
|
|
// Owned by wx. Deleted implicitly upon destruction.
|
|
|
|
CRegTable* m_register_table;
|
2008-12-08 05:46:09 +01:00
|
|
|
};
|