diff --git a/src/emucore/Console.cxx b/src/emucore/Console.cxx index 65d896ec8..d87d36928 100644 --- a/src/emucore/Console.cxx +++ b/src/emucore/Console.cxx @@ -59,6 +59,7 @@ #include "FrameLayout.hxx" #include "frame-manager/FrameManager.hxx" #include "frame-manager/FrameLayoutDetector.hxx" +#include "frame-manager/YStartDetector.hxx" #ifdef DEBUGGER_SUPPORT #include "Debugger.hxx" @@ -144,7 +145,20 @@ Console::Console(OSystem& osystem, unique_ptr& cart, // Don't forget to reset the SC progress bars again myOSystem.settings().setValue("fastscbios", fastscbios); + + // TODO: move! move! move! (temporary for testing) + YStartDetector ystartDetector; + ystartDetector.setLayout(frameLayoutDetector.detectedLayout()); + myTIA->setFrameManager(&ystartDetector); + mySystem->reset(); + + for (int i = 0; i < 80; i++) myTIA->update(); + + myTIA->setFrameManager(myFrameManager.get()); + + (cout << "detected ystart value: " << ystartDetector.detectedYStart() << std::endl).flush(); } + myConsoleInfo.DisplayFormat = myDisplayFormat + autodetected; // Set up the correct properties used when toggling format diff --git a/src/emucore/tia/frame-manager/FrameLayoutDetector.cxx b/src/emucore/tia/frame-manager/FrameLayoutDetector.cxx index 06298863b..9538201c6 100644 --- a/src/emucore/tia/frame-manager/FrameLayoutDetector.cxx +++ b/src/emucore/tia/frame-manager/FrameLayoutDetector.cxx @@ -40,7 +40,7 @@ void FrameLayoutDetector::onReset() { myState = State::waitForVsyncStart; myNtscFrames = myPalFrames = 0; - myLinesWaitingForVsync = 0; + myLinesWaitingForVsyncToStart = 0; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -62,14 +62,14 @@ void FrameLayoutDetector::onNextLine() // We start counting the number of "lines spent while waiting for vsync start" from // the "ideal" frame size (corrected by the three scanlines spent in vsync). if (myCurrentFrameTotalLines > frameLines - 3 || myTotalFrames == 0) - myLinesWaitingForVsync++; + myLinesWaitingForVsyncToStart++; - if (myLinesWaitingForVsync > Metrics::waitForVsync) setState(State::waitForVsyncEnd); + if (myLinesWaitingForVsyncToStart > Metrics::waitForVsync) setState(State::waitForVsyncEnd); break; case State::waitForVsyncEnd: - if (++myLinesWaitingForVsync > Metrics::waitForVsync) setState(State::waitForVsyncStart); + if (++myLinesWaitingForVsyncToStart > Metrics::waitForVsync) setState(State::waitForVsyncStart); break; @@ -84,7 +84,7 @@ void FrameLayoutDetector::setState(State state) if (state == myState) return; myState = state; - myLinesWaitingForVsync = 0; + myLinesWaitingForVsyncToStart = 0; switch (myState) { case State::waitForVsyncEnd: diff --git a/src/emucore/tia/frame-manager/FrameLayoutDetector.hxx b/src/emucore/tia/frame-manager/FrameLayoutDetector.hxx index 05cbe8b4d..1be30623d 100644 --- a/src/emucore/tia/frame-manager/FrameLayoutDetector.hxx +++ b/src/emucore/tia/frame-manager/FrameLayoutDetector.hxx @@ -96,7 +96,7 @@ class FrameLayoutDetector: public AbstractFrameManager { * We count the number of scanlines we spend waiting for vsync to be * toggled. If a threshold is exceeded, we force the transition. */ - uInt32 myLinesWaitingForVsync; + uInt32 myLinesWaitingForVsyncToStart; }; diff --git a/src/emucore/tia/frame-manager/module.mk b/src/emucore/tia/frame-manager/module.mk index fc89b863f..7999f5d00 100644 --- a/src/emucore/tia/frame-manager/module.mk +++ b/src/emucore/tia/frame-manager/module.mk @@ -4,7 +4,8 @@ MODULE_OBJS := \ src/emucore/tia/frame-manager/FrameManager.o \ src/emucore/tia/frame-manager/VblankManager.o \ src/emucore/tia/frame-manager/AbstractFrameManager.o \ - src/emucore/tia/frame-manager/FrameLayoutDetector.o + src/emucore/tia/frame-manager/FrameLayoutDetector.o \ + src/emucore/tia/frame-manager/YStartDetector.o MODULE_DIRS += \ src/emucore/tia/frame-manager