From 2e3463b49db1c45f4d2ae6e1554b99b41c2aa7ca Mon Sep 17 00:00:00 2001 From: mrvacbob Date: Sat, 6 Aug 2016 02:26:55 -0700 Subject: [PATCH] Fix memory corruption caused by not enough parens in malloc math. Also detect GL extensions properly. Fixes https://github.com/OpenEmu/OpenEmu/issues/2621 --- PPSSPPGameCore.mm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/PPSSPPGameCore.mm b/PPSSPPGameCore.mm index 864af7a..da9d235 100644 --- a/PPSSPPGameCore.mm +++ b/PPSSPPGameCore.mm @@ -40,7 +40,7 @@ #include "Core/System.h" #define SAMPLERATE 44100 -#define SIZESOUNDBUFFER 44100 / 30 * 4 +#define SIZESOUNDBUFFER ((SAMPLERATE / 30) * 4) @interface PPSSPPGameCore () { @@ -102,6 +102,7 @@ g_Config.internalDataDirectory = [directoryString UTF8String]; g_Config.iShowFPSCounter = true; g_Config.bFrameSkipUnthrottle = false; + g_Config.bVertexDecoderJit = true; g_Config.bSeparateIOThread = true; g_Config.bSeparateCPUThread = false; @@ -146,7 +147,9 @@ { // This is where PPSSPP will look for ppge_atlas.zim NSString *resourcePath = [[[[self owner] bundle] resourcePath] stringByAppendingString:@"/"]; - + + extern void CheckGLExtensions(); + CheckGLExtensions(); NativeInit(0, nil, nil, [resourcePath UTF8String], nil, false); NativeInitGraphics(0); } @@ -168,14 +171,13 @@ } NativeRender(0); - glFlushRenderAPPLE(); float vps, fps; __DisplayGetFPS(&vps, &_frameInterval, &fps); if(_frameInterval <= 0) _frameInterval = 60; - int samplesWritten = NativeMix((short *)_soundBuffer, SAMPLERATE / _frameInterval); + int samplesWritten = NativeMix((short *)_soundBuffer, ceil(SAMPLERATE / _frameInterval)); [[self ringBufferAtIndex:0] write:_soundBuffer maxLength:sizeof(uint16_t) * samplesWritten * 2]; }