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 if(direction == +1) // increase Height
{ {
height++; height++;
if (height < 210) height = 210;
if(height > 256 || height > dheight) if(height > 256 || height > dheight)
{ {
myOSystem.frameBuffer().showMessage("Height at maximum"); myOSystem.frameBuffer().showMessage("Height at maximum");
@ -520,11 +521,7 @@ void Console::changeHeight(int direction)
else if(direction == -1) // decrease Height else if(direction == -1) // decrease Height
{ {
height--; height--;
if(height < 210) if(height < 210) height = 0;
{
myOSystem.frameBuffer().showMessage("Height at minimum");
return;
}
} }
else else
return; return;
@ -546,7 +543,7 @@ void Console::setTIAProperties()
uInt32 ystart = atoi(myProperties.get(Display_YStart).c_str()); uInt32 ystart = atoi(myProperties.get(Display_YStart).c_str());
if(ystart > 64) ystart = 64; if(ystart > 64) ystart = 64;
uInt32 height = atoi(myProperties.get(Display_Height).c_str()); 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; else if(height > 256) height = 256;
if(myDisplayFormat == "NTSC" || myDisplayFormat == "PAL60" || if(myDisplayFormat == "NTSC" || myDisplayFormat == "PAL60" ||
@ -563,18 +560,9 @@ void Console::setTIAProperties()
myConsoleInfo.InitialFrameRate = "50"; myConsoleInfo.InitialFrameRate = "50";
// PAL ROMs normally need at least 250 lines // 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->setYStart(ystart);
myTIA->setHeight(height); myTIA->setHeight(height);
} }

View File

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

View File

@ -45,6 +45,7 @@ static constexpr uInt32
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrameManager::FrameManager() FrameManager::FrameManager()
: myMode(TvMode::pal), : myMode(TvMode::pal),
myFixedHeight(0),
myVblankMode(VblankMode::floating), myVblankMode(VblankMode::floating),
myYstart(0) myYstart(0)
{ {
@ -100,9 +101,8 @@ void FrameManager::nextLine()
break; break;
case State::frame: case State::frame:
if (myLineInState >= myKernelLines + Metrics::visibleOverscan) { if (myLineInState >= (myFixedHeight > 0 ? myFixedHeight : (myKernelLines + Metrics::visibleOverscan)))
finalizeFrame(); finalizeFrame();
}
break; break;
default: default:
@ -234,7 +234,15 @@ TvMode FrameManager::tvMode() const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 FrameManager::height() 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; uInt32 height() const;
void setFixedHeight(uInt32 height);
uInt32 currentLine() const; uInt32 currentLine() const;
uInt32 scanlines() const; uInt32 scanlines() const;
@ -129,6 +131,7 @@ class FrameManager : public Serializable
uInt32 myKernelLines; uInt32 myKernelLines;
uInt32 myOverscanLines; uInt32 myOverscanLines;
uInt32 myFrameLines; uInt32 myFrameLines;
uInt32 myFixedHeight;
VblankMode myVblankMode; VblankMode myVblankMode;
uInt32 myLastVblankLines; uInt32 myLastVblankLines;

View File

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