Support manual height, remove vertical centering logic (no easy way to get this to work with ystart autodetect).

This commit is contained in:
Christian Speckner 2017-01-10 00:12:25 +01:00
parent bd46bb4174
commit ef000d2ae5
5 changed files with 20 additions and 24 deletions

View File

@ -511,6 +511,7 @@ void Console::changeHeight(int direction)
if(direction == +1) // increase Height
{
height++;
if (height < 210) height = 210;
if(height > 256 || height > dheight)
{
myOSystem.frameBuffer().showMessage("Height at maximum");
@ -520,11 +521,7 @@ void Console::changeHeight(int direction)
else if(direction == -1) // decrease Height
{
height--;
if(height < 210)
{
myOSystem.frameBuffer().showMessage("Height at minimum");
return;
}
if(height < 210) height = 0;
}
else
return;
@ -546,7 +543,7 @@ void Console::setTIAProperties()
uInt32 ystart = atoi(myProperties.get(Display_YStart).c_str());
if(ystart > 64) ystart = 64;
uInt32 height = atoi(myProperties.get(Display_Height).c_str());
if(height < 210) height = 210;
if(height < 210 && height != 0) height = 210;
else if(height > 256) height = 256;
if(myDisplayFormat == "NTSC" || myDisplayFormat == "PAL60" ||
@ -563,18 +560,9 @@ void Console::setTIAProperties()
myConsoleInfo.InitialFrameRate = "50";
// PAL ROMs normally need at least 250 lines
height = std::max(height, 250u);
if (height != 0) height = std::max(height, 250u);
}
// Make sure these values fit within the bounds of the desktop
// If not, attempt to center vertically
uInt32 dheight = myOSystem.frameBuffer().desktopSize().h;
if(height > dheight)
{
ystart += height - dheight;
ystart = std::min(ystart, 64u);
height = dheight;
}
myTIA->setYStart(ystart);
myTIA->setHeight(height);
}

View File

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

View File

@ -45,6 +45,7 @@ static constexpr uInt32
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrameManager::FrameManager()
: myMode(TvMode::pal),
myFixedHeight(0),
myVblankMode(VblankMode::floating),
myYstart(0)
{
@ -100,9 +101,8 @@ void FrameManager::nextLine()
break;
case State::frame:
if (myLineInState >= myKernelLines + Metrics::visibleOverscan) {
if (myLineInState >= (myFixedHeight > 0 ? myFixedHeight : (myKernelLines + Metrics::visibleOverscan)))
finalizeFrame();
}
break;
default:
@ -234,7 +234,15 @@ TvMode FrameManager::tvMode() const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 FrameManager::height() const
{
return myKernelLines + Metrics::visibleOverscan;
return myFixedHeight > 0 ? myFixedHeight : (myKernelLines + Metrics::visibleOverscan);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameManager::setFixedHeight(uInt32 height)
{
myFixedHeight = height;
(cout << myFixedHeight << "\n").flush();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -55,6 +55,8 @@ class FrameManager : public Serializable
uInt32 height() const;
void setFixedHeight(uInt32 height);
uInt32 currentLine() const;
uInt32 scanlines() const;
@ -129,6 +131,7 @@ class FrameManager : public Serializable
uInt32 myKernelLines;
uInt32 myOverscanLines;
uInt32 myFrameLines;
uInt32 myFixedHeight;
VblankMode myVblankMode;
uInt32 myLastVblankLines;

View File

@ -614,27 +614,24 @@ void TIA::update()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// TODO: stub
uInt32 TIA::height() const
{
return myFrameManager.height();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// TODO: stub
uInt32 TIA::ystart() const
{
return myFrameManager.ystart();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// TODO: stub
void TIA::setHeight(uInt32 height)
{
myFrameManager.setFixedHeight(height);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// TODO: stub
void TIA::setYStart(uInt32 ystart)
{
myFrameManager.setYstart(ystart);