2013-04-18 03:43:35 +00:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// 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/chartype.h>
|
|
|
|
#include <wx/colour.h>
|
|
|
|
#include <wx/defs.h>
|
|
|
|
#include <wx/gdicmn.h>
|
|
|
|
#include <wx/grid.h>
|
|
|
|
#include <wx/string.h>
|
|
|
|
#include <wx/windowid.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/WxUtils.h"
|
|
|
|
#include "DolphinWX/Debugger/DSPRegisterView.h"
|
2009-04-02 12:50:47 +00:00
|
|
|
|
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
|
|
|
{
|
2009-06-28 17:18:52 +00:00
|
|
|
if (row < 32) // 32 "normal" regs
|
2009-04-02 12:50:47 +00:00
|
|
|
{
|
|
|
|
switch (col)
|
|
|
|
{
|
2013-02-28 04:37:38 +00:00
|
|
|
case 0: return StrToWxStr(pdregname(row));
|
2014-05-17 17:17:28 +00:00
|
|
|
case 1: return wxString::Format("0x%04x", DSPCore_ReadRegister(row));
|
2011-12-22 22:28:12 +00:00
|
|
|
default: return wxEmptyString;
|
2009-04-02 12:50:47 +00:00
|
|
|
}
|
|
|
|
}
|
2011-12-22 22:28:12 +00:00
|
|
|
return wxEmptyString;
|
2009-04-02 12:50:47 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 04:52:19 +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
|
|
|
{
|
|
|
|
if (m_CachedCounter == g_dsp.step_counter)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_CachedCounter = g_dsp.step_counter;
|
|
|
|
|
2009-06-28 17:18:52 +00:00
|
|
|
for (int i = 0; i < 32; ++i)
|
2009-04-02 12:50:47 +00:00
|
|
|
{
|
2010-12-29 02:12:06 +00:00
|
|
|
m_CachedRegHasChanged[i] = (m_CachedRegs[i] != DSPCore_ReadRegister(i));
|
|
|
|
m_CachedRegs[i] = DSPCore_ReadRegister(i);
|
2009-04-02 12:50:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-29 04:52:19 +00:00
|
|
|
wxGridCellAttr *CDSPRegTable::GetAttr(int row, int col, wxGridCellAttr::wxAttrKind)
|
2009-04-02 12:50:47 +00:00
|
|
|
{
|
|
|
|
wxGridCellAttr *attr = new wxGridCellAttr();
|
|
|
|
|
2014-05-17 17:17:28 +00:00
|
|
|
attr->SetBackgroundColour(*wxWHITE);
|
2009-04-02 12:50:47 +00:00
|
|
|
|
|
|
|
switch (col)
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
attr->SetAlignment(wxALIGN_CENTER, wxALIGN_CENTER);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
attr->SetAlignment(wxALIGN_LEFT, wxALIGN_CENTER);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (col == 1)
|
2014-05-17 17:17:28 +00:00
|
|
|
attr->SetTextColour(m_CachedRegHasChanged[row] ? *wxRED : *wxBLACK);
|
2009-04-02 12:50:47 +00:00
|
|
|
|
|
|
|
attr->IncRef();
|
|
|
|
return attr;
|
|
|
|
}
|
|
|
|
|
|
|
|
DSPRegisterView::DSPRegisterView(wxWindow *parent, wxWindowID id)
|
2009-06-28 10:00:25 +00:00
|
|
|
: wxGrid(parent, id, wxDefaultPosition, wxSize(130, 120))
|
2009-04-02 12:50:47 +00:00
|
|
|
{
|
2011-01-29 04:52:19 +00:00
|
|
|
SetTable(new CDSPRegTable(), true);
|
2009-04-02 12:50:47 +00:00
|
|
|
SetRowLabelSize(0);
|
|
|
|
SetColLabelSize(0);
|
|
|
|
DisableDragRowSize();
|
|
|
|
|
|
|
|
AutoSizeColumns();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DSPRegisterView::Update()
|
|
|
|
{
|
2011-01-29 04:52:19 +00:00
|
|
|
((CDSPRegTable *)GetTable())->UpdateCachedRegs();
|
2010-08-01 00:47:14 +00:00
|
|
|
ForceRefresh();
|
2009-04-02 12:50:47 +00:00
|
|
|
}
|