Support fixed ystart, change ystart default to 0 = autodetect.

This commit is contained in:
Christian Speckner 2017-01-08 00:31:35 +01:00
parent 602b7b9d0d
commit 452f083fc1
4 changed files with 33 additions and 5 deletions

View File

@ -321,7 +321,7 @@ const char* Properties::ourDefaultProperties[LastPropType] = {
"NO", // Controller.SwapPaddles
"AUTO", // Controller.MouseAxis
"AUTO", // Display.Format
"34", // Display.YStart
"0", // Display.YStart
"210", // Display.Height
"NO", // Display.Phosphor
"77" // Display.PPBlend

View File

@ -44,7 +44,8 @@ static constexpr uInt32
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrameManager::FrameManager()
: myMode(TvMode::pal)
: myMode(TvMode::pal),
myYstart(0)
{
setTvMode(TvMode::ntsc);
reset();
@ -73,11 +74,12 @@ void FrameManager::reset()
myTotalFrames = 0;
myFramesInMode = 0;
myModeConfirmed = false;
myVblankMode = VblankMode::floating;
myLastVblankLines = 0;
myVblankViolations = 0;
myStableVblankFrames = 0;
myVblankViolated = false;
if (myVblankMode == VblankMode::locked) myVblankMode = VblankMode::floating;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -153,9 +155,28 @@ void FrameManager::nextLineInVsync()
myVblankMode = VblankMode::floating;
break;
case VblankMode::fixed:
if (myLineInState > myYstart) setState(State::frame);
break;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameManager::setYstart(uInt32 ystart)
{
if (ystart == myYstart) return;
myYstart = ystart;
myVblankMode = ystart ? VblankMode::fixed : VblankMode::floating;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 FrameManager::ystart() const {
return myYstart;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameManager::setVblank(bool vblank)
{

View File

@ -65,6 +65,10 @@ class FrameManager : public Serializable
float frameRate() const { return myFrameRate; }
void setYstart(uInt32 ystart);
uInt32 ystart() const;
/**
Serializable methods (see that class for more information).
*/
@ -87,7 +91,8 @@ class FrameManager : public Serializable
enum VblankMode {
locked,
floating
floating,
fixed
};
private:
@ -127,6 +132,7 @@ class FrameManager : public Serializable
VblankMode myVblankMode;
uInt32 myLastVblankLines;
uInt32 myYstart;
uInt8 myVblankViolations;
uInt8 myStableVblankFrames;
bool myVblankViolated;

View File

@ -619,7 +619,7 @@ uInt32 TIA::height() const
// TODO: stub
uInt32 TIA::ystart() const
{
return 0;
return myFrameManager.ystart();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -632,6 +632,7 @@ void TIA::setHeight(uInt32 height)
// TODO: stub
void TIA::setYStart(uInt32 ystart)
{
myFrameManager.setYstart(ystart);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -