DSPHLE: Remove unneeded calls to m_mail_handler.Clear()

It's cleared whenever the uCode changes, so there's no reason to clear it in a destructor or during initialization.

I've also renamed it to ClearPending.
This commit is contained in:
Pokechu22 2022-06-08 19:59:27 -07:00
parent b063f15dcc
commit 567f9bede4
8 changed files with 10 additions and 12 deletions

View File

@ -67,7 +67,7 @@ void DSPHLE::SendMailToDSP(u32 mail)
void DSPHLE::SetUCode(u32 crc)
{
m_mail_handler.Clear();
m_mail_handler.ClearPending();
m_ucode = UCodeFactory(crc, this, m_wii);
m_ucode->Initialize();
}
@ -77,7 +77,7 @@ void DSPHLE::SetUCode(u32 crc)
// Even callers are deleted.
void DSPHLE::SwapUCode(u32 crc)
{
m_mail_handler.Clear();
m_mail_handler.ClearPending();
if (m_last_ucode && UCodeInterface::GetCRC(m_last_ucode.get()) == crc)
{

View File

@ -19,7 +19,6 @@ CMailHandler::CMailHandler()
CMailHandler::~CMailHandler()
{
Clear();
}
void CMailHandler::PushMail(u32 mail, bool interrupt, int cycles_into_future)
@ -69,7 +68,7 @@ u16 CMailHandler::ReadDSPMailboxLow()
return 0x00;
}
void CMailHandler::Clear()
void CMailHandler::ClearPending()
{
while (!m_Mails.empty())
m_Mails.pop();
@ -84,7 +83,7 @@ void CMailHandler::Halt(bool _Halt)
{
if (_Halt)
{
Clear();
ClearPending();
PushMail(0x80544348);
}
}
@ -93,7 +92,7 @@ void CMailHandler::DoState(PointerWrap& p)
{
if (p.IsReadMode())
{
Clear();
ClearPending();
int sz = 0;
p.Do(sz);
for (int i = 0; i < sz; i++)

View File

@ -20,11 +20,15 @@ public:
// TODO: figure out correct timing for interrupts rather than defaulting to "immediately."
void PushMail(u32 mail, bool interrupt = false, int cycles_into_future = 0);
void Clear();
void Halt(bool _Halt);
void DoState(PointerWrap& p);
bool HasPending() const;
// Clear any pending mail from the current uCode. This is called by DSPHLE::SetUCode and
// DSPHLE::SwapUCode. Since pending mail is an abstraction for DSPHLE and not something that
// actually exists on real hardware, HLE implementations do not need to call this directly.
void ClearPending();
u16 ReadDSPMailboxHigh();
u16 ReadDSPMailboxLow();

View File

@ -34,7 +34,6 @@ AXUCode::AXUCode(DSPHLE* dsphle, u32 crc) : UCodeInterface(dsphle, crc)
AXUCode::~AXUCode()
{
m_mail_handler.Clear();
}
void AXUCode::Initialize()

View File

@ -18,7 +18,6 @@ CARDUCode::CARDUCode(DSPHLE* dsphle, u32 crc) : UCodeInterface(dsphle, crc)
CARDUCode::~CARDUCode()
{
m_mail_handler.Clear();
}
void CARDUCode::Initialize()

View File

@ -75,7 +75,6 @@ GBAUCode::GBAUCode(DSPHLE* dsphle, u32 crc) : UCodeInterface(dsphle, crc)
GBAUCode::~GBAUCode()
{
m_mail_handler.Clear();
}
void GBAUCode::Initialize()

View File

@ -34,7 +34,6 @@ ROMUCode::~ROMUCode()
void ROMUCode::Initialize()
{
m_mail_handler.Clear();
m_mail_handler.PushMail(0x8071FEED);
}

View File

@ -130,7 +130,6 @@ ZeldaUCode::ZeldaUCode(DSPHLE* dsphle, u32 crc) : UCodeInterface(dsphle, crc)
ZeldaUCode::~ZeldaUCode()
{
m_mail_handler.Clear();
}
void ZeldaUCode::Initialize()