Core/DSPHLE: Remove global System access from CMailHandler.

This commit is contained in:
Admiral H. Curtiss 2024-01-06 05:46:38 +01:00
parent 9be9cbda2f
commit a9bf93cf2a
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
3 changed files with 15 additions and 7 deletions

View File

@ -14,7 +14,7 @@
namespace DSP::HLE namespace DSP::HLE
{ {
DSPHLE::DSPHLE(Core::System& system) : m_system(system) DSPHLE::DSPHLE(Core::System& system) : m_mail_handler(system.GetDSP()), m_system(system)
{ {
} }

View File

@ -8,11 +8,10 @@
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/MsgHandler.h" #include "Common/MsgHandler.h"
#include "Core/HW/DSP.h" #include "Core/HW/DSP.h"
#include "Core/System.h"
namespace DSP::HLE 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()) if (m_pending_mails.empty())
{ {
Core::System::GetInstance().GetDSP().GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP, m_dsp.GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP, cycles_into_future);
cycles_into_future);
} }
else else
{ {
@ -60,7 +58,7 @@ u16 CMailHandler::ReadDSPMailboxLow()
if (generate_interrupt) 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. // Clear the top bit of the high mail word after the mail has been read.

View File

@ -8,6 +8,10 @@
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
namespace DSP
{
class DSPManager;
}
class PointerWrap; class PointerWrap;
namespace DSP::HLE namespace DSP::HLE
@ -15,7 +19,11 @@ namespace DSP::HLE
class CMailHandler class CMailHandler
{ {
public: 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(); ~CMailHandler();
// TODO: figure out correct timing for interrupts rather than defaulting to "immediately." // TODO: figure out correct timing for interrupts rather than defaulting to "immediately."
@ -44,5 +52,7 @@ private:
u32 m_last_mail = 0; u32 m_last_mail = 0;
// When halted, the DSP itself is not running, but the last mail can be read. // When halted, the DSP itself is not running, but the last mail can be read.
bool m_halted = false; bool m_halted = false;
DSP::DSPManager& m_dsp;
}; };
} // namespace DSP::HLE } // namespace DSP::HLE