From e3de37e47bf6efd5989d56742e4090f1fa7e069b Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 29 Dec 2020 14:14:41 -0500 Subject: [PATCH] DSPCore: Make the accelerator private This is only used internally. --- Source/Core/Core/DSP/DSPCore.cpp | 4 +- Source/Core/Core/DSP/DSPCore.h | 3 +- Source/Core/Core/DSP/DSPHWInterface.cpp | 68 +++++++++++++------------ 3 files changed, 38 insertions(+), 37 deletions(-) diff --git a/Source/Core/Core/DSP/DSPCore.cpp b/Source/Core/Core/DSP/DSPCore.cpp index 45e7cdfe8a..c58aeb0249 100644 --- a/Source/Core/Core/DSP/DSPCore.cpp +++ b/Source/Core/Core/DSP/DSPCore.cpp @@ -120,7 +120,7 @@ SDSP::~SDSP() = default; bool SDSP::Initialize(const DSPInitOptions& opts) { step_counter = 0; - accelerator = std::make_unique(*this); + m_accelerator = std::make_unique(*this); irom = static_cast(Common::AllocateMemoryPages(DSP_IROM_BYTE_SIZE)); iram = static_cast(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); diff --git a/Source/Core/Core/DSP/DSPCore.h b/Source/Core/Core/DSP/DSPCore.h index 60b317eecf..504890dcb5 100644 --- a/Source/Core/Core/DSP/DSPCore.h +++ b/Source/Core/Core/DSP/DSPCore.h @@ -432,8 +432,6 @@ struct SDSP // Accelerator / DMA / other hardware registers. Not GPRs. std::array ifx_regs{}; - std::unique_ptr 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 m_accelerator; std::array, 2> m_mailbox; DSPCore& m_dsp_core; Analyzer m_analyzer; diff --git a/Source/Core/Core/DSP/DSPHWInterface.cpp b/Source/Core/Core/DSP/DSPHWInterface.cpp index 1b9cb2fe99..c0c2e0c36e 100644 --- a/Source/Core/Core/DSP/DSPHWInterface.cpp +++ b/Source/Core/Core/DSP/DSPHWInterface.cpp @@ -142,40 +142,42 @@ void SDSP::WriteIFX(u32 address, u16 value) break; case DSP_ACSAH: - accelerator->SetStartAddress(value << 16 | static_cast(accelerator->GetStartAddress())); + m_accelerator->SetStartAddress(value << 16 | + static_cast(m_accelerator->GetStartAddress())); break; case DSP_ACSAL: - accelerator->SetStartAddress(static_cast(accelerator->GetStartAddress() >> 16) << 16 | - value); - break; - case DSP_ACEAH: - accelerator->SetEndAddress(value << 16 | static_cast(accelerator->GetEndAddress())); - break; - case DSP_ACEAL: - accelerator->SetEndAddress(static_cast(accelerator->GetEndAddress() >> 16) << 16 | value); - break; - case DSP_ACCAH: - accelerator->SetCurrentAddress(value << 16 | - static_cast(accelerator->GetCurrentAddress())); - break; - case DSP_ACCAL: - accelerator->SetCurrentAddress(static_cast(accelerator->GetCurrentAddress() >> 16) << 16 | + m_accelerator->SetStartAddress(static_cast(m_accelerator->GetStartAddress() >> 16) << 16 | value); break; + case DSP_ACEAH: + m_accelerator->SetEndAddress(value << 16 | static_cast(m_accelerator->GetEndAddress())); + break; + case DSP_ACEAL: + m_accelerator->SetEndAddress(static_cast(m_accelerator->GetEndAddress() >> 16) << 16 | + value); + break; + case DSP_ACCAH: + m_accelerator->SetCurrentAddress(value << 16 | + static_cast(m_accelerator->GetCurrentAddress())); + break; + case DSP_ACCAL: + m_accelerator->SetCurrentAddress( + static_cast(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(accelerator->GetStartAddress() >> 16); + return static_cast(m_accelerator->GetStartAddress() >> 16); case DSP_ACSAL: - return static_cast(accelerator->GetStartAddress()); + return static_cast(m_accelerator->GetStartAddress()); case DSP_ACEAH: - return static_cast(accelerator->GetEndAddress() >> 16); + return static_cast(m_accelerator->GetEndAddress() >> 16); case DSP_ACEAL: - return static_cast(accelerator->GetEndAddress()); + return static_cast(m_accelerator->GetEndAddress()); case DSP_ACCAH: - return static_cast(accelerator->GetCurrentAddress() >> 16); + return static_cast(m_accelerator->GetCurrentAddress() >> 16); case DSP_ACCAL: - return static_cast(accelerator->GetCurrentAddress()); + return static_cast(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(&ifx_regs[DSP_COEF_A1_0])); + return m_accelerator->Read(reinterpret_cast(&ifx_regs[DSP_COEF_A1_0])); case DSP_ACDATA1: // Accelerator reads (Zelda type) - "UnkZelda" - return accelerator->ReadD3(); + return m_accelerator->ReadD3(); default: {