mirror of https://github.com/stella-emu/stella.git
Change adjustscanlines parameterization to -5% .. 5%, hook uo hotkey.
This commit is contained in:
parent
3e9a9a7a2a
commit
5b99e3e998
|
@ -688,19 +688,24 @@ void Console::changeScanlineAdjust(int direction)
|
||||||
// Get correct setting, depending on whether we're in NTSC or PAL
|
// Get correct setting, depending on whether we're in NTSC or PAL
|
||||||
// Int32 adjust = myOSystem.settings().getInt("tia.adjustscanlines.ntsc");
|
// Int32 adjust = myOSystem.settings().getInt("tia.adjustscanlines.ntsc");
|
||||||
|
|
||||||
|
float newAdjustScanliens = myTIA->adjustScanlines();;
|
||||||
|
|
||||||
|
if (direction != -1 && direction != +1) return;
|
||||||
|
|
||||||
if(direction == +1) // increase scanline adjustment
|
if(direction == +1) // increase scanline adjustment
|
||||||
{
|
{
|
||||||
cerr << "adjust scanline +\n";
|
newAdjustScanliens = std::min(myTIA->adjustScanlines() + 0.5f, 5.f);
|
||||||
}
|
}
|
||||||
else if(direction == -1) // decrease scanline adjustment
|
else if(direction == -1) // decrease scanline adjustment
|
||||||
{
|
{
|
||||||
cerr << "adjust scanline -\n";
|
newAdjustScanliens = std::max(myTIA->adjustScanlines() - 0.5f, -5.f);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Set new adjustment, updating the correct setting
|
if (newAdjustScanliens != myTIA->adjustScanlines()) {
|
||||||
// ...
|
myTIA->setAdjustScanlines(newAdjustScanliens);
|
||||||
|
myOSystem.settings().setValue("tia.adjustscanlines", newAdjustScanliens);
|
||||||
|
initializeVideo();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -715,15 +720,14 @@ void Console::setTIAProperties()
|
||||||
{
|
{
|
||||||
// Assume we've got ~262 scanlines (NTSC-like format)
|
// Assume we've got ~262 scanlines (NTSC-like format)
|
||||||
myTIA->setLayout(FrameLayout::ntsc);
|
myTIA->setLayout(FrameLayout::ntsc);
|
||||||
myTIA->setAdjustScanlines(myOSystem.settings().getInt("tia.adjustscanlines.ntsc"));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Assume we've got ~312 scanlines (PAL-like format)
|
// Assume we've got ~312 scanlines (PAL-like format)
|
||||||
myTIA->setLayout(FrameLayout::pal);
|
myTIA->setLayout(FrameLayout::pal);
|
||||||
myTIA->setAdjustScanlines(myOSystem.settings().getInt("tia.adjustscanlines.pal"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
myTIA->setAdjustScanlines(myOSystem.settings().getFloat("tia.adjustscanlines"));
|
||||||
myTIA->setVcenter(vcenter);
|
myTIA->setVcenter(vcenter);
|
||||||
|
|
||||||
myEmulationTiming.updateFrameLayout(myTIA->frameLayout());
|
myEmulationTiming.updateFrameLayout(myTIA->frameLayout());
|
||||||
|
|
|
@ -50,8 +50,7 @@ Settings::Settings()
|
||||||
// TIA specific options
|
// TIA specific options
|
||||||
setPermanent("tia.zoom", "3");
|
setPermanent("tia.zoom", "3");
|
||||||
setPermanent("tia.inter", "false");
|
setPermanent("tia.inter", "false");
|
||||||
setPermanent("tia.adjustscanlines.ntsc", "0");
|
setPermanent("tia.adjustscanlines", 0.f);
|
||||||
setPermanent("tia.adjustscanlines.pal", "0");
|
|
||||||
setPermanent("fullscreen", "false");
|
setPermanent("fullscreen", "false");
|
||||||
setPermanent("tia.fs_stretch", "false");
|
setPermanent("tia.fs_stretch", "false");
|
||||||
setPermanent("tia.fs_overscan", "0");
|
setPermanent("tia.fs_overscan", "0");
|
||||||
|
@ -255,10 +254,8 @@ void Settings::validate()
|
||||||
f = getFloat("speed");
|
f = getFloat("speed");
|
||||||
if (f <= 0) setValue("speed", "1.0");
|
if (f <= 0) setValue("speed", "1.0");
|
||||||
|
|
||||||
i = getInt("tia.adjustscanlines.ntsc");
|
i = getFloat("tia.adjustscanlines");
|
||||||
if(i < -25 || i > 25) setValue("tia.adjustscanlines.ntsc", "90");
|
if(i < -5. || i > 5.) setValue("tia.adjustscanlines", 0.f);
|
||||||
i = getInt("tia.adjustscanlines.pal");
|
|
||||||
if(i < -25 || i > 25) setValue("tia.adjustscanlines.pal", "100");
|
|
||||||
|
|
||||||
s = getString("tia.dbgcolors");
|
s = getString("tia.dbgcolors");
|
||||||
sort(s.begin(), s.end());
|
sort(s.begin(), s.end());
|
||||||
|
@ -410,8 +407,7 @@ void Settings::usage() const
|
||||||
<< " for TIA image\n"
|
<< " for TIA image\n"
|
||||||
<< " -tia.inter <1|0> Enable interpolated (smooth) scaling for TIA\n"
|
<< " -tia.inter <1|0> Enable interpolated (smooth) scaling for TIA\n"
|
||||||
<< " image\n"
|
<< " image\n"
|
||||||
<< " -tia.adjustscanlines.ntsc <number> Adjust the visible number if TIA scanlines on NTSC\n"
|
<< " -tia.adjustscanlines <float> Adjust the visible number if TIA scanlines [percent]\n"
|
||||||
<< " -tia.adjustscanlines.pal <number> Adjust the visible number if TIA scanlines on PAL\n"
|
|
||||||
<< " -tia.fs_stretch <1|0> Stretch TIA image to fill fullscreen mode\n"
|
<< " -tia.fs_stretch <1|0> Stretch TIA image to fill fullscreen mode\n"
|
||||||
<< " -tia.fs_overscan <0-10> Add overscan to TIA image in fill fullscreen mode\n"
|
<< " -tia.fs_overscan <0-10> Add overscan to TIA image in fill fullscreen mode\n"
|
||||||
<< " -tia.dbgcolors <string> Debug colors to use for each object (see manual\n"
|
<< " -tia.dbgcolors <string> Debug colors to use for each object (see manual\n"
|
||||||
|
|
|
@ -264,8 +264,8 @@ class TIA : public Device
|
||||||
void setLayout(FrameLayout layout) { myFrameManager->setLayout(layout); }
|
void setLayout(FrameLayout layout) { myFrameManager->setLayout(layout); }
|
||||||
FrameLayout frameLayout() const { return myFrameManager->layout(); }
|
FrameLayout frameLayout() const { return myFrameManager->layout(); }
|
||||||
|
|
||||||
void setAdjustScanlines(Int32 adjustScanlines) { myFrameManager->setAdjustScanlines(adjustScanlines); }
|
void setAdjustScanlines(float adjustScanlines) { myFrameManager->setAdjustScanlines(adjustScanlines); }
|
||||||
Int32 adjustScanlines() const { return myFrameManager->adjustScanlines(); }
|
float adjustScanlines() const { return myFrameManager->adjustScanlines(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Enables/disables color-loss for PAL modes only.
|
Enables/disables color-loss for PAL modes only.
|
||||||
|
|
|
@ -181,9 +181,9 @@ class AbstractFrameManager : public Serializable
|
||||||
virtual Int32 maxVcenter() const { return 0; }
|
virtual Int32 maxVcenter() const { return 0; }
|
||||||
|
|
||||||
|
|
||||||
virtual void setAdjustScanlines(Int32 adjustScanlines) {}
|
virtual void setAdjustScanlines(float adjustScanlines) {}
|
||||||
|
|
||||||
virtual Int32 adjustScanlines() const { return 0; }
|
virtual float adjustScanlines() const { return 0; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The corresponding start line.
|
* The corresponding start line.
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
// #define TIA_FRAMEMANAGER_DEBUG_LOG
|
// #define TIA_FRAMEMANAGER_DEBUG_LOG
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
#include "FrameManager.hxx"
|
#include "FrameManager.hxx"
|
||||||
|
|
||||||
|
@ -27,8 +28,8 @@ enum Metrics: uInt32 {
|
||||||
vsync = 3,
|
vsync = 3,
|
||||||
frameSizeNTSC = 262,
|
frameSizeNTSC = 262,
|
||||||
frameSizePAL = 312,
|
frameSizePAL = 312,
|
||||||
baseHeightNTSC = 240,
|
baseHeightNTSC = 228,
|
||||||
baseHeightPAL = 288,
|
baseHeightPAL = 274,
|
||||||
maxLinesVsync = 50,
|
maxLinesVsync = 50,
|
||||||
initialGarbageFrames = TIAConstants::initialGarbageFrames,
|
initialGarbageFrames = TIAConstants::initialGarbageFrames,
|
||||||
ystartNTSC = 16,
|
ystartNTSC = 16,
|
||||||
|
@ -120,7 +121,7 @@ void FrameManager::setVcenter(Int32 vcenter)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void FrameManager::setAdjustScanlines(Int32 adjustScanlines)
|
void FrameManager::setAdjustScanlines(float adjustScanlines)
|
||||||
{
|
{
|
||||||
myAdjustScanlines = adjustScanlines;
|
myAdjustScanlines = adjustScanlines;
|
||||||
recalculateMetrics();
|
recalculateMetrics();
|
||||||
|
@ -243,10 +244,12 @@ void FrameManager::recalculateMetrics() {
|
||||||
throw runtime_error("frame manager: invalid TV mode");
|
throw runtime_error("frame manager: invalid TV mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
myHeight = BSPF::clamp<uInt32>(baseHeight + myAdjustScanlines * 2, 0, myFrameLines);
|
myHeight = BSPF::clamp<uInt32>(round(static_cast<float>(baseHeight) * (1.f + myAdjustScanlines / 100.f)), 0, myFrameLines);
|
||||||
myYStart = BSPF::clamp<uInt32>(ystartBase + (baseHeight - static_cast<Int32>(myHeight)) / 2 - myVcenter, 0, myFrameLines);
|
myYStart = BSPF::clamp<uInt32>(ystartBase + (baseHeight - static_cast<Int32>(myHeight)) / 2 - myVcenter, 0, myFrameLines);
|
||||||
// TODO: why "- 1" here: ???
|
// TODO: why "- 1" here: ???
|
||||||
myMaxVcenter = BSPF::clamp<Int32>(ystartBase + (baseHeight - static_cast<Int32>(myHeight)) / 2 - 1, 0, TIAConstants::maxVcenter);
|
myMaxVcenter = BSPF::clamp<Int32>(ystartBase + (baseHeight - static_cast<Int32>(myHeight)) / 2 - 1, 0, TIAConstants::maxVcenter);
|
||||||
|
|
||||||
|
cout << myAdjustScanlines << " " << myHeight << endl << std::flush;
|
||||||
|
|
||||||
myJitterEmulation.setYStart(myYStart);
|
myJitterEmulation.setYStart(myYStart);
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,9 +52,9 @@ class FrameManager: public AbstractFrameManager {
|
||||||
|
|
||||||
Int32 maxVcenter() const override { return myMaxVcenter; }
|
Int32 maxVcenter() const override { return myMaxVcenter; }
|
||||||
|
|
||||||
void setAdjustScanlines(Int32 adjustScanlines) override;
|
void setAdjustScanlines(float adjustScanlines) override;
|
||||||
|
|
||||||
Int32 adjustScanlines() const override { return myAdjustScanlines; }
|
float adjustScanlines() const override { return myAdjustScanlines; }
|
||||||
|
|
||||||
uInt32 startLine() const override { return myYStart; }
|
uInt32 startLine() const override { return myYStart; }
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ class FrameManager: public AbstractFrameManager {
|
||||||
uInt32 myYStart{0};
|
uInt32 myYStart{0};
|
||||||
Int32 myVcenter{0};
|
Int32 myVcenter{0};
|
||||||
Int32 myMaxVcenter{0};
|
Int32 myMaxVcenter{0};
|
||||||
Int32 myAdjustScanlines{0};
|
float myAdjustScanlines{0.f};
|
||||||
|
|
||||||
bool myJitterEnabled{false};
|
bool myJitterEnabled{false};
|
||||||
|
|
||||||
|
|
|
@ -136,21 +136,12 @@ VideoDialog::VideoDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
ypos += lineHeight + VGAP;
|
ypos += lineHeight + VGAP;
|
||||||
|
|
||||||
// Aspect ratio (NTSC mode)
|
// Aspect ratio (NTSC mode)
|
||||||
myAdjustScanlinesNTSC =
|
myAdjustScanlines =
|
||||||
new SliderWidget(myTab, font, xpos, ypos-1, swidth, lineHeight,
|
new SliderWidget(myTab, font, xpos, ypos-1, swidth, lineHeight,
|
||||||
"NTSC scanlines adjust ", lwidth, 0, fontWidth * 4, "", 0, true);
|
"Scanlines adjust ", lwidth, 0, fontWidth * 4, "", 0, true);
|
||||||
myAdjustScanlinesNTSC->setMinValue(-25); myAdjustScanlinesNTSC->setMaxValue(25);
|
myAdjustScanlines->setMinValue(-50); myAdjustScanlines->setMaxValue(50);
|
||||||
myAdjustScanlinesNTSC->setTickmarkIntervals(2);
|
myAdjustScanlines->setTickmarkIntervals(5);
|
||||||
wid.push_back(myAdjustScanlinesNTSC);
|
wid.push_back(myAdjustScanlines);
|
||||||
ypos += lineHeight + VGAP;
|
|
||||||
|
|
||||||
// Aspect ratio (PAL mode)
|
|
||||||
myAdjustScanlinesPAL =
|
|
||||||
new SliderWidget(myTab, font, xpos, ypos-1, swidth, lineHeight,
|
|
||||||
"PAL scanlines adjust ", lwidth, 0, fontWidth * 4, "", 0, true);
|
|
||||||
myAdjustScanlinesPAL->setMinValue(-25); myAdjustScanlinesPAL->setMaxValue(25);
|
|
||||||
myAdjustScanlinesPAL->setTickmarkIntervals(2);
|
|
||||||
wid.push_back(myAdjustScanlinesPAL);
|
|
||||||
ypos += lineHeight + VGAP;
|
ypos += lineHeight + VGAP;
|
||||||
|
|
||||||
// Speed
|
// Speed
|
||||||
|
@ -351,8 +342,9 @@ void VideoDialog::loadConfig()
|
||||||
myTIAInterpolate->setState(instance().settings().getBool("tia.inter"));
|
myTIAInterpolate->setState(instance().settings().getBool("tia.inter"));
|
||||||
|
|
||||||
// Aspect ratio setting (NTSC and PAL)
|
// Aspect ratio setting (NTSC and PAL)
|
||||||
myAdjustScanlinesNTSC->setValue(instance().settings().getInt("tia.adjustscanlines.ntsc"));
|
myAdjustScanlines->setValue(
|
||||||
myAdjustScanlinesPAL->setValue(instance().settings().getInt("tia.adjustscanlines.pal"));
|
round(instance().settings().getFloat("tia.adjustscanlines") * 10)
|
||||||
|
);
|
||||||
|
|
||||||
// Emulation speed
|
// Emulation speed
|
||||||
int speed = mapSpeed(instance().settings().getFloat("speed"));
|
int speed = mapSpeed(instance().settings().getFloat("speed"));
|
||||||
|
@ -424,8 +416,9 @@ void VideoDialog::saveConfig()
|
||||||
instance().settings().setValue("tia.inter", myTIAInterpolate->getState());
|
instance().settings().setValue("tia.inter", myTIAInterpolate->getState());
|
||||||
|
|
||||||
// Aspect ratio setting (NTSC and PAL)
|
// Aspect ratio setting (NTSC and PAL)
|
||||||
instance().settings().setValue("tia.adjustscanlines.ntsc", myAdjustScanlinesNTSC->getValueLabel());
|
instance().settings().setValue("tia.adjustscanlines",
|
||||||
instance().settings().setValue("tia.adjustscanlines.pal", myAdjustScanlinesPAL->getValueLabel());
|
static_cast<float>(myAdjustScanlines->getValue()) / 10.f
|
||||||
|
);
|
||||||
|
|
||||||
// Speed
|
// Speed
|
||||||
int speedup = mySpeed->getValue();
|
int speedup = mySpeed->getValue();
|
||||||
|
@ -505,8 +498,7 @@ void VideoDialog::setDefaults()
|
||||||
myTIAZoom->setValue(300);
|
myTIAZoom->setValue(300);
|
||||||
myTIAPalette->setSelected("standard", "");
|
myTIAPalette->setSelected("standard", "");
|
||||||
myTIAInterpolate->setState(false);
|
myTIAInterpolate->setState(false);
|
||||||
myAdjustScanlinesNTSC->setValue(0);
|
myAdjustScanlines->setValue(0);
|
||||||
myAdjustScanlinesPAL->setValue(0);
|
|
||||||
mySpeed->setValue(0);
|
mySpeed->setValue(0);
|
||||||
|
|
||||||
myFullscreen->setState(false);
|
myFullscreen->setState(false);
|
||||||
|
|
|
@ -58,8 +58,7 @@ class VideoDialog : public Dialog
|
||||||
SliderWidget* myTIAZoom{nullptr};
|
SliderWidget* myTIAZoom{nullptr};
|
||||||
PopUpWidget* myTIAPalette{nullptr};
|
PopUpWidget* myTIAPalette{nullptr};
|
||||||
CheckboxWidget* myTIAInterpolate{nullptr};
|
CheckboxWidget* myTIAInterpolate{nullptr};
|
||||||
SliderWidget* myAdjustScanlinesNTSC{nullptr};
|
SliderWidget* myAdjustScanlines{nullptr};
|
||||||
SliderWidget* myAdjustScanlinesPAL{nullptr};
|
|
||||||
SliderWidget* mySpeed{nullptr};
|
SliderWidget* mySpeed{nullptr};
|
||||||
|
|
||||||
CheckboxWidget* myFullscreen{nullptr};
|
CheckboxWidget* myFullscreen{nullptr};
|
||||||
|
|
|
@ -90,8 +90,7 @@ bool StellaLIBRETRO::create(bool logging)
|
||||||
|
|
||||||
settings.setValue("tia.zoom", 1);
|
settings.setValue("tia.zoom", 1);
|
||||||
settings.setValue("tia.inter", false);
|
settings.setValue("tia.inter", false);
|
||||||
settings.setValue("tia.adjustscanlines.ntsc", 0);
|
settings.setValue("tia.", 0.f);
|
||||||
settings.setValue("tia.adjustscanlines.ntsc", 0);
|
|
||||||
|
|
||||||
//fastscbios
|
//fastscbios
|
||||||
// Fast loading of Supercharger BIOS
|
// Fast loading of Supercharger BIOS
|
||||||
|
|
Loading…
Reference in New Issue