From 92cfef3db3c8627f5ea611391aa77cb237e86004 Mon Sep 17 00:00:00 2001 From: clobber Date: Fri, 4 Jul 2014 19:38:27 -0500 Subject: [PATCH] Fix audio related crash. In some cases, __DisplayGetFPS can return wildly negative values and cause a crash based on how we compute samples. Known occurrence in Power Stone Collection while loading Power Stone. --- PPSSPPGameCore.mm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PPSSPPGameCore.mm b/PPSSPPGameCore.mm index a8032ad..d6dba93 100644 --- a/PPSSPPGameCore.mm +++ b/PPSSPPGameCore.mm @@ -171,6 +171,8 @@ float vps, fps; __DisplayGetFPS(&vps, &_frameInterval, &fps); + + if(_frameInterval <= 0) _frameInterval = 60; int samplesWritten = NativeMix((short *)_soundBuffer, SAMPLERATE / _frameInterval); [[self ringBufferAtIndex:0] write:_soundBuffer maxLength:sizeof(uint16_t) * samplesWritten * 2];