AUX return data should be mixed to main buffers, not AUX buffers. Fixes a regression introduced by r954c55e35afb, now EA games sound works again.

This commit is contained in:
Pierre Bourdon 2012-11-27 21:48:59 +01:00
parent 9270b62830
commit 1a129abe0d
2 changed files with 21 additions and 14 deletions

View File

@ -405,9 +405,12 @@ void CUCode_AX::MixAUXSamples(int aux_id, u32 write_addr, u32 read_addr)
// Then, we read the new temp from the CPU and add to our current
// temp.
int* ptr = (int*)HLEMemory_Get_Pointer(read_addr);
for (u32 i = 0; i < 3; ++i)
for (u32 j = 0; j < 5 * 32; ++j)
buffers[i][j] += (int)Common::swap32(*ptr++);
for (u32 i = 0; i < 5 * 32; ++i)
m_samples_left[i] += (int)Common::swap32(*ptr++);
for (u32 i = 0; i < 5 * 32; ++i)
m_samples_right[i] += (int)Common::swap32(*ptr++);
for (u32 i = 0; i < 5 * 32; ++i)
m_samples_surround[i] += (int)Common::swap32(*ptr++);
}
void CUCode_AX::UploadLRS(u32 dst_addr)

View File

@ -252,8 +252,12 @@ void CUCode_AXWii::ProcessPBList(u32 pb_addr)
void CUCode_AXWii::MixAUXSamples(int aux_id, u32 write_addr, u32 read_addr, u16 volume)
{
int temp[3][3 * 32];
int* buffers[3] = { 0 };
int* main_buffers[3] = {
m_samples_left,
m_samples_right,
m_samples_surround
};
switch (aux_id)
{
@ -279,19 +283,19 @@ void CUCode_AXWii::MixAUXSamples(int aux_id, u32 write_addr, u32 read_addr, u16
// Send the content of AUX buffers to the CPU
if (write_addr)
{
for (u32 i = 0; i < 3 * 32; ++i)
for (u32 j = 0; j < 3; ++j)
temp[j][i] = Common::swap32(buffers[j][i]);
memcpy(HLEMemory_Get_Pointer(write_addr), temp, sizeof (temp));
int* ptr = (int*)HLEMemory_Get_Pointer(write_addr);
for (u32 i = 0; i < 3; ++i)
for (u32 j = 0; j < 3 * 32; ++j)
*ptr++ = Common::swap32(buffers[i][j]);
}
// Then read the buffers from the CPU and add to our current buffers.
memcpy(temp, HLEMemory_Get_Pointer(read_addr), sizeof (temp));
for (u32 i = 0; i < 3 * 32; ++i)
for (u32 j = 0; j < 3; ++j)
// Then read the buffers from the CPU and add to our main buffers.
int* ptr = (int*)HLEMemory_Get_Pointer(read_addr);
for (u32 i = 0; i < 3; ++i)
for (u32 j = 0; j < 3 * 32; ++j)
{
s64 new_val = buffers[j][i] + Common::swap32(temp[j][i]);
buffers[j][i] = (new_val * volume) >> 15;
s64 new_val = main_buffers[i][j] + Common::swap32(*ptr++);
main_buffers[i][j] = (new_val * volume) >> 15;
}
}