DSPCore: Make the accelerator private

This is only used internally.
This commit is contained in:
Lioncash 2020-12-29 14:14:41 -05:00
parent 41316daf91
commit e3de37e47b
3 changed files with 38 additions and 37 deletions

View File

@ -120,7 +120,7 @@ SDSP::~SDSP() = default;
bool SDSP::Initialize(const DSPInitOptions& opts)
{
step_counter = 0;
accelerator = std::make_unique<LLEAccelerator>(*this);
m_accelerator = std::make_unique<LLEAccelerator>(*this);
irom = static_cast<u16*>(Common::AllocateMemoryPages(DSP_IROM_BYTE_SIZE));
iram = static_cast<u16*>(Common::AllocateMemoryPages(DSP_IRAM_BYTE_SIZE));
@ -386,7 +386,7 @@ void SDSP::DoState(PointerWrap& p)
p.Do(step_counter);
p.DoArray(ifx_regs);
accelerator->DoState(p);
m_accelerator->DoState(p);
p.Do(m_mailbox[0]);
p.Do(m_mailbox[1]);
Common::UnWriteProtectMemory(iram, DSP_IRAM_BYTE_SIZE, false);

View File

@ -432,8 +432,6 @@ struct SDSP
// Accelerator / DMA / other hardware registers. Not GPRs.
std::array<u16, 256> ifx_regs{};
std::unique_ptr<Accelerator> accelerator;
// When state saving, all of the above can just be memcpy'd into the save state.
// The below needs special handling.
u16* iram = nullptr;
@ -455,6 +453,7 @@ private:
u16 ReadIFXImpl(u16 address);
std::unique_ptr<Accelerator> m_accelerator;
std::array<std::atomic<u32>, 2> m_mailbox;
DSPCore& m_dsp_core;
Analyzer m_analyzer;

View File

@ -142,40 +142,42 @@ void SDSP::WriteIFX(u32 address, u16 value)
break;
case DSP_ACSAH:
accelerator->SetStartAddress(value << 16 | static_cast<u16>(accelerator->GetStartAddress()));
m_accelerator->SetStartAddress(value << 16 |
static_cast<u16>(m_accelerator->GetStartAddress()));
break;
case DSP_ACSAL:
accelerator->SetStartAddress(static_cast<u16>(accelerator->GetStartAddress() >> 16) << 16 |
m_accelerator->SetStartAddress(static_cast<u16>(m_accelerator->GetStartAddress() >> 16) << 16 |
value);
break;
case DSP_ACEAH:
accelerator->SetEndAddress(value << 16 | static_cast<u16>(accelerator->GetEndAddress()));
m_accelerator->SetEndAddress(value << 16 | static_cast<u16>(m_accelerator->GetEndAddress()));
break;
case DSP_ACEAL:
accelerator->SetEndAddress(static_cast<u16>(accelerator->GetEndAddress() >> 16) << 16 | value);
break;
case DSP_ACCAH:
accelerator->SetCurrentAddress(value << 16 |
static_cast<u16>(accelerator->GetCurrentAddress()));
break;
case DSP_ACCAL:
accelerator->SetCurrentAddress(static_cast<u16>(accelerator->GetCurrentAddress() >> 16) << 16 |
m_accelerator->SetEndAddress(static_cast<u16>(m_accelerator->GetEndAddress() >> 16) << 16 |
value);
break;
case DSP_ACCAH:
m_accelerator->SetCurrentAddress(value << 16 |
static_cast<u16>(m_accelerator->GetCurrentAddress()));
break;
case DSP_ACCAL:
m_accelerator->SetCurrentAddress(
static_cast<u16>(m_accelerator->GetCurrentAddress() >> 16) << 16 | value);
break;
case DSP_FORMAT:
accelerator->SetSampleFormat(value);
m_accelerator->SetSampleFormat(value);
break;
case DSP_YN1:
accelerator->SetYn1(value);
m_accelerator->SetYn1(value);
break;
case DSP_YN2:
accelerator->SetYn2(value);
m_accelerator->SetYn2(value);
break;
case DSP_PRED_SCALE:
accelerator->SetPredScale(value);
m_accelerator->SetPredScale(value);
break;
case DSP_ACDATA1: // Accelerator write (Zelda type) - "UnkZelda"
accelerator->WriteD3(value);
m_accelerator->WriteD3(value);
break;
default:
@ -222,29 +224,29 @@ u16 SDSP::ReadIFXImpl(u16 address)
return ifx_regs[address & 0xFF];
case DSP_ACSAH:
return static_cast<u16>(accelerator->GetStartAddress() >> 16);
return static_cast<u16>(m_accelerator->GetStartAddress() >> 16);
case DSP_ACSAL:
return static_cast<u16>(accelerator->GetStartAddress());
return static_cast<u16>(m_accelerator->GetStartAddress());
case DSP_ACEAH:
return static_cast<u16>(accelerator->GetEndAddress() >> 16);
return static_cast<u16>(m_accelerator->GetEndAddress() >> 16);
case DSP_ACEAL:
return static_cast<u16>(accelerator->GetEndAddress());
return static_cast<u16>(m_accelerator->GetEndAddress());
case DSP_ACCAH:
return static_cast<u16>(accelerator->GetCurrentAddress() >> 16);
return static_cast<u16>(m_accelerator->GetCurrentAddress() >> 16);
case DSP_ACCAL:
return static_cast<u16>(accelerator->GetCurrentAddress());
return static_cast<u16>(m_accelerator->GetCurrentAddress());
case DSP_FORMAT:
return accelerator->GetSampleFormat();
return m_accelerator->GetSampleFormat();
case DSP_YN1:
return accelerator->GetYn1();
return m_accelerator->GetYn1();
case DSP_YN2:
return accelerator->GetYn2();
return m_accelerator->GetYn2();
case DSP_PRED_SCALE:
return accelerator->GetPredScale();
return m_accelerator->GetPredScale();
case DSP_ACCELERATOR: // ADPCM Accelerator reads
return accelerator->Read(reinterpret_cast<s16*>(&ifx_regs[DSP_COEF_A1_0]));
return m_accelerator->Read(reinterpret_cast<s16*>(&ifx_regs[DSP_COEF_A1_0]));
case DSP_ACDATA1: // Accelerator reads (Zelda type) - "UnkZelda"
return accelerator->ReadD3();
return m_accelerator->ReadD3();
default:
{