dsphle - improved ax/axwii hle ucode switching (needed for Nintendo Puzzle Collection <-> GBA, ...)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6052 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Marko Pusljar 2010-08-04 16:50:52 +00:00
parent 3312435ae2
commit a8f6904ec7
2 changed files with 34 additions and 29 deletions

View File

@ -211,14 +211,10 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
// Handle incoming mail
void CUCode_AX::HandleMail(u32 _uMail)
{
static s8 newucodemails = -1;
if (newucodemails > -1) {
newucodemails++;
if (newucodemails == 10) {
newucodemails = -1;
m_rMailHandler.PushMail(DSP_RESUME);
}
if (m_UploadSetupInProgress)
{
PrepareBootUCode(_uMail);
return;
}
else {
if ((_uMail & 0xFFFF0000) == MAIL_AX_ALIST)
@ -232,13 +228,16 @@ void CUCode_AX::HandleMail(u32 _uMail)
}
else if (_uMail == 0xCDD10001) // Action 1 - new ucode upload ( GC: BayBlade S.T.B,...)
{
NOTICE_LOG(DSPHLE,"DSP IROM - New Ucode!");
newucodemails = 0;
DEBUG_LOG(DSPHLE,"DSP IROM - New Ucode!");
// TODO find a better way to protect from HLEMixer?
soundStream->GetMixer()->SetHLEReady(false);
m_UploadSetupInProgress = true;
}
else if (_uMail == 0xCDD10002) // Action 2 - IROM_Reset(); ( GC: NFS Carbon, FF Crystal Chronicles,...)
{
NOTICE_LOG(DSPHLE,"DSP IROM - Reset!");
DEBUG_LOG(DSPHLE,"DSP IROM - Reset!");
CDSPHandler::GetInstance().SetUCode(UCODE_ROM);
return;
}
else if (_uMail == 0xCDD10003) // Action 3 - AX_GetNextCmdBlock();
{
@ -256,8 +255,13 @@ void CUCode_AX::HandleMail(u32 _uMail)
// Update with DSP Interrupt
void CUCode_AX::Update(int cycles)
{
if (NeedsResumeMail())
{
m_rMailHandler.PushMail(DSP_RESUME);
g_dspInitialize.pGenerateDSPInterrupt();
}
// check if we have to send something
if (!m_rMailHandler.IsEmpty())
else if (!m_rMailHandler.IsEmpty())
{
g_dspInitialize.pGenerateDSPInterrupt();
}

View File

@ -51,14 +51,10 @@ CUCode_AXWii::~CUCode_AXWii()
void CUCode_AXWii::HandleMail(u32 _uMail)
{
static s8 newucodemails = -1;
if (newucodemails > -1) {
newucodemails++;
if (newucodemails == 10) {
newucodemails = -1;
m_rMailHandler.PushMail(DSP_RESUME);
}
if (m_UploadSetupInProgress)
{
PrepareBootUCode(_uMail);
return;
}
else if ((_uMail & 0xFFFF0000) == MAIL_AX_ALIST)
{
@ -72,24 +68,24 @@ void CUCode_AXWii::HandleMail(u32 _uMail)
break;
case 0xCDD10001: // Action 1 - new ucode upload
NOTICE_LOG(DSPHLE,"DSP IROM - New Ucode!");
newucodemails = 0;
DEBUG_LOG(DSPHLE,"DSP IROM - New Ucode!");
// TODO find a better way to protect from HLEMixer?
soundStream->GetMixer()->SetHLEReady(false);
m_UploadSetupInProgress = true;
break;
case 0xCDD10002: // Action 2 - IROM_Reset(); ( WII: De Blob, Cursed Mountain,...)
NOTICE_LOG(DSPHLE,"DSP IROM - Reset!");
DEBUG_LOG(DSPHLE,"DSP IROM - Reset!");
CDSPHandler::GetInstance().SetUCode(UCODE_ROM);
break;
return;
case 0xCDD10003: // Action 3 - AX_GetNextCmdBlock()
//TODO: Implement??
break;
default:
{
DEBUG_LOG(DSPHLE, " >>>> u32 MAIL : AXTask Mail (%08x)", _uMail);
AXTask(_uMail);
}
break;
}
}
@ -147,8 +143,13 @@ void CUCode_AXWii::MixAdd(short* _pBuffer, int _iSize)
void CUCode_AXWii::Update(int cycles)
{
// check if we have to sent something
if (!m_rMailHandler.IsEmpty())
if (NeedsResumeMail())
{
m_rMailHandler.PushMail(DSP_RESUME);
g_dspInitialize.pGenerateDSPInterrupt();
}
// check if we have to send something
else if (!m_rMailHandler.IsEmpty())
{
g_dspInitialize.pGenerateDSPInterrupt();
}