added global hotkeys (pageup/down) for current displayed setting (or volume)

This commit is contained in:
thrust26 2020-05-14 21:18:55 +02:00
parent a6df70db89
commit c06a60d704
21 changed files with 252 additions and 118 deletions

View File

@ -1767,6 +1767,24 @@
<td>Alt + Up arrow</td> <td>Alt + Up arrow</td>
<td>Cmd + Up arrow</td> <td>Cmd + Up arrow</td>
</tr> </tr>
<tr>
<td>Decrease current setting (*)</td>
<td>PageDown</td>
<td>PageDown</td>
</tr>
<tr>
<td>Increase current setting (*)
<td>PageUp</td>
<td>PageUp</td>
</tr>
<tr>
<td colspan="3"><center><font size="-1">
(*) Note: These keys allow easy changing of the current displayed selection (e.g. volume (default),
phosphor, zoom...) without having to use the original keys.</font></center></td>
</tr>
</table> </table>
<p><b>UI keys in Text Editing areas (cannot be remapped)</b></p> <p><b>UI keys in Text Editing areas (cannot be remapped)</b></p>

View File

@ -493,11 +493,14 @@ PhysicalKeyboardHandler::EventMappingArray PhysicalKeyboardHandler::DefaultCommo
{Event::ToggleColorLoss, KBDK_L, KBDM_CTRL}, {Event::ToggleColorLoss, KBDK_L, KBDM_CTRL},
{Event::PaletteDecrease, KBDK_P, KBDM_SHIFT | KBDM_CTRL}, {Event::PaletteDecrease, KBDK_P, KBDM_SHIFT | KBDM_CTRL},
{Event::PaletteIncrease, KBDK_P, KBDM_CTRL}, {Event::PaletteIncrease, KBDK_P, KBDM_CTRL},
{Event::SettingDecrease, KBDK_PAGEDOWN},
{Event::SettingIncrease, KBDK_PAGEUP},
{Event::ToggleInter, KBDK_I, KBDM_CTRL}, {Event::ToggleInter, KBDK_I, KBDM_CTRL},
{Event::ToggleTurbo, KBDK_T, KBDM_CTRL}, {Event::ToggleTurbo, KBDK_T, KBDM_CTRL},
{Event::ToggleJitter, KBDK_J, MOD3}, {Event::ToggleJitter, KBDK_J, MOD3},
{Event::ToggleFrameStats, KBDK_L, MOD3}, {Event::ToggleFrameStats, KBDK_L, MOD3},
{Event::ToggleTimeMachine, KBDK_T, MOD3}, {Event::ToggleTimeMachine, KBDK_T, MOD3},
#ifdef PNG_SUPPORT #ifdef PNG_SUPPORT
{Event::ToggleContSnapshots, KBDK_S, MOD3}, {Event::ToggleContSnapshots, KBDK_S, MOD3},
{Event::ToggleContSnapshotsFrame, KBDK_S, KBDM_SHIFT | MOD3}, {Event::ToggleContSnapshotsFrame, KBDK_S, KBDM_SHIFT | MOD3},

View File

@ -55,7 +55,7 @@ string PaletteHandler::toPaletteName(PaletteType type) const
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PaletteHandler::cyclePalette(bool next) AdjustFunction PaletteHandler::cyclePalette(bool next)
{ {
const string MESSAGES[PaletteType::NumTypes] = { const string MESSAGES[PaletteType::NumTypes] = {
"Standard Stella", "Z26", "User-defined", "Custom" "Standard Stella", "Z26", "User-defined", "Custom"
@ -89,6 +89,7 @@ void PaletteHandler::cyclePalette(bool next)
myOSystem.frameBuffer().showMessage(message); myOSystem.frameBuffer().showMessage(message);
setPalette(palette); setPalette(palette);
return std::bind(&PaletteHandler::cyclePalette, this, std::placeholders::_1);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -112,12 +113,13 @@ void PaletteHandler::showAdjustableMessage()
{ {
const int value = scaleTo100(*myAdjustables[myCurrentAdjustable].value); const int value = scaleTo100(*myAdjustables[myCurrentAdjustable].value);
buf << value << "%"; buf << value << "%";
myOSystem.frameBuffer().showMessage(msg.str(), buf.str(), value); myOSystem.frameBuffer().showMessage(
msg.str(), buf.str(), value);
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PaletteHandler::cycleAdjustable(bool next) AdjustFunction PaletteHandler::cycleAdjustable(bool next)
{ {
const bool isCustomPalette = SETTING_CUSTOM == myOSystem.settings().getString("palette"); const bool isCustomPalette = SETTING_CUSTOM == myOSystem.settings().getString("palette");
bool isPhaseShift; bool isPhaseShift;
@ -141,10 +143,11 @@ void PaletteHandler::cycleAdjustable(bool next)
} while(isPhaseShift && !isCustomPalette); } while(isPhaseShift && !isCustomPalette);
showAdjustableMessage(); showAdjustableMessage();
return std::bind(&PaletteHandler::changeAdjustable, this, std::placeholders::_1);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PaletteHandler::changeAdjustable(bool increase) AdjustFunction PaletteHandler::changeAdjustable(bool increase)
{ {
if(myAdjustables[myCurrentAdjustable].value == nullptr) if(myAdjustables[myCurrentAdjustable].value == nullptr)
changeColorPhaseShift(increase); changeColorPhaseShift(increase);
@ -163,6 +166,7 @@ void PaletteHandler::changeAdjustable(bool increase)
showAdjustableMessage(); showAdjustableMessage();
setPalette(); setPalette();
} }
return std::bind(&PaletteHandler::changeAdjustable, this, std::placeholders::_1);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -21,6 +21,7 @@
#include "bspf.hxx" #include "bspf.hxx"
#include "OSystem.hxx" #include "OSystem.hxx"
#include "ConsoleTiming.hxx" #include "ConsoleTiming.hxx"
#include "EventHandlerConstants.hxx"
class PaletteHandler class PaletteHandler
{ {
@ -51,21 +52,21 @@ class PaletteHandler
@param next Select next palette, else previous one @param next Select next palette, else previous one
*/ */
void cyclePalette(bool next = true); AdjustFunction cyclePalette(bool next = true);
/* /*
Cycle through each palette adjustable. Cycle through each palette adjustable.
@param next Select next adjustable, else previous one @param next Select next adjustable, else previous one
*/ */
void cycleAdjustable(bool next = true); AdjustFunction cycleAdjustable(bool next = true);
/* /*
Increase or decrease current palette adjustable. Increase or decrease current palette adjustable.
@param increase Increase adjustable if true, else decrease @param increase Increase adjustable if true, else decrease
*/ */
void changeAdjustable(bool increase = true); AdjustFunction changeAdjustable(bool increase = true);
// Load adjustables from settings // Load adjustables from settings
void loadConfig(const Settings& settings); void loadConfig(const Settings& settings);
@ -129,7 +130,7 @@ class PaletteHandler
string toPaletteName(PaletteType type) const; string toPaletteName(PaletteType type) const;
/** /**
Display current adjustable with bar gauge message Display current adjustable with gauge bar message
*/ */
void showAdjustableMessage(); void showAdjustableMessage();

View File

@ -97,10 +97,10 @@ class SoundNull : public Sound
/** /**
Adjusts the volume of the sound device based on the given direction. Adjusts the volume of the sound device based on the given direction.
@param direction Increase or decrease the current volume by a predefined @param increase Increase or decrease the current volume by a predefined
amount based on the direction (1 = increase, -1 =decrease) amount
*/ */
void adjustVolume(Int8 direction) override { } AdjustFunction adjustVolume(bool increase) override { return nullptr; }
/** /**
This method is called to provide information about the sound device. This method is called to provide information about the sound device.

View File

@ -186,16 +186,31 @@ bool SoundSDL2::mute(bool state)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool SoundSDL2::toggleMute() bool SoundSDL2::toggleMute()
{ {
bool enabled = myAudioSettings.enabled(); bool enabled = !myAudioSettings.enabled();
setEnabled(!enabled); setEnabled(enabled);
myOSystem.console().initializeAudio(); myOSystem.console().initializeAudio();
string message = "Sound "; string message = "Sound ";
message += !enabled ? "unmuted" : "muted"; message += enabled ? "unmuted" : "muted";
myOSystem.frameBuffer().showMessage(message); myOSystem.frameBuffer().showMessage(message);
//ostringstream strval;
//uInt32 volume;
//// Now show an onscreen message
//if(enabled)
//{
// volume = myVolume;
// strval << volume << "%";
//}
//else
//{
// volume = 0;
// strval << "Muted";
//}
//myOSystem.frameBuffer().showMessage("Volume", strval.str(), volume);
return enabled; return enabled;
} }
@ -214,17 +229,12 @@ void SoundSDL2::setVolume(uInt32 percent)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SoundSDL2::adjustVolume(Int8 direction) AdjustFunction SoundSDL2::adjustVolume(bool increase)
{ {
ostringstream strval; ostringstream strval;
Int32 percent = myVolume; Int32 percent = myVolume;
if(direction == -1) percent = BSPF::clamp(percent += increase ? 2 : -2, 0, 100);
percent -= 2;
else if(direction == 1)
percent += 2;
percent = BSPF::clamp(percent, 0, 100);
setVolume(percent); setVolume(percent);
@ -243,6 +253,7 @@ void SoundSDL2::adjustVolume(Int8 direction)
else else
strval << "Off"; strval << "Off";
myOSystem.frameBuffer().showMessage("Volume", strval.str(), percent); myOSystem.frameBuffer().showMessage("Volume", strval.str(), percent);
return std::bind(&SoundSDL2::adjustVolume, this, std::placeholders::_1);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -98,10 +98,10 @@ class SoundSDL2 : public Sound
/** /**
Adjusts the volume of the sound device based on the given direction. Adjusts the volume of the sound device based on the given direction.
@param direction Increase or decrease the current volume by a predefined @param increase Increase or decrease the current volume by a predefined
amount based on the direction (1 = increase, -1 = decrease) amount
*/ */
void adjustVolume(Int8 direction) override; AdjustFunction adjustVolume(bool increase) override;
/** /**
This method is called to provide information about the sound device. This method is called to provide information about the sound device.

View File

@ -198,7 +198,7 @@ void StateManager::update()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StateManager::loadState(int slot) AdjustFunction StateManager::loadState(int slot)
{ {
if(myOSystem.hasConsole()) if(myOSystem.hasConsole())
{ {
@ -216,7 +216,7 @@ void StateManager::loadState(int slot)
buf.str(""); buf.str("");
buf << "Can't open/load from state file " << slot; buf << "Can't open/load from state file " << slot;
myOSystem.frameBuffer().showMessage(buf.str()); myOSystem.frameBuffer().showMessage(buf.str());
return; return nullptr;
} }
// First test if we have a valid header // First test if we have a valid header
@ -241,10 +241,11 @@ void StateManager::loadState(int slot)
myOSystem.frameBuffer().showMessage(buf.str()); myOSystem.frameBuffer().showMessage(buf.str());
} }
return std::bind(&StateManager::changeState, this, std::placeholders::_1);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StateManager::saveState(int slot) AdjustFunction StateManager::saveState(int slot)
{ {
if(myOSystem.hasConsole()) if(myOSystem.hasConsole())
{ {
@ -262,7 +263,7 @@ void StateManager::saveState(int slot)
buf.str(""); buf.str("");
buf << "Can't open/save to state file " << slot; buf << "Can't open/save to state file " << slot;
myOSystem.frameBuffer().showMessage(buf.str()); myOSystem.frameBuffer().showMessage(buf.str());
return; return nullptr;
} }
try try
@ -275,7 +276,7 @@ void StateManager::saveState(int slot)
{ {
buf << "Error saving state " << slot; buf << "Error saving state " << slot;
myOSystem.frameBuffer().showMessage(buf.str()); myOSystem.frameBuffer().showMessage(buf.str());
return; return nullptr;
} }
// Do a complete state save using the Console // Do a complete state save using the Console
@ -294,12 +295,13 @@ void StateManager::saveState(int slot)
myOSystem.frameBuffer().showMessage(buf.str()); myOSystem.frameBuffer().showMessage(buf.str());
} }
return std::bind(&StateManager::changeState, this, std::placeholders::_1);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StateManager::changeState(int direction) AdjustFunction StateManager::changeState(bool next)
{ {
myCurrentSlot += direction; myCurrentSlot += next ? 1 : -1;
if (myCurrentSlot < 0) if (myCurrentSlot < 0)
myCurrentSlot = 9; myCurrentSlot = 9;
else else
@ -309,6 +311,7 @@ void StateManager::changeState(int direction)
ostringstream buf; ostringstream buf;
buf << "Changed to slot " << myCurrentSlot; buf << "Changed to slot " << myCurrentSlot;
myOSystem.frameBuffer().showMessage(buf.str()); myOSystem.frameBuffer().showMessage(buf.str());
return std::bind(&StateManager::changeState, this, std::placeholders::_1);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -104,19 +104,19 @@ class StateManager
@param slot The state 'slot' to load state from @param slot The state 'slot' to load state from
*/ */
void loadState(int slot = -1); AdjustFunction loadState(int slot = -1);
/** /**
Save the current state from the system. Save the current state from the system.
@param slot The state 'slot' to save into @param slot The state 'slot' to save into
*/ */
void saveState(int slot = -1); AdjustFunction saveState(int slot = -1);
/** /**
Switches to the next higher or lower state slot (circular queue style). Switches to the next higher or lower state slot (circular queue style).
*/ */
void changeState(int direction); AdjustFunction changeState(bool next);
/** /**
Toggles auto slot mode. Toggles auto slot mode.

View File

@ -43,6 +43,7 @@ using uInt64 = uint64_t;
#include <algorithm> #include <algorithm>
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <functional>
#include <iomanip> #include <iomanip>
#include <memory> #include <memory>
#include <string> #include <string>
@ -86,6 +87,8 @@ using StringList = std::vector<std::string>;
using ByteBuffer = std::unique_ptr<uInt8[]>; // NOLINT using ByteBuffer = std::unique_ptr<uInt8[]>; // NOLINT
using DWordBuffer = std::unique_ptr<uInt32[]>; // NOLINT using DWordBuffer = std::unique_ptr<uInt32[]>; // NOLINT
using AdjustFunction = std::function<void(bool)>;
// We use KB a lot; let's make a literal for it // We use KB a lot; let's make a literal for it
constexpr uInt32 operator "" _KB(unsigned long long size) constexpr uInt32 operator "" _KB(unsigned long long size)
{ {

View File

@ -349,7 +349,7 @@ bool Console::load(Serializer& in)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::selectFormat(bool next) AdjustFunction Console::selectFormat(bool next)
{ {
string saveformat, message; string saveformat, message;
uInt32 format = myCurrentFormat; uInt32 format = myCurrentFormat;
@ -360,6 +360,7 @@ void Console::selectFormat(bool next)
format = myCurrentFormat > 0 ? (myCurrentFormat - 1) : 6; format = myCurrentFormat > 0 ? (myCurrentFormat - 1) : 6;
setFormat(format); setFormat(format);
return std::bind(&Console::selectFormat, this, std::placeholders::_1);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -504,7 +505,7 @@ void Console::toggleTurbo()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::togglePhosphor() AdjustFunction Console::togglePhosphor()
{ {
if(myOSystem.frameBuffer().tiaSurface().phosphorEnabled()) if(myOSystem.frameBuffer().tiaSurface().phosphorEnabled())
{ {
@ -518,10 +519,11 @@ void Console::togglePhosphor()
myOSystem.frameBuffer().tiaSurface().enablePhosphor(true); myOSystem.frameBuffer().tiaSurface().enablePhosphor(true);
myOSystem.frameBuffer().showMessage("Phosphor effect enabled"); myOSystem.frameBuffer().showMessage("Phosphor effect enabled");
} }
return std::bind(&Console::changePhosphor, this, std::placeholders::_1);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::changePhosphor(bool increase) AdjustFunction Console::changePhosphor(bool increase)
{ {
int blend = BSPF::stringToInt(myProperties.get(PropType::Display_PPBlend)); int blend = BSPF::stringToInt(myProperties.get(PropType::Display_PPBlend));
@ -530,6 +532,7 @@ void Console::changePhosphor(bool increase)
else // decrease blend else // decrease blend
blend -= 2; blend -= 2;
blend = BSPF::clamp(blend, 0, 100); blend = BSPF::clamp(blend, 0, 100);
myOSystem.frameBuffer().tiaSurface().enablePhosphor(true, blend);
ostringstream val; ostringstream val;
val << blend; val << blend;
@ -542,7 +545,7 @@ void Console::changePhosphor(bool increase)
val << "Off"; val << "Off";
} }
myOSystem.frameBuffer().showMessage("Phosphor blend", val.str(), blend); myOSystem.frameBuffer().showMessage("Phosphor blend", val.str(), blend);
myOSystem.frameBuffer().tiaSurface().enablePhosphor(true, blend); return std::bind(&Console::changePhosphor, this, std::placeholders::_1);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -619,7 +622,7 @@ void Console::fry() const
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::changeVerticalCenter(bool increase) AdjustFunction Console::changeVerticalCenter(bool increase)
{ {
Int32 vcenter = myTIA->vcenter(); Int32 vcenter = myTIA->vcenter();
@ -638,6 +641,7 @@ void Console::changeVerticalCenter(bool increase)
val << (vcenter ? vcenter > 0 ? "+" : "" : " ") << vcenter << "px"; val << (vcenter ? vcenter > 0 ? "+" : "" : " ") << vcenter << "px";
myOSystem.frameBuffer().showMessage("V-Center", val.str(), vcenter, myOSystem.frameBuffer().showMessage("V-Center", val.str(), vcenter,
myTIA->minVcenter(), myTIA->maxVcenter()); myTIA->minVcenter(), myTIA->maxVcenter());
return std::bind(&Console::changeVerticalCenter, this, std::placeholders::_1);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -650,7 +654,7 @@ void Console::updateVcenter(Int32 vcenter)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::changeVSizeAdjust(bool increase) AdjustFunction Console::changeVSizeAdjust(bool increase)
{ {
Int32 newAdjustVSize = myTIA->adjustVSize(); Int32 newAdjustVSize = myTIA->adjustVSize();
@ -670,6 +674,7 @@ void Console::changeVSizeAdjust(bool increase)
val << (newAdjustVSize ? newAdjustVSize > 0 ? "+" : "" : " ") << newAdjustVSize << "%"; val << (newAdjustVSize ? newAdjustVSize > 0 ? "+" : "" : " ") << newAdjustVSize << "%";
myOSystem.frameBuffer().showMessage("V-Size", val.str(), newAdjustVSize, -5, 5); myOSystem.frameBuffer().showMessage("V-Size", val.str(), newAdjustVSize, -5, 5);
return std::bind(&Console::changeVSizeAdjust, this, std::placeholders::_1);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -191,7 +191,7 @@ class Console : public Serializable, public ConsoleIO
@param next Select next if true, else previous @param next Select next if true, else previous
*/ */
void selectFormat(bool next = true); AdjustFunction selectFormat(bool next = true);
/** /**
Set NTSC/PAL/SECAM (and variants) display format. Set NTSC/PAL/SECAM (and variants) display format.
@ -217,14 +217,14 @@ class Console : public Serializable, public ConsoleIO
/** /**
Toggles phosphor effect. Toggles phosphor effect.
*/ */
void togglePhosphor(); AdjustFunction togglePhosphor();
/** /**
Change the "Display.PPBlend" variable. Change the "Display.PPBlend" variable.
@param increase Increase if true, else decrease @param increase Increase if true, else decrease
*/ */
void changePhosphor(bool increase = true); AdjustFunction changePhosphor(bool increase = true);
/** /**
Toggles the PAL color-loss effect. Toggles the PAL color-loss effect.
@ -259,7 +259,7 @@ class Console : public Serializable, public ConsoleIO
@param increase Increase if true, else decrease @param increase Increase if true, else decrease
*/ */
void changeVerticalCenter(bool increase = true); AdjustFunction changeVerticalCenter(bool increase = true);
/** /**
Change the "TIA scanline adjust" variable. Change the "TIA scanline adjust" variable.
@ -268,7 +268,7 @@ class Console : public Serializable, public ConsoleIO
@param increase Increase if true, else decrease @param increase Increase if true, else decrease
*/ */
void changeVSizeAdjust(bool increase = true); AdjustFunction changeVSizeAdjust(bool increase = true);
/** /**
Returns the current framerate. Returns the current framerate.

View File

@ -122,6 +122,7 @@ class Event
ToggleFrameStats, ToggleSAPortOrder, ExitGame, ToggleFrameStats, ToggleSAPortOrder, ExitGame,
// add new events from here to avoid that user remapped events get overwritten // add new events from here to avoid that user remapped events get overwritten
SettingDecrease, SettingIncrease,
LastType LastType
}; };

View File

@ -63,6 +63,8 @@
#include "ScrollBarWidget.hxx" #include "ScrollBarWidget.hxx"
#endif #endif
using namespace std::placeholders;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EventHandler::EventHandler(OSystem& osystem) EventHandler::EventHandler(OSystem& osystem)
: myOSystem(osystem) : myOSystem(osystem)
@ -347,8 +349,32 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
// or need to be preprocessed before passing them on // or need to be preprocessed before passing them on
const bool pressed = (value != 0); const bool pressed = (value != 0);
// The global settings keys react as long as the setting message from the previous event is
// still displayed. When no message is displayed, volume adjustment will be the default event.
if(!myOSystem.frameBuffer().messageShown() || myAdjustFunction == nullptr)
myAdjustFunction = std::bind(&Sound::adjustVolume, &myOSystem.sound(), std::placeholders::_1);
// Assume no adjust function will be pressed
const AdjustFunction oldAdjustFunction = myAdjustFunction;
if(pressed)
myAdjustFunction = nullptr;
switch(event) switch(event)
{ {
////////////////////////////////////////////////////////////////////////
// Allow adjusting several (mostly repeated) settings using the same two hotkeys
case Event::SettingDecrease:
if(pressed && oldAdjustFunction != nullptr)
oldAdjustFunction(false);
myAdjustFunction = oldAdjustFunction;
return;
case Event::SettingIncrease:
if(pressed && oldAdjustFunction != nullptr)
oldAdjustFunction(true);
myAdjustFunction = oldAdjustFunction;
return;
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// If enabled, make sure 'impossible' joystick directions aren't allowed // If enabled, make sure 'impossible' joystick directions aren't allowed
case Event::JoystickZeroUp: case Event::JoystickZeroUp:
@ -401,55 +427,68 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return; return;
case Event::VolumeDecrease: case Event::VolumeDecrease:
if(pressed) myOSystem.sound().adjustVolume(-1); if(pressed)
myAdjustFunction = myOSystem.sound().adjustVolume(false);
return; return;
case Event::VolumeIncrease: case Event::VolumeIncrease:
if(pressed) myOSystem.sound().adjustVolume(+1); if(pressed)
myAdjustFunction = myOSystem.sound().adjustVolume(true);
return; return;
case Event::SoundToggle: case Event::SoundToggle:
if(pressed && !repeated) myOSystem.sound().toggleMute(); if(pressed && !repeated)
myOSystem.sound().toggleMute();
return; return;
case Event::VidmodeDecrease: case Event::VidmodeDecrease:
if(pressed) myOSystem.frameBuffer().selectVidMode(false); if(pressed)
myAdjustFunction = myOSystem.frameBuffer().selectVidMode(false);
return; return;
case Event::VidmodeIncrease: case Event::VidmodeIncrease:
if(pressed) myOSystem.frameBuffer().selectVidMode(true); if(pressed)
myAdjustFunction = myOSystem.frameBuffer().selectVidMode(true);
return; return;
case Event::VCenterDecrease: case Event::VCenterDecrease:
if (pressed) myOSystem.console().changeVerticalCenter(false); if (pressed)
myAdjustFunction = myOSystem.console().changeVerticalCenter(false);
return; return;
case Event::VCenterIncrease: case Event::VCenterIncrease:
if (pressed) myOSystem.console().changeVerticalCenter(true); if (pressed)
myAdjustFunction = myOSystem.console().changeVerticalCenter(true);
return; return;
case Event::VSizeAdjustDecrease: case Event::VSizeAdjustDecrease:
if (pressed) myOSystem.console().changeVSizeAdjust(false); if (pressed)
myAdjustFunction = myOSystem.console().changeVSizeAdjust(false);
return; return;
case Event::VSizeAdjustIncrease: case Event::VSizeAdjustIncrease:
if (pressed) myOSystem.console().changeVSizeAdjust(true); if (pressed)
myAdjustFunction = myOSystem.console().changeVSizeAdjust(true);
return; return;
case Event::PreviousPaletteAttribute: case Event::PreviousPaletteAttribute:
if (pressed) myOSystem.frameBuffer().tiaSurface().paletteHandler().cycleAdjustable(false); if(pressed)
myAdjustFunction = myOSystem.frameBuffer().tiaSurface().paletteHandler().cycleAdjustable(false);
return; return;
case Event::NextPaletteAttribute: case Event::NextPaletteAttribute:
if (pressed) myOSystem.frameBuffer().tiaSurface().paletteHandler().cycleAdjustable(true); if(pressed)
myAdjustFunction = myOSystem.frameBuffer().tiaSurface().paletteHandler().cycleAdjustable(true);
return; return;
case Event::PaletteAttributeDecrease: case Event::PaletteAttributeDecrease:
if (pressed) myOSystem.frameBuffer().tiaSurface().paletteHandler().changeAdjustable(false); if(pressed)
myAdjustFunction = myOSystem.frameBuffer().tiaSurface().paletteHandler().changeAdjustable(false);
return; return;
case Event::PaletteAttributeIncrease: case Event::PaletteAttributeIncrease:
if (pressed) myOSystem.frameBuffer().tiaSurface().paletteHandler().changeAdjustable(true); if(pressed)
myAdjustFunction = myOSystem.frameBuffer().tiaSurface().paletteHandler().changeAdjustable(true);
return; return;
case Event::ToggleFullScreen: case Event::ToggleFullScreen:
@ -457,19 +496,23 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return; return;
case Event::OverscanDecrease: case Event::OverscanDecrease:
if (pressed) myOSystem.frameBuffer().changeOverscan(false); if (pressed)
myAdjustFunction = myOSystem.frameBuffer().changeOverscan(false);
return; return;
case Event::OverscanIncrease: case Event::OverscanIncrease:
if (pressed) myOSystem.frameBuffer().changeOverscan(true); if (pressed)
myAdjustFunction = myOSystem.frameBuffer().changeOverscan(true);
return; return;
case Event::PreviousVideoMode: case Event::PreviousVideoMode:
if (pressed && !repeated) myOSystem.frameBuffer().tiaSurface().changeNTSC(false); if (pressed && !repeated)
myAdjustFunction = myOSystem.frameBuffer().tiaSurface().changeNTSC(false);
return; return;
case Event::NextVideoMode: case Event::NextVideoMode:
if (pressed && !repeated) myOSystem.frameBuffer().tiaSurface().changeNTSC(true); if (pressed && !repeated)
myAdjustFunction = myOSystem.frameBuffer().tiaSurface().changeNTSC(true);
return; return;
case Event::VidmodeStd: case Event::VidmodeStd:
@ -497,39 +540,48 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return; return;
case Event::PreviousAttribute: case Event::PreviousAttribute:
if (pressed) myOSystem.frameBuffer().tiaSurface().setNTSCAdjustable(false); if(pressed)
myAdjustFunction = myOSystem.frameBuffer().tiaSurface().setNTSCAdjustable(false);
return; return;
case Event::NextAttribute: case Event::NextAttribute:
if (pressed) myOSystem.frameBuffer().tiaSurface().setNTSCAdjustable(true); if (pressed)
myAdjustFunction = myOSystem.frameBuffer().tiaSurface().setNTSCAdjustable(true);
return; return;
case Event::DecreaseAttribute: case Event::DecreaseAttribute:
if(pressed) myOSystem.frameBuffer().tiaSurface().changeNTSCAdjustable(false); if(pressed)
myAdjustFunction = myOSystem.frameBuffer().tiaSurface().changeNTSCAdjustable(false);
return; return;
case Event::IncreaseAttribute: case Event::IncreaseAttribute:
if(pressed) myOSystem.frameBuffer().tiaSurface().changeNTSCAdjustable(true); if(pressed)
myAdjustFunction = myOSystem.frameBuffer().tiaSurface().changeNTSCAdjustable(true);
return; return;
case Event::ScanlinesDecrease: case Event::ScanlinesDecrease:
if (pressed) myOSystem.frameBuffer().tiaSurface().setScanlineIntensity(-2); if (pressed)
myAdjustFunction = myOSystem.frameBuffer().tiaSurface().setScanlineIntensity(false);
return; return;
case Event::ScanlinesIncrease: case Event::ScanlinesIncrease:
if (pressed) myOSystem.frameBuffer().tiaSurface().setScanlineIntensity(+2); if (pressed)
myAdjustFunction = myOSystem.frameBuffer().tiaSurface().setScanlineIntensity(true);
return; return;
case Event::PhosphorDecrease: case Event::PhosphorDecrease:
if (pressed) myOSystem.console().changePhosphor(false); if (pressed)
myAdjustFunction = myOSystem.console().changePhosphor(false);
return; return;
case Event::PhosphorIncrease: case Event::PhosphorIncrease:
if (pressed) myOSystem.console().changePhosphor(true); if (pressed)
myAdjustFunction = myOSystem.console().changePhosphor(true);
return; return;
case Event::TogglePhosphor: case Event::TogglePhosphor:
if (pressed && !repeated) myOSystem.console().togglePhosphor(); if(pressed && !repeated)
myAdjustFunction = myOSystem.console().togglePhosphor();
return; return;
case Event::ToggleColorLoss: case Event::ToggleColorLoss:
@ -537,11 +589,13 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return; return;
case Event::PaletteDecrease: case Event::PaletteDecrease:
if (pressed && !repeated) myOSystem.frameBuffer().tiaSurface().paletteHandler().cyclePalette(false); if (pressed && !repeated)
myAdjustFunction = myOSystem.frameBuffer().tiaSurface().paletteHandler().cyclePalette(false);
return; return;
case Event::PaletteIncrease: case Event::PaletteIncrease:
if (pressed && !repeated) myOSystem.frameBuffer().tiaSurface().paletteHandler().cyclePalette(true); if (pressed && !repeated)
myAdjustFunction = myOSystem.frameBuffer().tiaSurface().paletteHandler().cyclePalette(true);
return; return;
case Event::ToggleInter: case Event::ToggleInter:
@ -583,11 +637,13 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return; return;
case Event::FormatDecrease: case Event::FormatDecrease:
if (pressed) myOSystem.console().selectFormat(false); if (pressed && !repeated)
myAdjustFunction = myOSystem.console().selectFormat(false);
return; return;
case Event::FormatIncrease: case Event::FormatIncrease:
if (pressed) myOSystem.console().selectFormat(true); if (pressed && !repeated)
myAdjustFunction = myOSystem.console().selectFormat(true);
return; return;
case Event::ToggleGrabMouse: case Event::ToggleGrabMouse:
@ -656,7 +712,8 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return; return;
case Event::SaveState: case Event::SaveState:
if(pressed && !repeated) myOSystem.state().saveState(); if(pressed && !repeated)
myAdjustFunction = myOSystem.state().saveState();
return; return;
case Event::SaveAllStates: case Event::SaveAllStates:
@ -664,12 +721,14 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
myOSystem.frameBuffer().showMessage(myOSystem.state().rewindManager().saveAllStates()); myOSystem.frameBuffer().showMessage(myOSystem.state().rewindManager().saveAllStates());
return; return;
case Event::NextState: case Event::PreviousState:
if(pressed) myOSystem.state().changeState(1); if (pressed)
myAdjustFunction = myOSystem.state().changeState(false);
return; return;
case Event::PreviousState: case Event::NextState:
if (pressed) myOSystem.state().changeState(-1); if(pressed)
myAdjustFunction = myOSystem.state().changeState(true);
return; return;
case Event::ToggleAutoSlot: case Event::ToggleAutoSlot:
@ -677,7 +736,8 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return; return;
case Event::LoadState: case Event::LoadState:
if(pressed && !repeated) myOSystem.state().loadState(); if(pressed && !repeated)
myAdjustFunction = myOSystem.state().loadState();
return; return;
case Event::LoadAllStates: case Event::LoadAllStates:
@ -1950,6 +2010,10 @@ EventHandler::EmulActionList EventHandler::ourEmulActionList = { {
{ Event::PhosphorIncrease, "Increase 'phosphor' blend", "" }, { Event::PhosphorIncrease, "Increase 'phosphor' blend", "" },
{ Event::ScanlinesDecrease, "Decrease scanlines", "" }, { Event::ScanlinesDecrease, "Decrease scanlines", "" },
{ Event::ScanlinesIncrease, "Increase scanlines", "" }, { Event::ScanlinesIncrease, "Increase scanlines", "" },
{ Event::SettingDecrease, "Decrease current setting", "" },
{ Event::SettingIncrease, "Increase current setting", "" },
// Developer keys: // Developer keys:
{ Event::ToggleFrameStats, "Toggle frame stats", "" }, { Event::ToggleFrameStats, "Toggle frame stats", "" },
{ Event::ToggleP0Bit, "Toggle TIA Player0 object", "" }, { Event::ToggleP0Bit, "Toggle TIA Player0 object", "" },
@ -2044,6 +2108,7 @@ const Event::EventSet EventHandler::MiscEvents = {
// Event::MouseButtonLeftValue, Event::MouseButtonRightValue, // Event::MouseButtonLeftValue, Event::MouseButtonRightValue,
Event::HandleMouseControl, Event::ToggleGrabMouse, Event::HandleMouseControl, Event::ToggleGrabMouse,
Event::ToggleSAPortOrder, Event::ToggleSAPortOrder,
Event::SettingDecrease, Event::SettingIncrease
}; };
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -425,6 +425,8 @@ class EventHandler
string key; string key;
}; };
AdjustFunction myAdjustFunction{nullptr};
// Global Event object // Global Event object
Event myEvent; Event myEvent;
@ -468,7 +470,7 @@ class EventHandler
#else #else
PNG_SIZE = 0, PNG_SIZE = 0,
#endif #endif
EMUL_ACTIONLIST_SIZE = 152 + PNG_SIZE + COMBO_SIZE, EMUL_ACTIONLIST_SIZE = 154 + PNG_SIZE + COMBO_SIZE,
MENU_ACTIONLIST_SIZE = 18 MENU_ACTIONLIST_SIZE = 18
; ;

View File

@ -533,11 +533,11 @@ void FrameBuffer::showMessage(const string& message, const string& valueText,
return; return;
const int fontWidth = font().getMaxCharWidth(), const int fontWidth = font().getMaxCharWidth(),
fontHeight = font().getFontHeight(); fontHeight = font().getFontHeight();
const int VBORDER = fontHeight / 4; const int VBORDER = fontHeight / 4;
const int HBORDER = fontWidth * 1.25 / 2.0; const int HBORDER = fontWidth * 1.25 / 2.0;
myMsg.counter = uInt32(myOSystem.frameRate()) * 5; // Show message for 5 seconds myMsg.counter = uInt32(myOSystem.frameRate()) * 3; // Show message for 3 seconds
if(myMsg.counter == 0) if(myMsg.counter == 0)
myMsg.counter = 120; myMsg.counter = 120;
@ -551,10 +551,10 @@ void FrameBuffer::showMessage(const string& message, const string& valueText,
myMsg.value = 100.F; myMsg.value = 100.F;
myMsg.valueText = valueText; myMsg.valueText = valueText;
myMsg.w = std::min(fontWidth * MESSAGE_WIDTH, myMsg.w = std::min(fontWidth * MESSAGE_WIDTH,
font().getStringWidth(myMsg.text) font().getStringWidth(myMsg.text)
+ fontWidth * (GAUGEBAR_WIDTH + 2) + fontWidth * (GAUGEBAR_WIDTH + 2)
+ font().getStringWidth(myMsg.valueText)) + font().getStringWidth(myMsg.valueText))
+ HBORDER * 2; + HBORDER * 2;
myMsg.h = fontHeight + VBORDER * 2; myMsg.h = fontHeight + VBORDER * 2;
myMsg.position = MessagePosition::BottomCenter; myMsg.position = MessagePosition::BottomCenter;
myMsg.enabled = true; myMsg.enabled = true;
@ -564,6 +564,16 @@ void FrameBuffer::showMessage(const string& message, const string& valueText,
#endif #endif
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FrameBuffer::messageShown()
{
#ifdef GUI_SUPPORT
return myMsg.enabled;
#else
return false;
#endif
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::drawFrameStats(float framesPerSecond) void FrameBuffer::drawFrameStats(float framesPerSecond)
{ {
@ -662,6 +672,7 @@ inline bool FrameBuffer::drawMessage()
#ifdef GUI_SUPPORT #ifdef GUI_SUPPORT
// Either erase the entire message (when time is reached), // Either erase the entire message (when time is reached),
// or show again this frame // or show again this frame
cerr << myMsg.counter << endl;
if(myMsg.counter == 0) if(myMsg.counter == 0)
{ {
myMsg.enabled = false; myMsg.enabled = false;
@ -749,7 +760,7 @@ inline bool FrameBuffer::drawMessage()
// align bar with bottom of text // align bar with bottom of text
const int y = VBORDER + font().desc().ascent - bheight; const int y = VBORDER + font().desc().ascent - bheight;
// draw bar gauge // draw gauge bar
myMsg.surface->fillRect(x - BORDER, y, swidth + BORDER * 2, bheight, kSliderBGColor); myMsg.surface->fillRect(x - BORDER, y, swidth + BORDER * 2, bheight, kSliderBGColor);
myMsg.surface->fillRect(x, y + BORDER, bwidth, bheight - BORDER * 2, kSliderColor); myMsg.surface->fillRect(x, y + BORDER, bwidth, bheight - BORDER * 2, kSliderColor);
// draw tickmark in the middle of the bar // draw tickmark in the middle of the bar
@ -983,7 +994,7 @@ void FrameBuffer::toggleFullscreen()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::changeOverscan(bool increase) AdjustFunction FrameBuffer::changeOverscan(bool increase)
{ {
if (fullScreen()) if (fullScreen())
{ {
@ -1002,10 +1013,11 @@ void FrameBuffer::changeOverscan(bool increase)
val << (overscan ? overscan > 0 ? "+" : "" : " ") << overscan << "%"; val << (overscan ? overscan > 0 ? "+" : "" : " ") << overscan << "%";
myOSystem.frameBuffer().showMessage("Overscan", val.str(), overscan, 0, 10); myOSystem.frameBuffer().showMessage("Overscan", val.str(), overscan, 0, 10);
} }
return std::bind(&FrameBuffer::changeOverscan, this, std::placeholders::_1);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FrameBuffer::selectVidMode(bool next) AdjustFunction FrameBuffer::selectVidMode(bool next)
{ {
EventHandlerState state = myOSystem.eventHandler().state(); EventHandlerState state = myOSystem.eventHandler().state();
bool tiaMode = (state != EventHandlerState::DEBUGGER && bool tiaMode = (state != EventHandlerState::DEBUGGER &&
@ -1013,7 +1025,7 @@ bool FrameBuffer::selectVidMode(bool next)
// Only applicable when in TIA/emulation mode // Only applicable when in TIA/emulation mode
if(!tiaMode) if(!tiaMode)
return false; return nullptr;
if(next) if(next)
myCurrentModeList->next(); myCurrentModeList->next();
@ -1047,11 +1059,11 @@ bool FrameBuffer::selectVidMode(bool next)
else else
myOSystem.settings().setValue("tia.zoom", mode.zoom); myOSystem.settings().setValue("tia.zoom", mode.zoom);
return true; return std::bind(&FrameBuffer::selectVidMode, this, std::placeholders::_1);
} }
myOSystem.sound().mute(oldMuteState); myOSystem.sound().mute(oldMuteState);
return false; return nullptr;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -148,17 +148,19 @@ class FrameBuffer
MessagePosition position = MessagePosition::BottomCenter, MessagePosition position = MessagePosition::BottomCenter,
bool force = false); bool force = false);
/** /**
Shows a message with a bar gauge onscreen. Shows a message with a gauge bar onscreen.
@param message The message to be shown @param message The message to be shown
@param valueText The value of the bar gauge as text @param valueText The value of the gauge bar as text
@param value The bar gauge percentage @param value The gauge bar percentage
@param minValue The minimal value of the bar gauge @param minValue The minimal value of the gauge bar
@param maxValue The maximal value of the bar gauge @param maxValue The maximal value of the gauge bar
*/ */
void showMessage(const string& message, const string& valueText, void showMessage(const string& message, const string& valueText,
float value, float minValue = 0.F, float maxValue = 100.F); float value, float minValue = 0.F, float maxValue = 100.F);
bool messageShown();
/** /**
Toggles showing or hiding framerate statistics. Toggles showing or hiding framerate statistics.
*/ */
@ -265,7 +267,7 @@ class FrameBuffer
@param increase Increase if true, else decrease @param increase Increase if true, else decrease
*/ */
void changeOverscan(bool increase = true); AdjustFunction changeOverscan(bool increase = true);
/** /**
This method is called when the user wants to switch to the next This method is called when the user wants to switch to the next
@ -277,7 +279,7 @@ class FrameBuffer
@param next Select next if true, else previous @param next Select next if true, else previous
*/ */
bool selectVidMode(bool next = true); AdjustFunction selectVidMode(bool next = true);
/** /**
Sets the state of the cursor (hidden or grabbed) based on the Sets the state of the cursor (hidden or grabbed) based on the

View File

@ -88,10 +88,10 @@ class Sound
/** /**
Adjusts the volume of the sound device based on the given direction. Adjusts the volume of the sound device based on the given direction.
@param direction Increase or decrease the current volume by a predefined @param increase Increase or decrease the current volume by a predefined
amount based on the direction (1 = increase, -1 =decrease) amount
*/ */
virtual void adjustVolume(Int8 direction) = 0; virtual AdjustFunction adjustVolume(bool increase) = 0;
/** /**
This method is called to provide information about the sound device. This method is called to provide information about the sound device.

View File

@ -200,7 +200,7 @@ void TIASurface::setNTSC(NTSCFilter::Preset preset, bool show)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIASurface::changeNTSC(bool next, bool show) AdjustFunction TIASurface::changeNTSC(bool next)
{ {
constexpr NTSCFilter::Preset PRESETS[] = { constexpr NTSCFilter::Preset PRESETS[] = {
NTSCFilter::Preset::OFF, NTSCFilter::Preset::RGB, NTSCFilter::Preset::SVIDEO, NTSCFilter::Preset::OFF, NTSCFilter::Preset::RGB, NTSCFilter::Preset::SVIDEO,
@ -222,11 +222,12 @@ void TIASurface::changeNTSC(bool next, bool show)
else else
preset--; preset--;
} }
setNTSC(PRESETS[preset], show); setNTSC(PRESETS[preset], true);
return std::bind(&TIASurface::changeNTSC, this, std::placeholders::_1);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIASurface::setNTSCAdjustable(bool next) AdjustFunction TIASurface::setNTSCAdjustable(bool next)
{ {
string text, valueText; string text, valueText;
Int32 value; Int32 value;
@ -234,11 +235,12 @@ void TIASurface::setNTSCAdjustable(bool next)
setNTSC(NTSCFilter::Preset::CUSTOM); setNTSC(NTSCFilter::Preset::CUSTOM);
ntsc().selectAdjustable(next, text, valueText, value); ntsc().selectAdjustable(next, text, valueText, value);
myOSystem.frameBuffer().showMessage(text, valueText, value); myOSystem.frameBuffer().showMessage(text, valueText, value);
return std::bind(&TIASurface::changeNTSCAdjustable, this, std::placeholders::_1);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIASurface::changeNTSCAdjustable(bool increase) AdjustFunction TIASurface::changeNTSCAdjustable(bool increase)
{ {
string text, valueText; string text, valueText;
Int32 newValue; Int32 newValue;
@ -246,13 +248,14 @@ void TIASurface::changeNTSCAdjustable(bool increase)
setNTSC(NTSCFilter::Preset::CUSTOM); setNTSC(NTSCFilter::Preset::CUSTOM);
ntsc().changeAdjustable(increase, text, valueText, newValue); ntsc().changeAdjustable(increase, text, valueText, newValue);
myOSystem.frameBuffer().showMessage(text, valueText, newValue); myOSystem.frameBuffer().showMessage(text, valueText, newValue);
return std::bind(&TIASurface::changeNTSCAdjustable, this, std::placeholders::_1);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIASurface::setScanlineIntensity(int amount) AdjustFunction TIASurface::setScanlineIntensity(bool increase)
{ {
ostringstream buf; ostringstream buf;
uInt32 intensity = enableScanlines(amount); uInt32 intensity = enableScanlines(increase ? 2 : -2);
myOSystem.settings().setValue("tv.scanlines", intensity); myOSystem.settings().setValue("tv.scanlines", intensity);
enableNTSC(ntscEnabled()); enableNTSC(ntscEnabled());
@ -262,6 +265,7 @@ void TIASurface::setScanlineIntensity(int amount)
else else
buf << "Off"; buf << "Off";
myFB.showMessage("Scanline intensity", buf.str(), intensity); myFB.showMessage("Scanline intensity", buf.str(), intensity);
return std::bind(&TIASurface::setScanlineIntensity, this, std::placeholders::_1);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -92,17 +92,17 @@ class TIASurface
/** /**
Switch to next/previous NTSC filtering effect. Switch to next/previous NTSC filtering effect.
*/ */
void changeNTSC(bool next, bool show = true); AdjustFunction changeNTSC(bool next);
/** /**
Switch to next/previous NTSC filtering adjustable. Switch to next/previous NTSC filtering adjustable.
*/ */
void setNTSCAdjustable(bool next = true); AdjustFunction setNTSCAdjustable(bool next = true);
/** /**
Increase/decrease current NTSC filtering adjustable. Increase/decrease current NTSC filtering adjustable.
*/ */
void changeNTSCAdjustable(bool increase = true); AdjustFunction changeNTSCAdjustable(bool increase = true);
/** /**
Retrieve palette handler. Retrieve palette handler.
@ -112,7 +112,7 @@ class TIASurface
/** /**
Increase/decrease current scanline intensity by given relative amount. Increase/decrease current scanline intensity by given relative amount.
*/ */
void setScanlineIntensity(int relative); AdjustFunction setScanlineIntensity(bool increase);
/** /**
Change scanline intensity and interpolation. Change scanline intensity and interpolation.

View File

@ -95,10 +95,10 @@ class SoundLIBRETRO : public Sound
/** /**
Adjusts the volume of the sound device based on the given direction. Adjusts the volume of the sound device based on the given direction.
@param direction Increase or decrease the current volume by a predefined @param increase Increase or decrease the current volume by a predefined
amount based on the direction (1 = increase, -1 = decrease) amount
*/ */
void adjustVolume(Int8 direction) override { } void adjustVolume(bool increase) override { return nullptr; }
/** /**
This method is called to provide information about the sound device. This method is called to provide information about the sound device.