Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #9897 from leoetlino/axe-faulty-ax-checks
DSPHLE: Minor AX fixes
  • Loading branch information
delroth committed Jul 14, 2021
2 parents 9b17805 + 5021a13 commit cccb1ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
4 changes: 2 additions & 2 deletions Source/Core/Core/HW/DSPHLE/UCodes/AXStructs.h
Expand Up @@ -236,8 +236,8 @@ struct AXPB
u16 coef_select;
u16 mixer_control;

u16 running; // 1=RUN 0=STOP
u16 is_stream; // 1 = stream, 0 = one shot
u16 running; // 1 = playing, anything else = stopped
u16 is_stream; // 1 = stream, anything else = one shot

PBMixer mixer;
PBInitialTimeDelay initial_time_delay;
Expand Down
19 changes: 2 additions & 17 deletions Source/Core/Core/HW/DSPHLE/UCodes/AXVoice.h
Expand Up @@ -146,7 +146,6 @@ void WritePB(u32 addr, const PB_TYPE& pb, u32 crc)

// Simulated accelerator state.
static PB_TYPE* acc_pb;
static bool acc_end_reached;

class HLEAccelerator final : public Accelerator
{
Expand All @@ -157,7 +156,7 @@ class HLEAccelerator final : public Accelerator
{
// Set the ADPCM info to continue processing at loop_addr.
SetPredScale(acc_pb->adpcm_loop_info.pred_scale);
if (!acc_pb->is_stream)
if (acc_pb->is_stream != 1)
{
SetYn1(acc_pb->adpcm_loop_info.yn1);
SetYn2(acc_pb->adpcm_loop_info.yn2);
Expand All @@ -177,15 +176,6 @@ class HLEAccelerator final : public Accelerator
{
// Non looping voice reached the end -> running = 0.
acc_pb->running = 0;

#ifdef AX_WII
// One of the few meaningful differences between AXGC and AXWii:
// while AXGC handles non looping voices ending by relying on the
// accelerator to stop reads once the loop address is reached,
// AXWii has the 0000 samples internally in DRAM and use an internal
// pointer to it (loop addr does not contain 0000 samples on AXWii!).
acc_end_reached = true;
#endif
}
}

Expand All @@ -206,18 +196,13 @@ void AcceleratorSetup(PB_TYPE* pb)
s_accelerator->SetYn1(pb->adpcm.yn1);
s_accelerator->SetYn2(pb->adpcm.yn2);
s_accelerator->SetPredScale(pb->adpcm.pred_scale);
acc_end_reached = false;
}

// Reads a sample from the accelerator. Also handles looping and
// disabling streams that reached the end (this is done by an exception raised
// by the accelerator on real hardware).
u16 AcceleratorGetSample()
{
// See below for explanations about acc_end_reached.
if (acc_end_reached)
return 0;

return s_accelerator->Read(acc_pb->adpcm.coefs);
}

Expand Down Expand Up @@ -418,7 +403,7 @@ void ProcessVoice(PB_TYPE& pb, const AXBuffers& buffers, u16 count, AXMixControl
const s16* coeffs)
{
// If the voice is not running, nothing to do.
if (!pb.running)
if (pb.running != 1)
return;

// Read input samples, performing sample rate conversion if needed.
Expand Down

0 comments on commit cccb1ee

Please sign in to comment.