mirror of
https://github.com/libretro/ppsspp.git
synced 2024-12-01 04:10:30 +00:00
Correct a case where release rate was set negative.
Seems to be capped at INT_MAX like the others, oops.
This commit is contained in:
parent
a610c30c12
commit
df7d25f4bf
@ -20,6 +20,7 @@
|
||||
#include "Core/MemMap.h"
|
||||
#include "Core/HLE/sceAtrac.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/Reporting.h"
|
||||
#include "SasAudio.h"
|
||||
|
||||
#include <algorithm>
|
||||
@ -286,6 +287,8 @@ static int getReleaseRate(int bitfield2) {
|
||||
}
|
||||
return 0x10000000 >> n;
|
||||
}
|
||||
if (n == 0)
|
||||
return 0x7FFFFFFF;
|
||||
return 0x80000000 >> n;
|
||||
}
|
||||
|
||||
@ -303,6 +306,10 @@ void ADSREnvelope::SetSimpleEnvelope(u32 ADSREnv1, u32 ADSREnv2) {
|
||||
releaseRate = getReleaseRate(ADSREnv2);
|
||||
releaseType = getReleaseType(ADSREnv2);
|
||||
sustainLevel = getSustainLevel(ADSREnv1);
|
||||
|
||||
if (attackRate < 0 || decayRate < 0 || sustainRate < 0 || releaseRate < 0) {
|
||||
ERROR_LOG_REPORT(SCESAS, "Simple ADSR resulted in invalid rates: %04x, %04x", ADSREnv1, ADSREnv2);
|
||||
}
|
||||
}
|
||||
|
||||
SasInstance::SasInstance()
|
||||
|
Loading…
Reference in New Issue
Block a user