diff --git a/Source/Core/Core/HW/DSPHLE/DSPHLE.cpp b/Source/Core/Core/HW/DSPHLE/DSPHLE.cpp index 22f6f70e86..e29fbddb71 100644 --- a/Source/Core/Core/HW/DSPHLE/DSPHLE.cpp +++ b/Source/Core/Core/HW/DSPHLE/DSPHLE.cpp @@ -14,7 +14,7 @@ namespace DSP::HLE { -DSPHLE::DSPHLE(Core::System& system) : m_system(system) +DSPHLE::DSPHLE(Core::System& system) : m_mail_handler(system.GetDSP()), m_system(system) { } diff --git a/Source/Core/Core/HW/DSPHLE/MailHandler.cpp b/Source/Core/Core/HW/DSPHLE/MailHandler.cpp index 33b044f69f..db783a51e7 100644 --- a/Source/Core/Core/HW/DSPHLE/MailHandler.cpp +++ b/Source/Core/Core/HW/DSPHLE/MailHandler.cpp @@ -8,11 +8,10 @@ #include "Common/Logging/Log.h" #include "Common/MsgHandler.h" #include "Core/HW/DSP.h" -#include "Core/System.h" namespace DSP::HLE { -CMailHandler::CMailHandler() +CMailHandler::CMailHandler(DSP::DSPManager& dsp) : m_dsp(dsp) { } @@ -26,8 +25,7 @@ void CMailHandler::PushMail(u32 mail, bool interrupt, int cycles_into_future) { if (m_pending_mails.empty()) { - Core::System::GetInstance().GetDSP().GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP, - cycles_into_future); + m_dsp.GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP, cycles_into_future); } else { @@ -60,7 +58,7 @@ u16 CMailHandler::ReadDSPMailboxLow() if (generate_interrupt) { - Core::System::GetInstance().GetDSP().GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP); + m_dsp.GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP); } } // Clear the top bit of the high mail word after the mail has been read. diff --git a/Source/Core/Core/HW/DSPHLE/MailHandler.h b/Source/Core/Core/HW/DSPHLE/MailHandler.h index ee38bcde53..5ce9a7af0d 100644 --- a/Source/Core/Core/HW/DSPHLE/MailHandler.h +++ b/Source/Core/Core/HW/DSPHLE/MailHandler.h @@ -8,6 +8,10 @@ #include "Common/CommonTypes.h" +namespace DSP +{ +class DSPManager; +} class PointerWrap; namespace DSP::HLE @@ -15,7 +19,11 @@ namespace DSP::HLE class CMailHandler { public: - CMailHandler(); + explicit CMailHandler(DSP::DSPManager& dsp); + CMailHandler(const CMailHandler& other) = delete; + CMailHandler(CMailHandler&& other) = delete; + CMailHandler& operator=(const CMailHandler& other) = delete; + CMailHandler& operator=(CMailHandler&& other) = delete; ~CMailHandler(); // TODO: figure out correct timing for interrupts rather than defaulting to "immediately." @@ -44,5 +52,7 @@ private: u32 m_last_mail = 0; // When halted, the DSP itself is not running, but the last mail can be read. bool m_halted = false; + + DSP::DSPManager& m_dsp; }; } // namespace DSP::HLE