Partial fix for the EA Wii games having no sound - implement the second OUTPUT command in AXWii. Sound in videos and musics still don't play.

This commit is contained in:
Pierre Bourdon 2013-04-02 02:53:19 +02:00
parent 60b43eb8d3
commit 5c67a0bcf6
2 changed files with 28 additions and 14 deletions

View File

@ -53,7 +53,7 @@ void CUCode_AXWii::HandleCommandList()
u32 pb_addr = 0; u32 pb_addr = 0;
// WARN_LOG(DSPHLE, "Command list:"); // WARN_LOG(DSPHLE, "Command list:");
// for (u32 i = 0; m_cmdlist[i] != CMD_END_OLD; ++i) // for (u32 i = 0; m_cmdlist[i] != CMD_END; ++i)
// WARN_LOG(DSPHLE, "%04x", m_cmdlist[i]); // WARN_LOG(DSPHLE, "%04x", m_cmdlist[i]);
// WARN_LOG(DSPHLE, "-------------"); // WARN_LOG(DSPHLE, "-------------");
@ -115,15 +115,15 @@ void CUCode_AXWii::HandleCommandList()
case CMD_UNK_0B_OLD: curr_idx += 4; break; case CMD_UNK_0B_OLD: curr_idx += 4; break;
case CMD_OUTPUT_OLD: case CMD_OUTPUT_OLD:
case CMD_OUTPUT_DPL2_OLD:
addr_hi = m_cmdlist[curr_idx++]; addr_hi = m_cmdlist[curr_idx++];
addr_lo = m_cmdlist[curr_idx++]; addr_lo = m_cmdlist[curr_idx++];
addr2_hi = m_cmdlist[curr_idx++]; addr2_hi = m_cmdlist[curr_idx++];
addr2_lo = m_cmdlist[curr_idx++]; addr2_lo = m_cmdlist[curr_idx++];
OutputSamples(HILO_TO_32(addr2), HILO_TO_32(addr), 0x8000); OutputSamples(HILO_TO_32(addr2), HILO_TO_32(addr), 0x8000,
cmd == CMD_OUTPUT_DPL2_OLD);
break; break;
case CMD_UNK_0D_OLD: curr_idx += 5; break;
case CMD_WM_OUTPUT_OLD: case CMD_WM_OUTPUT_OLD:
{ {
u32 addresses[4] = { u32 addresses[4] = {
@ -190,16 +190,16 @@ void CUCode_AXWii::HandleCommandList()
case CMD_UNK_0A: curr_idx += 4; break; case CMD_UNK_0A: curr_idx += 4; break;
case CMD_OUTPUT: case CMD_OUTPUT:
case CMD_OUTPUT_DPL2:
volume = m_cmdlist[curr_idx++]; volume = m_cmdlist[curr_idx++];
addr_hi = m_cmdlist[curr_idx++]; addr_hi = m_cmdlist[curr_idx++];
addr_lo = m_cmdlist[curr_idx++]; addr_lo = m_cmdlist[curr_idx++];
addr2_hi = m_cmdlist[curr_idx++]; addr2_hi = m_cmdlist[curr_idx++];
addr2_lo = m_cmdlist[curr_idx++]; addr2_lo = m_cmdlist[curr_idx++];
OutputSamples(HILO_TO_32(addr2), HILO_TO_32(addr), volume); OutputSamples(HILO_TO_32(addr2), HILO_TO_32(addr), volume,
cmd == CMD_OUTPUT_DPL2);
break; break;
case CMD_UNK_0C: curr_idx += 5; break;
case CMD_WM_OUTPUT: case CMD_WM_OUTPUT:
{ {
u32 addresses[4] = { u32 addresses[4] = {
@ -499,17 +499,26 @@ void CUCode_AXWii::MixAUXSamples(int aux_id, u32 write_addr, u32 read_addr, u16
} }
} }
void CUCode_AXWii::OutputSamples(u32 lr_addr, u32 surround_addr, u16 volume) void CUCode_AXWii::OutputSamples(u32 lr_addr, u32 surround_addr, u16 volume,
bool upload_auxc)
{ {
u16 volume_ramp[96]; u16 volume_ramp[96];
GenerateVolumeRamp(volume_ramp, m_last_main_volume, volume, 96); GenerateVolumeRamp(volume_ramp, m_last_main_volume, volume, 96);
m_last_main_volume = volume; m_last_main_volume = volume;
int surround_buffer[3 * 32] = { 0 }; int upload_buffer[3 * 32] = { 0 };
for (u32 i = 0; i < 3 * 32; ++i) for (u32 i = 0; i < 3 * 32; ++i)
surround_buffer[i] = Common::swap32(m_samples_surround[i]); upload_buffer[i] = Common::swap32(m_samples_surround[i]);
memcpy(HLEMemory_Get_Pointer(surround_addr), surround_buffer, sizeof (surround_buffer)); memcpy(HLEMemory_Get_Pointer(surround_addr), upload_buffer, sizeof (upload_buffer));
if (upload_auxc)
{
surround_addr += sizeof (upload_buffer);
for (u32 i = 0; i < 3 * 32; ++i)
upload_buffer[i] = Common::swap32(m_samples_auxC_left[i]);
memcpy(HLEMemory_Get_Pointer(surround_addr), upload_buffer, sizeof (upload_buffer));
}
short buffer[3 * 32 * 2]; short buffer[3 * 32 * 2];
@ -539,6 +548,10 @@ void CUCode_AXWii::OutputSamples(u32 lr_addr, u32 surround_addr, u16 volume)
} }
memcpy(HLEMemory_Get_Pointer(lr_addr), buffer, sizeof (buffer)); memcpy(HLEMemory_Get_Pointer(lr_addr), buffer, sizeof (buffer));
// There should be a DSP_SYNC message sent here. However, it looks like not
// sending it does not cause any issue, and sending it actually causes some
// sounds to go at half speed. I have no idea why.
} }
void CUCode_AXWii::OutputWMSamples(u32* addresses) void CUCode_AXWii::OutputWMSamples(u32* addresses)

View File

@ -74,7 +74,8 @@ protected:
void AddToLR(u32 val_addr); void AddToLR(u32 val_addr);
void ProcessPBList(u32 pb_addr); void ProcessPBList(u32 pb_addr);
void MixAUXSamples(int aux_id, u32 write_addr, u32 read_addr, u16 volume); void MixAUXSamples(int aux_id, u32 write_addr, u32 read_addr, u16 volume);
void OutputSamples(u32 lr_addr, u32 surround_addr, u16 volume); void OutputSamples(u32 lr_addr, u32 surround_addr, u16 volume,
bool upload_auxc);
void OutputWMSamples(u32* addresses); // 4 addresses void OutputWMSamples(u32* addresses); // 4 addresses
private: private:
@ -92,7 +93,7 @@ private:
CMD_UNK_09 = 0x09, CMD_UNK_09 = 0x09,
CMD_UNK_0A = 0x0A, CMD_UNK_0A = 0x0A,
CMD_OUTPUT = 0x0B, CMD_OUTPUT = 0x0B,
CMD_UNK_0C = 0x0C, CMD_OUTPUT_DPL2 = 0x0C,
CMD_WM_OUTPUT = 0x0D, CMD_WM_OUTPUT = 0x0D,
CMD_END = 0x0E, CMD_END = 0x0E,
}; };
@ -115,7 +116,7 @@ private:
CMD_UNK_0A_OLD = 0x0A, CMD_UNK_0A_OLD = 0x0A,
CMD_UNK_0B_OLD = 0x0B, CMD_UNK_0B_OLD = 0x0B,
CMD_OUTPUT_OLD = 0x0C, // no volume! CMD_OUTPUT_OLD = 0x0C, // no volume!
CMD_UNK_0D_OLD = 0x0D, CMD_OUTPUT_DPL2_OLD = 0x0D,
CMD_WM_OUTPUT_OLD = 0x0E, CMD_WM_OUTPUT_OLD = 0x0E,
CMD_END_OLD = 0x0F CMD_END_OLD = 0x0F
}; };