mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 08:09:26 +01:00
Zelda uCode (SMS): fix a bug where we would receive more sync mails that expected.
Actually the sync mail sequences contain 3 mails, not 2. That's what happens when you don't look at the uCode enough... git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3824 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
d5c7105c78
commit
8cdae6fc1d
@ -34,6 +34,8 @@ CUCode_Zelda::CUCode_Zelda(CMailHandler& _rMailHandler, u32 _CRC)
|
||||
IUCode(_rMailHandler),
|
||||
m_CRC(_CRC),
|
||||
|
||||
m_NumSyncMail(0),
|
||||
|
||||
m_bSyncInProgress(false),
|
||||
m_MaxVoice(0),
|
||||
|
||||
@ -188,39 +190,41 @@ void CUCode_Zelda::HandleMail_LightVersion(u32 _uMail)
|
||||
|
||||
void CUCode_Zelda::HandleMail_SMSVersion(u32 _uMail)
|
||||
{
|
||||
if (m_bSyncCmdPending)
|
||||
if (m_bSyncInProgress)
|
||||
{
|
||||
if (m_bSyncInProgress)
|
||||
if (m_bSyncCmdPending)
|
||||
{
|
||||
m_bSyncInProgress = false;
|
||||
m_SyncFlags[(m_NumSyncMail << 1) ] = _uMail >> 16;
|
||||
m_SyncFlags[(m_NumSyncMail << 1) + 1] = _uMail & 0xFFFF;
|
||||
|
||||
m_SyncFlags[2] = _uMail >> 16;
|
||||
m_SyncFlags[3] = _uMail & 0xFFFF;
|
||||
|
||||
m_CurBuffer++;
|
||||
|
||||
m_rMailHandler.PushMail(DSP_SYNC);
|
||||
g_dspInitialize.pGenerateDSPInterrupt();
|
||||
m_rMailHandler.PushMail(0xF355FF00 | m_CurBuffer);
|
||||
|
||||
if (m_CurBuffer == m_NumBuffers)
|
||||
m_NumSyncMail++;
|
||||
if (m_NumSyncMail == 2)
|
||||
{
|
||||
m_rMailHandler.PushMail(DSP_FRAME_END);
|
||||
//g_dspInitialize.pGenerateDSPInterrupt();
|
||||
m_NumSyncMail = 0;
|
||||
m_bSyncInProgress = false;
|
||||
|
||||
soundStream->GetMixer()->SetHLEReady(true);
|
||||
DEBUG_LOG(DSPHLE, "Update the SoundThread to be in sync");
|
||||
soundStream->Update(); //do it in this thread to avoid sync problems
|
||||
m_CurBuffer++;
|
||||
|
||||
m_bSyncCmdPending = false;
|
||||
m_rMailHandler.PushMail(DSP_SYNC);
|
||||
g_dspInitialize.pGenerateDSPInterrupt();
|
||||
m_rMailHandler.PushMail(0xF355FF00 | m_CurBuffer);
|
||||
|
||||
if (m_CurBuffer == m_NumBuffers)
|
||||
{
|
||||
m_rMailHandler.PushMail(DSP_FRAME_END);
|
||||
//g_dspInitialize.pGenerateDSPInterrupt();
|
||||
|
||||
soundStream->GetMixer()->SetHLEReady(true);
|
||||
DEBUG_LOG(DSPHLE, "Update the SoundThread to be in sync");
|
||||
soundStream->Update(); //do it in this thread to avoid sync problems
|
||||
|
||||
m_bSyncCmdPending = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bSyncInProgress = true;
|
||||
|
||||
m_SyncFlags[0] = _uMail >> 16;
|
||||
m_SyncFlags[1] = _uMail & 0xFFFF;
|
||||
m_bSyncInProgress = false;
|
||||
}
|
||||
|
||||
return;
|
||||
@ -245,6 +249,11 @@ void CUCode_Zelda::HandleMail_SMSVersion(u32 _uMail)
|
||||
|
||||
// Here holds: m_bSyncInProgress == false && m_bListInProgress == false
|
||||
|
||||
if (_uMail == 0)
|
||||
{
|
||||
m_bSyncInProgress = true;
|
||||
m_NumSyncMail = 0;
|
||||
}
|
||||
if ((_uMail >> 16) == 0)
|
||||
{
|
||||
m_bListInProgress = true;
|
||||
@ -553,6 +562,8 @@ void CUCode_Zelda::DoState(PointerWrap &p)
|
||||
p.Do(m_MaxVoice);
|
||||
p.Do(m_SyncFlags);
|
||||
|
||||
p.Do(m_NumSyncMail);
|
||||
|
||||
p.Do(m_NumVoices);
|
||||
|
||||
p.Do(m_bSyncCmdPending);
|
||||
|
@ -242,6 +242,9 @@ private:
|
||||
u32 m_MaxVoice;
|
||||
u32 m_SyncFlags[16];
|
||||
|
||||
// Used by SMS version
|
||||
u32 m_NumSyncMail;
|
||||
|
||||
u32 m_NumVoices;
|
||||
|
||||
bool m_bSyncCmdPending;
|
||||
|
Loading…
x
Reference in New Issue
Block a user