DSP plugin merge - the two DSP plugins are now gone and all the code has been merged into Dolphin.

This WILL temporarily break the Linux and MacOSX builds but should be easy to fix.

Things left to do:
  * The UI on the new Audio tab for the LLE/HLE choice is ugly
  * At times the code still look "plugin-y" and needs cleanup
  * The two plugins should be merged further. DSPHLE should use the emulated memory etc of DSPLLE as much as possible, so that simply saving the DSPLLE state is enough. This would also bring the possibility of savestate compatibility between the two plugins.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6947 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard
2011-01-28 18:39:30 +00:00
parent 976420b9d5
commit 419d6a244b
116 changed files with 1271 additions and 3914 deletions

View File

@ -3,6 +3,10 @@ set(SRCS Src/BreakpointDlg.cpp
Src/BreakpointWindow.cpp
Src/CodeWindow.cpp
Src/CodeWindowFunctions.cpp
Src/DSPDebugWindow.cpp
Src/DSPDebugWindow.h
Src/DSPRegisterView.cpp
Src/DSPRegisterView.h
Src/JitWindow.cpp
Src/MemoryCheckDlg.cpp
Src/MemoryWindow.cpp

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Version="9,00"
Name="Debugger"
ProjectGUID="{4D3CD4C5-412B-4B49-9B1B-A68A2A129C77}"
RootNamespace="DebuggerWX"
@ -46,7 +46,7 @@
Name="VCCLCompilerTool"
Optimization="0"
WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\DebuggerUICommon\Src"
AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\DSPCore\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\DebuggerUICommon\Src"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__WXMSW__;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@ -113,7 +113,7 @@
Name="VCCLCompilerTool"
Optimization="0"
WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\DebuggerUICommon\Src"
AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\DSPCore\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\DebuggerUICommon\Src"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__WXMSW__;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
MinimalRebuild="true"
ExceptionHandling="2"
@ -179,7 +179,7 @@
<Tool
Name="VCCLCompilerTool"
WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\DebuggerUICommon\Src"
AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\DSPCore\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\DebuggerUICommon\Src"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__WXMSW__;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
RuntimeLibrary="0"
BufferSecurityCheck="false"
@ -246,7 +246,7 @@
Name="VCCLCompilerTool"
AdditionalOptions="/MP"
WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\DebuggerUICommon\Src"
AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\DSPCore\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\DebuggerUICommon\Src"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__WXMSW__;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
RuntimeLibrary="0"
BufferSecurityCheck="false"
@ -311,7 +311,7 @@
Name="VCCLCompilerTool"
Optimization="0"
WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\DebuggerUICommon\Src"
AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\DSPCore\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\DebuggerUICommon\Src"
PreprocessorDefinitions="WIN32;__WXMSW__;_WINDOWS;NOPCH;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;DEBUGFAST"
MinimalRebuild="true"
BasicRuntimeChecks="0"
@ -379,7 +379,7 @@
<Tool
Name="VCCLCompilerTool"
WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\DebuggerUICommon\Src"
AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\DSPCore\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\DebuggerUICommon\Src"
PreprocessorDefinitions="WIN32;__WXMSW__;_WINDOWS;NOPCH;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;DEBUGFAST"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@ -732,6 +732,10 @@
RelativePath=".\src\BreakpointWindow.h"
>
</File>
<File
RelativePath=".\CMakeLists.txt"
>
</File>
<File
RelativePath=".\src\CodeWindow.cpp"
>
@ -784,6 +788,22 @@
RelativePath=".\Src\CodeWindowFunctions.cpp"
>
</File>
<File
RelativePath=".\Src\DSPDebugWindow.cpp"
>
</File>
<File
RelativePath=".\Src\DSPDebugWindow.h"
>
</File>
<File
RelativePath=".\Src\DSPRegisterView.cpp"
>
</File>
<File
RelativePath=".\Src\DSPRegisterView.h"
>
</File>
<File
RelativePath=".\src\JitWindow.cpp"
>

View File

@ -90,6 +90,7 @@ class CCodeWindow
void ToggleBreakPointWindow(bool bShow);
void ToggleMemoryWindow(bool bShow);
void ToggleJitWindow(bool bShow);
void ToggleSoundWindow(bool bShow);
void ToggleDLLWindow(int Id, bool bShow);
void OnChangeFont(wxCommandEvent& event);

View File

@ -512,6 +512,27 @@ void CCodeWindow::ToggleJitWindow(bool bShow)
}
}
void CCodeWindow::ToggleSoundWindow(bool bShow)
{
GetMenuBar()->FindItem(IDM_SOUNDWINDOW)->Check(bShow);
if (bShow)
{
/* TODO: Resurrect DSP debugger window.
if (!m_JitWindow)
m_JitWindow = new CJitWindow(Parent, IDM_SOUNDWINDOW);
Parent->DoAddPage(m_JitWindow,
iNbAffiliation[IDM_SOUNDWINDOW - IDM_LOGWINDOW],
Parent->bFloatWindow[IDM_SOUNDWINDOW - IDM_LOGWINDOW]);
*/
}
else // Close
{
//Parent->DoRemovePage(m_JitWindow, false);
// m_JitWindow = NULL;
}
}
// Notice: This windows docking will produce several wx debugging messages for plugin
// windows when ::GetWindowRect and ::DestroyWindow fails in wxApp::CleanUp() for the
// plugin.
@ -525,10 +546,6 @@ void CCodeWindow::ToggleDLLWindow(int Id, bool bShow)
switch(Id)
{
case IDM_SOUNDWINDOW:
DLLName = SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str();
PluginType = PLUGIN_TYPE_DSP;
break;
case IDM_VIDEOWINDOW:
DLLName = SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str();
PluginType = PLUGIN_TYPE_VIDEO;

View File

@ -0,0 +1,289 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "Common.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <wx/artprov.h>
#include "StringUtil.h"
#include "DSPDebugWindow.h"
#include "DSPRegisterView.h"
#include "CodeView.h"
#include "MemoryView.h"
#include "HW\DSPLLE\DSPSymbols.h"
// Define these here to avoid undefined symbols while still saving functionality
void Host_NotifyMapLoaded() {}
void Host_UpdateBreakPointView() {}
DSPDebuggerLLE* m_DebuggerFrame = NULL;
BEGIN_EVENT_TABLE(DSPDebuggerLLE, wxPanel)
EVT_CLOSE(DSPDebuggerLLE::OnClose)
EVT_MENU_RANGE(ID_RUNTOOL, ID_SHOWPCTOOL, DSPDebuggerLLE::OnChangeState)
EVT_TEXT_ENTER(ID_ADDRBOX, DSPDebuggerLLE::OnAddrBoxChange)
EVT_LISTBOX(ID_SYMBOLLIST, DSPDebuggerLLE::OnSymbolListChange)
END_EVENT_TABLE()
DSPDebuggerLLE::DSPDebuggerLLE(wxWindow* parent)
: wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(700, 800),
wxTAB_TRAVERSAL, _("DSP LLE Debugger"))
, m_CachedStepCounter(-1)
{
// notify wxAUI which frame to use
m_mgr.SetManagedWindow(this);
m_Toolbar = new wxAuiToolBar(this, ID_TOOLBAR,
wxDefaultPosition, wxDefaultSize, wxAUI_TB_HORZ_TEXT);
m_Toolbar->AddTool(ID_RUNTOOL, wxT("Pause"),
wxArtProvider::GetBitmap(wxART_TICK_MARK, wxART_OTHER, wxSize(10,10)));
m_Toolbar->AddTool(ID_STEPTOOL, wxT("Step"),
wxArtProvider::GetBitmap(wxART_GO_DOWN, wxART_OTHER, wxSize(10,10)));
m_Toolbar->AddTool(ID_SHOWPCTOOL, wxT("Show PC"),
wxArtProvider::GetBitmap(wxART_GO_TO_PARENT, wxART_OTHER, wxSize(10,10)));
m_Toolbar->AddSeparator();
m_Toolbar->AddControl(new wxTextCtrl(m_Toolbar, ID_ADDRBOX, wxEmptyString,
wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER));
m_Toolbar->Realize();
m_SymbolList = new wxListBox(this, ID_SYMBOLLIST, wxDefaultPosition,
wxSize(140, 100), 0, NULL, wxLB_SORT);
m_MainNotebook = new wxAuiNotebook(this, wxID_ANY,
wxDefaultPosition, wxDefaultSize,
wxAUI_NB_TOP | wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_MOVE);
wxPanel *code_panel = new wxPanel(m_MainNotebook, wxID_ANY);
wxBoxSizer *code_sizer = new wxBoxSizer(wxVERTICAL);
m_CodeView = new CCodeView(&debug_interface, &DSPSymbols::g_dsp_symbol_db, code_panel);
m_CodeView->SetPlain();
code_sizer->Add(m_CodeView, 1, wxALL | wxEXPAND);
code_panel->SetSizer(code_sizer);
code_sizer->SetSizeHints(code_panel);
m_MainNotebook->AddPage(code_panel, wxT("Disasm"), true);
wxPanel *mem_panel = new wxPanel(m_MainNotebook, wxID_ANY);
wxBoxSizer *mem_sizer = new wxBoxSizer(wxVERTICAL);
// TODO insert memViewer class
m_MemView = new CMemoryView(&debug_interface, mem_panel);
mem_sizer->Add(m_MemView, 1, wxALL | wxEXPAND);
mem_panel->SetSizer(mem_sizer);
mem_sizer->SetSizeHints(mem_panel);
m_MainNotebook->AddPage(mem_panel, wxT("Mem"));
m_Regs = new DSPRegisterView(this, ID_DSP_REGS);
// add the panes to the manager
m_mgr.AddPane(m_Toolbar, wxAuiPaneInfo().
ToolbarPane().Top().
LeftDockable(false).RightDockable(false));
m_mgr.AddPane(m_SymbolList, wxAuiPaneInfo().
Left().CloseButton(false).
Caption(wxT("Symbols")).Dockable(true));
m_mgr.AddPane(m_MainNotebook, wxAuiPaneInfo().
Name(wxT("m_MainNotebook")).Center().
CloseButton(false).MaximizeButton(true));
m_mgr.AddPane(m_Regs, wxAuiPaneInfo().Right().
CloseButton(false).Caption(wxT("Registers")).
Dockable(true));
UpdateState();
m_mgr.Update();
}
DSPDebuggerLLE::~DSPDebuggerLLE()
{
m_mgr.UnInit();
m_DebuggerFrame = NULL;
}
void DSPDebuggerLLE::OnClose(wxCloseEvent& event)
{
event.Skip();
}
void DSPDebuggerLLE::OnChangeState(wxCommandEvent& event)
{
if (DSPCore_GetState() == DSPCORE_STOP)
return;
switch (event.GetId())
{
case ID_RUNTOOL:
if (DSPCore_GetState() == DSPCORE_RUNNING)
DSPCore_SetState(DSPCORE_STEPPING);
else
DSPCore_SetState(DSPCORE_RUNNING);
break;
case ID_STEPTOOL:
if (DSPCore_GetState() == DSPCORE_STEPPING)
{
DSPCore_Step();
Refresh();
}
break;
case ID_SHOWPCTOOL:
FocusOnPC();
break;
}
UpdateState();
m_mgr.Update();
}
void DSPDebuggerLLE::Refresh()
{
#if defined HAVE_X11 && HAVE_X11
if (!wxIsMainThread())
wxMutexGuiEnter();
#endif
UpdateSymbolMap();
UpdateDisAsmListView();
UpdateRegisterFlags();
UpdateState();
m_mgr.Update();
#if defined HAVE_X11 && HAVE_X11
if (!wxIsMainThread())
wxMutexGuiLeave();
#endif
}
void DSPDebuggerLLE::FocusOnPC()
{
JumpToAddress(g_dsp.pc);
}
void DSPDebuggerLLE::UpdateState()
{
if (DSPCore_GetState() == DSPCORE_RUNNING)
{
m_Toolbar->SetToolLabel(ID_RUNTOOL, wxT("Pause"));
m_Toolbar->SetToolBitmap(ID_RUNTOOL,
wxArtProvider::GetBitmap(wxART_TICK_MARK, wxART_OTHER, wxSize(10,10)));
m_Toolbar->EnableTool(ID_STEPTOOL, false);
}
else
{
m_Toolbar->SetToolLabel(ID_RUNTOOL, wxT("Run"));
m_Toolbar->SetToolBitmap(ID_RUNTOOL,
wxArtProvider::GetBitmap(wxART_GO_FORWARD, wxART_OTHER, wxSize(10,10)));
m_Toolbar->EnableTool(ID_STEPTOOL, true);
}
m_Toolbar->Realize();
}
void DSPDebuggerLLE::UpdateDisAsmListView()
{
if (m_CachedStepCounter == g_dsp.step_counter)
return;
// show PC
FocusOnPC();
m_CachedStepCounter = g_dsp.step_counter;
m_Regs->Update();
}
void DSPDebuggerLLE::UpdateSymbolMap()
{
if (g_dsp.dram == NULL)
return;
m_SymbolList->Freeze(); // HyperIris: wx style fast filling
m_SymbolList->Clear();
for (SymbolDB::XFuncMap::iterator iter = DSPSymbols::g_dsp_symbol_db.GetIterator();
iter != DSPSymbols::g_dsp_symbol_db.End(); ++iter)
{
int idx = m_SymbolList->Append(wxString::FromAscii(iter->second.name.c_str()));
m_SymbolList->SetClientData(idx, (void*)&iter->second);
}
m_SymbolList->Thaw();
}
void DSPDebuggerLLE::OnSymbolListChange(wxCommandEvent& event)
{
int index = m_SymbolList->GetSelection();
if (index >= 0) {
Symbol* pSymbol = static_cast<Symbol *>(m_SymbolList->GetClientData(index));
if (pSymbol != NULL)
{
if (pSymbol->type == Symbol::SYMBOL_FUNCTION)
{
JumpToAddress(pSymbol->address);
}
}
}
}
void DSPDebuggerLLE::UpdateRegisterFlags()
{
}
void DSPDebuggerLLE::OnAddrBoxChange(wxCommandEvent& event)
{
wxTextCtrl* pAddrCtrl = (wxTextCtrl*)m_Toolbar->FindControl(ID_ADDRBOX);
wxString txt = pAddrCtrl->GetValue();
std::string text(txt.mb_str());
text = StripSpaces(text);
if (text.size())
{
u32 addr;
sscanf(text.c_str(), "%04x", &addr);
if (JumpToAddress(addr))
pAddrCtrl->SetBackgroundColour(*wxWHITE);
else
pAddrCtrl->SetBackgroundColour(*wxRED);
}
event.Skip();
}
bool DSPDebuggerLLE::JumpToAddress(u16 addr)
{
int page = m_MainNotebook->GetSelection();
if (page == 0)
{
// Center on valid instruction in IRAM/IROM
int new_line = DSPSymbols::Addr2Line(addr);
if (new_line >= 0) {
m_CodeView->Center(new_line);
return true;
}
}
else if (page == 1)
{
// Center on any location in any valid ROM/RAM
int seg = addr >> 12;
if (seg == 0 || seg == 1 ||
seg == 8 || seg == 0xf)
{
m_MemView->Center(addr);
return true;
}
}
return false;
}

View File

@ -0,0 +1,102 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _DSP_DEBUGGER_LLE_H
#define _DSP_DEBUGGER_LLE_H
// general things
#include <iostream>
#include <vector>
#include <list>
#include <map>
#include <algorithm>
#include <wx/wx.h>
#include <wx/frame.h>
#include <wx/button.h>
#include <wx/stattext.h>
#include <wx/statbox.h>
#include <wx/sizer.h>
#include <wx/listctrl.h>
#include <wx/statline.h>
#include <wx/aui/aui.h>
#include "disassemble.h"
#include "DSPInterpreter.h"
#include "DSPMemoryMap.h"
#include "HW/DSPLLE/DSPDebugInterface.h"
class DSPRegisterView;
class CCodeView;
class CMemoryView;
class DSPDebuggerLLE : public wxPanel
{
public:
DSPDebuggerLLE(wxWindow *parent);
virtual ~DSPDebuggerLLE();
void Refresh();
private:
DECLARE_EVENT_TABLE();
enum
{
ID_TOOLBAR = 1000,
ID_RUNTOOL,
ID_STEPTOOL,
ID_SHOWPCTOOL,
ID_ADDRBOX,
ID_SYMBOLLIST,
ID_DSP_REGS
};
DSPDebugInterface debug_interface;
u64 m_CachedStepCounter;
// GUI updaters
void UpdateDisAsmListView();
void UpdateRegisterFlags();
void UpdateSymbolMap();
void UpdateState();
// GUI items
wxAuiManager m_mgr;
wxAuiToolBar* m_Toolbar;
CCodeView* m_CodeView;
CMemoryView* m_MemView;
DSPRegisterView* m_Regs;
wxListBox* m_SymbolList;
wxAuiNotebook* m_MainNotebook;
void OnClose(wxCloseEvent& event);
void OnChangeState(wxCommandEvent& event);
void OnRightClick(wxListEvent& event);
void OnDoubleClick(wxListEvent& event);
void OnAddrBoxChange(wxCommandEvent& event);
void OnSymbolListChange(wxCommandEvent& event);
bool JumpToAddress(u16 addr);
void FocusOnPC();
void UnselectAll();
};
extern DSPDebuggerLLE* m_DebuggerFrame;
#endif //_DSP_DEBUGGER_LLE_H

View File

@ -0,0 +1,94 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "DSPDebugWindow.h"
#include "DSPRegisterView.h"
wxString CRegTable::GetValue(int row, int col)
{
if (row < 32) // 32 "normal" regs
{
switch (col)
{
case 0: return wxString::FromAscii(pdregname(row));
case 1: return wxString::Format(wxT("0x%04x"), DSPCore_ReadRegister(row));
default: return wxString::FromAscii("");
}
}
return wxString::FromAscii("");
}
void CRegTable::SetValue(int, int, const wxString &)
{
}
void CRegTable::UpdateCachedRegs()
{
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);
}
}
wxGridCellAttr *CRegTable::GetAttr(int row, int col, wxGridCellAttr::wxAttrKind)
{
wxGridCellAttr *attr = new wxGridCellAttr();
attr->SetBackgroundColour(wxColour(wxT("#FFFFFF")));
switch (col)
{
case 1:
attr->SetAlignment(wxALIGN_CENTER, wxALIGN_CENTER);
break;
default:
attr->SetAlignment(wxALIGN_LEFT, wxALIGN_CENTER);
break;
}
if (col == 1)
attr->SetTextColour(m_CachedRegHasChanged[row] ? wxColor(wxT("#FF0000")) : wxColor(wxT("#000000")));
attr->IncRef();
return attr;
}
DSPRegisterView::DSPRegisterView(wxWindow *parent, wxWindowID id)
: wxGrid(parent, id, wxDefaultPosition, wxSize(130, 120))
{
SetTable(new CRegTable(), true);
SetRowLabelSize(0);
SetColLabelSize(0);
DisableDragRowSize();
AutoSizeColumns();
}
void DSPRegisterView::Update()
{
((CRegTable *)GetTable())->UpdateCachedRegs();
ForceRefresh();
}

View File

@ -0,0 +1,56 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef __DSPREGISTERVIEW_h__
#define __DSPREGISTERVIEW_h__
#include <wx/grid.h>
class CRegTable : public wxGridTableBase
{
private:
u64 m_CachedCounter;
u16 m_CachedRegs[32];
bool m_CachedRegHasChanged[32];
DECLARE_NO_COPY_CLASS(CRegTable);
public:
CRegTable()
{
memset(m_CachedRegs, 0, sizeof(m_CachedRegs));
memset(m_CachedRegHasChanged, 0, sizeof(m_CachedRegHasChanged));
}
int GetNumberCols(void) {return 2;}
int GetNumberRows(void) {return 32;}
bool IsEmptyCell(int row, int col) {return false;}
wxString GetValue(int row, int col);
void SetValue(int row, int col, const wxString &);
wxGridCellAttr *GetAttr(int, int, wxGridCellAttr::wxAttrKind);
void UpdateCachedRegs();
};
class DSPRegisterView : public wxGrid
{
public:
DSPRegisterView(wxWindow* parent, wxWindowID id);
void Update();
};
#endif //__DSPREGISTERVIEW_h__

View File

@ -11,6 +11,10 @@ files = [
"BreakpointWindow.cpp",
"CodeWindow.cpp",
"CodeWindowFunctions.cpp",
"Src/DSPDebugWindow.cpp",
"Src/DSPDebugWindow.h",
"Src/DSPRegisterView.cpp",
"Src/DSPRegisterView.h",
"MemoryCheckDlg.cpp",
"MemoryWindow.cpp",
"RegisterWindow.cpp",