From 706939e6328d894fcede80b5d9a44be6f7eb1de3 Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Tue, 27 Nov 2012 00:03:02 +0100 Subject: [PATCH] Implement command 10, used by FIFA 06 and linked to AUXB mixing. Sound still broken in that game. --- .../Core/Src/HW/DSPHLE/UCodes/UCode_AX.cpp | 34 ++++++++++++++++++- .../Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.h | 3 +- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.cpp b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.cpp index 435e321010..0f97893455 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.cpp +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.cpp @@ -170,7 +170,14 @@ void CUCode_AX::HandleCommandList() end = true; break; - case CMD_UNK_10: curr_idx += 4; break; + case CMD_MIX_AUXB_LR: + addr_hi = m_cmdlist[curr_idx++]; + addr_lo = m_cmdlist[curr_idx++]; + addr2_hi = m_cmdlist[curr_idx++]; + addr2_lo = m_cmdlist[curr_idx++]; + MixAUXBLR(HILO_TO_32(addr), HILO_TO_32(addr2)); + break; + case CMD_UNK_11: curr_idx += 2; break; case CMD_UNK_12: curr_idx += 1; break; @@ -447,6 +454,31 @@ void CUCode_AX::OutputSamples(u32 lr_addr, u32 surround_addr) memcpy(HLEMemory_Get_Pointer(lr_addr), buffer, sizeof (buffer)); } +void CUCode_AX::MixAUXBLR(u32 ul_addr, u32 dl_addr) +{ + // Upload AUXB L/R + int* ptr = (int*)HLEMemory_Get_Pointer(ul_addr); + for (u32 i = 0; i < 5 * 32; ++i) + *ptr++ = Common::swap32(m_samples_auxB_left[i]); + for (u32 i = 0; i < 5 * 32; ++i) + *ptr++ = Common::swap32(m_samples_auxB_right[i]); + + // Mix AUXB L/R to MAIN L/R, and replace AUXB L/R + ptr = (int*)HLEMemory_Get_Pointer(dl_addr); + for (u32 i = 0; i < 5 * 32; ++i) + { + int samp = Common::swap32(*ptr++); + m_samples_auxB_left[i] = samp; + m_samples_left[i] += samp; + } + for (u32 i = 0; i < 5 * 32; ++i) + { + int samp = Common::swap32(*ptr++); + m_samples_auxB_right[i] = samp; + m_samples_right[i] += samp; + } +} + void CUCode_AX::SendAUXAndMix(u32 main_auxa_up, u32 auxb_s_up, u32 main_l_dl, u32 main_r_dl, u32 auxb_l_dl, u32 auxb_r_dl) { diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.h b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.h index a0c6374f95..4ac23f7968 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.h +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.h @@ -135,6 +135,7 @@ protected: void MixAUXSamples(int aux_id, u32 write_addr, u32 read_addr); void UploadLRS(u32 dst_addr); void OutputSamples(u32 out_addr, u32 surround_addr); + void MixAUXBLR(u32 ul_addr, u32 dl_addr); void SendAUXAndMix(u32 main_auxa_up, u32 auxb_s_up, u32 main_l_dl, u32 main_r_dl, u32 auxb_l_dl, u32 auxb_r_dl); @@ -157,7 +158,7 @@ private: CMD_MORE = 0x0D, CMD_OUTPUT = 0x0E, CMD_END = 0x0F, - CMD_UNK_10 = 0x10, + CMD_MIX_AUXB_LR = 0x10, CMD_UNK_11 = 0x11, CMD_UNK_12 = 0x12, CMD_SEND_AUX_AND_MIX = 0x13,