Same as the last change but for Wii AX.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4377 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2009-10-07 19:04:48 +00:00
parent c0c52fffe9
commit bf595e31be
2 changed files with 15 additions and 6 deletions

View File

@ -174,14 +174,17 @@ void CUCode_AXWii::MixAdd_(short* _pBuffer, int _iSize, ParamBlockType &PB)
#endif #endif
u32 blockAddr = m_addressPBs; u32 blockAddr = m_addressPBs;
if (!blockAddr)
return;
for (int i = 0; i < NUMBER_OF_PBS; i++) for (int i = 0; i < NUMBER_OF_PBS; i++)
{ {
// read out pbs // read out pbs
ReadOutPBWii(blockAddr, PB); if (!ReadOutPBWii(blockAddr, PB))
break;
ProcessUpdates(PB); ProcessUpdates(PB);
MixAddVoice(PB, templbuffer, temprbuffer, _iSize, true); MixAddVoice(PB, templbuffer, temprbuffer, _iSize, true);
WriteBackPBWii(blockAddr, PB); if (!WriteBackPBWii(blockAddr, PB))
break;
// next block // next block
blockAddr = (PB.next_pb_hi << 16) | PB.next_pb_lo; blockAddr = (PB.next_pb_hi << 16) | PB.next_pb_lo;

View File

@ -37,12 +37,14 @@ extern float ratioFactor;
template<class ParamBlockType> template<class ParamBlockType>
inline void ReadOutPBWii(u32 pbs_address, ParamBlockType& PB) inline bool ReadOutPBWii(u32 pbs_address, ParamBlockType& PB)
{ {
u32 blockAddr = pbs_address; u32 blockAddr = pbs_address;
u32 pAddr = 0; u32 pAddr = 0;
const short *pSrc = (const short *)g_dspInitialize.pGetMemoryPointer(blockAddr); const short *pSrc = (const short *)g_dspInitialize.pGetMemoryPointer(blockAddr);
if (!pSrc)
return false;
pAddr = blockAddr; pAddr = blockAddr;
short *pDest = (short *)&PB; short *pDest = (short *)&PB;
for (u32 p = 0; p < sizeof(ParamBlockType) / 2; p++) for (u32 p = 0; p < sizeof(ParamBlockType) / 2; p++)
@ -58,21 +60,25 @@ inline void ReadOutPBWii(u32 pbs_address, ParamBlockType& PB)
} }
PB.mixer_control = Common::swap32(PB.mixer_control); PB.mixer_control = Common::swap32(PB.mixer_control);
return true;
} }
template<class ParamBlockType> template<class ParamBlockType>
inline void WriteBackPBWii(u32 pb_address, ParamBlockType& PB) inline bool WriteBackPBWii(u32 pb_address, ParamBlockType& PB)
//void WriteBackPBsWii(u32 pbs_address, AXParamBlockWii* _pPBs, int _num) //void WriteBackPBsWii(u32 pbs_address, AXParamBlockWii* _pPBs, int _num)
{ {
// write back and 'halfword'swap // write back and 'halfword'swap
short* pSrc = (short*)&PB; short* pSrc = (short*)&PB;
short* pDest = (short*)g_dspInitialize.pGetMemoryPointer(pb_address); short* pDest = (short*)g_dspInitialize.pGetMemoryPointer(pb_address);
if (!pDest)
return false;
PB.mixer_control = Common::swap32(PB.mixer_control); PB.mixer_control = Common::swap32(PB.mixer_control);
for (size_t p = 0; p < sizeof(ParamBlockType) / 2; p++) for (size_t p = 0; p < sizeof(ParamBlockType) / 2; p++)
{ {
if (p == 6 || p == 7) pDest[p] = pSrc[p]; // control for the u32 if (p == 6 || p == 7) pDest[p] = pSrc[p]; // control for the u32
else pDest[p] = Common::swap16(pSrc[p]); else pDest[p] = Common::swap16(pSrc[p]);
} }
return true;
} }
template<class ParamBlockType> template<class ParamBlockType>