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) void TasEditorWindow::playbackTurboSeekCb(bool val)
{ {
FCEU_CRITICAL_SECTION( emuLock );
taseditorConfig.turboSeek = val; taseditorConfig.turboSeek = val;
// if currently seeking, apply this option immediately
if (playback.getPauseFrame() >= 0)
{
turbo = taseditorConfig.turboSeek;
}
} }
// ---------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------
void TasEditorWindow::playbackAutoRestoreCb(bool val) void TasEditorWindow::playbackAutoRestoreCb(bool val)

View File

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

View File

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

View File

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

View File

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