From 8c2c9ebb60d4d734bba08ebef824b0b7f6c01564 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Thu, 2 Jul 2020 23:33:13 +0200
Subject: [PATCH] Added global hot keys for debug options
---
Changes.txt | 1 +
docs/index.html | 99 +++++++------
src/common/PKeyboardHandler.cxx | 4 +
src/emucore/Console.cxx | 47 +++---
src/emucore/Console.hxx | 40 ++---
src/emucore/Event.hxx | 3 +-
src/emucore/EventHandler.cxx | 250 +++++++++++++++++++++++++++-----
src/emucore/EventHandler.hxx | 41 +++++-
src/emucore/FrameBuffer.cxx | 8 +-
src/emucore/FrameBuffer.hxx | 2 +-
src/emucore/tia/TIA.cxx | 27 +++-
src/emucore/tia/TIA.hxx | 12 +-
12 files changed, 393 insertions(+), 141 deletions(-)
diff --git a/Changes.txt b/Changes.txt
index 65b7dbec1..cc1ca3b3b 100644
--- a/Changes.txt
+++ b/Changes.txt
@@ -16,6 +16,7 @@
* Added new interface palette 'Dark'. (TODO: DOC)
+ * Extended global hotkeys for debug options.
6.2 to 6.2.1: (June 20, 2020)
diff --git a/docs/index.html b/docs/index.html
index 276fbae1b..bc3f46f29 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -1430,7 +1430,7 @@
- These settings can also be changed using Global Audio & Video Keys
+ These settings can also be changed using Global Keys
|
@@ -1480,7 +1480,7 @@
- These settings can also be changed using Global Audio & Video Keys
+ These settings can also be changed using Global Keys
|
@@ -1550,7 +1550,7 @@
- These settings can also be changed using Global Audio & Video Keys
+ These settings can also be changed using Global Keys
|
@@ -1559,45 +1559,6 @@
- Global Audio & Video Keys (can be remapped)
- These keys allow selecting and changing audio & video settings without having to remember the
- dedicated keys.
-
-
- Function |
- Key (Standard) |
- Key (macOS) |
-
-
- Select previous AV setting |
- End |
- Fn + Left arrow |
-
-
- Select next AV setting |
- Home |
- Fn + Right arrow |
-
-
- Decrease current AV setting |
- PageDown |
- Fn + Down arrow |
-
-
- Increase current AV setting
- | PageUp |
- Fn + Up arrow |
-
-
- Notes:
-
- - Only available if UI messages are enabled.
- - Currently not available settings are automatically skipped.
- - If a setting was selected via dedicated key, its value can also be changed with the
- global keys.
-
-
-
Developer Keys (can be remapped)
@@ -1715,8 +1676,62 @@
Alt + j |
Cmd + j |
+
+
+ These settings can also be changed using Global Keys
+ |
+
+ Global Keys (can be remapped)
+ These keys allow selecting and changing settings without having to remember the
+ dedicated keys. They keys are grouped by Audio & Video and Debug settings.
+
+
+ Function |
+ Key (Standard) |
+ Key (macOS) |
+
+
+ Select previous setting group |
+ Control + End |
+ Control-Fn + Left arrow |
+
+
+ Select next setting group |
+ Control + Home |
+ Control-Fn + Right arrow |
+
+
+ Select previous setting |
+ End |
+ Fn + Left arrow |
+
+
+ Select next setting |
+ Home |
+ Fn + Right arrow |
+
+
+ Decrease current setting |
+ PageDown |
+ Fn + Down arrow |
+
+
+ Increase current setting
+ | PageUp |
+ Fn + Up arrow |
+
+
+ Notes:
+
+ - Only available if UI messages are enabled.
+ - Currently not available settings are automatically skipped.
+ - If a setting was selected via dedicated key, its value can also be changed with the
+ global keys.
+
+
+
Other Emulation Keys (can be remapped)
diff --git a/src/common/PKeyboardHandler.cxx b/src/common/PKeyboardHandler.cxx
index 4ff5191fb..59beffdac 100644
--- a/src/common/PKeyboardHandler.cxx
+++ b/src/common/PKeyboardHandler.cxx
@@ -505,9 +505,13 @@ PhysicalKeyboardHandler::EventMappingArray PhysicalKeyboardHandler::DefaultCommo
#ifndef BSPF_MACOS
{Event::PreviousSetting, KBDK_END},
{Event::NextSetting, KBDK_HOME},
+ {Event::PreviousSettingGroup, KBDK_END, KBDM_CTRL},
+ {Event::NextSettingGroup, KBDK_HOME, KBDM_CTRL},
#else
{Event::PreviousSetting, KBDK_HOME},
{Event::NextSetting, KBDK_END},
+ {Event::PreviousSettingGroup, KBDK_HOME, KBDM_CTRL},
+ {Event::NextSettingGroup, KBDK_END, KBDM_CTRL},
#endif
{Event::SettingDecrease, KBDK_PAGEDOWN},
{Event::SettingIncrease, KBDK_PAGEUP},
diff --git a/src/emucore/Console.cxx b/src/emucore/Console.cxx
index e6afa0aa4..1f828ee94 100644
--- a/src/emucore/Console.cxx
+++ b/src/emucore/Console.cxx
@@ -444,7 +444,7 @@ void Console::setFormat(uInt32 format, bool force)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void Console::toggleColorLoss()
+void Console::toggleColorLoss(bool toggle)
{
bool colorloss = !myTIA->colorLossEnabled();
if(myTIA->enableColorLoss(colorloss))
@@ -876,51 +876,56 @@ float Console::getFramerate() const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void Console::toggleTIABit(TIABit bit, const string& bitname, bool show) const
+void Console::toggleTIABit(TIABit bit, const string& bitname, bool show, bool toggle) const
{
- bool result = myTIA->toggleBit(bit);
- string message = bitname + (result ? " enabled" : " disabled");
+ bool result = myTIA->toggleBit(bit, toggle ? 2 : 3);
+ const string message = bitname + (result ? " enabled" : " disabled");
+
myOSystem.frameBuffer().showMessage(message);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void Console::toggleBits() const
+void Console::toggleBits(bool toggle) const
{
- bool enabled = myTIA->toggleBits();
- string message = string("TIA bits") + (enabled ? " enabled" : " disabled");
+ bool enabled = myTIA->toggleBits(toggle);
+ const string message = string("TIA bits ") + (enabled ? "enabled" : "disabled");
+
myOSystem.frameBuffer().showMessage(message);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void Console::toggleTIACollision(TIABit bit, const string& bitname, bool show) const
+void Console::toggleTIACollision(TIABit bit, const string& bitname, bool show, bool toggle) const
{
- bool result = myTIA->toggleCollision(bit);
- string message = bitname + (result ? " collision enabled" : " collision disabled");
+ bool result = myTIA->toggleCollision(bit, toggle ? 2 : 3);
+ const string message = bitname + (result ? " collision enabled" : " collision disabled");
+
myOSystem.frameBuffer().showMessage(message);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void Console::toggleCollisions() const
+void Console::toggleCollisions(bool toggle) const
{
- bool enabled = myTIA->toggleCollisions();
- string message = string("TIA collisions") + (enabled ? " enabled" : " disabled");
+ bool enabled = myTIA->toggleCollisions(toggle);
+ const string message = string("TIA collisions ") + (enabled ? "enabled" : "disabled");
+
myOSystem.frameBuffer().showMessage(message);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void Console::toggleFixedColors() const
+void Console::toggleFixedColors(bool toggle) const
{
- if(myTIA->toggleFixedColors())
- myOSystem.frameBuffer().showMessage("Fixed debug colors enabled");
- else
- myOSystem.frameBuffer().showMessage("Fixed debug colors disabled");
+ bool enabled = toggle ? myTIA->toggleFixedColors() : myTIA->usingFixedColors();
+ const string message = string("Fixed debug colors ") + (enabled ? "enabled" : "disabled");
+
+ myOSystem.frameBuffer().showMessage(message);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void Console::toggleJitter() const
+void Console::toggleJitter(bool toggle) const
{
- bool enabled = myTIA->toggleJitter();
- string message = string("TV scanline jitter") + (enabled ? " enabled" : " disabled");
+ bool enabled = myTIA->toggleJitter(toggle ? 2 : 3);
+ const string message = string("TV scanline jitter ") + (enabled ? "enabled" : "disabled");
+
myOSystem.frameBuffer().showMessage(message);
}
diff --git a/src/emucore/Console.hxx b/src/emucore/Console.hxx
index d13588b07..1cc37fc0b 100644
--- a/src/emucore/Console.hxx
+++ b/src/emucore/Console.hxx
@@ -229,7 +229,7 @@ class Console : public Serializable, public ConsoleIO
/**
Toggles the PAL color-loss effect.
*/
- void toggleColorLoss();
+ void toggleColorLoss(bool toggle = true);
void enableColorLoss(bool state);
/**
@@ -278,34 +278,34 @@ class Console : public Serializable, public ConsoleIO
/**
Toggles the TIA bit specified in the method name.
*/
- void toggleP0Bit() const { toggleTIABit(P0Bit, "P0"); }
- void toggleP1Bit() const { toggleTIABit(P1Bit, "P1"); }
- void toggleM0Bit() const { toggleTIABit(M0Bit, "M0"); }
- void toggleM1Bit() const { toggleTIABit(M1Bit, "M1"); }
- void toggleBLBit() const { toggleTIABit(BLBit, "BL"); }
- void togglePFBit() const { toggleTIABit(PFBit, "PF"); }
- void toggleBits() const;
+ void toggleP0Bit(bool toggle = true) const { toggleTIABit(P0Bit, "P0", true, toggle); }
+ void toggleP1Bit(bool toggle = true) const { toggleTIABit(P1Bit, "P1", true, toggle); }
+ void toggleM0Bit(bool toggle = true) const { toggleTIABit(M0Bit, "M0", true, toggle); }
+ void toggleM1Bit(bool toggle = true) const { toggleTIABit(M1Bit, "M1", true, toggle); }
+ void toggleBLBit(bool toggle = true) const { toggleTIABit(BLBit, "BL", true, toggle); }
+ void togglePFBit(bool toggle = true) const { toggleTIABit(PFBit, "PF", true, toggle); }
+ void toggleBits(bool toggle = true) const;
/**
Toggles the TIA collisions specified in the method name.
*/
- void toggleP0Collision() const { toggleTIACollision(P0Bit, "P0"); }
- void toggleP1Collision() const { toggleTIACollision(P1Bit, "P1"); }
- void toggleM0Collision() const { toggleTIACollision(M0Bit, "M0"); }
- void toggleM1Collision() const { toggleTIACollision(M1Bit, "M1"); }
- void toggleBLCollision() const { toggleTIACollision(BLBit, "BL"); }
- void togglePFCollision() const { toggleTIACollision(PFBit, "PF"); }
- void toggleCollisions() const;
+ void toggleP0Collision(bool toggle = true) const { toggleTIACollision(P0Bit, "P0", true, toggle); }
+ void toggleP1Collision(bool toggle = true) const { toggleTIACollision(P1Bit, "P1", true, toggle); }
+ void toggleM0Collision(bool toggle = true) const { toggleTIACollision(M0Bit, "M0", true, toggle); }
+ void toggleM1Collision(bool toggle = true) const { toggleTIACollision(M1Bit, "M1", true, toggle); }
+ void toggleBLCollision(bool toggle = true) const { toggleTIACollision(BLBit, "BL", true, toggle); }
+ void togglePFCollision(bool toggle = true) const { toggleTIACollision(PFBit, "PF", true, toggle); }
+ void toggleCollisions(bool toggle = true) const;
/**
Toggles the TIA 'fixed debug colors' mode.
*/
- void toggleFixedColors() const;
+ void toggleFixedColors(bool toggle = true) const;
/**
Toggles the TIA 'scanline jitter' mode.
*/
- void toggleJitter() const;
+ void toggleJitter(bool toggle = true) const;
/**
* Update vcenter
@@ -351,8 +351,10 @@ class Console : public Serializable, public ConsoleIO
unique_ptr getControllerPort(const Controller::Type type,
const Controller::Jack port, const string& romMd5);
- void toggleTIABit(TIABit bit, const string& bitname, bool show = true) const;
- void toggleTIACollision(TIABit bit, const string& bitname, bool show = true) const;
+ void toggleTIABit(TIABit bit, const string& bitname,
+ bool show = true, bool toggle = true) const;
+ void toggleTIACollision(TIABit bit, const string& bitname,
+ bool show = true, bool toggle = true) const;
private:
// Reference to the osystem object
diff --git a/src/emucore/Event.hxx b/src/emucore/Event.hxx
index 9a6c16352..f666e19bc 100644
--- a/src/emucore/Event.hxx
+++ b/src/emucore/Event.hxx
@@ -121,9 +121,10 @@ class Event
ToggleCollisions, ToggleBits, ToggleFixedColors,
ToggleFrameStats, ToggleSAPortOrder, ExitGame,
- // add new events from here to avoid that user remapped events get overwritten
SettingDecrease, SettingIncrease, PreviousSetting, NextSetting,
ToggleAdaptRefresh, PreviousMultiCartRom,
+ // add new events from here to avoid that user remapped events get overwritten
+ PreviousSettingGroup, NextSettingGroup,
LastType
};
diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx
index 23a9c98ee..53b1eee7a 100644
--- a/src/emucore/EventHandler.cxx
+++ b/src/emucore/EventHandler.cxx
@@ -342,6 +342,16 @@ void EventHandler::handleSystemEvent(SystemEvent e, int, int)
}
}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+EventHandler::AdjustGroup EventHandler::getAdjustGroup()
+{
+ if (myAdjustSetting >= AdjustSetting::START_DEBUG_ADJ && myAdjustSetting <= AdjustSetting::END_DEBUG_ADJ)
+ return AdjustGroup::DEBUG;
+
+ return AdjustGroup::AV;
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AdjustFunction EventHandler::cycleAdjustSetting(int direction)
{
@@ -350,21 +360,38 @@ AdjustFunction EventHandler::cycleAdjustSetting(int direction)
myOSystem.settings().getString("palette") == PaletteHandler::SETTING_CUSTOM;
const bool isCustomFilter =
myOSystem.settings().getInt("tv.filter") == int(NTSCFilter::Preset::CUSTOM);
- bool repeat;
+ const bool isPAL = myOSystem.console().timing() == ConsoleTiming::pal;
+ bool repeat = false;
do
{
- myAdjustSetting =
- AdjustSetting(BSPF::clampw(int(myAdjustSetting) + direction, 0, int(AdjustSetting::MAX_ADJ)));
- // skip currently non-relevant adjustments
- repeat = (myAdjustSetting == AdjustSetting::OVERSCAN && !isFullScreen)
- #ifdef ADAPTABLE_REFRESH_SUPPORT
- || (myAdjustSetting == AdjustSetting::ADAPT_REFRESH && !isFullScreen)
- #endif
- || (myAdjustSetting == AdjustSetting::PALETTE_PHASE && !isCustomPalette)
- || (myAdjustSetting >= AdjustSetting::NTSC_SHARPNESS
- && myAdjustSetting <= AdjustSetting::NTSC_BLEEDING
- && !isCustomFilter);
+ switch (getAdjustGroup())
+ {
+ case AdjustGroup::AV:
+ myAdjustSetting =
+ AdjustSetting(BSPF::clampw(int(myAdjustSetting) + direction,
+ int(AdjustSetting::START_AV_ADJ), int(AdjustSetting::END_AV_ADJ)));
+ // skip currently non-relevant adjustments
+ repeat = (myAdjustSetting == AdjustSetting::OVERSCAN && !isFullScreen)
+ #ifdef ADAPTABLE_REFRESH_SUPPORT
+ || (myAdjustSetting == AdjustSetting::ADAPT_REFRESH && !isFullScreen)
+ #endif
+ || (myAdjustSetting == AdjustSetting::PALETTE_PHASE && !isCustomPalette)
+ || (myAdjustSetting >= AdjustSetting::NTSC_SHARPNESS
+ && myAdjustSetting <= AdjustSetting::NTSC_BLEEDING
+ && !isCustomFilter);
+ break;
+
+ case AdjustGroup::DEBUG:
+ myAdjustSetting =
+ AdjustSetting(BSPF::clampw(int(myAdjustSetting) + direction,
+ int(AdjustSetting::START_DEBUG_ADJ), int(AdjustSetting::END_DEBUG_ADJ)));
+ repeat = (myAdjustSetting == AdjustSetting::COLOR_LOSS && !isPAL);
+ break;
+
+ default:
+ break;
+ }
// avoid endless loop
if(repeat && !direction)
direction = 1;
@@ -381,6 +408,7 @@ AdjustFunction EventHandler::getAdjustSetting(AdjustSetting setting)
// - This array MUST have the same order as AdjustSetting
const AdjustFunction ADJUST_FUNCTIONS[int(AdjustSetting::NUM_ADJ)] =
{
+ // Audio & Video settings
std::bind(&Sound::adjustVolume, &myOSystem.sound(), _1),
std::bind(&FrameBuffer::selectVidMode, &myOSystem.frameBuffer(), _1),
std::bind(&FrameBuffer::toggleFullscreen, &myOSystem.frameBuffer(), _1),
@@ -424,6 +452,25 @@ AdjustFunction EventHandler::getAdjustSetting(AdjustSetting setting)
std::bind(&StateManager::changeState, &myOSystem.state(), _1),
std::bind(&PaletteHandler::changeCurrentAdjustable, &myOSystem.frameBuffer().tiaSurface().paletteHandler(), _1),
std::bind(&TIASurface::changeCurrentNTSCAdjustable, &myOSystem.frameBuffer().tiaSurface(), _1),
+ // Debug settings
+ std::bind(&FrameBuffer::toggleFrameStats, &myOSystem.frameBuffer(), _1),
+ std::bind(&Console::toggleP0Bit, &myOSystem.console(), _1),
+ std::bind(&Console::toggleP1Bit, &myOSystem.console(), _1),
+ std::bind(&Console::toggleM0Bit, &myOSystem.console(), _1),
+ std::bind(&Console::toggleM1Bit, &myOSystem.console(), _1),
+ std::bind(&Console::toggleBLBit, &myOSystem.console(), _1),
+ std::bind(&Console::togglePFBit, &myOSystem.console(), _1),
+ std::bind(&Console::toggleBits, &myOSystem.console(), _1),
+ std::bind(&Console::toggleP0Collision, &myOSystem.console(), _1),
+ std::bind(&Console::toggleP1Collision, &myOSystem.console(), _1),
+ std::bind(&Console::toggleM0Collision, &myOSystem.console(), _1),
+ std::bind(&Console::toggleM1Collision, &myOSystem.console(), _1),
+ std::bind(&Console::toggleBLCollision, &myOSystem.console(), _1),
+ std::bind(&Console::togglePFCollision, &myOSystem.console(), _1),
+ std::bind(&Console::toggleCollisions, &myOSystem.console(), _1),
+ std::bind(&Console::toggleFixedColors, &myOSystem.console(), _1),
+ std::bind(&Console::toggleColorLoss, &myOSystem.console(), _1),
+ std::bind(&Console::toggleJitter, &myOSystem.console(), _1),
};
return ADJUST_FUNCTIONS[int(setting)];
@@ -446,8 +493,10 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
myAdjustActive = false;
myAdjustDirect = AdjustSetting::NONE;
}
+
const bool adjustActive = myAdjustActive;
- const AdjustSetting adjustDirect = myAdjustDirect;
+ const AdjustSetting adjustAVDirect = myAdjustDirect;
+
if(pressed)
{
myAdjustActive = false;
@@ -457,6 +506,36 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
switch(event)
{
////////////////////////////////////////////////////////////////////////
+ // Allow adjusting several (mostly repeated) settings using the same four hotkeys
+ case Event::PreviousSettingGroup:
+ case Event::NextSettingGroup:
+ if (pressed && !repeated)
+ {
+ const int direction = event == Event::PreviousSettingGroup ? -1 : +1;
+ AdjustGroup adjustGroup = AdjustGroup(BSPF::clampw(int(getAdjustGroup()) + direction,
+ 0, int(AdjustGroup::NUM_GROUPS) - 1));
+ string msg;
+
+ switch (adjustGroup)
+ {
+ case AdjustGroup::AV:
+ msg = "Audio & Video";
+ myAdjustSetting = AdjustSetting::START_AV_ADJ;
+ break;
+
+ case AdjustGroup::DEBUG:
+ msg = "Debug";
+ myAdjustSetting = AdjustSetting::START_DEBUG_ADJ;
+ break;
+
+ default:
+ break;
+ }
+ myOSystem.frameBuffer().showMessage(msg + " settings");
+ myAdjustActive = false;
+ }
+ break;
+
// Allow adjusting several (mostly repeated) settings using the same four hotkeys
case Event::PreviousSetting:
case Event::NextSetting:
@@ -481,9 +560,9 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
const int direction = event == Event::SettingDecrease ? -1 : +1;
// if a "direct only" hotkey was pressed last, use this one
- if(adjustDirect != AdjustSetting::NONE)
+ if(adjustAVDirect != AdjustSetting::NONE)
{
- myAdjustDirect = adjustDirect;
+ myAdjustDirect = adjustAVDirect;
getAdjustSetting(myAdjustDirect)(direction);
}
else
@@ -853,7 +932,12 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::ToggleColorLoss:
- if (pressed && !repeated) myOSystem.console().toggleColorLoss();
+ if (pressed && !repeated)
+ {
+ myOSystem.console().toggleColorLoss();
+ myAdjustSetting = AdjustSetting::COLOR_LOSS;
+ myAdjustActive = true;
+ }
return;
case Event::PaletteDecrease:
@@ -888,11 +972,21 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::ToggleJitter:
- if (pressed && !repeated) myOSystem.console().toggleJitter();
+ if (pressed && !repeated)
+ {
+ myOSystem.console().toggleJitter();
+ myAdjustSetting = AdjustSetting::JITTER;
+ myAdjustActive = true;
+ }
return;
case Event::ToggleFrameStats:
- if (pressed) myOSystem.frameBuffer().toggleFrameStats();
+ if (pressed && !repeated)
+ {
+ myOSystem.frameBuffer().toggleFrameStats();
+ myAdjustSetting = AdjustSetting::STATS;
+ myAdjustActive = true;
+ }
return;
case Event::ToggleTimeMachine:
@@ -941,63 +1035,138 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::ToggleP0Collision:
- if (pressed && !repeated) myOSystem.console().toggleP0Collision();
+ if (pressed && !repeated)
+ {
+ myOSystem.console().toggleP0Collision();
+ myAdjustSetting = AdjustSetting::P0_CX;
+ myAdjustActive = true;
+ }
return;
case Event::ToggleP0Bit:
- if (pressed && !repeated) myOSystem.console().toggleP0Bit();
+ if (pressed && !repeated)
+ {
+ myOSystem.console().toggleP0Bit();
+ myAdjustSetting = AdjustSetting::P0_ENAM;
+ myAdjustActive = true;
+ }
return;
case Event::ToggleP1Collision:
- if (pressed && !repeated) myOSystem.console().toggleP1Collision();
+ if (pressed && !repeated)
+ {
+ myOSystem.console().toggleP1Collision();
+ myAdjustSetting = AdjustSetting::P1_CX;
+ myAdjustActive = true;
+ }
return;
case Event::ToggleP1Bit:
- if (pressed && !repeated) myOSystem.console().toggleP1Bit();
+ if (pressed && !repeated)
+ {
+ myOSystem.console().toggleP1Bit();
+ myAdjustSetting = AdjustSetting::P1_ENAM;
+ myAdjustActive = true;
+ }
return;
case Event::ToggleM0Collision:
- if (pressed && !repeated) myOSystem.console().toggleM0Collision();
+ if (pressed && !repeated)
+ {
+ myOSystem.console().toggleM0Collision();
+ myAdjustSetting = AdjustSetting::M0_CX;
+ myAdjustActive = true;
+ }
return;
case Event::ToggleM0Bit:
- if (pressed && !repeated) myOSystem.console().toggleM0Bit();
+ if (pressed && !repeated)
+ {
+ myOSystem.console().toggleM0Bit();
+ myAdjustSetting = AdjustSetting::M0_ENAM;
+ myAdjustActive = true;
+ }
return;
case Event::ToggleM1Collision:
- if (pressed && !repeated) myOSystem.console().toggleM1Collision();
+ if (pressed && !repeated)
+ {
+ myOSystem.console().toggleM1Collision();
+ myAdjustSetting = AdjustSetting::M1_CX;
+ myAdjustActive = true;
+ }
return;
case Event::ToggleM1Bit:
- if (pressed && !repeated) myOSystem.console().toggleM1Bit();
+ if (pressed && !repeated)
+ {
+ myOSystem.console().toggleM1Bit();
+ myAdjustSetting = AdjustSetting::M1_ENAM;
+ myAdjustActive = true;
+ }
return;
case Event::ToggleBLCollision:
- if (pressed && !repeated) myOSystem.console().toggleBLCollision();
+ if (pressed && !repeated)
+ {
+ myOSystem.console().toggleBLCollision();
+ myAdjustSetting = AdjustSetting::BL_CX;
+ myAdjustActive = true;
+ }
return;
case Event::ToggleBLBit:
- if (pressed) myOSystem.console().toggleBLBit();
+ if (pressed && !repeated)
+ {
+ myOSystem.console().toggleBLBit();
+ myAdjustSetting = AdjustSetting::BL_ENAM;
+ myAdjustActive = true;
+ }
return;
case Event::TogglePFCollision:
- if (pressed && !repeated) myOSystem.console().togglePFCollision();
+ if (pressed && !repeated)
+ {
+ myOSystem.console().togglePFCollision();
+ myAdjustSetting = AdjustSetting::PF_CX;
+ myAdjustActive = true;
+ }
return;
case Event::TogglePFBit:
- if (pressed && !repeated) myOSystem.console().togglePFBit();
- return;
-
- case Event::ToggleFixedColors:
- if (pressed) myOSystem.console().toggleFixedColors();
+ if (pressed && !repeated)
+ {
+ myOSystem.console().togglePFBit();
+ myAdjustSetting = AdjustSetting::PF_ENAM;
+ myAdjustActive = true;
+ }
return;
case Event::ToggleCollisions:
- if (pressed && !repeated) myOSystem.console().toggleCollisions();
+ if (pressed && !repeated)
+ {
+ myOSystem.console().toggleCollisions();
+ myAdjustSetting = AdjustSetting::ALL_CX;
+ myAdjustActive = true;
+ }
return;
case Event::ToggleBits:
- if (pressed && !repeated) myOSystem.console().toggleBits();
+ if (pressed && !repeated)
+ {
+ myOSystem.console().toggleBits();
+ myAdjustSetting = AdjustSetting::ALL_ENAM;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::ToggleFixedColors:
+ if (pressed && !repeated)
+ {
+ myOSystem.console().toggleFixedColors();
+ myAdjustSetting = AdjustSetting::FIXED_COL;
+ myAdjustActive = true;
+ }
return;
case Event::SaveState:
@@ -2316,6 +2485,8 @@ EventHandler::EmulActionList EventHandler::ourEmulActionList = { {
{ Event::ScanlinesDecrease, "Decrease scanlines", "" },
{ Event::ScanlinesIncrease, "Increase scanlines", "" },
+ { Event::PreviousSettingGroup, "Select previous setting group", "" },
+ { Event::NextSettingGroup, "Select next setting group", "" },
{ Event::PreviousSetting, "Select previous setting", "" },
{ Event::NextSetting, "Select next setting", "" },
{ Event::SettingDecrease, "Decrease current setting", "" },
@@ -2414,7 +2585,10 @@ const Event::EventSet EventHandler::MiscEvents = {
// Event::MouseAxisXMove, Event::MouseAxisYMove,
// Event::MouseButtonLeftValue, Event::MouseButtonRightValue,
Event::HandleMouseControl, Event::ToggleGrabMouse,
- Event::ToggleSAPortOrder, Event::PreviousMultiCartRom
+ Event::ToggleSAPortOrder, Event::PreviousMultiCartRom,
+ Event::PreviousSettingGroup, Event::NextSettingGroup,
+ Event::PreviousSetting, Event::NextSetting,
+ Event::SettingDecrease, Event::SettingIncrease,
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -2435,8 +2609,6 @@ const Event::EventSet EventHandler::AudioVideoEvents = {
Event::PhosphorDecrease, Event::PhosphorIncrease, Event::TogglePhosphor,
Event::ScanlinesDecrease, Event::ScanlinesIncrease,
Event::ToggleInter,
- Event::PreviousSetting, Event::NextSetting,
- Event::SettingDecrease, Event::SettingIncrease,
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/emucore/EventHandler.hxx b/src/emucore/EventHandler.hxx
index 5d82e31b8..324b1fb5d 100644
--- a/src/emucore/EventHandler.hxx
+++ b/src/emucore/EventHandler.hxx
@@ -420,15 +420,45 @@ class EventHandler
NTSC_ARTIFACTS,
NTSC_FRINGING,
NTSC_BLEEDING,
+ // Other TV effects adjustables
PHOSPHOR,
SCANLINES,
INTERPOLATION,
- MAX_ADJ = INTERPOLATION,
// Only used via direct hotkeys
STATE,
PALETTE_CHANGE_ATTRIBUTE,
NTSC_CHANGE_ATTRIBUTE,
- NUM_ADJ
+ // Debug
+ STATS,
+ P0_ENAM,
+ P1_ENAM,
+ M0_ENAM,
+ M1_ENAM,
+ BL_ENAM,
+ PF_ENAM,
+ ALL_ENAM,
+ P0_CX,
+ P1_CX,
+ M0_CX,
+ M1_CX,
+ BL_CX,
+ PF_CX,
+ ALL_CX,
+ FIXED_COL,
+ COLOR_LOSS,
+ JITTER,
+ // Ranges
+ NUM_ADJ,
+ START_AV_ADJ = VOLUME,
+ END_AV_ADJ = INTERPOLATION,
+ START_DEBUG_ADJ = STATS,
+ END_DEBUG_ADJ = JITTER,
+ };
+ enum class AdjustGroup
+ {
+ AV,
+ DEBUG,
+ NUM_GROUPS
};
private:
@@ -459,6 +489,7 @@ class EventHandler
// The following two methods are used for adjusting several settings using global hotkeys
// They return the function used to adjust the currenly selected setting
+ AdjustGroup getAdjustGroup();
AdjustFunction cycleAdjustSetting(int direction);
AdjustFunction getAdjustSetting(AdjustSetting setting);
@@ -470,10 +501,10 @@ class EventHandler
string key;
};
- // ID of the currently selected global setting
- AdjustSetting myAdjustSetting{AdjustSetting::VOLUME};
// If true, the setting is visible and its value can be changed
bool myAdjustActive{false};
+ // ID of the currently selected global setting
+ AdjustSetting myAdjustSetting{AdjustSetting::START_AV_ADJ};
// ID of the currently selected direct hotkey setting (0 if none)
AdjustSetting myAdjustDirect{AdjustSetting::NONE};
@@ -525,7 +556,7 @@ class EventHandler
#else
REFRESH_SIZE = 0,
#endif
- EMUL_ACTIONLIST_SIZE = 157 + PNG_SIZE + COMBO_SIZE + REFRESH_SIZE,
+ EMUL_ACTIONLIST_SIZE = 159 + PNG_SIZE + COMBO_SIZE + REFRESH_SIZE,
MENU_ACTIONLIST_SIZE = 18
;
diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx
index 6ae234fa0..2f4626968 100644
--- a/src/emucore/FrameBuffer.cxx
+++ b/src/emucore/FrameBuffer.cxx
@@ -634,11 +634,15 @@ void FrameBuffer::drawFrameStats(float framesPerSecond)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void FrameBuffer::toggleFrameStats()
+void FrameBuffer::toggleFrameStats(bool toggle)
{
- showFrameStats(!myStatsEnabled);
+ if (toggle)
+ showFrameStats(!myStatsEnabled);
myOSystem.settings().setValue(
myOSystem.settings().getBool("dev.settings") ? "dev.stats" : "plr.stats", myStatsEnabled);
+
+ myOSystem.frameBuffer().showMessage(string("Console info ") +
+ (myStatsEnabled ? "enabled" : "disabled"));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/emucore/FrameBuffer.hxx b/src/emucore/FrameBuffer.hxx
index 544c8c6c1..58d61dfd3 100644
--- a/src/emucore/FrameBuffer.hxx
+++ b/src/emucore/FrameBuffer.hxx
@@ -171,7 +171,7 @@ class FrameBuffer
/**
Toggles showing or hiding framerate statistics.
*/
- void toggleFrameStats();
+ void toggleFrameStats(bool toggle = true);
/**
Shows a message containing frame statistics for the current frame.
diff --git a/src/emucore/tia/TIA.cxx b/src/emucore/tia/TIA.cxx
index 6d3461c4c..b3a48c335 100644
--- a/src/emucore/tia/TIA.cxx
+++ b/src/emucore/tia/TIA.cxx
@@ -1029,9 +1029,13 @@ bool TIA::toggleBit(TIABit b, uInt8 mode)
mask = b;
break;
- default:
+ case 2:
mask = (~mySpriteEnabledBits & b);
break;
+
+ default:
+ mask = (mySpriteEnabledBits & b);
+ break;
}
mySpriteEnabledBits = (mySpriteEnabledBits & ~b) | mask;
@@ -1047,9 +1051,11 @@ bool TIA::toggleBit(TIABit b, uInt8 mode)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-bool TIA::toggleBits()
+bool TIA::toggleBits(bool toggle)
{
- toggleBit(TIABit(0xFF), mySpriteEnabledBits > 0 ? 0 : 1);
+ toggleBit(TIABit(0xFF), toggle
+ ? mySpriteEnabledBits > 0 ? 0 : 1
+ : mySpriteEnabledBits);
return mySpriteEnabledBits;
}
@@ -1068,9 +1074,13 @@ bool TIA::toggleCollision(TIABit b, uInt8 mode)
mask = b;
break;
- default:
+ case 2:
mask = (~myCollisionsEnabledBits & b);
break;
+
+ default:
+ mask = (myCollisionsEnabledBits & b);
+ break;
}
myCollisionsEnabledBits = (myCollisionsEnabledBits & ~b) | mask;
@@ -1086,9 +1096,11 @@ bool TIA::toggleCollision(TIABit b, uInt8 mode)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-bool TIA::toggleCollisions()
+bool TIA::toggleCollisions(bool toggle)
{
- toggleCollision(TIABit(0xFF), myCollisionsEnabledBits > 0 ? 0 : 1);
+ toggleCollision(TIABit(0xFF), toggle
+ ? myCollisionsEnabledBits > 0 ? 0 : 1
+ : myCollisionsEnabledBits);
return myCollisionsEnabledBits;
}
@@ -1207,6 +1219,9 @@ bool TIA::toggleJitter(uInt8 mode)
myEnableJitter = !myEnableJitter;
break;
+ case 3:
+ break;
+
default:
throw runtime_error("invalid argument for toggleJitter");
}
diff --git a/src/emucore/tia/TIA.hxx b/src/emucore/tia/TIA.hxx
index de3c373a4..3b2cbea7c 100644
--- a/src/emucore/tia/TIA.hxx
+++ b/src/emucore/tia/TIA.hxx
@@ -356,23 +356,25 @@ class TIA : public Device
disabling a graphical object also disables its collisions.
@param mode 1/0 indicates on/off, and values greater than 1 mean
- flip the bit from its current state
+ 2 means flip the bit from its current state
+ and values greater than 2 mean return current state
@return Whether the bit was enabled or disabled
*/
bool toggleBit(TIABit b, uInt8 mode = 2);
- bool toggleBits();
+ bool toggleBits(bool toggle = true);
/**
Enables/disable/toggle the specified (or all) TIA bit collision(s).
- @param mode 1/0 indicates on/off, and values greater than 1 mean
- flip the collision from its current state
+ @param mode 1/0 indicates on/off,
+ 2 means flip the collision from its current state
+ and values greater than 2 mean return current state
@return Whether the collision was enabled or disabled
*/
bool toggleCollision(TIABit b, uInt8 mode = 2);
- bool toggleCollisions();
+ bool toggleCollisions(bool toggle = true);
/**
Enables/disable/toggle/query 'fixed debug colors' mode.