Add implementation for command 02: SUB_TO_LR

This commit is contained in:
Pierre Bourdon 2013-04-02 03:10:29 +02:00
parent 5c67a0bcf6
commit 74dee41b87
2 changed files with 10 additions and 8 deletions

View File

@ -77,12 +77,12 @@ void CUCode_AXWii::HandleCommandList()
break;
case CMD_ADD_TO_LR_OLD:
case CMD_SUB_TO_LR_OLD:
addr_hi = m_cmdlist[curr_idx++];
addr_lo = m_cmdlist[curr_idx++];
AddToLR(HILO_TO_32(addr));
AddToLR(HILO_TO_32(addr), cmd == CMD_SUB_TO_LR_OLD);
break;
case CMD_UNK_02_OLD: curr_idx += 2; break;
case CMD_UNK_03_OLD: curr_idx += 2; break;
case CMD_PB_ADDR_OLD:
@ -156,12 +156,12 @@ void CUCode_AXWii::HandleCommandList()
break;
case CMD_ADD_TO_LR:
case CMD_SUB_TO_LR:
addr_hi = m_cmdlist[curr_idx++];
addr_lo = m_cmdlist[curr_idx++];
AddToLR(HILO_TO_32(addr));
AddToLR(HILO_TO_32(addr), cmd == CMD_SUB_TO_LR);
break;
case CMD_UNK_02: curr_idx += 2; break;
case CMD_UNK_03: curr_idx += 2; break;
case CMD_PROCESS:
@ -278,12 +278,14 @@ void CUCode_AXWii::SetupProcessing(u32 init_addr)
}
}
void CUCode_AXWii::AddToLR(u32 val_addr)
void CUCode_AXWii::AddToLR(u32 val_addr, bool neg)
{
int* ptr = (int*)HLEMemory_Get_Pointer(val_addr);
for (int i = 0; i < 32 * 3; ++i)
{
int val = (int)Common::swap32(*ptr++);
if (neg)
val = -val;
m_samples_left[i] += val;
m_samples_right[i] += val;

View File

@ -71,7 +71,7 @@ protected:
virtual void HandleCommandList();
void SetupProcessing(u32 init_addr);
void AddToLR(u32 val_addr);
void AddToLR(u32 val_addr, bool neg);
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,
@ -83,7 +83,7 @@ private:
{
CMD_SETUP = 0x00,
CMD_ADD_TO_LR = 0x01,
CMD_UNK_02 = 0x02,
CMD_SUB_TO_LR = 0x02,
CMD_UNK_03 = 0x03,
CMD_PROCESS = 0x04,
CMD_MIX_AUXA = 0x05,
@ -105,7 +105,7 @@ private:
{
CMD_SETUP_OLD = 0x00,
CMD_ADD_TO_LR_OLD = 0x01,
CMD_UNK_02_OLD = 0x02,
CMD_SUB_TO_LR_OLD = 0x02,
CMD_UNK_03_OLD = 0x03,
CMD_PB_ADDR_OLD = 0x04,
CMD_PROCESS_OLD = 0x05,