Skip to content

Commit

Permalink
added check which ignores invalid frames (too many scanlines) during …
Browse files Browse the repository at this point in the history
…frame detection (fixes Tarzan)
  • Loading branch information
thrust26 committed Jun 4, 2024
1 parent 2a09855 commit b246dcb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/emucore/tia/frame-manager/FrameLayoutDetector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,14 @@ void FrameLayoutDetector::onNextLine()
if (myCurrentFrameTotalLines > frameLines - 3 || myTotalFrames == 0)
++myLinesWaitingForVsyncToStart;

if (myLinesWaitingForVsyncToStart > Metrics::waitForVsync) setState(State::waitForVsyncEnd);
if (myLinesWaitingForVsyncToStart > Metrics::waitForVsync)
setState(State::waitForVsyncEnd);

break;

case State::waitForVsyncEnd:
if (++myLinesWaitingForVsyncToStart > Metrics::waitForVsync) setState(State::waitForVsyncStart);
if (++myLinesWaitingForVsyncToStart > Metrics::waitForVsync)
setState(State::waitForVsyncStart);

break;

Expand Down Expand Up @@ -232,7 +234,10 @@ void FrameLayoutDetector::finalizeFrame()
{
notifyFrameComplete();

if (myTotalFrames <= Metrics::initialGarbageFrames) return;
if (myTotalFrames <= Metrics::initialGarbageFrames)
return;
if (myCurrentFrameFinalLines > Metrics::frameLinesPAL + Metrics::waitForVsync)
return;

// Calculate how close a frame is to PAL and NTSC based on scanlines. An odd scanline count
// results into a penalty of 0.5 for PAL. The result is between 0.0 (<=262 scanlines) and
Expand Down

0 comments on commit b246dcb

Please sign in to comment.