From 6e2a254ceefe35a0d85299e269f5086b07cc891f Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Thu, 9 Jan 2020 10:36:00 -0330 Subject: [PATCH] Add hotkey to change scanline adjustment. For now, this is only a stub. --- src/common/PKeyboardHandler.cxx | 2 ++ src/emucore/Console.cxx | 21 +++++++++++++++++++++ src/emucore/Console.hxx | 9 +++++++++ src/emucore/Event.hxx | 1 + src/emucore/EventHandler.cxx | 11 +++++++++++ src/emucore/EventHandler.hxx | 2 +- 6 files changed, 45 insertions(+), 1 deletion(-) diff --git a/src/common/PKeyboardHandler.cxx b/src/common/PKeyboardHandler.cxx index 2e2ad4987..1c3c369bb 100644 --- a/src/common/PKeyboardHandler.cxx +++ b/src/common/PKeyboardHandler.cxx @@ -428,6 +428,8 @@ PhysicalKeyboardHandler::EventMappingArray PhysicalKeyboardHandler::DefaultCommo {Event::VidmodeIncrease, KBDK_EQUALS, MOD3}, {Event::VCenterDecrease, KBDK_PAGEDOWN, MOD3}, {Event::VCenterIncrease, KBDK_PAGEUP, MOD3}, + {Event::ScanlineAdjustDecrease, KBDK_PAGEDOWN, KBDM_SHIFT | MOD3}, + {Event::ScanlineAdjustIncrease, KBDK_PAGEUP, KBDM_SHIFT | MOD3}, {Event::VolumeDecrease, KBDK_LEFTBRACKET, MOD3}, {Event::VolumeIncrease, KBDK_RIGHTBRACKET, MOD3}, {Event::SoundToggle, KBDK_RIGHTBRACKET, KBDM_CTRL}, diff --git a/src/emucore/Console.cxx b/src/emucore/Console.cxx index 852e6f7d4..f92673ad7 100644 --- a/src/emucore/Console.cxx +++ b/src/emucore/Console.cxx @@ -684,6 +684,27 @@ void Console::updateVcenter(Int32 vcenter) if (vcenter != myTIA->vcenter()) myTIA->setVcenter(vcenter); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void Console::changeScanlineAdjust(int direction) +{ + // Get correct setting, depending on whether we're in NTSC or PAL + // Int32 adjust = myOSystem.settings().getInt("tia.adjustscanlines.ntsc"); + + if(direction == +1) // increase scanline adjustment + { + cerr << "adjust scanline +\n"; + } + else if(direction == -1) // decrease scanline adjustment + { + cerr << "adjust scanline -\n"; + } + else + return; + + // Set new adjustment, updating the correct setting + // ... +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Console::setTIAProperties() { diff --git a/src/emucore/Console.hxx b/src/emucore/Console.hxx index ee13cea41..5db42048b 100644 --- a/src/emucore/Console.hxx +++ b/src/emucore/Console.hxx @@ -269,6 +269,15 @@ class Console : public Serializable, public ConsoleIO */ void changeVerticalCenter(int direction); + /** + Change the "TIA scanline adjust" variable. + Note that there are currently two of these (NTSC and PAL). The currently + active mode will determine which one is used. + + @param direction +1 indicates increase, -1 indicates decrease. + */ + void changeScanlineAdjust(int direction); + /** Returns the current framerate. */ diff --git a/src/emucore/Event.hxx b/src/emucore/Event.hxx index ada04a80f..f7abf1c3b 100644 --- a/src/emucore/Event.hxx +++ b/src/emucore/Event.hxx @@ -84,6 +84,7 @@ class Event VidmodeStd, VidmodeRGB, VidmodeSVideo, VidModeComposite, VidModeBad, VidModeCustom, PreviousAttribute, NextAttribute, DecreaseAttribute, IncreaseAttribute, ScanlinesDecrease, ScanlinesIncrease, VCenterDecrease, VCenterIncrease, + ScanlineAdjustDecrease, ScanlineAdjustIncrease, ToggleP0Collision, ToggleP0Bit, ToggleP1Collision, ToggleP1Bit, ToggleM0Collision, ToggleM0Bit, ToggleM1Collision, ToggleM1Bit, diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index afc12ecda..211da3762 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -424,6 +424,14 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated) if (pressed) myOSystem.console().changeVerticalCenter(+1); return; + case Event::ScanlineAdjustDecrease: + if (pressed) myOSystem.console().changeScanlineAdjust(-1); + return; + + case Event::ScanlineAdjustIncrease: + if (pressed) myOSystem.console().changeScanlineAdjust(+1); + return; + case Event::ToggleFullScreen: if (pressed && !repeated) myOSystem.frameBuffer().toggleFullscreen(); return; @@ -1843,6 +1851,8 @@ EventHandler::EmulActionList EventHandler::ourEmulActionList = { { { Event::OverscanIncrease, "Increase overscan in fullscreen mode", "" }, { Event::VCenterIncrease, "Move display up", "" }, { Event::VCenterDecrease, "Move display down", "" }, + { Event::ScanlineAdjustIncrease, "Increase scanline adjust", "" }, + { Event::ScanlineAdjustDecrease, "Decrease scanline adjust", "" }, { Event::FormatDecrease, "Decrease display format", "" }, { Event::FormatIncrease, "Increase display format", "" }, { Event::TogglePalette, "Switch palette (Standard/Z26/User)", "" }, @@ -1972,6 +1982,7 @@ const Event::EventSet EventHandler::AudioVideoEvents = { Event::PhosphorDecrease, Event::PhosphorIncrease, Event::TogglePhosphor, Event::FormatDecrease, Event::FormatIncrease, Event::VCenterDecrease, Event::VCenterIncrease, + Event::ScanlineAdjustDecrease, Event::ScanlineAdjustIncrease, Event::OverscanDecrease, Event::OverscanIncrease, Event::TogglePalette, Event::ToggleInter }; diff --git a/src/emucore/EventHandler.hxx b/src/emucore/EventHandler.hxx index a23909e66..ec7e51041 100644 --- a/src/emucore/EventHandler.hxx +++ b/src/emucore/EventHandler.hxx @@ -464,7 +464,7 @@ class EventHandler #else PNG_SIZE = 0, #endif - EMUL_ACTIONLIST_SIZE = 141 + PNG_SIZE + COMBO_SIZE, + EMUL_ACTIONLIST_SIZE = 143 + PNG_SIZE + COMBO_SIZE, MENU_ACTIONLIST_SIZE = 18 ;