summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorMarkus Wick <degasus@users.noreply.github.com>2016-10-08 10:40:14 +0200
committerGitHub <noreply@github.com>2016-10-08 10:40:14 +0200
commit1a2d71cb58afcafbfca4f8457c4f0c2e22d8d2a3 (patch)
treef22fabc9213d9c1ba6088f607b485ccc83e87cdc /Source/Core
parent4ba1100f3191c80e58f89c78d1e8965e126da8f3 (diff)
parent2ba0d6eb77eb1542a68d5a3998531578b4782b25 (diff)
Merge pull request #4310 from lioncash/dsptable
DSPRegisterView: Minor changes
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/DSP/DSPCore.cpp4
-rw-r--r--Source/Core/Core/DSP/DSPCore.h5
-rw-r--r--Source/Core/DolphinWX/Debugger/DSPRegisterView.cpp10
-rw-r--r--Source/Core/DolphinWX/Debugger/DSPRegisterView.h28
4 files changed, 23 insertions, 24 deletions
diff --git a/Source/Core/Core/DSP/DSPCore.cpp b/Source/Core/Core/DSP/DSPCore.cpp
index 428cd09fd3..5a0b06ad3d 100644
--- a/Source/Core/Core/DSP/DSPCore.cpp
+++ b/Source/Core/Core/DSP/DSPCore.cpp
@@ -331,7 +331,7 @@ void CompileCurrent()
}
}
-u16 DSPCore_ReadRegister(int reg)
+u16 DSPCore_ReadRegister(size_t reg)
{
switch (reg)
{
@@ -388,7 +388,7 @@ u16 DSPCore_ReadRegister(int reg)
}
}
-void DSPCore_WriteRegister(int reg, u16 val)
+void DSPCore_WriteRegister(size_t reg, u16 val)
{
switch (reg)
{
diff --git a/Source/Core/Core/DSP/DSPCore.h b/Source/Core/Core/DSP/DSPCore.h
index b270b0117a..c6ac49eb99 100644
--- a/Source/Core/Core/DSP/DSPCore.h
+++ b/Source/Core/Core/DSP/DSPCore.h
@@ -7,6 +7,7 @@
#include <array>
#include <atomic>
+#include <cstddef>
#include <memory>
#include <string>
@@ -358,5 +359,5 @@ DSPCoreState DSPCore_GetState();
void DSPCore_Step();
-u16 DSPCore_ReadRegister(int reg);
-void DSPCore_WriteRegister(int reg, u16 val);
+u16 DSPCore_ReadRegister(size_t reg);
+void DSPCore_WriteRegister(size_t reg, u16 val);
diff --git a/Source/Core/DolphinWX/Debugger/DSPRegisterView.cpp b/Source/Core/DolphinWX/Debugger/DSPRegisterView.cpp
index 4f0d6fb2d3..65fdc2b9ca 100644
--- a/Source/Core/DolphinWX/Debugger/DSPRegisterView.cpp
+++ b/Source/Core/DolphinWX/Debugger/DSPRegisterView.cpp
@@ -13,7 +13,7 @@
wxString CDSPRegTable::GetValue(int row, int col)
{
- if (row < 32) // 32 "normal" regs
+ if (row < GetNumberRows())
{
switch (col)
{
@@ -41,10 +41,12 @@ void CDSPRegTable::UpdateCachedRegs()
m_CachedCounter = g_dsp.step_counter;
- for (int i = 0; i < 32; ++i)
+ for (size_t i = 0; i < m_CachedRegs.size(); ++i)
{
- m_CachedRegHasChanged[i] = (m_CachedRegs[i] != DSPCore_ReadRegister(i));
- m_CachedRegs[i] = DSPCore_ReadRegister(i);
+ const u16 value = DSPCore_ReadRegister(i);
+
+ m_CachedRegHasChanged[i] = m_CachedRegs[i] != value;
+ m_CachedRegs[i] = value;
}
}
diff --git a/Source/Core/DolphinWX/Debugger/DSPRegisterView.h b/Source/Core/DolphinWX/Debugger/DSPRegisterView.h
index dccfb7f975..2d1354b5e9 100644
--- a/Source/Core/DolphinWX/Debugger/DSPRegisterView.h
+++ b/Source/Core/DolphinWX/Debugger/DSPRegisterView.h
@@ -4,26 +4,15 @@
#pragma once
-#include <cstring>
+#include <array>
#include <wx/grid.h>
#include "Common/CommonTypes.h"
-class CDSPRegTable : public wxGridTableBase
+class CDSPRegTable final : public wxGridTableBase
{
-private:
- u64 m_CachedCounter;
- u16 m_CachedRegs[32];
- bool m_CachedRegHasChanged[32];
-
- DECLARE_NO_COPY_CLASS(CDSPRegTable);
-
public:
- CDSPRegTable()
- {
- memset(m_CachedRegs, 0, sizeof(m_CachedRegs));
- memset(m_CachedRegHasChanged, 0, sizeof(m_CachedRegHasChanged));
- }
+ CDSPRegTable() = default;
int GetNumberCols() override { return 2; }
int GetNumberRows() override { return 32; }
@@ -32,12 +21,19 @@ public:
void SetValue(int row, int col, const wxString&) override;
wxGridCellAttr* GetAttr(int, int, wxGridCellAttr::wxAttrKind) override;
void UpdateCachedRegs();
+
+private:
+ u64 m_CachedCounter = 0;
+ std::array<u16, 32> m_CachedRegs{};
+ std::array<bool, 32> m_CachedRegHasChanged{};
+
+ DECLARE_NO_COPY_CLASS(CDSPRegTable);
};
-class DSPRegisterView : public wxGrid
+class DSPRegisterView final : public wxGrid
{
public:
- DSPRegisterView(wxWindow* parent, wxWindowID id = wxID_ANY);
+ explicit DSPRegisterView(wxWindow* parent, wxWindowID id = wxID_ANY);
void Repopulate();
private: