mirror of https://github.com/stella-emu/stella.git
add overscan option to StellaSettingsDialog
fix dialog position when overscan is enabled
This commit is contained in:
parent
1e7ff8974f
commit
91e46faddf
|
@ -1014,7 +1014,6 @@ FrameBuffer::VideoMode::VideoMode(uInt32 iw, uInt32 ih, uInt32 sw, uInt32 sh,
|
||||||
|
|
||||||
if(fsIndex != -1)
|
if(fsIndex != -1)
|
||||||
{
|
{
|
||||||
//double overscan = 1 - myOSystem.settings().getInt("tia.fs_overscan") / 100.0;
|
|
||||||
switch(stretch)
|
switch(stretch)
|
||||||
{
|
{
|
||||||
case Stretch::Preserve:
|
case Stretch::Preserve:
|
||||||
|
|
|
@ -167,14 +167,17 @@ void Dialog::center()
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Dialog::positionAt(uInt32 pos)
|
void Dialog::positionAt(uInt32 pos)
|
||||||
{
|
{
|
||||||
|
const bool fullscreen = instance().settings().getBool("fullscreen");
|
||||||
|
const double overscan = fullscreen ? instance().settings().getInt("tia.fs_overscan") / 200.0 : 0.0;
|
||||||
const Common::Size& screen = instance().frameBuffer().screenSize();
|
const Common::Size& screen = instance().frameBuffer().screenSize();
|
||||||
const Common::Rect& dst = _surface->dstRect();
|
const Common::Rect& dst = _surface->dstRect();
|
||||||
// shift stacked dialogs
|
// shift stacked dialogs
|
||||||
uInt32 gap = (screen.w >> 6) * _layer;
|
Int32 hgap = (screen.w >> 6) * _layer + screen.w * overscan;
|
||||||
int top = std::min(screen.h - dst.height(), gap);
|
Int32 vgap = (screen.w >> 6) * _layer + screen.h * overscan;
|
||||||
int btm = std::min(screen.h - dst.height(), screen.h - dst.height() - gap);
|
int top = std::min(std::max(0, Int32(screen.h - dst.height())), vgap);
|
||||||
int left = std::min(screen.w - dst.width(), gap);
|
int btm = std::max(0, Int32(screen.h - dst.height() - vgap));
|
||||||
int right = std::min(screen.w - dst.width(), screen.w - dst.width() - gap);
|
int left = std::min(std::max(0, Int32(screen.w - dst.width())), hgap);
|
||||||
|
int right = std::max(0, Int32(screen.w - dst.width() - hgap));
|
||||||
|
|
||||||
switch (pos)
|
switch (pos)
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,7 +47,7 @@ StellaSettingsDialog::StellaSettingsDialog(OSystem& osystem, DialogContainer& pa
|
||||||
VariantList items;
|
VariantList items;
|
||||||
|
|
||||||
// Set real dimensions
|
// Set real dimensions
|
||||||
setSize(33 * fontWidth + HBORDER * 2 + 3, 15 * (lineHeight + VGAP) + VGAP * 9 + 6 + _th, max_w, max_h);
|
setSize(35 * fontWidth + HBORDER * 2 + 3, 14 * (lineHeight + VGAP) + VGAP * 9 + 10 + _th, max_w, max_h);
|
||||||
|
|
||||||
xpos = HBORDER;
|
xpos = HBORDER;
|
||||||
ypos = VBORDER + _th;
|
ypos = VBORDER + _th;
|
||||||
|
@ -123,7 +123,7 @@ void StellaSettingsDialog::addVideoOptions(WidgetArray& wid, int& xpos, int& ypo
|
||||||
VariantList items;
|
VariantList items;
|
||||||
|
|
||||||
// TV effects options
|
// TV effects options
|
||||||
int swidth = font.getMaxCharWidth() * 8 - 4;
|
int swidth = font.getMaxCharWidth() * 11;
|
||||||
|
|
||||||
// TV Mode
|
// TV Mode
|
||||||
items.clear();
|
items.clear();
|
||||||
|
@ -132,37 +132,37 @@ void StellaSettingsDialog::addVideoOptions(WidgetArray& wid, int& xpos, int& ypo
|
||||||
VarList::push_back(items, "S-Video", static_cast<uInt32>(NTSCFilter::Preset::SVIDEO));
|
VarList::push_back(items, "S-Video", static_cast<uInt32>(NTSCFilter::Preset::SVIDEO));
|
||||||
VarList::push_back(items, "Composite", static_cast<uInt32>(NTSCFilter::Preset::COMPOSITE));
|
VarList::push_back(items, "Composite", static_cast<uInt32>(NTSCFilter::Preset::COMPOSITE));
|
||||||
VarList::push_back(items, "Bad adjust", static_cast<uInt32>(NTSCFilter::Preset::BAD));
|
VarList::push_back(items, "Bad adjust", static_cast<uInt32>(NTSCFilter::Preset::BAD));
|
||||||
int lwidth = font.getStringWidth("TV mode ");
|
int pwidth = font.getStringWidth("Right bottom");
|
||||||
int pwidth = font.getStringWidth("Bad adjust");
|
int lwidth = font.getStringWidth("Scanline intensity ");
|
||||||
|
|
||||||
myTVMode = new PopUpWidget(this, font, xpos, ypos, pwidth, lineHeight,
|
myTVMode = new PopUpWidget(this, font, xpos, ypos, pwidth, lineHeight,
|
||||||
items, "TV mode ");
|
items, "TV mode ");
|
||||||
wid.push_back(myTVMode);
|
wid.push_back(myTVMode);
|
||||||
ypos += lineHeight + VGAP * 2;
|
ypos += lineHeight + VGAP;
|
||||||
|
|
||||||
lwidth = font.getStringWidth("Intensity ");
|
|
||||||
swidth = font.getMaxCharWidth() * 10;
|
|
||||||
|
|
||||||
// Scanline intensity
|
// Scanline intensity
|
||||||
myTVScanlines = new StaticTextWidget(this, font, xpos, ypos + 1, "Scanlines:");
|
myTVScanIntense = new SliderWidget(this, font, xpos, ypos-1, swidth, lineHeight,
|
||||||
ypos += lineHeight;
|
"Scanline intensity", lwidth, kScanlinesChanged, fontWidth * 3);
|
||||||
myTVScanIntense = new SliderWidget(this, font, xpos + INDENT, ypos-1, swidth, lineHeight,
|
|
||||||
"Intensity ", lwidth, kScanlinesChanged, fontWidth * 2);
|
|
||||||
myTVScanIntense->setMinValue(0); myTVScanIntense->setMaxValue(10);
|
myTVScanIntense->setMinValue(0); myTVScanIntense->setMaxValue(10);
|
||||||
myTVScanIntense->setTickmarkIntervals(2);
|
myTVScanIntense->setTickmarkIntervals(2);
|
||||||
wid.push_back(myTVScanIntense);
|
wid.push_back(myTVScanIntense);
|
||||||
ypos += lineHeight + VGAP;
|
ypos += lineHeight + VGAP;
|
||||||
|
|
||||||
// TV Phosphor effect
|
|
||||||
new StaticTextWidget(this, font, xpos, ypos + 1, "Phosphor effect:");
|
|
||||||
ypos += lineHeight;
|
|
||||||
// TV Phosphor blend level
|
// TV Phosphor blend level
|
||||||
myTVPhosLevel = new SliderWidget(this, font, xpos + INDENT, ypos-1, swidth, lineHeight,
|
myTVPhosLevel = new SliderWidget(this, font, xpos, ypos-1, swidth, lineHeight,
|
||||||
"Blend ", lwidth, kPhosphorChanged, fontWidth * 2);
|
"Phosphor blend ", lwidth, kPhosphorChanged, fontWidth * 3);
|
||||||
myTVPhosLevel->setMinValue(0); myTVPhosLevel->setMaxValue(10);
|
myTVPhosLevel->setMinValue(0); myTVPhosLevel->setMaxValue(10);
|
||||||
myTVPhosLevel->setTickmarkIntervals(2);
|
myTVPhosLevel->setTickmarkIntervals(2);
|
||||||
wid.push_back(myTVPhosLevel);
|
wid.push_back(myTVPhosLevel);
|
||||||
ypos += lineHeight + VGAP;
|
ypos += lineHeight + VGAP;
|
||||||
|
|
||||||
|
// FS overscan
|
||||||
|
myTVOverscan = new SliderWidget(this, font, xpos, ypos - 1, swidth, lineHeight,
|
||||||
|
"Overscan ", lwidth, kOverscanChanged, fontWidth * 3);
|
||||||
|
myTVOverscan->setMinValue(0); myTVOverscan->setMaxValue(10);
|
||||||
|
myTVOverscan->setTickmarkIntervals(2);
|
||||||
|
wid.push_back(myTVOverscan);
|
||||||
|
ypos += lineHeight + VGAP;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -227,6 +227,11 @@ void StellaSettingsDialog::loadConfig()
|
||||||
// TV phosphor blend
|
// TV phosphor blend
|
||||||
myTVPhosLevel->setValue(valueToLevel(settings.getInt("tv.phosblend")));
|
myTVPhosLevel->setValue(valueToLevel(settings.getInt("tv.phosblend")));
|
||||||
|
|
||||||
|
// TV overscan
|
||||||
|
myTVOverscan->setValue(settings.getInt("tia.fs_overscan"));
|
||||||
|
|
||||||
|
handleOverscanChange();
|
||||||
|
|
||||||
// Controllers
|
// Controllers
|
||||||
Properties props;
|
Properties props;
|
||||||
|
|
||||||
|
@ -270,6 +275,9 @@ void StellaSettingsDialog::saveConfig()
|
||||||
instance().settings().setValue("tv.scanlines",
|
instance().settings().setValue("tv.scanlines",
|
||||||
levelToValue(myTVScanIntense->getValue()));
|
levelToValue(myTVScanIntense->getValue()));
|
||||||
|
|
||||||
|
// TV overscan
|
||||||
|
instance().settings().setValue("tia.fs_overscan", myTVOverscan->getValueLabel());
|
||||||
|
|
||||||
// Controller properties
|
// Controller properties
|
||||||
myGameProperties.set(PropType::Controller_Left, myLeftPort->getSelectedTag().toString());
|
myGameProperties.set(PropType::Controller_Left, myLeftPort->getSelectedTag().toString());
|
||||||
myGameProperties.set(PropType::Controller_Right, myRightPort->getSelectedTag().toString());
|
myGameProperties.set(PropType::Controller_Right, myRightPort->getSelectedTag().toString());
|
||||||
|
@ -302,6 +310,8 @@ void StellaSettingsDialog::setDefaults()
|
||||||
myTVScanIntense->setValue(3); // 18
|
myTVScanIntense->setValue(3); // 18
|
||||||
// TV phosphor blend
|
// TV phosphor blend
|
||||||
myTVPhosLevel->setValue(6); // = 45
|
myTVPhosLevel->setValue(6); // = 45
|
||||||
|
// TV overscan
|
||||||
|
myTVOverscan->setValue(0);
|
||||||
|
|
||||||
// Load the default game properties
|
// Load the default game properties
|
||||||
Properties defaultProperties;
|
Properties defaultProperties;
|
||||||
|
@ -358,12 +368,29 @@ void StellaSettingsDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
myTVPhosLevel->setValueLabel("Off");
|
myTVPhosLevel->setValueLabel("Off");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case kOverscanChanged:
|
||||||
|
handleOverscanChange();
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Dialog::handleCommand(sender, cmd, data, 0);
|
Dialog::handleCommand(sender, cmd, data, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void StellaSettingsDialog::handleOverscanChange()
|
||||||
|
{
|
||||||
|
if (myTVOverscan->getValue() == 0)
|
||||||
|
{
|
||||||
|
myTVOverscan->setValueLabel("Off");
|
||||||
|
myTVOverscan->setValueUnit("");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
myTVOverscan->setValueUnit("%");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void StellaSettingsDialog::switchSettingsMode()
|
void StellaSettingsDialog::switchSettingsMode()
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,6 +54,7 @@ class StellaSettingsDialog : public Dialog
|
||||||
void addGameOptions(WidgetArray& wid, int& xpos, int& ypos, const GUI::Font& font);
|
void addGameOptions(WidgetArray& wid, int& xpos, int& ypos, const GUI::Font& font);
|
||||||
|
|
||||||
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
||||||
|
void handleOverscanChange();
|
||||||
|
|
||||||
// switch to advanced settings after user confirmation
|
// switch to advanced settings after user confirmation
|
||||||
void switchSettingsMode();
|
void switchSettingsMode();
|
||||||
|
@ -82,6 +83,9 @@ class StellaSettingsDialog : public Dialog
|
||||||
// TV phosphor effect
|
// TV phosphor effect
|
||||||
SliderWidget* myTVPhosLevel;
|
SliderWidget* myTVPhosLevel;
|
||||||
|
|
||||||
|
// TV Overscan
|
||||||
|
SliderWidget* myTVOverscan;
|
||||||
|
|
||||||
// Controller properties
|
// Controller properties
|
||||||
StaticTextWidget* myGameSettings;
|
StaticTextWidget* myGameSettings;
|
||||||
|
|
||||||
|
@ -110,7 +114,8 @@ class StellaSettingsDialog : public Dialog
|
||||||
kConfirmSwitchCmd = 'SScf',
|
kConfirmSwitchCmd = 'SScf',
|
||||||
kHelp = 'SShl',
|
kHelp = 'SShl',
|
||||||
kScanlinesChanged = 'SSsc',
|
kScanlinesChanged = 'SSsc',
|
||||||
kPhosphorChanged = 'SSph'
|
kPhosphorChanged = 'SSph',
|
||||||
|
kOverscanChanged = 'SSov'
|
||||||
};
|
};
|
||||||
|
|
||||||
// Game properties for currently loaded ROM
|
// Game properties for currently loaded ROM
|
||||||
|
|
|
@ -196,11 +196,11 @@ VideoDialog::VideoDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
ypos += lineHeight + VGAP;
|
ypos += lineHeight + VGAP;
|
||||||
|
|
||||||
// FS overscan
|
// FS overscan
|
||||||
myUseOverscan = new SliderWidget(myTab, font, xpos + INDENT, ypos - 1, swidth, lineHeight,
|
myTVOverscan = new SliderWidget(myTab, font, xpos + INDENT, ypos - 1, swidth, lineHeight,
|
||||||
"Overscan", font.getStringWidth("Overscan "), kOverscanChanged, fontWidth * 3, "%");
|
"Overscan", font.getStringWidth("Overscan "), kOverscanChanged, fontWidth * 3, "%");
|
||||||
myUseOverscan->setMinValue(0); myUseOverscan->setMaxValue(10);
|
myTVOverscan->setMinValue(0); myTVOverscan->setMaxValue(10);
|
||||||
myUseOverscan->setTickmarkIntervals(2);
|
myTVOverscan->setTickmarkIntervals(2);
|
||||||
wid.push_back(myUseOverscan);
|
wid.push_back(myTVOverscan);
|
||||||
ypos += (lineHeight + VGAP) * 2;
|
ypos += (lineHeight + VGAP) * 2;
|
||||||
|
|
||||||
// Skip progress load bars for SuperCharger ROMs
|
// Skip progress load bars for SuperCharger ROMs
|
||||||
|
@ -370,7 +370,8 @@ void VideoDialog::loadConfig()
|
||||||
// Fullscreen stretch setting
|
// Fullscreen stretch setting
|
||||||
myUseStretch->setState(instance().settings().getBool("tia.fs_stretch"));
|
myUseStretch->setState(instance().settings().getBool("tia.fs_stretch"));
|
||||||
// Fullscreen overscan setting
|
// Fullscreen overscan setting
|
||||||
myUseOverscan->setValue(instance().settings().getInt("tia.fs_overscan"));
|
myTVOverscan->setValue(instance().settings().getInt("tia.fs_overscan"));
|
||||||
|
handleFullScreenChange();
|
||||||
|
|
||||||
// Use sync to vertical blank
|
// Use sync to vertical blank
|
||||||
myUseVSync->setState(instance().settings().getBool("vsync"));
|
myUseVSync->setState(instance().settings().getBool("vsync"));
|
||||||
|
@ -443,7 +444,7 @@ void VideoDialog::saveConfig()
|
||||||
// Fullscreen stretch setting
|
// Fullscreen stretch setting
|
||||||
instance().settings().setValue("tia.fs_stretch", myUseStretch->getState());
|
instance().settings().setValue("tia.fs_stretch", myUseStretch->getState());
|
||||||
// Fullscreen overscan
|
// Fullscreen overscan
|
||||||
instance().settings().setValue("tia.fs_overscan", myUseOverscan->getValueLabel());
|
instance().settings().setValue("tia.fs_overscan", myTVOverscan->getValueLabel());
|
||||||
|
|
||||||
// Use sync to vertical blank
|
// Use sync to vertical blank
|
||||||
instance().settings().setValue("vsync", myUseVSync->getState());
|
instance().settings().setValue("vsync", myUseVSync->getState());
|
||||||
|
@ -586,19 +587,19 @@ void VideoDialog::handleFullScreenChange()
|
||||||
{
|
{
|
||||||
bool enable = myFullscreen->getState();
|
bool enable = myFullscreen->getState();
|
||||||
myUseStretch->setEnabled(enable);
|
myUseStretch->setEnabled(enable);
|
||||||
myUseOverscan->setEnabled(enable);
|
myTVOverscan->setEnabled(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void VideoDialog::handleOverscanChange()
|
void VideoDialog::handleOverscanChange()
|
||||||
{
|
{
|
||||||
if (myUseOverscan->getValue() == 0)
|
if (myTVOverscan->getValue() == 0)
|
||||||
{
|
{
|
||||||
myUseOverscan->setValueLabel("Off");
|
myTVOverscan->setValueLabel("Off");
|
||||||
myUseOverscan->setValueUnit("");
|
myTVOverscan->setValueUnit("");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
myUseOverscan->setValueUnit("%");
|
myTVOverscan->setValueUnit("%");
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -65,7 +65,7 @@ class VideoDialog : public Dialog
|
||||||
CheckboxWidget* myFullscreen;
|
CheckboxWidget* myFullscreen;
|
||||||
//PopUpWidget* myFullScreenMode;
|
//PopUpWidget* myFullScreenMode;
|
||||||
CheckboxWidget* myUseStretch;
|
CheckboxWidget* myUseStretch;
|
||||||
SliderWidget* myUseOverscan;
|
SliderWidget* myTVOverscan;
|
||||||
CheckboxWidget* myUseVSync;
|
CheckboxWidget* myUseVSync;
|
||||||
CheckboxWidget* myUIMessages;
|
CheckboxWidget* myUIMessages;
|
||||||
CheckboxWidget* myCenter;
|
CheckboxWidget* myCenter;
|
||||||
|
|
Loading…
Reference in New Issue