Implemented command 03: ADD_SUB_TO_LR

This commit is contained in:
Pierre Bourdon 2013-04-02 03:23:48 +02:00
parent 74dee41b87
commit 0220fd1940
2 changed files with 28 additions and 4 deletions

View File

@ -83,7 +83,11 @@ void CUCode_AXWii::HandleCommandList()
AddToLR(HILO_TO_32(addr), cmd == CMD_SUB_TO_LR_OLD);
break;
case CMD_UNK_03_OLD: curr_idx += 2; break;
case CMD_ADD_SUB_TO_LR_OLD:
addr_hi = m_cmdlist[curr_idx++];
addr_lo = m_cmdlist[curr_idx++];
AddSubToLR(HILO_TO_32(addr));
break;
case CMD_PB_ADDR_OLD:
addr_hi = m_cmdlist[curr_idx++];
@ -162,7 +166,11 @@ void CUCode_AXWii::HandleCommandList()
AddToLR(HILO_TO_32(addr), cmd == CMD_SUB_TO_LR);
break;
case CMD_UNK_03: curr_idx += 2; break;
case CMD_ADD_SUB_TO_LR:
addr_hi = m_cmdlist[curr_idx++];
addr_lo = m_cmdlist[curr_idx++];
AddSubToLR(HILO_TO_32(addr));
break;
case CMD_PROCESS:
addr_hi = m_cmdlist[curr_idx++];
@ -292,6 +300,21 @@ void CUCode_AXWii::AddToLR(u32 val_addr, bool neg)
}
}
void CUCode_AXWii::AddSubToLR(u32 val_addr)
{
int* ptr = (int*)HLEMemory_Get_Pointer(val_addr);
for (int i = 0; i < 32 * 3; ++i)
{
int val = (int)Common::swap32(*ptr++);
m_samples_left[i] += val;
}
for (int i = 0; i < 32 * 3; ++i)
{
int val = (int)Common::swap32(*ptr++);
m_samples_right[i] -= val;
}
}
AXMixControl CUCode_AXWii::ConvertMixerControl(u32 mixer_control)
{
u32 ret = 0;

View File

@ -72,6 +72,7 @@ protected:
void SetupProcessing(u32 init_addr);
void AddToLR(u32 val_addr, bool neg);
void AddSubToLR(u32 val_addr);
void ProcessPBList(u32 pb_addr);
void MixAUXSamples(int aux_id, u32 write_addr, u32 read_addr, u16 volume);
void OutputSamples(u32 lr_addr, u32 surround_addr, u16 volume,
@ -84,7 +85,7 @@ private:
CMD_SETUP = 0x00,
CMD_ADD_TO_LR = 0x01,
CMD_SUB_TO_LR = 0x02,
CMD_UNK_03 = 0x03,
CMD_ADD_SUB_TO_LR = 0x03,
CMD_PROCESS = 0x04,
CMD_MIX_AUXA = 0x05,
CMD_MIX_AUXB = 0x06,
@ -106,7 +107,7 @@ private:
CMD_SETUP_OLD = 0x00,
CMD_ADD_TO_LR_OLD = 0x01,
CMD_SUB_TO_LR_OLD = 0x02,
CMD_UNK_03_OLD = 0x03,
CMD_ADD_SUB_TO_LR_OLD = 0x03,
CMD_PB_ADDR_OLD = 0x04,
CMD_PROCESS_OLD = 0x05,
CMD_MIX_AUXA_OLD = 0x06,