Skip to content

Commit

Permalink
Implemented command 03: ADD_SUB_TO_LR
Browse files Browse the repository at this point in the history
  • Loading branch information
delroth committed Apr 2, 2013
1 parent 74dee41 commit 0220fd1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
27 changes: 25 additions & 2 deletions Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AXWii.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++];
Expand Down Expand Up @@ -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++];
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AXWii.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class CUCode_AXWii : public CUCode_AX

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,
Expand All @@ -84,7 +85,7 @@ class CUCode_AXWii : public CUCode_AX
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,
Expand All @@ -106,7 +107,7 @@ class CUCode_AXWii : public CUCode_AX
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,
Expand Down

0 comments on commit 0220fd1

Please sign in to comment.