From 90768f93ba2dcbda9e1f5b151a7de6cbad05658c Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Thu, 17 Oct 2013 22:25:51 +0200 Subject: [PATCH] GLES2N64: Put old Frameskip code (from mupen 1.5) instead --- source/gles2n64/src/OpenGL.cpp | 2 +- source/gles2n64/src/gles2N64.cpp | 41 ++++++++++++++++++++++++++++---- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/source/gles2n64/src/OpenGL.cpp b/source/gles2n64/src/OpenGL.cpp index dd0ca4d..c9c029f 100755 --- a/source/gles2n64/src/OpenGL.cpp +++ b/source/gles2n64/src/OpenGL.cpp @@ -1214,7 +1214,7 @@ void OGL_SwapBuffers() { //OGL_DrawTriangles(); scProgramChanged = 0; -#if 0 +#if 1 static int frames = 0; static unsigned lastTicks = 0; unsigned ticks = ticksGetTicks(); diff --git a/source/gles2n64/src/gles2N64.cpp b/source/gles2n64/src/gles2N64.cpp index 69ec8ed..00fc63e 100755 --- a/source/gles2n64/src/gles2N64.cpp +++ b/source/gles2n64/src/gles2N64.cpp @@ -139,6 +139,39 @@ EXPORT void CALL ProcessDList(void) { OGL.frame_dl++; +#if 1 + if (config.autoFrameSkip) + { + OGL_UpdateFrameTime(); + + if (OGL.consecutiveSkips < 1) + { + unsigned t = 0; + for(int i = 0; i < OGL_FRAMETIME_NUM; i++) t += OGL.frameTime[i]; + t *= config.targetFPS; + if (config.romPAL) t = (t * 5) / 6; + if (t > (OGL_FRAMETIME_NUM * 1000)) + { + OGL.consecutiveSkips++; + OGL.frameSkipped++; + RSP.busy = FALSE; + RSP.DList++; + *REG.MI_INTR |= MI_INTR_SP | MI_INTR_DP; + CheckInterrupts(); + return; + } + } + } + else if ((OGL.frame_vsync % config.frameRenderRate) != 0) + { + OGL.frameSkipped++; + RSP.busy = FALSE; + RSP.DList++; + *REG.MI_INTR |= MI_INTR_SP | MI_INTR_DP; + CheckInterrupts(); + return; + } +#else if (frameSkipper.willSkipNext()) { OGL.frameSkipped++; @@ -146,13 +179,13 @@ EXPORT void CALL ProcessDList(void) RSP.DList++; /* avoid hang on frameskip */ - *REG.MI_INTR |= MI_INTR_DP; - CheckInterrupts(); - *REG.MI_INTR |= MI_INTR_SP; +// *REG.MI_INTR |= MI_INTR_DP; +// CheckInterrupts(); + *REG.MI_INTR |= MI_INTR_SP | MI_INTR_DP; CheckInterrupts(); return; } - +#endif OGL.consecutiveSkips = 0; RSP_ProcessDList(); OGL.mustRenderDlist = true; -- 2.39.5