diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/AESnd.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/AESnd.cpp index 8a71b8a355..5084a6ed24 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/AESnd.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/AESnd.cpp @@ -81,7 +81,8 @@ bool AESndUCode::UseNewFlagMasks() const m_crc == HASH_2022_PAD || m_crc == HASH_2023; } -AESndUCode::AESndUCode(DSPHLE* dsphle, u32 crc) : UCodeInterface(dsphle, crc) +AESndUCode::AESndUCode(DSPHLE* dsphle, u32 crc) + : UCodeInterface(dsphle, crc), m_accelerator(dsphle->GetSystem().GetDSP()) { } @@ -239,6 +240,12 @@ void AESndUCode::DMAOutParameterBlock() HLEMemory_Write_U32(memory, m_parameter_block_addr + 40, m_parameter_block.flags); } +AESndAccelerator::AESndAccelerator(DSP::DSPManager& dsp) : m_dsp(dsp) +{ +} + +AESndAccelerator::~AESndAccelerator() = default; + void AESndAccelerator::OnEndException() { // exception5 - this updates internal state @@ -249,12 +256,12 @@ void AESndAccelerator::OnEndException() u8 AESndAccelerator::ReadMemory(u32 address) { - return Core::System::GetInstance().GetDSP().ReadARAM(address); + return m_dsp.ReadARAM(address); } void AESndAccelerator::WriteMemory(u32 address, u8 value) { - Core::System::GetInstance().GetDSP().WriteARAM(value, address); + m_dsp.WriteARAM(value, address); } static constexpr std::array ACCELERATOR_COEFS = {}; // all zeros diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/AESnd.h b/Source/Core/Core/HW/DSPHLE/UCodes/AESnd.h index 0d55f2ed06..874e0440db 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/AESnd.h +++ b/Source/Core/Core/HW/DSPHLE/UCodes/AESnd.h @@ -10,16 +10,32 @@ #include "Core/DSP/DSPAccelerator.h" #include "Core/HW/DSPHLE/UCodes/UCodes.h" +namespace DSP +{ +class DSPManager; +} + namespace DSP::HLE { class DSPHLE; class AESndAccelerator final : public Accelerator { +public: + explicit AESndAccelerator(DSP::DSPManager& dsp); + AESndAccelerator(const AESndAccelerator&) = delete; + AESndAccelerator(AESndAccelerator&&) = delete; + AESndAccelerator& operator=(const AESndAccelerator&) = delete; + AESndAccelerator& operator=(AESndAccelerator&&) = delete; + ~AESndAccelerator(); + protected: void OnEndException() override; u8 ReadMemory(u32 address) override; void WriteMemory(u32 address, u8 value) override; + +private: + DSP::DSPManager& m_dsp; }; class AESndUCode final : public UCodeInterface