DSPHLE: Fix running and is_stream checks in AX HLE
A voice is considered running if and only if `running` equals 1, not if `running` is not equal to 0. This fixes https://bugs.dolphin-emu.org/issues/12508 because for some reason *The Sims 2 - Castaway* sets `running` to 8 when a stream finishes playing; previously our AX HLE would just loop the voice and eventually crash after accessing invalid memory addresses. Thanks to JMC47 and delroth's help, I've verified that this is the correct check for the following ucodes: GC: * 0x3ad3b7ac * 0x3daf59b9 * 0x4e8a8b21 * 0x07f88145 * 0xe2136399 * 0x3389a79e Wii: * 0x347112ba * 0xfa450138 * 0xadbc06bd And while I was fixing the running check, I noticed that the is_stream field was also being handled incorrectly, so I've fixed that as well.
This commit is contained in:
parent
887fcfc99a
commit
5021a13aa9
|
@ -236,8 +236,8 @@ struct AXPB
|
||||||
u16 coef_select;
|
u16 coef_select;
|
||||||
u16 mixer_control;
|
u16 mixer_control;
|
||||||
|
|
||||||
u16 running; // 1=RUN 0=STOP
|
u16 running; // 1 = playing, anything else = stopped
|
||||||
u16 is_stream; // 1 = stream, 0 = one shot
|
u16 is_stream; // 1 = stream, anything else = one shot
|
||||||
|
|
||||||
PBMixer mixer;
|
PBMixer mixer;
|
||||||
PBInitialTimeDelay initial_time_delay;
|
PBInitialTimeDelay initial_time_delay;
|
||||||
|
|
|
@ -156,7 +156,7 @@ protected:
|
||||||
{
|
{
|
||||||
// Set the ADPCM info to continue processing at loop_addr.
|
// Set the ADPCM info to continue processing at loop_addr.
|
||||||
SetPredScale(acc_pb->adpcm_loop_info.pred_scale);
|
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);
|
SetYn1(acc_pb->adpcm_loop_info.yn1);
|
||||||
SetYn2(acc_pb->adpcm_loop_info.yn2);
|
SetYn2(acc_pb->adpcm_loop_info.yn2);
|
||||||
|
@ -403,7 +403,7 @@ void ProcessVoice(PB_TYPE& pb, const AXBuffers& buffers, u16 count, AXMixControl
|
||||||
const s16* coeffs)
|
const s16* coeffs)
|
||||||
{
|
{
|
||||||
// If the voice is not running, nothing to do.
|
// If the voice is not running, nothing to do.
|
||||||
if (!pb.running)
|
if (pb.running != 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Read input samples, performing sample rate conversion if needed.
|
// Read input samples, performing sample rate conversion if needed.
|
||||||
|
|
Loading…
Reference in New Issue