From 1f0fe5a99a258aa1b60493e389b14b55b8197108 Mon Sep 17 00:00:00 2001 From: "Admiral H. Curtiss" Date: Mon, 8 Jan 2024 10:27:39 +0100 Subject: [PATCH] Core/DSPHLE: Store reference to DSPManager in HLEAccelerator (AX/AXWii). --- Source/Core/Core/HW/DSPHLE/UCodes/AX.cpp | 2 +- Source/Core/Core/HW/DSPHLE/UCodes/AXVoice.h | 21 +++++++++++++-------- Source/Core/Core/HW/DSPHLE/UCodes/AXWii.cpp | 2 +- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/AX.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/AX.cpp index d921e2d1ba..15001f8db3 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/AX.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/AX.cpp @@ -38,7 +38,7 @@ void AXUCode::Initialize() { InitializeShared(); - m_accelerator = std::make_unique(); + m_accelerator = std::make_unique(m_dsphle->GetSystem().GetDSP()); } void AXUCode::InitializeShared() diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/AXVoice.h b/Source/Core/Core/HW/DSPHLE/UCodes/AXVoice.h index 2e055608a2..4c9eec6df1 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/AXVoice.h +++ b/Source/Core/Core/HW/DSPHLE/UCodes/AXVoice.h @@ -150,6 +150,13 @@ void WritePB(Memory::MemoryManager& memory, u32 addr, const PB_TYPE& pb, u32 crc class HLEAccelerator final : public Accelerator { public: + explicit HLEAccelerator(DSP::DSPManager& dsp) : m_dsp(dsp) {} + HLEAccelerator(const HLEAccelerator&) = delete; + HLEAccelerator(HLEAccelerator&&) = delete; + HLEAccelerator& operator=(const HLEAccelerator&) = delete; + HLEAccelerator& operator=(HLEAccelerator&&) = delete; + ~HLEAccelerator() = default; + PB_TYPE* acc_pb = nullptr; protected: @@ -182,14 +189,12 @@ protected: } } - u8 ReadMemory(u32 address) override - { - return Core::System::GetInstance().GetDSP().ReadARAM(address); - } - void WriteMemory(u32 address, u8 value) override - { - Core::System::GetInstance().GetDSP().WriteARAM(value, address); - } + u8 ReadMemory(u32 address) override { return m_dsp.ReadARAM(address); } + + void WriteMemory(u32 address, u8 value) override { m_dsp.WriteARAM(value, address); } + +private: + DSP::DSPManager& m_dsp; }; // Sets up the simulated accelerator. diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/AXWii.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/AXWii.cpp index 094327c3c5..cbdb814d36 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/AXWii.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/AXWii.cpp @@ -34,7 +34,7 @@ void AXWiiUCode::Initialize() { InitializeShared(); - m_accelerator = std::make_unique(); + m_accelerator = std::make_unique(m_dsphle->GetSystem().GetDSP()); } void AXWiiUCode::HandleCommandList()