revert last 3 commits, experiment failed. its always there if it proves helpful.
This commit is contained in:
parent
c990bb3798
commit
e71e32ceb7
|
@ -11,9 +11,7 @@ static const double Normal = 1.0; // 1x speed (around 60 fps on NTSC)
|
|||
static uint64 Lasttime, Nexttime;
|
||||
static long double desired_frametime;
|
||||
static int InFrame;
|
||||
double fps_scale = Normal; // used by sdl.cpp
|
||||
double fps_scale_frameadvance = Normal;
|
||||
double fps_scale_unpaused = Normal;
|
||||
double g_fpsScale = Normal; // used by sdl.cpp
|
||||
bool MaxSpeed = false;
|
||||
|
||||
/* LOGMUL = exp(log(2) / 3)
|
||||
|
@ -33,7 +31,7 @@ void
|
|||
RefreshThrottleFPS()
|
||||
{
|
||||
uint64 fps = FCEUI_GetDesiredFPS(); // Do >> 24 to get in Hz
|
||||
desired_frametime = 16777216.0l / (fps * fps_scale);
|
||||
desired_frametime = 16777216.0l / (fps * g_fpsScale);
|
||||
|
||||
Lasttime=0;
|
||||
Nexttime=0;
|
||||
|
@ -46,7 +44,7 @@ RefreshThrottleFPS()
|
|||
int
|
||||
SpeedThrottle()
|
||||
{
|
||||
if(fps_scale >= 32)
|
||||
if(g_fpsScale >= 32)
|
||||
{
|
||||
return 0; /* Done waiting */
|
||||
}
|
||||
|
@ -94,15 +92,13 @@ SpeedThrottle()
|
|||
*/
|
||||
void IncreaseEmulationSpeed(void)
|
||||
{
|
||||
fps_scale_unpaused *= LOGMUL;
|
||||
g_fpsScale *= LOGMUL;
|
||||
|
||||
if(fps_scale_unpaused > Fastest) fps_scale_unpaused = Fastest;
|
||||
|
||||
fps_scale = fps_scale_unpaused;
|
||||
if(g_fpsScale > Fastest) g_fpsScale = Fastest;
|
||||
|
||||
RefreshThrottleFPS();
|
||||
|
||||
FCEU_DispMessage("Emulation speed %.1f%%",0, fps_scale*100.0);
|
||||
FCEU_DispMessage("Emulation speed %.1f%%",0, g_fpsScale*100.0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -110,15 +106,13 @@ void IncreaseEmulationSpeed(void)
|
|||
*/
|
||||
void DecreaseEmulationSpeed(void)
|
||||
{
|
||||
fps_scale_unpaused /= LOGMUL;
|
||||
if(fps_scale_unpaused < Slowest)
|
||||
fps_scale_unpaused = Slowest;
|
||||
|
||||
fps_scale = fps_scale_unpaused;
|
||||
g_fpsScale /= LOGMUL;
|
||||
if(g_fpsScale < Slowest)
|
||||
g_fpsScale = Slowest;
|
||||
|
||||
RefreshThrottleFPS();
|
||||
|
||||
FCEU_DispMessage("Emulation speed %.1f%%",0, fps_scale*100.0);
|
||||
FCEU_DispMessage("Emulation speed %.1f%%",0, g_fpsScale*100.0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -131,19 +125,19 @@ FCEUD_SetEmulationSpeed(int cmd)
|
|||
|
||||
switch(cmd) {
|
||||
case EMUSPEED_SLOWEST:
|
||||
fps_scale_unpaused = Slowest;
|
||||
g_fpsScale = Slowest;
|
||||
break;
|
||||
case EMUSPEED_SLOWER:
|
||||
DecreaseEmulationSpeed();
|
||||
break;
|
||||
case EMUSPEED_NORMAL:
|
||||
fps_scale_unpaused = Normal;
|
||||
g_fpsScale = Normal;
|
||||
break;
|
||||
case EMUSPEED_FASTER:
|
||||
IncreaseEmulationSpeed();
|
||||
break;
|
||||
case EMUSPEED_FASTEST:
|
||||
fps_scale_unpaused = Fastest;
|
||||
g_fpsScale = Fastest;
|
||||
MaxSpeed = true;
|
||||
break;
|
||||
default:
|
||||
|
@ -152,5 +146,5 @@ FCEUD_SetEmulationSpeed(int cmd)
|
|||
|
||||
RefreshThrottleFPS();
|
||||
|
||||
FCEU_DispMessage("Emulation speed %.1f%%",0, fps_scale*100.0);
|
||||
FCEU_DispMessage("Emulation speed %.1f%%",0, g_fpsScale*100.0);
|
||||
}
|
||||
|
|
|
@ -48,9 +48,8 @@
|
|||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
extern double fps_scale;
|
||||
extern double fps_scale_frameadvance;
|
||||
extern double fps_scale_unpaused;
|
||||
|
||||
extern double g_fpsScale;
|
||||
|
||||
extern bool MaxSpeed;
|
||||
|
||||
|
@ -403,14 +402,14 @@ FCEUD_Update(uint8 *XBuf,
|
|||
|
||||
int ocount = Count;
|
||||
// apply frame scaling to Count
|
||||
Count = (int)(Count / fps_scale);
|
||||
Count = (int)(Count / g_fpsScale);
|
||||
if(Count) {
|
||||
int32 can=GetWriteSound();
|
||||
static int uflow=0;
|
||||
int32 tmpcan;
|
||||
|
||||
// don't underflow when scaling fps
|
||||
if(can >= GetMaxSound() && fps_scale==1.0) uflow=1; /* Go into massive underflow mode. */
|
||||
if(can >= GetMaxSound() && g_fpsScale==1.0) uflow=1; /* Go into massive underflow mode. */
|
||||
|
||||
if(can > Count) can=Count;
|
||||
else uflow=0;
|
||||
|
@ -423,7 +422,7 @@ FCEUD_Update(uint8 *XBuf,
|
|||
//if(uflow) puts("Underflow");
|
||||
tmpcan = GetWriteSound();
|
||||
// don't underflow when scaling fps
|
||||
if(fps_scale>1.0 || ((tmpcan < Count*0.90) && !uflow)) {
|
||||
if(g_fpsScale>1.0 || ((tmpcan < Count*0.90) && !uflow)) {
|
||||
if(XBuf && (inited&4) && !(NoWaiting & 2))
|
||||
BlitScreen(XBuf);
|
||||
Buffer+=can;
|
||||
|
|
|
@ -43,26 +43,20 @@
|
|||
#include "file.h"
|
||||
#include "vsuni.h"
|
||||
#include "ines.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include "drivers/win/pref.h"
|
||||
#include "utils/xstring.h"
|
||||
#include "drivers/win/pref.h"
|
||||
#include "utils/xstring.h"
|
||||
|
||||
extern void CDLoggerROMClosed();
|
||||
extern void CDLoggerROMChanged();
|
||||
extern void ResetDebugStatisticsCounters();
|
||||
extern void SetMainWindowText();
|
||||
extern bool isTaseditorRecording();
|
||||
extern void CDLoggerROMClosed();
|
||||
extern void CDLoggerROMChanged();
|
||||
extern void ResetDebugStatisticsCounters();
|
||||
extern void SetMainWindowText();
|
||||
extern bool isTaseditorRecording();
|
||||
|
||||
extern int32 fps_scale;
|
||||
extern int32 fps_scale_unpaused;
|
||||
extern int32 fps_scale_frameadvance;
|
||||
#else
|
||||
extern int32 fps_scale;
|
||||
extern int32 fps_scale_unpaused;
|
||||
extern int32 fps_scale_frameadvance;
|
||||
extern int32 fps_scale;
|
||||
extern int32 fps_scale_unpaused;
|
||||
extern int32 fps_scale_frameadvance;
|
||||
#endif
|
||||
|
||||
extern void RefreshThrottleFPS();
|
||||
|
||||
#ifdef _S9XLUA_H
|
||||
|
@ -649,20 +643,24 @@ void FCEUI_Emulate(uint8 **pXBuf, int32 **SoundBuf, int32 *SoundBufSize, int ski
|
|||
// the user is holding Frame Advance key
|
||||
// clear paused flag temporarily
|
||||
EmulationPaused &= ~EMULATIONPAUSED_PAUSED;
|
||||
#ifdef WIN32
|
||||
// different emulation speed when holding Frame Advance
|
||||
if (fps_scale_frameadvance > 0)
|
||||
{
|
||||
fps_scale = fps_scale_frameadvance;
|
||||
RefreshThrottleFPS();
|
||||
}
|
||||
#endif
|
||||
} else
|
||||
{
|
||||
#ifdef WIN32
|
||||
if (fps_scale_frameadvance > 0)
|
||||
{
|
||||
// restore emulation speed when Frame Advance is not held
|
||||
fps_scale = fps_scale_unpaused;
|
||||
RefreshThrottleFPS();
|
||||
}
|
||||
#endif
|
||||
if (EmulationPaused & EMULATIONPAUSED_PAUSED)
|
||||
{
|
||||
// emulator is paused
|
||||
|
|
Loading…
Reference in New Issue