Port over win32 runahead fixes to SDL (#1770)

* Port over win32 runahead fixes to SDL

* Fix formatting
This commit is contained in:
Jason Han 2024-05-05 06:18:10 -07:00 committed by GitHub
parent c46b16f225
commit acea063357
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 47 additions and 30 deletions

View File

@ -160,23 +160,40 @@ static int RunFrame(int bDraw, int bPause)
{ {
nFramesRendered++; nFramesRendered++;
if (!bRunAhead || bAppDoFast) { // Run-Ahead feature -dink aug 02, 2021 if (!bRunAhead || (BurnDrvGetFlags() & BDF_RUNAHEAD_DISABLED) || bAppDoFast) { // Run-Ahead feature -dink aug 02, 2021
if (VidFrame()) { // Do one frame w/o RunAhead or if FFWD is pressed. if (VidFrame()) { // Do one frame w/o RunAhead or if FFWD is pressed.
// VidFrame() failed, but we must run a driver frame because we have
// a clocked input. Possibly from recording or netplay(!)
// Note: VidFrame() calls BurnDrvFrame() on success.
pBurnDraw = NULL; // Make sure no image is drawn
BurnDrvFrame();
AudBlankSound(); AudBlankSound();
} }
} else { } else {
pBurnDraw = NULL; // Do one frame w/RunAhead pBurnDraw = (BurnDrvGetFlags() & BDF_RUNAHEAD_DRAWSYNC) ? pVidImage : NULL;
BurnDrvFrame(); BurnDrvFrame();
StateRunAheadSave(); StateRunAheadSave();
pBurnSoundOut = NULL; INT16 *pBurnSoundOut_temp = pBurnSoundOut;
VidFrame(); pBurnSoundOut = NULL;
StateRunAheadLoad(); nCurrentFrame++;
bBurnRunAheadFrame = 1;
if (VidFrame()) {
// VidFrame() failed, but we must run a driver frame because we have
// an input. Possibly from recording or netplay(!)
pBurnDraw = NULL; // Make sure no image is drawn, since video failed this time 'round.
BurnDrvFrame();
}
bBurnRunAheadFrame = 0;
nCurrentFrame--;
StateRunAheadLoad();
pBurnSoundOut = pBurnSoundOut_temp; // restore pointer, for wav & avi writer
} }
VidPaint(0); // paint the screen (no need to validate) VidPaint(0); // paint the screen (no need to validate)
} } else { // frame skipping
else
{ // frame skipping
pBurnDraw = NULL; // Make sure no image is drawn pBurnDraw = NULL; // Make sure no image is drawn
BurnDrvFrame(); BurnDrvFrame();
} }