diff --git a/src/emucore/tia/FrameManager.cxx b/src/emucore/tia/FrameManager.cxx index 24a1b707c..66950bc27 100644 --- a/src/emucore/tia/FrameManager.cxx +++ b/src/emucore/tia/FrameManager.cxx @@ -124,6 +124,10 @@ void FrameManager::setVsync(bool vsync) { if (!myWaitForVsync || vsync == myVsync) return; +#ifdef TIA_FRAMEMANAGER_DEBUG_LOG + (cout << "vsync " << myVsync << " -> " << vsync << ": state " << int(myState) << " @ " << myLineInState << "\n").flush(); +#endif + myVsync = vsync; switch (myState) @@ -142,7 +146,7 @@ void FrameManager::setVsync(bool vsync) break; case State::frame: - if (myVsync) finalizeFrame(); + if (myVsync) finalizeFrame(State::waitForVsyncEnd); break; default: @@ -220,6 +224,10 @@ void FrameManager::setState(FrameManager::State state) { if (myState == state) return; +#ifdef TIA_FRAMEMANAGER_DEBUG_LOG + (cout << "state change " << myState << " -> " << state << " @ " << myLineInState << "\n").flush(); +#endif // TIA_FRAMEMANAGER_DEBUG_LOG + myState = state; myLineInState = 0; @@ -227,7 +235,7 @@ void FrameManager::setState(FrameManager::State state) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FrameManager::finalizeFrame() +void FrameManager::finalizeFrame(FrameManager::State state) { const uInt32 deltaNTSC = abs(Int32(myCurrentFrameTotalLines) - Int32(frameLinesNTSC)), @@ -241,9 +249,13 @@ void FrameManager::finalizeFrame() myOnFrameComplete(); } +#ifdef TIA_FRAMEMANAGER_DEBUG_LOG + (cout << "frame complete @ " << myLineInState << " (" << myCurrentFrameFinalLines << " total)" << "\n").flush(); +#endif // TIA_FRAMEMANAGER_DEBUG_LOG + myCurrentFrameFinalLines = myCurrentFrameTotalLines; myCurrentFrameTotalLines = 0; - setState(State::overscan); + setState(state); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/tia/FrameManager.hxx b/src/emucore/tia/FrameManager.hxx index e9dab180d..e8ce6ef74 100644 --- a/src/emucore/tia/FrameManager.hxx +++ b/src/emucore/tia/FrameManager.hxx @@ -82,7 +82,7 @@ class FrameManager : public Serializable void setState(State state); - void finalizeFrame(); + void finalizeFrame(State state = State::overscan); private: