DSPHLE - AX - Metroid Prime 2 (GC) audio should be better now

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4737 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Marko Pusljar 2009-12-27 22:52:33 +00:00
parent d62d6b0c33
commit dfc24337b5
2 changed files with 39 additions and 20 deletions

View File

@ -54,7 +54,6 @@ CUCode_AX::CUCode_AX(CMailHandler& _rMailHandler)
{ {
// we got loaded // we got loaded
m_rMailHandler.PushMail(0xDCD10000); m_rMailHandler.PushMail(0xDCD10000);
m_rMailHandler.PushMail(0x80000000); // handshake ??? only (crc == 0xe2136399) needs it ...
templbuffer = new int[1024 * 1024]; templbuffer = new int[1024 * 1024];
temprbuffer = new int[1024 * 1024]; temprbuffer = new int[1024 * 1024];
@ -337,24 +336,32 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
#endif #endif
AXParamBlock PB; AXParamBlock PB;
u32 blockAddr = m_addressPBs;
if (!blockAddr)
return;
// ------------ for (int x = 0; x < numPBaddr; x++)
for (int i = 0; i < NUMBER_OF_PBS; i++)
{ {
if (!ReadOutPB(blockAddr, PB)) //u32 blockAddr = m_addressPBs;
break; u32 blockAddr = PBaddr[x];
ProcessUpdates(PB);
MixAddVoice(PB, templbuffer, temprbuffer, _iSize, false); if (!blockAddr)
if (!WriteBackPB(blockAddr, PB)) return;
break;
// ------------
for (int i = 0; i < NUMBER_OF_PBS; i++)
{
if (!ReadOutPB(blockAddr, PB))
break;
ProcessUpdates(PB);
MixAddVoice(PB, templbuffer, temprbuffer, _iSize, false);
if (!WriteBackPB(blockAddr, PB))
break;
blockAddr = (PB.next_pb_hi << 16) | PB.next_pb_lo;
blockAddr = (PB.next_pb_hi << 16) | PB.next_pb_lo;
if (!blockAddr) {
// Guess we're out of blocks // Guess we're out of blocks
break; if (!blockAddr)
break;
} }
} }
@ -393,6 +400,13 @@ void CUCode_AX::HandleMail(u32 _uMail)
// a new List // a new List
DEBUG_LOG(DSPHLE, " >>>> u32 MAIL : General Mail (%08x)", _uMail); DEBUG_LOG(DSPHLE, " >>>> u32 MAIL : General Mail (%08x)", _uMail);
} }
else if (_uMail == 0xCDD10000) // Action 0 - restart
{
m_rMailHandler.PushMail(0xDCD10001);
}
else if ((_uMail & 0xFFFF0000) == 0xCDD10000) // Action 1/2/3
{
}
else else
{ {
DEBUG_LOG(DSPHLE, " >>>> u32 MAIL : AXTask Mail (%08x)", _uMail); DEBUG_LOG(DSPHLE, " >>>> u32 MAIL : AXTask Mail (%08x)", _uMail);
@ -454,6 +468,8 @@ bool CUCode_AX::AXTask(u32& _uMail)
bool bExecuteList = true; bool bExecuteList = true;
numPBaddr = 0;
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
if (m_DebuggerFrame) SaveMail(false, _uMail); // Save mail for debugging if (m_DebuggerFrame) SaveMail(false, _uMail); // Save mail for debugging
#endif #endif
@ -462,6 +478,7 @@ bool CUCode_AX::AXTask(u32& _uMail)
static int last_valid_command = 0; static int last_valid_command = 0;
u16 iCommand = Memory_Read_U16(uAddress); u16 iCommand = Memory_Read_U16(uAddress);
uAddress += 2; uAddress += 2;
switch (iCommand) switch (iCommand)
{ {
case AXLIST_STUDIOADDR: //00 case AXLIST_STUDIOADDR: //00
@ -491,15 +508,15 @@ bool CUCode_AX::AXTask(u32& _uMail)
// //
case AXLIST_PBADDR: //02 case AXLIST_PBADDR: //02
{ {
m_addressPBs = Memory_Read_U32(uAddress); PBaddr[numPBaddr] = Memory_Read_U32(uAddress);
uAddress += 4; numPBaddr++;
m_addressPBs = Memory_Read_U32(uAddress); // left in for now
uAddress += 4;
soundStream->GetMixer()->SetHLEReady(true); soundStream->GetMixer()->SetHLEReady(true);
SaveLog("%08x : AXLIST PB address: %08x", uAddress, m_addressPBs); SaveLog("%08x : AXLIST PB address: %08x", uAddress, m_addressPBs);
SaveLog("Update the SoundThread to be in sync"); SaveLog("Update the SoundThread to be in sync");
// soundStream->Update(); //do it in this thread to avoid sync problems // soundStream->Update(); //do it in this thread to avoid sync problems
} }
break; break;
@ -617,6 +634,6 @@ bool CUCode_AX::AXTask(u32& _uMail)
SaveLog("End"); SaveLog("End");
// i hope resume is okay AX // i hope resume is okay AX
m_rMailHandler.PushMail(0xDCD10001); m_rMailHandler.PushMail(0xDCD10002);
return true; return true;
} }

View File

@ -48,6 +48,8 @@ public:
int saveNext; int saveNext;
// PBs // PBs
u8 numPBaddr;
u32 PBaddr[8]; //2 needed for MP2
u32 m_addressPBs; u32 m_addressPBs;
u32 _CRC; u32 _CRC;