Added Qt TAS turbo seek functionality.

This commit is contained in:
mjbudd77 2022-01-08 04:17:16 -05:00
parent 2dfa98ac9f
commit f135fd2888
5 changed files with 26 additions and 6 deletions

View File

@ -3178,7 +3178,15 @@ void TasEditorWindow::playbackFollowCursorCb(bool val)
// ----------------------------------------------------------------------------------------------
void TasEditorWindow::playbackTurboSeekCb(bool val)
{
FCEU_CRITICAL_SECTION( emuLock );
taseditorConfig.turboSeek = val;
// if currently seeking, apply this option immediately
if (playback.getPauseFrame() >= 0)
{
turbo = taseditorConfig.turboSeek;
}
}
// ----------------------------------------------------------------------------------------------
void TasEditorWindow::playbackAutoRestoreCb(bool val)

View File

@ -59,6 +59,7 @@ void PLAYBACK::reset()
forwardFullButtonOldState = forwardFullButtonState = false;
emuPausedOldState = emuPausedState = true;
stopSeeking();
turbo = false;
}
void PLAYBACK::update()
{
@ -348,12 +349,19 @@ void PLAYBACK::startSeekingToFrame(int frame)
pauseFrame = frame + 1;
}
if (taseditorConfig->turboSeek)
{
//printf("Turbo seek on\n");
turbo = true;
}
unpauseEmulation();
}
void PLAYBACK::stopSeeking()
{
pauseFrame = 0;
//if ( turbo )
//{
// printf("Turbo seek off\n");
//}
turbo = false;
pauseEmulation();
setProgressbar(1, 1);
@ -381,7 +389,9 @@ void PLAYBACK::handleForwardFrame()
if (pauseFrame && !emuPausedState) return;
jump(currFrameCounter + 1);
if (!pauseFrame)
{
pauseEmulation();
}
turbo = false;
}
void PLAYBACK::handleRewindFull(int speed)

View File

@ -1202,7 +1202,7 @@ static void DoFun(int frameskip, int periodic_saves)
fskipc = (fskipc + 1) % (frameskip + 1);
#endif
if (NoWaiting)
if (NoWaiting || turbo)
{
gfx = 0;
}
@ -1674,7 +1674,7 @@ bool FCEUD_ShouldDrawInputAids(void)
return drawInputAidsEnable;
}
void FCEUD_TurboOn (void) { /* TODO */ };
void FCEUD_TurboOff (void) { /* TODO */ };
void FCEUD_TurboToggle(void) { /* TODO */ };
void FCEUD_TurboOn (void) { turbo = true; };
void FCEUD_TurboOff (void) { turbo = false; };
void FCEUD_TurboToggle(void) { turbo = !turbo; };

View File

@ -33,6 +33,7 @@
#include <cstdlib>
extern Config *g_config;
extern bool turbo;
static volatile int *s_Buffer = 0;
static unsigned int s_BufferSize;
@ -311,7 +312,7 @@ WriteSound(int32 *buf,
int udrFlowDup = 1;
static int skipCounter = 0;
if ( NoWaiting & 0x01 )
if ( (NoWaiting & 0x01) || turbo )
{ // During Turbo mode, don't bother with sound as
// overflowing the audio buffer can cause delays.
return;

View File

@ -56,6 +56,7 @@ double g_fpsScale = Normal; // used by sdl.cpp
bool MaxSpeed = false;
bool useIntFrameRate = false;
static double frmRateAdjRatio = 1.000000f; // Frame Rate Adjustment Ratio
extern bool turbo;
double getHighPrecTimeStamp(void)
{
@ -316,7 +317,7 @@ int highPrecSleep( double timeSeconds )
int
SpeedThrottle(void)
{
if ( (g_fpsScale >= 32) || (NoWaiting & 0x01) )
if ( (g_fpsScale >= 32) || (NoWaiting & 0x01) || turbo )
{
return 0; /* Done waiting */
}