mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 00:59:44 -06:00
Add formatting options for viewing registers
All formatting are individual per registers and they all have one option to go back to their original hexadecimal form. - GPR: signed integer, unsigned integer, float - FPR: double Also happened to come accross an issue where editing the PFR would ignore the higher 32 bits of the new value, this had to be fixed for the format to work.
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <cstring>
|
||||
#include <wx/grid.h>
|
||||
|
||||
@ -27,25 +28,19 @@
|
||||
|
||||
#define NUM_SPECIALS 14
|
||||
|
||||
enum class FormatSpecifier;
|
||||
|
||||
class CRegTable : public wxGridTableBase
|
||||
{
|
||||
public:
|
||||
CRegTable()
|
||||
{
|
||||
memset(m_CachedRegs, 0, sizeof(m_CachedRegs));
|
||||
memset(m_CachedSpecialRegs, 0, sizeof(m_CachedSpecialRegs));
|
||||
memset(m_CachedFRegs, 0, sizeof(m_CachedFRegs));
|
||||
memset(m_CachedRegHasChanged, 0, sizeof(m_CachedRegHasChanged));
|
||||
memset(m_CachedSpecialRegHasChanged, 0, sizeof(m_CachedSpecialRegHasChanged));
|
||||
memset(m_CachedFRegHasChanged, 0, sizeof(m_CachedFRegHasChanged));
|
||||
}
|
||||
|
||||
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:
|
||||
@ -55,6 +50,16 @@ private:
|
||||
bool m_CachedRegHasChanged[32];
|
||||
bool m_CachedSpecialRegHasChanged[NUM_SPECIALS];
|
||||
bool m_CachedFRegHasChanged[32][2];
|
||||
std::array<FormatSpecifier, 32> m_formatRegs;
|
||||
std::array<std::array<FormatSpecifier, 2>, 32> m_formatFRegs;
|
||||
|
||||
u32 GetSpecialRegValue(int reg);
|
||||
void SetSpecialRegValue(int reg, u32 value);
|
||||
wxString GetFormatString(FormatSpecifier specifier);
|
||||
wxString FormatGPR(int reg_index);
|
||||
wxString FormatFPR(int reg_index, int reg_part);
|
||||
bool TryParseGPR(wxString str, FormatSpecifier format, u32* value);
|
||||
bool TryParseFPR(wxString str, FormatSpecifier format, unsigned long long int* value);
|
||||
|
||||
DECLARE_NO_COPY_CLASS(CRegTable);
|
||||
};
|
||||
@ -70,6 +75,8 @@ private:
|
||||
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;
|
||||
|
Reference in New Issue
Block a user