Permalink
Browse files

core: temporary fix until upstream core accepts pull request

  • Loading branch information...
fzurita committed Feb 15, 2016
1 parent 9239aa0 commit 1a725011aa10bc39a4ffbb0e6de31c0045163bd9
Showing with 7 additions and 3 deletions.
  1. +7 −3 jni/mupen64plus-core/src/main/main.c
@@ -61,7 +61,7 @@
#include "plugin/get_time_using_C_localtime.h"
#include "plugin/plugin.h"
#include "plugin/rumble_via_input_plugin.h"
-#include "profile.h"
+#include "profile.h"o

This comment has been minimized.

Show comment
Hide comment
@Gillou68310

Gillou68310 Feb 16, 2016

Contributor

"o" lala ;-)

@Gillou68310

Gillou68310 Feb 16, 2016

Contributor

"o" lala ;-)

This comment has been minimized.

Show comment
Hide comment
@fzurita

fzurita Feb 16, 2016

Member

Whoops, how did that happen. I'm surprised it builds.

@fzurita

fzurita Feb 16, 2016

Member

Whoops, how did that happen. I'm surprised it builds.

#include "r4300/r4300.h"
#include "r4300/r4300_core.h"
#include "r4300/reset.h"
@@ -739,6 +739,7 @@ static void apply_speed_limiter(void)
static float VITotalDelta;
static float VIDeltas[64];
static unsigned int VIDeltasIndex;
+ unsigned int OverSleep = 0;
double VILimitMilliseconds = 1000.0 / ROM_PARAMS.vilimit;
double AdjustedLimit = VILimitMilliseconds * 100.0 / l_SpeedFactor; // adjust for selected emulator speed
@@ -774,20 +775,23 @@ static void apply_speed_limiter(void)
{
TimeToWait = (IntegratedDelta > ThisFrameDelta) ? -IntegratedDelta : -ThisFrameDelta;
DebugMessage(M64MSG_VERBOSE, " apply_speed_limiter(): Waiting %ims", (int) TimeToWait);
+ unsigned int SleepStart = SDL_GetTicks();
SDL_Delay((int) TimeToWait);
+
// recalculate # of milliseconds that have passed since the last video interrupt,
// taking into account the time we just waited
CurrentFPSTime = SDL_GetTicks();
+ OverSleep = CurrentFPSTime - SleepStart - TimeToWait;
ThisFrameDelta = CurrentFPSTime - LastFPSTime - AdjustedLimit;
}
}
// Discard frames with excessive execution time
if (ThisFrameDelta > AdjustedLimit * 3)
- ThisFrameDelta = 0.f;
+ ThisFrameDelta = 0.f;
// update our data structures
- LastFPSTime = CurrentFPSTime ;
+ LastFPSTime = CurrentFPSTime + OverSleep;
VITotalDelta += ThisFrameDelta - VIDeltas[VIDeltasIndex];
VIDeltas[VIDeltasIndex] = ThisFrameDelta;
VIDeltasIndex = (VIDeltasIndex + 1) & 63;

0 comments on commit 1a72501

Please sign in to comment.