2015-05-24 04:55:12 +00:00
|
|
|
// Copyright 2009 Dolphin Emulator Project
|
2015-05-17 23:08:10 +00:00
|
|
|
// Licensed under GPLv2+
|
2013-04-18 03:43:35 +00:00
|
|
|
// Refer to the license.txt file included.
|
2009-04-02 12:50:47 +00:00
|
|
|
|
2014-02-22 22:36:30 +00:00
|
|
|
#include <wx/colour.h>
|
|
|
|
#include <wx/grid.h>
|
|
|
|
|
|
|
|
#include "Common/CommonTypes.h"
|
|
|
|
#include "Core/DSP/DSPCore.h"
|
|
|
|
#include "Core/DSP/DSPTables.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "DolphinWX/Debugger/DSPRegisterView.h"
|
2016-06-24 08:43:46 +00:00
|
|
|
#include "DolphinWX/WxUtils.h"
|
2014-02-22 22:36:30 +00:00
|
|
|
|
2011-01-29 04:52:19 +00:00
|
|
|
wxString CDSPRegTable::GetValue(int row, int col)
|
2009-04-02 12:50:47 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
if (row < 32) // 32 "normal" regs
|
|
|
|
{
|
|
|
|
switch (col)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
return StrToWxStr(pdregname(row));
|
|
|
|
case 1:
|
|
|
|
return wxString::Format("0x%04x", DSPCore_ReadRegister(row));
|
|
|
|
default:
|
|
|
|
return wxEmptyString;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return wxEmptyString;
|
2009-04-02 12:50:47 +00:00
|
|
|
}
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void CDSPRegTable::SetValue(int, int, const wxString&)
|
2009-04-02 12:50:47 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-01-29 04:52:19 +00:00
|
|
|
void CDSPRegTable::UpdateCachedRegs()
|
2009-04-02 12:50:47 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
if (m_CachedCounter == g_dsp.step_counter)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_CachedCounter = g_dsp.step_counter;
|
|
|
|
|
|
|
|
for (int i = 0; i < 32; ++i)
|
|
|
|
{
|
|
|
|
m_CachedRegHasChanged[i] = (m_CachedRegs[i] != DSPCore_ReadRegister(i));
|
|
|
|
m_CachedRegs[i] = DSPCore_ReadRegister(i);
|
|
|
|
}
|
2009-04-02 12:50:47 +00:00
|
|
|
}
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
wxGridCellAttr* CDSPRegTable::GetAttr(int row, int col, wxGridCellAttr::wxAttrKind)
|
2009-04-02 12:50:47 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
wxGridCellAttr* attr = new wxGridCellAttr();
|
2009-04-02 12:50:47 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
attr->SetBackgroundColour(*wxWHITE);
|
2009-04-02 12:50:47 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
switch (col)
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
attr->SetAlignment(wxALIGN_CENTER, wxALIGN_CENTER);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
attr->SetAlignment(wxALIGN_LEFT, wxALIGN_CENTER);
|
|
|
|
break;
|
|
|
|
}
|
2009-04-02 12:50:47 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
if (col == 1)
|
|
|
|
attr->SetTextColour(m_CachedRegHasChanged[row] ? *wxRED : *wxBLACK);
|
2009-04-02 12:50:47 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
return attr;
|
2009-04-02 12:50:47 +00:00
|
|
|
}
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
DSPRegisterView::DSPRegisterView(wxWindow* parent, wxWindowID id)
|
|
|
|
: wxGrid(parent, id, wxDefaultPosition, wxSize(130, 120))
|
2009-04-02 12:50:47 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
m_register_table = new CDSPRegTable();
|
2015-03-24 13:37:20 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
SetTable(m_register_table, true);
|
|
|
|
SetRowLabelSize(0);
|
|
|
|
SetColLabelSize(0);
|
|
|
|
DisableDragRowSize();
|
2009-04-02 12:50:47 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
AutoSizeColumns();
|
2009-04-02 12:50:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DSPRegisterView::Update()
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
m_register_table->UpdateCachedRegs();
|
|
|
|
ForceRefresh();
|
2009-04-02 12:50:47 +00:00
|
|
|
}
|