From 9800252a289e0d25d10b13e6edb6fb4af0e4ae3c Mon Sep 17 00:00:00 2001 From: skidau Date: Sat, 6 Sep 2014 11:57:37 +1000 Subject: [PATCH] Re-added the acc_end_reached logic for AXWii. --- Source/Core/Core/HW/DSPHLE/UCodes/AXVoice.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/AXVoice.h b/Source/Core/Core/HW/DSPHLE/UCodes/AXVoice.h index 0f849b9fde..89731ecba6 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/AXVoice.h +++ b/Source/Core/Core/HW/DSPHLE/UCodes/AXVoice.h @@ -131,6 +131,7 @@ void DumpPB(const PB_TYPE& pb) static u32 acc_loop_addr, acc_end_addr; static u32* acc_cur_addr; static PB_TYPE* acc_pb; +static bool acc_end_reached; // Sets up the simulated accelerator. void AcceleratorSetup(PB_TYPE* pb, u32* cur_addr) @@ -139,6 +140,7 @@ void AcceleratorSetup(PB_TYPE* pb, u32* cur_addr) acc_loop_addr = HILO_TO_32(pb->audio_addr.loop_addr); acc_end_addr = HILO_TO_32(pb->audio_addr.end_addr); acc_cur_addr = cur_addr; + acc_end_reached = false; } // Reads a sample from the simulated accelerator. Also handles looping and @@ -149,6 +151,10 @@ u16 AcceleratorGetSample() u16 ret; u8 step_size_bytes = 0; + // See below for explanations about acc_end_reached. + if (acc_end_reached) + return 0; + switch (acc_pb->audio_addr.sample_format) { case 0x00: // ADPCM @@ -232,6 +238,15 @@ u16 AcceleratorGetSample() { // 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 having 0000 + // samples at the loop address, 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 } }