fix for rare crash

This commit is contained in:
zeromus 2021-01-13 12:47:09 -05:00
parent 14b07ab5f2
commit 4c3d727ad0
1 changed files with 4 additions and 3 deletions

View File

@ -564,9 +564,10 @@ void FCEU_SoundCPUHook(int cycles)
/* Unbelievably ugly hack */
if(FSettings.SndRate)
{
soundtsoffs+=DMCacc;
DoPCM();
soundtsoffs-=DMCacc;
const uint32 fudge = std::min<uint32>(-DMCacc, soundtsoffs + timestamp);
soundtsoffs -= fudge;
DoPCM();
soundtsoffs += fudge;
}
RawDALatch+=t;
if(RawDALatch&0x80)