Commit 285583f9 authored by thrust26's avatar thrust26
Browse files

removed option to disable scanline interpolation

parent 20936a46
......@@ -1305,16 +1305,6 @@
<td>Alt + 7</td>
<td>Cmd + 7</td>
</tr>
<tr>
<td>Disable scanline interpolation</td>
<td>Shift-Alt + 8</td>
<td>Shift-Cmd + 8</td>
</tr>
<tr>
<td>Enable scanline interpolation</td>
<td>Alt + 8</td>
<td>Cmd + 8</td>
</tr>
<tr>
<td>Select previous 'Custom' mode attribute (*)</td>
<td>Shift-Alt + 9</td>
......@@ -2002,12 +1992,6 @@
<td>TV effects scanline intensity, where 0 means completely off. Note: No scanlines in 1x mode snapshots.</td>
</tr>
<tr>
<td><pre>-tv.scaninter &lt;1|0&gt;</pre></td>
<td>Blargg TV effects scanline interpolation, resulting
in blending/smoothing of the scanlines.</td>
</tr>
<tr>
<td><pre>-tv.contrast &lt;number&gt;</pre></td>
<td>Blargg TV effects 'contrast' (only available in custom mode,
......@@ -2640,7 +2624,6 @@
(needs to be manually adjusted for your particular hardware)</td><td>-tv.phosblend</td></tr>
<tr><td>Scanline intensity</td><td>Sets scanline black-level intensity.</br>
Note: No scanlines in 1x mode snapshots.</td><td>-tv.scanlines</td></tr>
<tr><td>Scanline interpolation</td><td>Smooth/blend scanlines into image</td><td>-tv.scaninter</td></tr>
<tr><td>Clone Composite</td><td>Copy 'Composite' attributes to 'Custom' sliders</td><td>&nbsp;</td></tr>
<tr><td>Clone S-Video</td><td>Copy 'S-Video' attributes to 'Custom' sliders</td><td>&nbsp;</td></tr>
<tr><td>Clone RGB</td><td>Copy 'RGB' attributes to 'Custom' sliders</td><td>&nbsp;</td></tr>
......
......@@ -249,16 +249,85 @@ void PhysicalKeyboardHandler::handleEvent(StellaKey key, StellaMod mod, bool pre
}
#endif
bool handled = true;
EventHandlerState estate = myHandler.state();
// Immediately store the key state
myEvent.setKey(key, pressed);
// An attempt to speed up event processing; we quickly check for
// Control or Alt/Cmd combos first
// and don't pass the key on if we've already taken care of it
if(handleAltEvent(key, mod, pressed) || handleControlEvent(key, mod, pressed))
return;
EventHandlerState estate = myHandler.state();
// Arrange the logic to take advantage of short-circuit evaluation
if(!(StellaModTest::isControl(mod) || StellaModTest::isShift(mod) || StellaModTest::isAlt(mod)))
{
// Special handling for Escape key
// Basically, exit whichever mode we're currently in
if(pressed && key == KBDK_ESCAPE)
{
switch(estate)
{
case EventHandlerState::PAUSE:
myHandler.changeStateByEvent(Event::PauseMode);
return;
case EventHandlerState::CMDMENU:
myHandler.changeStateByEvent(Event::CmdMenuMode);
return;
case EventHandlerState::TIMEMACHINE:
myHandler.changeStateByEvent(Event::TimeMachineMode);
return;
#if 0 // FIXME - exits ROM too, when it should just go back to ROM
case EventHandlerState::DEBUGGER:
myHandler.changeStateByEvent(Event::DebuggerMode);
return;
#endif
default:
break;
}
}
// Handle keys which switch eventhandler state
if(!pressed && myHandler.changeStateByEvent(myKeyTable[key][kEmulationMode]))
return;
}
// Otherwise, let the event handler deal with it
switch(estate)
{
case EventHandlerState::EMULATION:
myHandler.handleEvent(myKeyTable[key][kEmulationMode], pressed);
break;
case EventHandlerState::PAUSE:
switch(myKeyTable[key][kEmulationMode])
{
case Event::TakeSnapshot:
case Event::DebuggerMode:
myHandler.handleEvent(myKeyTable[key][kEmulationMode], pressed);
break;
default:
break;
}
break;
default:
if(myHandler.hasOverlay())
myHandler.overlay().handleKeyEvent(key, mod, pressed);
break;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool PhysicalKeyboardHandler::handleAltEvent(StellaKey key, StellaMod mod, bool pressed)
{
bool handled = true;
if(StellaModTest::isAlt(mod) && pressed)
{
EventHandlerState estate = myHandler.state();
#ifdef BSPF_MACOS
// These keys work in all states
if(key == KBDK_Q)
......@@ -271,7 +340,7 @@ void PhysicalKeyboardHandler::handleEvent(StellaKey key, StellaMod mod, bool pre
{
// Swallow Alt-Tab, but remember that it happened
myAltKeyCounter = 1;
return;
return true;
}
else if(key == KBDK_RETURN)
{
......@@ -299,7 +368,7 @@ void PhysicalKeyboardHandler::handleEvent(StellaKey key, StellaMod mod, bool pre
myHandler.enterTimeMachineMenuMode(1000, true);
break;
// These can work in pause mode too
// These can work in pause mode too
case KBDK_EQUALS:
myOSystem.frameBuffer().changeWindowedVidMode(+1);
break;
......@@ -355,10 +424,6 @@ void PhysicalKeyboardHandler::handleEvent(StellaKey key, StellaMod mod, bool pre
myOSystem.frameBuffer().tiaSurface().setScanlineIntensity(+5);
break;
case KBDK_8: // Alt-8 turns toggles scanline interpolation
myOSystem.frameBuffer().tiaSurface().toggleScanlineInterpolation();
break;
case KBDK_9: // Alt-9 selects various custom adjustables for NTSC filtering
if(myOSystem.frameBuffer().tiaSurface().ntscEnabled())
{
......@@ -467,13 +532,25 @@ void PhysicalKeyboardHandler::handleEvent(StellaKey key, StellaMod mod, bool pre
default:
handled = false;
break;
}
} // switch
}
else
handled = false;
}
else if(StellaModTest::isControl(mod) && pressed && myUseCtrlKeyFlag)
} // alt
else
handled = false;
return handled;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool PhysicalKeyboardHandler::handleControlEvent(StellaKey key, StellaMod mod, bool pressed)
{
bool handled = true;
if(StellaModTest::isControl(mod) && pressed && myUseCtrlKeyFlag)
{
EventHandlerState estate = myHandler.state();
// These keys work in all states
if(key == KBDK_Q)
{
......@@ -524,73 +601,13 @@ void PhysicalKeyboardHandler::handleEvent(StellaKey key, StellaMod mod, bool pre
default:
handled = false;
break;
}
} // switch
}
else
handled = false;
}
} // control
else
handled = false;
// Don't pass the key on if we've already taken care of it
if(handled) return;
// Arrange the logic to take advantage of short-circuit evaluation
if(!(StellaModTest::isControl(mod) || StellaModTest::isShift(mod) || StellaModTest::isAlt(mod)))
{
// Special handling for Escape key
// Basically, exit whichever mode we're currently in
if(pressed && key == KBDK_ESCAPE)
{
switch(estate)
{
case EventHandlerState::PAUSE:
myHandler.changeStateByEvent(Event::PauseMode);
return;
case EventHandlerState::CMDMENU:
myHandler.changeStateByEvent(Event::CmdMenuMode);
return;
case EventHandlerState::TIMEMACHINE:
myHandler.changeStateByEvent(Event::TimeMachineMode);
return;
#if 0 // FIXME - exits ROM too, when it should just go back to ROM
case EventHandlerState::DEBUGGER:
myHandler.changeStateByEvent(Event::DebuggerMode);
return;
#endif
default:
break;
}
}
// Handle keys which switch eventhandler state
if(!pressed && myHandler.changeStateByEvent(myKeyTable[key][kEmulationMode]))
return;
}
// Otherwise, let the event handler deal with it
switch(estate)
{
case EventHandlerState::EMULATION:
myHandler.handleEvent(myKeyTable[key][kEmulationMode], pressed);
break;
case EventHandlerState::PAUSE:
switch(myKeyTable[key][kEmulationMode])
{
case Event::TakeSnapshot:
case Event::DebuggerMode:
myHandler.handleEvent(myKeyTable[key][kEmulationMode], pressed);
break;
default:
break;
}
break;
default:
if(myHandler.hasOverlay())
myHandler.overlay().handleKeyEvent(key, mod, pressed);
break;
}
}
return handled;
}
\ No newline at end of file
......@@ -65,12 +65,17 @@ class PhysicalKeyboardHandler
bool& useCtrlKey() { return myUseCtrlKeyFlag; }
private:
bool handleAltEvent(StellaKey key, StellaMod mod, bool pressed);
bool handleControlEvent(StellaKey key, StellaMod mod, bool pressed);
OSystem& myOSystem;
EventHandler& myHandler;
Event& myEvent;
// Array of key events, indexed by StellaKey
Event::Type myKeyTable[KBDK_LAST][kNumModes];
// Array of mod keys, indexed by StellaKey
StellaMod myModKeyTable[KBDK_LAST][kNumModes];
// Sometimes key combos with the Alt key become 'stuck' after the
// window changes state, and we want to ignore that event
......
......@@ -52,7 +52,6 @@ Settings::Settings()
setPermanent("tv.phosphor", "byrom");
setPermanent("tv.phosblend", "50");
setPermanent("tv.scanlines", "25");
setPermanent("tv.scaninter", "true");
// TV options when using 'custom' mode
setPermanent("tv.contrast", "0.0");
setPermanent("tv.brightness", "0.0");
......@@ -400,7 +399,6 @@ void Settings::usage() const
<< " -tv.phosblend <0-100> Set default blend level in phosphor mode\n"
<< " -tv.scanlines <0-100> Set scanline intensity to percentage\n"
<< " (0 disables completely)\n"
<< " -tv.scaninter <1|0> Enable interpolated (smooth) scanlines\n"
<< " -tv.contrast <-1.0 - 1.0> Set TV effects custom contrast\n"
<< " -tv.brightness <-1.0 - 1.0> Set TV effects custom brightness\n"
<< " -tv.hue <-1.0 - 1.0> Set TV effects custom hue\n"
......
......@@ -196,23 +196,6 @@ void TIASurface::setScanlineIntensity(int amount)
myFB.showMessage(buf.str());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIASurface::toggleScanlineInterpolation()
{
ostringstream buf;
if(ntscEnabled())
{
bool enable = !myOSystem.settings().getBool("tv.scaninter");
enableScanlineInterpolation(enable);
buf << "Scanline interpolation " << (enable ? "enabled" : "disabled");
myOSystem.settings().setValue("tv.scaninter", enable);
}
else
buf << "Scanlines only available in TV filtering mode";
myFB.showMessage(buf.str());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 TIASurface::enableScanlines(int relative, int absolute)
{
......@@ -226,14 +209,6 @@ uInt32 TIASurface::enableScanlines(int relative, int absolute)
return attr.blendalpha;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIASurface::enableScanlineInterpolation(bool enable)
{
FBSurface::Attributes& attr = mySLineSurface->attributes();
attr.smoothing = enable;
mySLineSurface->applyAttributes();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIASurface::enablePhosphor(bool enable, int blend)
{
......@@ -290,7 +265,7 @@ void TIASurface::enableNTSC(bool enable)
myScanlinesEnabled = myOSystem.settings().getInt("tv.scanlines") > 0;
FBSurface::Attributes& sl_attr = mySLineSurface->attributes();
sl_attr.smoothing = myOSystem.settings().getBool("tv.scaninter");
sl_attr.smoothing = true;
sl_attr.blending = myScanlinesEnabled;
sl_attr.blendalpha = myOSystem.settings().getInt("tv.scanlines");
mySLineSurface->applyAttributes();
......
......@@ -92,11 +92,6 @@ class TIASurface
*/
void setScanlineIntensity(int relative);
/**
Toggles interpolation/smoothing of scanlines in TV modes.
*/
void toggleScanlineInterpolation();
/**
Change scanline intensity and interpolation.
......
......@@ -274,25 +274,22 @@ VideoDialog::VideoDialog(OSystem& osystem, DialogContainer& parent,
// TV Phosphor effect
myTVPhosphor = new CheckboxWidget(myTab, font, xpos, ypos + 1, "Phosphor for all ROMs", kPhosphorChanged);
wid.push_back(myTVPhosphor);
ypos += lineHeight + VGAP;
ypos += lineHeight + VGAP / 2;
// TV Phosphor blend level
xpos += INDENT;
swidth = font.getMaxCharWidth() * 10;
CREATE_CUSTOM_SLIDERS(PhosLevel, "Blend ")
ypos += 6;
ypos += 8;
// Scanline intensity and interpolation
xpos -= INDENT;
myTVScanLabel = new StaticTextWidget(myTab, font, xpos, ypos, "Scanline settings");
ypos += lineHeight;
myTVScanLabel = new StaticTextWidget(myTab, font, xpos, ypos, "Scanlines:");
ypos += lineHeight + VGAP / 2;
xpos += INDENT;
CREATE_CUSTOM_SLIDERS(ScanIntense, "Intensity ")
myTVScanInterpolate = new CheckboxWidget(myTab, font, xpos, ypos, "Interpolation");
wid.push_back(myTVScanInterpolate);
ypos += lineHeight + 6;
ypos += lineHeight + 2;
// Adjustable presets
xpos -= INDENT;
......@@ -399,7 +396,6 @@ void VideoDialog::loadConfig()
// TV scanline intensity and interpolation
myTVScanIntense->setValue(instance().settings().getInt("tv.scanlines"));
myTVScanInterpolate->setState(instance().settings().getBool("tv.scaninter"));
myTab->loadConfig();
}
......@@ -479,9 +475,8 @@ void VideoDialog::saveConfig()
// TV phosphor blend
instance().settings().setValue("tv.phosblend", myTVPhosLevel->getValueLabel());
// TV scanline intensity and interpolation
// TV scanline intensity
instance().settings().setValue("tv.scanlines", myTVScanIntense->getValueLabel());
instance().settings().setValue("tv.scaninter", myTVScanInterpolate->getState());
// Finally, issue a complete framebuffer re-initialization
instance().createFrameBuffer();
......@@ -525,7 +520,6 @@ void VideoDialog::setDefaults()
// TV scanline intensity and interpolation
myTVScanIntense->setValue(25);
myTVScanInterpolate->setState(true);
// Make sure that mutually-exclusive items are not enabled at the same time
handleTVModeChange(NTSCFilter::PRESET_OFF);
......
......@@ -89,7 +89,6 @@ class VideoDialog : public Dialog
// TV scanline intensity and interpolation
StaticTextWidget* myTVScanLabel;
SliderWidget* myTVScanIntense;
CheckboxWidget* myTVScanInterpolate;
// TV effects adjustables presets (custom mode)
ButtonWidget* myCloneComposite;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment