Bug fixing, harcode min ystart to 0.

This commit is contained in:
Christian Speckner 2018-09-13 23:23:21 +02:00
parent 5bc84bca52
commit 2f9fc4f525
4 changed files with 33 additions and 19 deletions

View File

@ -64,6 +64,9 @@
"__hash_table": "cpp",
"array": "cpp",
"queue": "cpp",
"unordered_map": "cpp"
"unordered_map": "cpp",
"istream": "cpp",
"thread": "cpp",
"utility": "cpp"
}
}

View File

@ -680,10 +680,9 @@ void Console::changeYStart(int direction)
}
else if(direction == -1) // decrease YStart
{
if(ystart == TIAConstants::minYStart-1 && myAutodetectedYstart > 0)
if(ystart == 0)
{
myOSystem.frameBuffer().showMessage("YStart at minimum");
return;
throw runtime_error("cannot happen");
}
--ystart;
@ -694,7 +693,7 @@ void Console::changeYStart(int direction)
ostringstream val;
val << ystart;
if(ystart == TIAConstants::minYStart-1) {
if(ystart == 0) {
redetectYStart();
ystart = myAutodetectedYstart;
@ -707,12 +706,12 @@ void Console::changeYStart(int direction)
// We've reached the auto-detect value, so reset
myOSystem.frameBuffer().showMessage("YStart " + val.str() + " (Auto)");
val.str("");
val << TIAConstants::minYStart-1;
val << static_cast<int>(0);
}
else
myOSystem.frameBuffer().showMessage("YStart " + val.str());
myAutodetectedYstart = false;
myYStartAutodetected = false;
}
myProperties.set(Display_YStart, val.str());
@ -723,14 +722,23 @@ void Console::changeYStart(int direction)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::updateYStart(uInt32 ystart)
{
if (ystart == TIAConstants::minYStart-1 && !myYStartAutodetected) {
redetectYStart();
ystart = myAutodetectedYstart;
} else if (ystart <= TIAConstants::maxYStart) myYStartAutodetected = false;
if (ystart > TIAConstants::maxYStart) return;
if (ystart <= TIAConstants::maxYStart) {
ostringstream ss;
ss << ystart;
if (ss.str() == myProperties.get(Display_YStart)) return;
myProperties.set(Display_YStart, ss.str());
if (ystart == 0) {
redetectYStart();
myTIA->setYStart(myAutodetectedYstart);
myTIA->frameReset();
} else {
myTIA->setYStart(ystart);
myTIA->frameReset();
myYStartAutodetected = false;
}
}
@ -772,7 +780,7 @@ void Console::setTIAProperties()
{
uInt32 ystart = atoi(myProperties.get(Display_YStart).c_str());
if(ystart != 0)
ystart = BSPF::clamp(ystart, TIAConstants::minYStart, TIAConstants::maxYStart);
ystart = BSPF::clamp(ystart, 0u, TIAConstants::maxYStart);
uInt32 height = atoi(myProperties.get(Display_Height).c_str());
if(height != 0)
height = BSPF::clamp(height, TIAConstants::minViewableHeight, TIAConstants::maxViewableHeight);

View File

@ -23,7 +23,7 @@
namespace TIAConstants {
constexpr uInt32 frameBufferHeight = 320;
constexpr uInt32 minYStart = 1, maxYStart = 64;
constexpr uInt32 maxYStart = 64;
constexpr uInt32 minViewableHeight = 210, maxViewableHeight = 256;
constexpr uInt32 initialGarbageFrames = 10;
}

View File

@ -307,10 +307,10 @@ GameInfoDialog::GameInfoDialog(
t = new StaticTextWidget(myTab, font, HBORDER, ypos+2, "Y-start ");
myYStart = new SliderWidget(myTab, font, t->getRight(), ypos, swidth, lineHeight,
" ", 0, kYStartChanged, 5 * fontWidth, "px");
myYStart->setMinValue(TIAConstants::minYStart-1);
myYStart->setMinValue(0);
myYStart->setMaxValue(TIAConstants::maxYStart);
// one tickmark every ~10 pixel
myYStart->setTickmarkInterval((TIAConstants::maxYStart - (TIAConstants::minYStart-1) + 5) / 10);
myYStart->setTickmarkInterval((TIAConstants::maxYStart + 5) / 10);
wid.push_back(myYStart);
int iWidth = ifont.getCharWidth('2');
@ -532,8 +532,6 @@ void GameInfoDialog::saveConfig()
// Display properties
myGameProperties.set(Display_Format, myFormat->getSelectedTag().toString());
myGameProperties.set(Display_YStart, myYStart->getValueLabel() == "Auto" ? "0" :
myYStart->getValueLabel());
myGameProperties.set(Display_Height, myHeight->getValueLabel() == "Auto" ? "0" :
myHeight->getValueLabel());
myGameProperties.set(Display_Phosphor, myPhosphor->getState() ? "YES" : "NO");
@ -571,6 +569,11 @@ void GameInfoDialog::saveConfig()
instance().frameBuffer().tiaSurface().enablePhosphor(myPhosphor->getState(), myPPBlend->getValue());
if (reset)
instance().console().tia().frameReset();
} else {
myGameProperties.set(
Display_YStart,
myYStart->getValueLabel() == "Auto" ? "0" : myYStart->getValueLabel()
);
}
}
@ -703,7 +706,7 @@ void GameInfoDialog::handleCommand(CommandSender* sender, int cmd,
}
case kYStartChanged:
if(myYStart->getValue() == TIAConstants::minYStart-1)
if(myYStart->getValue() == 0)
{
myYStart->setValueLabel("Auto");
myYStart->setValueUnit("");