DSPRegisterView: Get rid of magic numbers

This commit is contained in:
Lioncash 2016-10-06 12:47:57 -04:00
parent 5dedd0a85b
commit 2ba0d6eb77
3 changed files with 11 additions and 8 deletions

View File

@ -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)
{

View File

@ -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);

View File

@ -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;
}
}