mirror of https://github.com/stella-emu/stella.git
added four global hotkeys which allow selecting and changing several adjustable settings (addresses #631)
This commit is contained in:
parent
378829da5a
commit
16a3280b56
|
@ -493,8 +493,12 @@ PhysicalKeyboardHandler::EventMappingArray PhysicalKeyboardHandler::DefaultCommo
|
|||
{Event::ToggleColorLoss, KBDK_L, KBDM_CTRL},
|
||||
{Event::PaletteDecrease, KBDK_P, KBDM_SHIFT | KBDM_CTRL},
|
||||
{Event::PaletteIncrease, KBDK_P, KBDM_CTRL},
|
||||
|
||||
{Event::PreviousSetting, KBDK_END},
|
||||
{Event::NextSetting, KBDK_HOME},
|
||||
{Event::SettingDecrease, KBDK_PAGEDOWN},
|
||||
{Event::SettingIncrease, KBDK_PAGEUP},
|
||||
|
||||
{Event::ToggleInter, KBDK_I, KBDM_CTRL},
|
||||
{Event::ToggleTurbo, KBDK_T, KBDM_CTRL},
|
||||
{Event::ToggleJitter, KBDK_J, MOD3},
|
||||
|
|
|
@ -55,33 +55,16 @@ string PaletteHandler::toPaletteName(PaletteType type) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AdjustFunction PaletteHandler::cyclePalette(bool next)
|
||||
void PaletteHandler::cyclePalette(int direction)
|
||||
{
|
||||
const string MESSAGES[PaletteType::NumTypes] = {
|
||||
"Standard Stella", "Z26", "User-defined", "Custom"
|
||||
};
|
||||
int type = toPaletteType(myOSystem.settings().getString("palette"));
|
||||
|
||||
if(next)
|
||||
{
|
||||
if(type == PaletteType::MaxType)
|
||||
type = PaletteType::Standard;
|
||||
else
|
||||
type++;
|
||||
// If we have no user-defined palette, we will skip it
|
||||
if(type == PaletteType::User && !myUserPaletteDefined)
|
||||
type++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(type == PaletteType::MinType)
|
||||
type = PaletteType::MaxType;
|
||||
else
|
||||
type--;
|
||||
// If we have no user-defined palette, we will skip it
|
||||
if(type == PaletteType::User && !myUserPaletteDefined)
|
||||
type--;
|
||||
}
|
||||
do {
|
||||
type = BSPF::clampw(type + direction, int(PaletteType::MinType), int(PaletteType::MaxType));
|
||||
} while(type == PaletteType::User && !myUserPaletteDefined);
|
||||
|
||||
const string palette = toPaletteName(PaletteType(type));
|
||||
const string message = MESSAGES[type] + " palette";
|
||||
|
@ -89,7 +72,6 @@ AdjustFunction PaletteHandler::cyclePalette(bool next)
|
|||
myOSystem.frameBuffer().showMessage(message);
|
||||
|
||||
setPalette(palette);
|
||||
return std::bind(&PaletteHandler::cyclePalette, this, std::placeholders::_1);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -119,58 +101,55 @@ void PaletteHandler::showAdjustableMessage()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AdjustFunction PaletteHandler::cycleAdjustable(bool next)
|
||||
void PaletteHandler::cycleAdjustable(int direction)
|
||||
{
|
||||
const bool isCustomPalette = SETTING_CUSTOM == myOSystem.settings().getString("palette");
|
||||
bool isPhaseShift;
|
||||
|
||||
do {
|
||||
if(next)
|
||||
{
|
||||
myCurrentAdjustable++;
|
||||
myCurrentAdjustable %= NUM_ADJUSTABLES;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(myCurrentAdjustable == 0)
|
||||
myCurrentAdjustable = NUM_ADJUSTABLES - 1;
|
||||
else
|
||||
myCurrentAdjustable--;
|
||||
}
|
||||
myCurrentAdjustable = BSPF::clampw(int(myCurrentAdjustable + direction), 0, NUM_ADJUSTABLES - 1);
|
||||
isPhaseShift = myAdjustables[myCurrentAdjustable].value == nullptr;
|
||||
|
||||
// skip phase shift when 'Custom' palette is not selected
|
||||
if(!direction && isPhaseShift && !isCustomPalette)
|
||||
myCurrentAdjustable++;
|
||||
} while(isPhaseShift && !isCustomPalette);
|
||||
|
||||
showAdjustableMessage();
|
||||
return std::bind(&PaletteHandler::changeAdjustable, this, std::placeholders::_1);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AdjustFunction PaletteHandler::changeAdjustable(bool increase)
|
||||
void PaletteHandler::changeAdjustable(int adjustable, int direction)
|
||||
{
|
||||
const bool isCustomPalette = SETTING_CUSTOM == myOSystem.settings().getString("palette");
|
||||
const bool isPhaseShift = myAdjustables[adjustable].value == nullptr;
|
||||
|
||||
myCurrentAdjustable = adjustable;
|
||||
if(isPhaseShift && !isCustomPalette)
|
||||
myCurrentAdjustable++;
|
||||
|
||||
changeCurrentAdjustable(direction);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PaletteHandler::changeCurrentAdjustable(int direction)
|
||||
{
|
||||
if(myAdjustables[myCurrentAdjustable].value == nullptr)
|
||||
changeColorPhaseShift(increase);
|
||||
changeColorPhaseShift(direction);
|
||||
else
|
||||
{
|
||||
int newVal = scaleTo100(*myAdjustables[myCurrentAdjustable].value);
|
||||
|
||||
if(increase)
|
||||
newVal += 2; // += 2%
|
||||
else
|
||||
newVal -= 2; // -= 2%
|
||||
newVal = BSPF::clamp(newVal, 0, 100);
|
||||
newVal = BSPF::clamp(newVal + direction * 2, 0, 100);
|
||||
|
||||
*myAdjustables[myCurrentAdjustable].value = scaleFrom100(newVal);
|
||||
|
||||
showAdjustableMessage();
|
||||
setPalette();
|
||||
}
|
||||
return std::bind(&PaletteHandler::changeAdjustable, this, std::placeholders::_1);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PaletteHandler::changeColorPhaseShift(bool increase)
|
||||
void PaletteHandler::changeColorPhaseShift(int direction)
|
||||
{
|
||||
const ConsoleTiming timing = myOSystem.console().timing();
|
||||
|
||||
|
@ -181,11 +160,7 @@ void PaletteHandler::changeColorPhaseShift(bool increase)
|
|||
const float shift = isNTSC ? DEF_NTSC_SHIFT : DEF_PAL_SHIFT;
|
||||
float newPhase = isNTSC ? myPhaseNTSC : myPhasePAL;
|
||||
|
||||
if(increase) // increase color phase shift
|
||||
newPhase += 0.3F;
|
||||
else // decrease color phase shift
|
||||
newPhase -= 0.3F;
|
||||
newPhase = BSPF::clamp(newPhase, shift - MAX_SHIFT, shift + MAX_SHIFT);
|
||||
newPhase = BSPF::clamp(newPhase + direction * 0.3F, shift - MAX_SHIFT, shift + MAX_SHIFT);
|
||||
|
||||
if(isNTSC)
|
||||
myPhaseNTSC = newPhase;
|
||||
|
|
|
@ -37,6 +37,15 @@ class PaletteHandler
|
|||
static constexpr float DEF_PAL_SHIFT = 31.3F; // ~= 360 / 11.5
|
||||
static constexpr float MAX_SHIFT = 4.5F;
|
||||
|
||||
enum Adjustables {
|
||||
PHASE_SHIFT,
|
||||
HUE,
|
||||
SATURATION,
|
||||
CONTRAST,
|
||||
BRIGHTNESS,
|
||||
GAMMA
|
||||
};
|
||||
|
||||
// Externally used adjustment parameters
|
||||
struct Adjustable {
|
||||
float phaseNtsc{0.F}, phasePal{0.F};
|
||||
|
@ -50,23 +59,31 @@ class PaletteHandler
|
|||
/**
|
||||
Cycle through available palettes.
|
||||
|
||||
@param next Select next palette, else previous one
|
||||
@param direction +1 indicates increase, -1 indicates decrease.
|
||||
*/
|
||||
AdjustFunction cyclePalette(bool next = true);
|
||||
void cyclePalette(int direction = +1);
|
||||
|
||||
/*
|
||||
Cycle through each palette adjustable.
|
||||
|
||||
@param next Select next adjustable, else previous one
|
||||
@param direction +1 indicates increase, -1 indicates decrease.
|
||||
*/
|
||||
AdjustFunction cycleAdjustable(bool next = true);
|
||||
void cycleAdjustable(int direction = +1);
|
||||
|
||||
/*
|
||||
Increase or decrease given palette adjustable.
|
||||
|
||||
@param adjustable The adjustable to change
|
||||
@param direction +1 indicates increase, -1 indicates decrease.
|
||||
*/
|
||||
void changeAdjustable(int adjustable, int direction);
|
||||
|
||||
/*
|
||||
Increase or decrease current palette adjustable.
|
||||
|
||||
@param increase Increase adjustable if true, else decrease
|
||||
@param direction +1 indicates increase, -1 indicates decrease.
|
||||
*/
|
||||
AdjustFunction changeAdjustable(bool increase = true);
|
||||
void changeCurrentAdjustable(int direction = +1);
|
||||
|
||||
// Load adjustables from settings
|
||||
void loadConfig(const Settings& settings);
|
||||
|
@ -139,9 +156,9 @@ class PaletteHandler
|
|||
Note that there are two of these (NTSC and PAL). The currently
|
||||
active mode will determine which one is used.
|
||||
|
||||
@param increase Increase if true, else decrease
|
||||
@param direction +1 indicates increase, -1 indicates decrease.
|
||||
*/
|
||||
void changeColorPhaseShift(bool increase = true);
|
||||
void changeColorPhaseShift(int direction = +1);
|
||||
|
||||
/**
|
||||
Generates a custom palette, based on user defined phase shifts.
|
||||
|
|
|
@ -97,10 +97,9 @@ class SoundNull : public Sound
|
|||
/**
|
||||
Adjusts the volume of the sound device based on the given direction.
|
||||
|
||||
@param increase Increase or decrease the current volume by a predefined
|
||||
amount
|
||||
@param direction +1 indicates increase, -1 indicates decrease.
|
||||
*/
|
||||
AdjustFunction adjustVolume(bool increase) override { return nullptr; }
|
||||
void adjustVolume(int direction = 1) override { }
|
||||
|
||||
/**
|
||||
This method is called to provide information about the sound device.
|
||||
|
|
|
@ -229,12 +229,12 @@ void SoundSDL2::setVolume(uInt32 percent)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AdjustFunction SoundSDL2::adjustVolume(bool increase)
|
||||
void SoundSDL2::adjustVolume(int direction)
|
||||
{
|
||||
ostringstream strval;
|
||||
Int32 percent = myVolume;
|
||||
|
||||
percent = BSPF::clamp(percent += increase ? 2 : -2, 0, 100);
|
||||
percent = BSPF::clamp(percent + direction * 2, 0, 100);
|
||||
|
||||
setVolume(percent);
|
||||
|
||||
|
@ -253,7 +253,6 @@ AdjustFunction SoundSDL2::adjustVolume(bool increase)
|
|||
else
|
||||
strval << "Off";
|
||||
myOSystem.frameBuffer().showMessage("Volume", strval.str(), percent);
|
||||
return std::bind(&SoundSDL2::adjustVolume, this, std::placeholders::_1);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -98,10 +98,9 @@ class SoundSDL2 : public Sound
|
|||
/**
|
||||
Adjusts the volume of the sound device based on the given direction.
|
||||
|
||||
@param increase Increase or decrease the current volume by a predefined
|
||||
amount
|
||||
@param direction +1 indicates increase, -1 indicates decrease.
|
||||
*/
|
||||
AdjustFunction adjustVolume(bool increase) override;
|
||||
void adjustVolume(int direction = 1) override;
|
||||
|
||||
/**
|
||||
This method is called to provide information about the sound device.
|
||||
|
|
|
@ -198,7 +198,7 @@ void StateManager::update()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AdjustFunction StateManager::loadState(int slot)
|
||||
void StateManager::loadState(int slot)
|
||||
{
|
||||
if(myOSystem.hasConsole())
|
||||
{
|
||||
|
@ -216,7 +216,7 @@ AdjustFunction StateManager::loadState(int slot)
|
|||
buf.str("");
|
||||
buf << "Can't open/load from state file " << slot;
|
||||
myOSystem.frameBuffer().showMessage(buf.str());
|
||||
return nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
// First test if we have a valid header
|
||||
|
@ -241,11 +241,10 @@ AdjustFunction StateManager::loadState(int slot)
|
|||
|
||||
myOSystem.frameBuffer().showMessage(buf.str());
|
||||
}
|
||||
return std::bind(&StateManager::changeState, this, std::placeholders::_1);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AdjustFunction StateManager::saveState(int slot)
|
||||
void StateManager::saveState(int slot)
|
||||
{
|
||||
if(myOSystem.hasConsole())
|
||||
{
|
||||
|
@ -263,7 +262,7 @@ AdjustFunction StateManager::saveState(int slot)
|
|||
buf.str("");
|
||||
buf << "Can't open/save to state file " << slot;
|
||||
myOSystem.frameBuffer().showMessage(buf.str());
|
||||
return nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -276,7 +275,7 @@ AdjustFunction StateManager::saveState(int slot)
|
|||
{
|
||||
buf << "Error saving state " << slot;
|
||||
myOSystem.frameBuffer().showMessage(buf.str());
|
||||
return nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
// Do a complete state save using the Console
|
||||
|
@ -295,23 +294,20 @@ AdjustFunction StateManager::saveState(int slot)
|
|||
|
||||
myOSystem.frameBuffer().showMessage(buf.str());
|
||||
}
|
||||
return std::bind(&StateManager::changeState, this, std::placeholders::_1);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AdjustFunction StateManager::changeState(bool next)
|
||||
void StateManager::changeState(int direction)
|
||||
{
|
||||
myCurrentSlot += next ? 1 : -1;
|
||||
if (myCurrentSlot < 0)
|
||||
myCurrentSlot = 9;
|
||||
else
|
||||
myCurrentSlot %= 10;
|
||||
myCurrentSlot = BSPF::clampw(myCurrentSlot + direction, 0, 9);
|
||||
|
||||
// Print appropriate message
|
||||
ostringstream buf;
|
||||
buf << "Changed to slot " << myCurrentSlot;
|
||||
if(direction)
|
||||
buf << "Changed to state slot " << myCurrentSlot;
|
||||
else
|
||||
buf << "State slot " << myCurrentSlot;
|
||||
myOSystem.frameBuffer().showMessage(buf.str());
|
||||
return std::bind(&StateManager::changeState, this, std::placeholders::_1);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -104,19 +104,21 @@ class StateManager
|
|||
|
||||
@param slot The state 'slot' to load state from
|
||||
*/
|
||||
AdjustFunction loadState(int slot = -1);
|
||||
void loadState(int slot = -1);
|
||||
|
||||
/**
|
||||
Save the current state from the system.
|
||||
|
||||
@param slot The state 'slot' to save into
|
||||
*/
|
||||
AdjustFunction saveState(int slot = -1);
|
||||
void saveState(int slot = -1);
|
||||
|
||||
/**
|
||||
Switches to the next higher or lower state slot (circular queue style).
|
||||
|
||||
@param direction +1 indicates increase, -1 indicates decrease.
|
||||
*/
|
||||
AdjustFunction changeState(bool next);
|
||||
void changeState(int direction = +1);
|
||||
|
||||
/**
|
||||
Toggles auto slot mode.
|
||||
|
|
|
@ -87,7 +87,7 @@ using StringList = std::vector<std::string>;
|
|||
using ByteBuffer = std::unique_ptr<uInt8[]>; // NOLINT
|
||||
using DWordBuffer = std::unique_ptr<uInt32[]>; // NOLINT
|
||||
|
||||
using AdjustFunction = std::function<void(bool)>;
|
||||
using AdjustFunction = std::function<void(int)>;
|
||||
|
||||
// We use KB a lot; let's make a literal for it
|
||||
constexpr uInt32 operator "" _KB(unsigned long long size)
|
||||
|
@ -136,6 +136,10 @@ namespace BSPF
|
|||
{
|
||||
if(val < lower || val > upper) val = setVal;
|
||||
}
|
||||
template<typename T> inline T clampw(T val, T lower, T upper)
|
||||
{
|
||||
return (val < lower) ? upper : (val > upper) ? lower : val;
|
||||
}
|
||||
|
||||
// Convert string to given case
|
||||
inline const string& toUpperCase(string& s)
|
||||
|
|
|
@ -62,9 +62,9 @@ string NTSCFilter::getPreset() const
|
|||
{
|
||||
switch(myPreset)
|
||||
{
|
||||
case Preset::COMPOSITE: return "COMPOSITE";
|
||||
case Preset::SVIDEO: return "S-VIDEO";
|
||||
case Preset::RGB: return "RGB";
|
||||
case Preset::SVIDEO: return "S-VIDEO";
|
||||
case Preset::COMPOSITE: return "COMPOSITE";
|
||||
case Preset::BAD: return "BAD ADJUST";
|
||||
case Preset::CUSTOM: return "CUSTOM";
|
||||
default: return "Disabled";
|
||||
|
@ -72,9 +72,10 @@ string NTSCFilter::getPreset() const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void NTSCFilter::selectAdjustable(bool next, string& text, string& valueText, Int32& value)
|
||||
void NTSCFilter::selectAdjustable(int direction,
|
||||
string& text, string& valueText, Int32& value)
|
||||
{
|
||||
if(next)
|
||||
if(direction == +1)
|
||||
{
|
||||
#ifdef BLARGG_PALETTE
|
||||
myCurrentAdjustable = (myCurrentAdjustable + 1) % 10;
|
||||
|
@ -82,7 +83,7 @@ void NTSCFilter::selectAdjustable(bool next, string& text, string& valueText, In
|
|||
myCurrentAdjustable = (myCurrentAdjustable + 1) % 5;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
else if(direction == -1)
|
||||
{
|
||||
#ifdef BLARGG_PALETTE
|
||||
if(myCurrentAdjustable == 0) myCurrentAdjustable = 9;
|
||||
|
@ -103,13 +104,22 @@ void NTSCFilter::selectAdjustable(bool next, string& text, string& valueText, In
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void NTSCFilter::changeAdjustable(bool increase, string& text, string& valueText, Int32& newValue)
|
||||
void NTSCFilter::changeAdjustable(int adjustable, int direction,
|
||||
string& text, string& valueText, Int32& newValue)
|
||||
{
|
||||
myCurrentAdjustable = adjustable;
|
||||
changeCurrentAdjustable(direction, text, valueText, newValue);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void NTSCFilter::changeCurrentAdjustable(int direction,
|
||||
string& text, string& valueText, Int32& newValue)
|
||||
{
|
||||
//if(myPreset != Preset::CUSTOM)
|
||||
// return "'Custom' TV mode not selected";
|
||||
|
||||
newValue = scaleTo100(*ourCustomAdjustables[myCurrentAdjustable].value);
|
||||
newValue = BSPF::clamp(newValue + (increase ? 2 : -2), 0, 100);
|
||||
newValue = BSPF::clamp(newValue + direction * 2, 0, 100);
|
||||
|
||||
*ourCustomAdjustables[myCurrentAdjustable].value = scaleFrom100(newValue);
|
||||
|
||||
|
@ -166,12 +176,12 @@ void NTSCFilter::getAdjustables(Adjustable& adjustable, Preset preset) const
|
|||
{
|
||||
switch(preset)
|
||||
{
|
||||
case Preset::COMPOSITE:
|
||||
convertToAdjustable(adjustable, AtariNTSC::TV_Composite); break;
|
||||
case Preset::SVIDEO:
|
||||
convertToAdjustable(adjustable, AtariNTSC::TV_SVideo); break;
|
||||
case Preset::RGB:
|
||||
convertToAdjustable(adjustable, AtariNTSC::TV_RGB); break;
|
||||
case Preset::SVIDEO:
|
||||
convertToAdjustable(adjustable, AtariNTSC::TV_SVideo); break;
|
||||
case Preset::COMPOSITE:
|
||||
convertToAdjustable(adjustable, AtariNTSC::TV_Composite); break;
|
||||
case Preset::BAD:
|
||||
convertToAdjustable(adjustable, AtariNTSC::TV_Bad); break;
|
||||
case Preset::CUSTOM:
|
||||
|
@ -228,7 +238,7 @@ const std::array<NTSCFilter::AdjustableTag, 10> NTSCFilter::ourCustomAdjustables
|
|||
{ "saturation", &myCustomSetup.saturation },
|
||||
{ "gamma", &myCustomSetup.gamma },
|
||||
#else
|
||||
const std::array<NTSCFilter::AdjustableTag, 5> NTSCFilter::ourCustomAdjustables = { {
|
||||
const std::array<NTSCFilter::AdjustableTag, int(NTSCFilter::Adjustables::NUM_ADJUSTABLES)> NTSCFilter::ourCustomAdjustables = { {
|
||||
#endif
|
||||
{ "sharpness", &myCustomSetup.sharpness },
|
||||
{ "resolution", &myCustomSetup.resolution },
|
||||
|
|
|
@ -47,6 +47,14 @@ class NTSCFilter
|
|||
BAD,
|
||||
CUSTOM
|
||||
};
|
||||
enum class Adjustables {
|
||||
SHARPNESS,
|
||||
RESOLUTION,
|
||||
ARTIFACTS,
|
||||
FRINGING,
|
||||
BLEEDING,
|
||||
NUM_ADJUSTABLES
|
||||
};
|
||||
|
||||
/* Normally used in conjunction with custom mode, contains all
|
||||
aspects currently adjustable in NTSC TV emulation. */
|
||||
|
@ -90,8 +98,12 @@ class NTSCFilter
|
|||
// Changes are made this way since otherwise 20 key-combinations
|
||||
// would be needed to dynamically change each setting, and now
|
||||
// only 4 combinations are necessary
|
||||
void selectAdjustable(bool next, string& text, string& valueText, Int32& value);
|
||||
void changeAdjustable(bool increase, string& text, string& valueText, Int32& newValue);
|
||||
void selectAdjustable(int direction,
|
||||
string& text, string& valueText, Int32& value);
|
||||
void changeAdjustable(int adjustable, int direction,
|
||||
string& text, string& valueText, Int32& newValue);
|
||||
void changeCurrentAdjustable(int direction,
|
||||
string& text, string& valueText, Int32& newValue);
|
||||
|
||||
// Load and save NTSC-related settings
|
||||
void loadConfig(const Settings& settings);
|
||||
|
|
|
@ -349,24 +349,20 @@ bool Console::load(Serializer& in)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AdjustFunction Console::selectFormat(bool next)
|
||||
void Console::selectFormat(int direction)
|
||||
{
|
||||
string saveformat, message;
|
||||
uInt32 format = myCurrentFormat;
|
||||
Int32 format = myCurrentFormat;
|
||||
|
||||
if(next)
|
||||
format = (myCurrentFormat + 1) % 7;
|
||||
else
|
||||
format = myCurrentFormat > 0 ? (myCurrentFormat - 1) : 6;
|
||||
format = BSPF::clampw(format + direction, 0, 6);
|
||||
|
||||
setFormat(format);
|
||||
return std::bind(&Console::selectFormat, this, std::placeholders::_1);
|
||||
setFormat(format, true);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Console::setFormat(uInt32 format)
|
||||
void Console::setFormat(uInt32 format, bool force)
|
||||
{
|
||||
if(myCurrentFormat == format)
|
||||
if(!force && myCurrentFormat == format)
|
||||
return;
|
||||
|
||||
string saveformat, message;
|
||||
|
@ -505,7 +501,7 @@ void Console::toggleTurbo()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AdjustFunction Console::togglePhosphor()
|
||||
void Console::togglePhosphor()
|
||||
{
|
||||
if(myOSystem.frameBuffer().tiaSurface().phosphorEnabled())
|
||||
{
|
||||
|
@ -519,19 +515,14 @@ AdjustFunction Console::togglePhosphor()
|
|||
myOSystem.frameBuffer().tiaSurface().enablePhosphor(true);
|
||||
myOSystem.frameBuffer().showMessage("Phosphor effect enabled");
|
||||
}
|
||||
return std::bind(&Console::changePhosphor, this, std::placeholders::_1);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AdjustFunction Console::changePhosphor(bool increase)
|
||||
void Console::changePhosphor(int direction)
|
||||
{
|
||||
int blend = BSPF::stringToInt(myProperties.get(PropType::Display_PPBlend));
|
||||
|
||||
if(increase) // increase blend
|
||||
blend += 2;
|
||||
else // decrease blend
|
||||
blend -= 2;
|
||||
blend = BSPF::clamp(blend, 0, 100);
|
||||
blend = BSPF::clamp(blend + direction * 2, 0, 100);
|
||||
myOSystem.frameBuffer().tiaSurface().enablePhosphor(true, blend);
|
||||
|
||||
ostringstream val;
|
||||
|
@ -545,7 +536,6 @@ AdjustFunction Console::changePhosphor(bool increase)
|
|||
val << "Off";
|
||||
}
|
||||
myOSystem.frameBuffer().showMessage("Phosphor blend", val.str(), blend);
|
||||
return std::bind(&Console::changePhosphor, this, std::placeholders::_1);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -622,15 +612,11 @@ void Console::fry() const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AdjustFunction Console::changeVerticalCenter(bool increase)
|
||||
void Console::changeVerticalCenter(int direction)
|
||||
{
|
||||
Int32 vcenter = myTIA->vcenter();
|
||||
|
||||
if(increase) // increase vcenter
|
||||
++vcenter;
|
||||
else // decrease vcenter
|
||||
--vcenter;
|
||||
vcenter = BSPF::clamp(vcenter, myTIA->minVcenter(), myTIA->maxVcenter());
|
||||
vcenter = BSPF::clamp(vcenter + direction, myTIA->minVcenter(), myTIA->maxVcenter());
|
||||
|
||||
ostringstream ss, val;
|
||||
ss << vcenter;
|
||||
|
@ -641,7 +627,6 @@ AdjustFunction Console::changeVerticalCenter(bool increase)
|
|||
val << (vcenter ? vcenter > 0 ? "+" : "" : " ") << vcenter << "px";
|
||||
myOSystem.frameBuffer().showMessage("V-Center", val.str(), vcenter,
|
||||
myTIA->minVcenter(), myTIA->maxVcenter());
|
||||
return std::bind(&Console::changeVerticalCenter, this, std::placeholders::_1);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -654,15 +639,11 @@ void Console::updateVcenter(Int32 vcenter)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AdjustFunction Console::changeVSizeAdjust(bool increase)
|
||||
void Console::changeVSizeAdjust(int direction)
|
||||
{
|
||||
Int32 newAdjustVSize = myTIA->adjustVSize();
|
||||
|
||||
if(increase) // increase scanline adjustment
|
||||
newAdjustVSize++;
|
||||
else // decrease scanline adjustment
|
||||
newAdjustVSize--;
|
||||
newAdjustVSize = BSPF::clamp(newAdjustVSize, -5, 5);
|
||||
newAdjustVSize = BSPF::clamp(newAdjustVSize + direction, -5, 5);
|
||||
|
||||
if (newAdjustVSize != myTIA->adjustVSize()) {
|
||||
myTIA->setAdjustVSize(newAdjustVSize);
|
||||
|
@ -674,7 +655,6 @@ AdjustFunction Console::changeVSizeAdjust(bool increase)
|
|||
|
||||
val << (newAdjustVSize ? newAdjustVSize > 0 ? "+" : "" : " ") << newAdjustVSize << "%";
|
||||
myOSystem.frameBuffer().showMessage("V-Size", val.str(), newAdjustVSize, -5, 5);
|
||||
return std::bind(&Console::changeVSizeAdjust, this, std::placeholders::_1);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -189,14 +189,14 @@ class Console : public Serializable, public ConsoleIO
|
|||
/**
|
||||
Toggle between NTSC/PAL/SECAM (and variants) display format.
|
||||
|
||||
@param next Select next if true, else previous
|
||||
@param direction +1 indicates increase, -1 indicates decrease.
|
||||
*/
|
||||
AdjustFunction selectFormat(bool next = true);
|
||||
void selectFormat(int direction = +1);
|
||||
|
||||
/**
|
||||
Set NTSC/PAL/SECAM (and variants) display format.
|
||||
*/
|
||||
void setFormat(uInt32 format);
|
||||
void setFormat(uInt32 format, bool force = false);
|
||||
|
||||
/**
|
||||
Get NTSC/PAL/SECAM (and variants) display format name
|
||||
|
@ -217,14 +217,14 @@ class Console : public Serializable, public ConsoleIO
|
|||
/**
|
||||
Toggles phosphor effect.
|
||||
*/
|
||||
AdjustFunction togglePhosphor();
|
||||
void togglePhosphor();
|
||||
|
||||
/**
|
||||
Change the "Display.PPBlend" variable.
|
||||
|
||||
@param increase Increase if true, else decrease
|
||||
@param direction +1 indicates increase, -1 indicates decrease.
|
||||
*/
|
||||
AdjustFunction changePhosphor(bool increase = true);
|
||||
void changePhosphor(int direction = +1);
|
||||
|
||||
/**
|
||||
Toggles the PAL color-loss effect.
|
||||
|
@ -257,18 +257,18 @@ class Console : public Serializable, public ConsoleIO
|
|||
/**
|
||||
Change the "Display.VCenter" variable.
|
||||
|
||||
@param increase Increase if true, else decrease
|
||||
@param direction +1 indicates increase, -1 indicates decrease.
|
||||
*/
|
||||
AdjustFunction changeVerticalCenter(bool increase = true);
|
||||
void changeVerticalCenter(int direction = +1);
|
||||
|
||||
/**
|
||||
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 increase Increase if true, else decrease
|
||||
@param direction +1 indicates increase, -1 indicates decrease.
|
||||
*/
|
||||
AdjustFunction changeVSizeAdjust(bool increase = true);
|
||||
void changeVSizeAdjust(int direction = +1);
|
||||
|
||||
/**
|
||||
Returns the current framerate.
|
||||
|
|
|
@ -122,7 +122,7 @@ class Event
|
|||
|
||||
ToggleFrameStats, ToggleSAPortOrder, ExitGame,
|
||||
// add new events from here to avoid that user remapped events get overwritten
|
||||
SettingDecrease, SettingIncrease,
|
||||
SettingDecrease, SettingIncrease, PreviousSetting, NextSetting,
|
||||
|
||||
LastType
|
||||
};
|
||||
|
|
|
@ -342,6 +342,78 @@ void EventHandler::handleSystemEvent(SystemEvent e, int, int)
|
|||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AdjustFunction EventHandler::cycleAdjustSetting(int direction)
|
||||
{
|
||||
const bool isFullScreen = myOSystem.frameBuffer().fullScreen();
|
||||
const bool isCustomPalette =
|
||||
myOSystem.settings().getString("palette") == PaletteHandler::SETTING_CUSTOM;
|
||||
const bool isCustomFilter =
|
||||
myOSystem.settings().getInt("tv.filter") == int(NTSCFilter::Preset::CUSTOM);
|
||||
|
||||
do
|
||||
{
|
||||
myAdjustSetting =
|
||||
AdjustSetting(BSPF::clampw(int(myAdjustSetting) + direction, 0, int(AdjustSetting::MAX_ADJ)));
|
||||
// skip currently non-relevant adjustments
|
||||
} while((myAdjustSetting == AdjustSetting::OVERSCAN && !isFullScreen)
|
||||
|| (myAdjustSetting == AdjustSetting::PALETTE_PHASE && !isCustomPalette)
|
||||
|| (myAdjustSetting >= AdjustSetting::NTSC_SHARPNESS
|
||||
&& myAdjustSetting <= AdjustSetting::NTSC_BLEEDING
|
||||
&& !isCustomFilter));
|
||||
|
||||
return getAdjustSetting(myAdjustSetting);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AdjustFunction EventHandler::getAdjustSetting(AdjustSetting setting)
|
||||
{
|
||||
// MUST have the same order as AdjustSetting
|
||||
const AdjustFunction ADJUST_FUNCTIONS[int(AdjustSetting::NUM_ADJ)] =
|
||||
{
|
||||
std::bind(&Sound::adjustVolume, &myOSystem.sound(), _1),
|
||||
std::bind(&FrameBuffer::selectVidMode, &myOSystem.frameBuffer(), _1),
|
||||
std::bind(&FrameBuffer::changeOverscan, &myOSystem.frameBuffer(), _1),
|
||||
std::bind(&Console::selectFormat, &myOSystem.console(), _1),
|
||||
std::bind(&Console::changeVerticalCenter, &myOSystem.console(), _1),
|
||||
std::bind(&Console::changeVSizeAdjust, &myOSystem.console(), _1),
|
||||
// Palette adjustables
|
||||
std::bind(&PaletteHandler::cyclePalette, &myOSystem.frameBuffer().tiaSurface().paletteHandler(), _1),
|
||||
std::bind(&PaletteHandler::changeAdjustable, &myOSystem.frameBuffer().tiaSurface().paletteHandler(),
|
||||
PaletteHandler::PHASE_SHIFT, _1),
|
||||
std::bind(&PaletteHandler::changeAdjustable, &myOSystem.frameBuffer().tiaSurface().paletteHandler(),
|
||||
PaletteHandler::HUE, _1),
|
||||
std::bind(&PaletteHandler::changeAdjustable, &myOSystem.frameBuffer().tiaSurface().paletteHandler(),
|
||||
PaletteHandler::SATURATION, _1),
|
||||
std::bind(&PaletteHandler::changeAdjustable, &myOSystem.frameBuffer().tiaSurface().paletteHandler(),
|
||||
PaletteHandler::CONTRAST, _1),
|
||||
std::bind(&PaletteHandler::changeAdjustable, &myOSystem.frameBuffer().tiaSurface().paletteHandler(),
|
||||
PaletteHandler::BRIGHTNESS, _1),
|
||||
std::bind(&PaletteHandler::changeAdjustable, &myOSystem.frameBuffer().tiaSurface().paletteHandler(),
|
||||
PaletteHandler::GAMMA, _1),
|
||||
// NTSC filter adjustables
|
||||
std::bind(&TIASurface::changeNTSC, &myOSystem.frameBuffer().tiaSurface(), _1),
|
||||
std::bind(&TIASurface::changeNTSCAdjustable, &myOSystem.frameBuffer().tiaSurface(),
|
||||
int(NTSCFilter::Adjustables::SHARPNESS), _1),
|
||||
std::bind(&TIASurface::changeNTSCAdjustable, &myOSystem.frameBuffer().tiaSurface(),
|
||||
int(NTSCFilter::Adjustables::RESOLUTION), _1),
|
||||
std::bind(&TIASurface::changeNTSCAdjustable, &myOSystem.frameBuffer().tiaSurface(),
|
||||
int(NTSCFilter::Adjustables::ARTIFACTS), _1),
|
||||
std::bind(&TIASurface::changeNTSCAdjustable, &myOSystem.frameBuffer().tiaSurface(),
|
||||
int(NTSCFilter::Adjustables::FRINGING), _1),
|
||||
std::bind(&TIASurface::changeNTSCAdjustable, &myOSystem.frameBuffer().tiaSurface(),
|
||||
int(NTSCFilter::Adjustables::BLEEDING), _1),
|
||||
std::bind(&Console::changePhosphor, &myOSystem.console(), _1),
|
||||
std::bind(&TIASurface::setScanlineIntensity, &myOSystem.frameBuffer().tiaSurface(), _1),
|
||||
// Following functions are not used when cycling settings but for "direct only" hotkeys
|
||||
std::bind(&StateManager::changeState, &myOSystem.state(), _1),
|
||||
std::bind(&PaletteHandler::changeCurrentAdjustable, &myOSystem.frameBuffer().tiaSurface().paletteHandler(), _1),
|
||||
std::bind(&TIASurface::changeCurrentNTSCAdjustable, &myOSystem.frameBuffer().tiaSurface(), _1),
|
||||
};
|
||||
|
||||
return ADJUST_FUNCTIONS[int(setting)];
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
|
||||
{
|
||||
|
@ -349,30 +421,61 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
|
|||
// or need to be preprocessed before passing them on
|
||||
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;
|
||||
// The global settings keys change settings or values as long as the setting
|
||||
// message from the previous settings event is still displayed.
|
||||
// Therefore, do not change global settings/values or direct values if
|
||||
// a) the setting message is no longer shown
|
||||
// b) other keys have been pressed
|
||||
if(!myOSystem.frameBuffer().messageShown())
|
||||
{
|
||||
myAdjustActive = false;
|
||||
myAdjustDirect = AdjustSetting::NONE;
|
||||
}
|
||||
const bool adjustActive = myAdjustActive;
|
||||
const AdjustSetting adjustDirect = myAdjustDirect;
|
||||
if(pressed)
|
||||
myAdjustFunction = nullptr;
|
||||
{
|
||||
myAdjustActive = false;
|
||||
myAdjustDirect = AdjustSetting::NONE;
|
||||
}
|
||||
|
||||
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;
|
||||
// Allow adjusting several (mostly repeated) settings using the same four hotkeys
|
||||
case Event::PreviousSetting:
|
||||
case Event::NextSetting:
|
||||
if(pressed && !repeated)
|
||||
{
|
||||
const int direction = event == Event::PreviousSetting ? -1 : +1;
|
||||
|
||||
// Get (and display) the previous|next adjustment function,
|
||||
// but do not change its value
|
||||
cycleAdjustSetting(adjustActive ? direction : 0)(0);
|
||||
myAdjustActive = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case Event::SettingDecrease:
|
||||
case Event::SettingIncrease:
|
||||
if(pressed && oldAdjustFunction != nullptr)
|
||||
oldAdjustFunction(true);
|
||||
myAdjustFunction = oldAdjustFunction;
|
||||
if(pressed)
|
||||
{
|
||||
const int direction = event == Event::SettingDecrease ? -1 : +1;
|
||||
|
||||
// if a "direct only" hotkey was pressed last, use this one
|
||||
if(adjustDirect != AdjustSetting::NONE)
|
||||
{
|
||||
myAdjustDirect = adjustDirect;
|
||||
getAdjustSetting(myAdjustDirect)(direction);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get (and display) the current adjustment function,
|
||||
// but only change its value if the function was already active before
|
||||
getAdjustSetting(myAdjustSetting)(adjustActive ? direction : 0);
|
||||
myAdjustActive = true;
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
@ -419,76 +522,124 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
|
|||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
case Event::Fry:
|
||||
if (!repeated) myFryingFlag = pressed;
|
||||
if(!repeated) myFryingFlag = pressed;
|
||||
return;
|
||||
|
||||
case Event::ReloadConsole:
|
||||
if (pressed && !repeated) myOSystem.reloadConsole();
|
||||
if(pressed && !repeated) myOSystem.reloadConsole();
|
||||
return;
|
||||
|
||||
case Event::VolumeDecrease:
|
||||
if(pressed)
|
||||
myAdjustFunction = myOSystem.sound().adjustVolume(false);
|
||||
{
|
||||
myOSystem.sound().adjustVolume(-1);
|
||||
myAdjustSetting = AdjustSetting::VOLUME;
|
||||
myAdjustActive = true;
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::VolumeIncrease:
|
||||
if(pressed)
|
||||
myAdjustFunction = myOSystem.sound().adjustVolume(true);
|
||||
{
|
||||
myOSystem.sound().adjustVolume(+1);
|
||||
myAdjustSetting = AdjustSetting::VOLUME;
|
||||
myAdjustActive = true;
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::SoundToggle:
|
||||
if(pressed && !repeated)
|
||||
{
|
||||
myOSystem.sound().toggleMute();
|
||||
myAdjustSetting = AdjustSetting::VOLUME;
|
||||
myAdjustActive = true;
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::VidmodeDecrease:
|
||||
if(pressed)
|
||||
myAdjustFunction = myOSystem.frameBuffer().selectVidMode(false);
|
||||
{
|
||||
myOSystem.frameBuffer().selectVidMode(-1);
|
||||
myAdjustSetting = AdjustSetting::ZOOM;
|
||||
myAdjustActive = true;
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::VidmodeIncrease:
|
||||
if(pressed)
|
||||
myAdjustFunction = myOSystem.frameBuffer().selectVidMode(true);
|
||||
{
|
||||
myOSystem.frameBuffer().selectVidMode(+1);
|
||||
myAdjustSetting = AdjustSetting::ZOOM;
|
||||
myAdjustActive = true;
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::VCenterDecrease:
|
||||
if (pressed)
|
||||
myAdjustFunction = myOSystem.console().changeVerticalCenter(false);
|
||||
if(pressed)
|
||||
{
|
||||
myOSystem.console().changeVerticalCenter(-1);
|
||||
myAdjustSetting = AdjustSetting::VCENTER;
|
||||
myAdjustActive = true;
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::VCenterIncrease:
|
||||
if (pressed)
|
||||
myAdjustFunction = myOSystem.console().changeVerticalCenter(true);
|
||||
if(pressed)
|
||||
{
|
||||
myOSystem.console().changeVerticalCenter(+1);
|
||||
myAdjustSetting = AdjustSetting::VCENTER;
|
||||
myAdjustActive = true;
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::VSizeAdjustDecrease:
|
||||
if (pressed)
|
||||
myAdjustFunction = myOSystem.console().changeVSizeAdjust(false);
|
||||
if(pressed)
|
||||
{
|
||||
myOSystem.console().changeVSizeAdjust(-1);
|
||||
myAdjustSetting = AdjustSetting::VSIZE;
|
||||
myAdjustActive = true;
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::VSizeAdjustIncrease:
|
||||
if (pressed)
|
||||
myAdjustFunction = myOSystem.console().changeVSizeAdjust(true);
|
||||
if(pressed)
|
||||
{
|
||||
myOSystem.console().changeVSizeAdjust(+1);
|
||||
myAdjustSetting = AdjustSetting::VSIZE;
|
||||
myAdjustActive = true;
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::PreviousPaletteAttribute:
|
||||
if(pressed)
|
||||
myAdjustFunction = myOSystem.frameBuffer().tiaSurface().paletteHandler().cycleAdjustable(false);
|
||||
{
|
||||
myOSystem.frameBuffer().tiaSurface().paletteHandler().cycleAdjustable(-1);
|
||||
myAdjustDirect = AdjustSetting::PALETTE_CHANGE_ATTRIBUTE;
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::NextPaletteAttribute:
|
||||
if(pressed)
|
||||
myAdjustFunction = myOSystem.frameBuffer().tiaSurface().paletteHandler().cycleAdjustable(true);
|
||||
{
|
||||
myOSystem.frameBuffer().tiaSurface().paletteHandler().cycleAdjustable(+1);
|
||||
myAdjustDirect = AdjustSetting::PALETTE_CHANGE_ATTRIBUTE;
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::PaletteAttributeDecrease:
|
||||
if(pressed)
|
||||
myAdjustFunction = myOSystem.frameBuffer().tiaSurface().paletteHandler().changeAdjustable(false);
|
||||
{
|
||||
myOSystem.frameBuffer().tiaSurface().paletteHandler().changeCurrentAdjustable(-1);
|
||||
myAdjustDirect = AdjustSetting::PALETTE_CHANGE_ATTRIBUTE;
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::PaletteAttributeIncrease:
|
||||
if(pressed)
|
||||
myAdjustFunction = myOSystem.frameBuffer().tiaSurface().paletteHandler().changeAdjustable(true);
|
||||
{
|
||||
myOSystem.frameBuffer().tiaSurface().paletteHandler().changeCurrentAdjustable(+1);
|
||||
myAdjustDirect = AdjustSetting::PALETTE_CHANGE_ATTRIBUTE;
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::ToggleFullScreen:
|
||||
|
@ -496,23 +647,39 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
|
|||
return;
|
||||
|
||||
case Event::OverscanDecrease:
|
||||
if (pressed)
|
||||
myAdjustFunction = myOSystem.frameBuffer().changeOverscan(false);
|
||||
if(pressed)
|
||||
{
|
||||
myOSystem.frameBuffer().changeOverscan(-1);
|
||||
myAdjustSetting = AdjustSetting::OVERSCAN;
|
||||
myAdjustActive = true;
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::OverscanIncrease:
|
||||
if (pressed)
|
||||
myAdjustFunction = myOSystem.frameBuffer().changeOverscan(true);
|
||||
if(pressed)
|
||||
{
|
||||
myOSystem.frameBuffer().changeOverscan(+1);
|
||||
myAdjustSetting = AdjustSetting::OVERSCAN;
|
||||
myAdjustActive = true;
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::PreviousVideoMode:
|
||||
if (pressed && !repeated)
|
||||
myAdjustFunction = myOSystem.frameBuffer().tiaSurface().changeNTSC(false);
|
||||
if(pressed && !repeated)
|
||||
{
|
||||
myOSystem.frameBuffer().tiaSurface().changeNTSC(-1);
|
||||
myAdjustSetting = AdjustSetting::NTSC_PRESET;
|
||||
myAdjustActive = true;
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::NextVideoMode:
|
||||
if (pressed && !repeated)
|
||||
myAdjustFunction = myOSystem.frameBuffer().tiaSurface().changeNTSC(true);
|
||||
if(pressed && !repeated)
|
||||
{
|
||||
myOSystem.frameBuffer().tiaSurface().changeNTSC(+1);
|
||||
myAdjustSetting = AdjustSetting::NTSC_PRESET;
|
||||
myAdjustActive = true;
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::VidmodeStd:
|
||||
|
@ -541,47 +708,80 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
|
|||
|
||||
case Event::PreviousAttribute:
|
||||
if(pressed)
|
||||
myAdjustFunction = myOSystem.frameBuffer().tiaSurface().setNTSCAdjustable(false);
|
||||
{
|
||||
myOSystem.frameBuffer().tiaSurface().setNTSCAdjustable(-1);
|
||||
myAdjustDirect = AdjustSetting::NTSC_CHANGE_ATTRIBUTE;
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::NextAttribute:
|
||||
if (pressed)
|
||||
myAdjustFunction = myOSystem.frameBuffer().tiaSurface().setNTSCAdjustable(true);
|
||||
if(pressed)
|
||||
{
|
||||
myOSystem.frameBuffer().tiaSurface().setNTSCAdjustable(+1);
|
||||
myAdjustDirect = AdjustSetting::NTSC_CHANGE_ATTRIBUTE;
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::DecreaseAttribute:
|
||||
if(pressed)
|
||||
myAdjustFunction = myOSystem.frameBuffer().tiaSurface().changeNTSCAdjustable(false);
|
||||
{
|
||||
myOSystem.frameBuffer().tiaSurface().changeCurrentNTSCAdjustable(-1);
|
||||
myAdjustDirect = AdjustSetting::NTSC_CHANGE_ATTRIBUTE;
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::IncreaseAttribute:
|
||||
if(pressed)
|
||||
myAdjustFunction = myOSystem.frameBuffer().tiaSurface().changeNTSCAdjustable(true);
|
||||
{
|
||||
myOSystem.frameBuffer().tiaSurface().changeCurrentNTSCAdjustable(+1);
|
||||
myAdjustDirect = AdjustSetting::NTSC_CHANGE_ATTRIBUTE;
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::ScanlinesDecrease:
|
||||
if (pressed)
|
||||
myAdjustFunction = myOSystem.frameBuffer().tiaSurface().setScanlineIntensity(false);
|
||||
if(pressed)
|
||||
{
|
||||
myOSystem.frameBuffer().tiaSurface().setScanlineIntensity(-1);
|
||||
myAdjustSetting = AdjustSetting::SCANLINES;
|
||||
myAdjustActive = true;
|
||||
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::ScanlinesIncrease:
|
||||
if (pressed)
|
||||
myAdjustFunction = myOSystem.frameBuffer().tiaSurface().setScanlineIntensity(true);
|
||||
if(pressed)
|
||||
{
|
||||
myOSystem.frameBuffer().tiaSurface().setScanlineIntensity(+1);
|
||||
myAdjustSetting = AdjustSetting::SCANLINES;
|
||||
myAdjustActive = true;
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::PhosphorDecrease:
|
||||
if (pressed)
|
||||
myAdjustFunction = myOSystem.console().changePhosphor(false);
|
||||
if(pressed)
|
||||
{
|
||||
myOSystem.console().changePhosphor(-1);
|
||||
myAdjustSetting = AdjustSetting::PHOSPHOR;
|
||||
myAdjustActive = true;
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::PhosphorIncrease:
|
||||
if (pressed)
|
||||
myAdjustFunction = myOSystem.console().changePhosphor(true);
|
||||
if(pressed)
|
||||
{
|
||||
myOSystem.console().changePhosphor(+1);
|
||||
myAdjustSetting = AdjustSetting::PHOSPHOR;
|
||||
myAdjustActive = true;
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::TogglePhosphor:
|
||||
if(pressed && !repeated)
|
||||
myAdjustFunction = myOSystem.console().togglePhosphor();
|
||||
{
|
||||
myOSystem.console().togglePhosphor();
|
||||
myAdjustSetting = AdjustSetting::PHOSPHOR;
|
||||
myAdjustActive = true;
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::ToggleColorLoss:
|
||||
|
@ -589,13 +789,21 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
|
|||
return;
|
||||
|
||||
case Event::PaletteDecrease:
|
||||
if (pressed && !repeated)
|
||||
myAdjustFunction = myOSystem.frameBuffer().tiaSurface().paletteHandler().cyclePalette(false);
|
||||
if(pressed && !repeated)
|
||||
{
|
||||
myOSystem.frameBuffer().tiaSurface().paletteHandler().cyclePalette(-1);
|
||||
myAdjustSetting = AdjustSetting::PALETTE;
|
||||
myAdjustActive = true;
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::PaletteIncrease:
|
||||
if (pressed && !repeated)
|
||||
myAdjustFunction = myOSystem.frameBuffer().tiaSurface().paletteHandler().cyclePalette(true);
|
||||
if(pressed && !repeated)
|
||||
{
|
||||
myOSystem.frameBuffer().tiaSurface().paletteHandler().cyclePalette(+1);
|
||||
myAdjustSetting = AdjustSetting::PALETTE;
|
||||
myAdjustActive = true;
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::ToggleInter:
|
||||
|
@ -637,13 +845,21 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
|
|||
return;
|
||||
|
||||
case Event::FormatDecrease:
|
||||
if (pressed && !repeated)
|
||||
myAdjustFunction = myOSystem.console().selectFormat(false);
|
||||
if(pressed && !repeated)
|
||||
{
|
||||
myOSystem.console().selectFormat(-1);
|
||||
myAdjustSetting = AdjustSetting::TVFORMAT;
|
||||
myAdjustActive = true;
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::FormatIncrease:
|
||||
if (pressed && !repeated)
|
||||
myAdjustFunction = myOSystem.console().selectFormat(true);
|
||||
if(pressed && !repeated)
|
||||
{
|
||||
myOSystem.console().selectFormat(+1);
|
||||
myAdjustSetting = AdjustSetting::TVFORMAT;
|
||||
myAdjustActive = true;
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::ToggleGrabMouse:
|
||||
|
@ -713,7 +929,10 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
|
|||
|
||||
case Event::SaveState:
|
||||
if(pressed && !repeated)
|
||||
myAdjustFunction = myOSystem.state().saveState();
|
||||
{
|
||||
myOSystem.state().saveState();
|
||||
myAdjustDirect = AdjustSetting::STATE;
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::SaveAllStates:
|
||||
|
@ -722,13 +941,19 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
|
|||
return;
|
||||
|
||||
case Event::PreviousState:
|
||||
if (pressed)
|
||||
myAdjustFunction = myOSystem.state().changeState(false);
|
||||
if(pressed)
|
||||
{
|
||||
myOSystem.state().changeState(-1);
|
||||
myAdjustDirect = AdjustSetting::STATE;
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::NextState:
|
||||
if(pressed)
|
||||
myAdjustFunction = myOSystem.state().changeState(true);
|
||||
{
|
||||
myOSystem.state().changeState(+1);
|
||||
myAdjustDirect = AdjustSetting::STATE;
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::ToggleAutoSlot:
|
||||
|
@ -737,7 +962,10 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
|
|||
|
||||
case Event::LoadState:
|
||||
if(pressed && !repeated)
|
||||
myAdjustFunction = myOSystem.state().loadState();
|
||||
{
|
||||
myOSystem.state().loadState();
|
||||
myAdjustDirect = AdjustSetting::STATE;
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::LoadAllStates:
|
||||
|
@ -2011,6 +2239,8 @@ EventHandler::EmulActionList EventHandler::ourEmulActionList = { {
|
|||
{ Event::ScanlinesDecrease, "Decrease scanlines", "" },
|
||||
{ Event::ScanlinesIncrease, "Increase scanlines", "" },
|
||||
|
||||
{ Event::PreviousSetting, "Select previous setting", "" },
|
||||
{ Event::NextSetting, "Select next setting", "" },
|
||||
{ Event::SettingDecrease, "Decrease current setting", "" },
|
||||
{ Event::SettingIncrease, "Increase current setting", "" },
|
||||
|
||||
|
@ -2108,7 +2338,8 @@ const Event::EventSet EventHandler::MiscEvents = {
|
|||
// Event::MouseButtonLeftValue, Event::MouseButtonRightValue,
|
||||
Event::HandleMouseControl, Event::ToggleGrabMouse,
|
||||
Event::ToggleSAPortOrder,
|
||||
Event::SettingDecrease, Event::SettingIncrease
|
||||
Event::SettingDecrease, Event::SettingIncrease,
|
||||
Event::PreviousSetting, Event::NextSetting,
|
||||
};
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -391,6 +391,41 @@ class EventHandler
|
|||
*/
|
||||
void removePhysicalJoystick(int index);
|
||||
|
||||
private:
|
||||
enum class AdjustSetting
|
||||
{
|
||||
NONE = -1,
|
||||
VOLUME,
|
||||
ZOOM,
|
||||
OVERSCAN,
|
||||
TVFORMAT,
|
||||
VCENTER,
|
||||
VSIZE,
|
||||
// Palette adjustables
|
||||
PALETTE,
|
||||
PALETTE_PHASE,
|
||||
PALETTE_HUE,
|
||||
PALETTE_SATURATION,
|
||||
PALETTE_CONTRAST,
|
||||
PALETTE_BRIGHTNESS,
|
||||
PALETTE_GAMMA,
|
||||
// NTSC filter adjustables
|
||||
NTSC_PRESET,
|
||||
NTSC_SHARPNESS,
|
||||
NTSC_RESOLUTION,
|
||||
NTSC_ARTIFACTS,
|
||||
NTSC_FRINGING,
|
||||
NTSC_BLEEDING,
|
||||
PHOSPHOR,
|
||||
SCANLINES,
|
||||
MAX_ADJ = SCANLINES,
|
||||
// Only used via direct hotkeys
|
||||
STATE,
|
||||
PALETTE_CHANGE_ATTRIBUTE,
|
||||
NTSC_CHANGE_ATTRIBUTE,
|
||||
NUM_ADJ
|
||||
};
|
||||
|
||||
private:
|
||||
// Define event groups
|
||||
static const Event::EventSet MiscEvents;
|
||||
|
@ -417,6 +452,11 @@ class EventHandler
|
|||
int getEmulActionListIndex(int idx, const Event::EventSet& events) const;
|
||||
int getActionListIndex(int idx, Event::Group group) const;
|
||||
|
||||
// The following two methods are used for adjusting several settings using global hotkeys
|
||||
// They return the function used to adjust the currenly selected setting
|
||||
AdjustFunction cycleAdjustSetting(int direction);
|
||||
AdjustFunction getAdjustSetting(AdjustSetting setting);
|
||||
|
||||
private:
|
||||
// Structure used for action menu items
|
||||
struct ActionList {
|
||||
|
@ -425,7 +465,12 @@ class EventHandler
|
|||
string key;
|
||||
};
|
||||
|
||||
AdjustFunction myAdjustFunction{nullptr};
|
||||
// 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 direct hotkey setting (0 if none)
|
||||
AdjustSetting myAdjustDirect{AdjustSetting::NONE};
|
||||
|
||||
// Global Event object
|
||||
Event myEvent;
|
||||
|
@ -470,7 +515,7 @@ class EventHandler
|
|||
#else
|
||||
PNG_SIZE = 0,
|
||||
#endif
|
||||
EMUL_ACTIONLIST_SIZE = 154 + PNG_SIZE + COMBO_SIZE,
|
||||
EMUL_ACTIONLIST_SIZE = 156 + PNG_SIZE + COMBO_SIZE,
|
||||
MENU_ACTIONLIST_SIZE = 18
|
||||
;
|
||||
|
||||
|
|
|
@ -537,7 +537,7 @@ void FrameBuffer::showMessage(const string& message, const string& valueText,
|
|||
const int VBORDER = fontHeight / 4;
|
||||
const int HBORDER = fontWidth * 1.25 / 2.0;
|
||||
|
||||
myMsg.counter = uInt32(myOSystem.frameRate()) * 3; // Show message for 3 seconds
|
||||
myMsg.counter = uInt32(myOSystem.frameRate()) * 2; // Show message for 2 seconds
|
||||
if(myMsg.counter == 0)
|
||||
myMsg.counter = 120;
|
||||
|
||||
|
@ -672,7 +672,6 @@ inline bool FrameBuffer::drawMessage()
|
|||
#ifdef GUI_SUPPORT
|
||||
// Either erase the entire message (when time is reached),
|
||||
// or show again this frame
|
||||
cerr << myMsg.counter << endl;
|
||||
if(myMsg.counter == 0)
|
||||
{
|
||||
myMsg.enabled = false;
|
||||
|
@ -760,7 +759,7 @@ inline bool FrameBuffer::drawMessage()
|
|||
// align bar with bottom of text
|
||||
const int y = VBORDER + font().desc().ascent - bheight;
|
||||
|
||||
// draw gauge bar
|
||||
// draw gauge bar
|
||||
myMsg.surface->fillRect(x - BORDER, y, swidth + BORDER * 2, bheight, kSliderBGColor);
|
||||
myMsg.surface->fillRect(x, y + BORDER, bwidth, bheight - BORDER * 2, kSliderColor);
|
||||
// draw tickmark in the middle of the bar
|
||||
|
@ -994,12 +993,12 @@ void FrameBuffer::toggleFullscreen()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AdjustFunction FrameBuffer::changeOverscan(bool increase)
|
||||
void FrameBuffer::changeOverscan(int direction)
|
||||
{
|
||||
if (fullScreen())
|
||||
{
|
||||
int oldOverscan = myOSystem.settings().getInt("tia.fs_overscan");
|
||||
int overscan = BSPF::clamp(oldOverscan + (increase ? 1 : -1), 0, 10);
|
||||
int overscan = BSPF::clamp(oldOverscan + direction, 0, 10);
|
||||
|
||||
if (overscan != oldOverscan)
|
||||
{
|
||||
|
@ -1010,14 +1009,16 @@ AdjustFunction FrameBuffer::changeOverscan(bool increase)
|
|||
}
|
||||
|
||||
ostringstream val;
|
||||
val << (overscan ? overscan > 0 ? "+" : "" : " ") << overscan << "%";
|
||||
if(overscan)
|
||||
val << (overscan > 0 ? "+" : "" ) << overscan << "%";
|
||||
else
|
||||
val << "Off";
|
||||
myOSystem.frameBuffer().showMessage("Overscan", val.str(), overscan, 0, 10);
|
||||
}
|
||||
return std::bind(&FrameBuffer::changeOverscan, this, std::placeholders::_1);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AdjustFunction FrameBuffer::selectVidMode(bool next)
|
||||
void FrameBuffer::selectVidMode(int direction)
|
||||
{
|
||||
EventHandlerState state = myOSystem.eventHandler().state();
|
||||
bool tiaMode = (state != EventHandlerState::DEBUGGER &&
|
||||
|
@ -1025,11 +1026,11 @@ AdjustFunction FrameBuffer::selectVidMode(bool next)
|
|||
|
||||
// Only applicable when in TIA/emulation mode
|
||||
if(!tiaMode)
|
||||
return nullptr;
|
||||
return;
|
||||
|
||||
if(next)
|
||||
if(direction == +1)
|
||||
myCurrentModeList->next();
|
||||
else
|
||||
else if(direction == -1)
|
||||
myCurrentModeList->previous();
|
||||
|
||||
saveCurrentWindowPosition();
|
||||
|
@ -1050,7 +1051,10 @@ AdjustFunction FrameBuffer::selectVidMode(bool next)
|
|||
myTIASurface->initialize(myOSystem.console(), mode);
|
||||
|
||||
resetSurfaces();
|
||||
showMessage("Zoom", mode.description, mode.zoom, supportedTIAMinZoom(), myTIAMaxZoom);
|
||||
if(fullScreen())
|
||||
showMessage(mode.description);
|
||||
else
|
||||
showMessage("Zoom", mode.description, mode.zoom, supportedTIAMinZoom(), myTIAMaxZoom);
|
||||
myOSystem.sound().mute(oldMuteState);
|
||||
|
||||
if(fullScreen())
|
||||
|
@ -1059,11 +1063,9 @@ AdjustFunction FrameBuffer::selectVidMode(bool next)
|
|||
else
|
||||
myOSystem.settings().setValue("tia.zoom", mode.zoom);
|
||||
|
||||
return std::bind(&FrameBuffer::selectVidMode, this, std::placeholders::_1);
|
||||
return;
|
||||
}
|
||||
myOSystem.sound().mute(oldMuteState);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -1196,12 +1198,12 @@ void FrameBuffer::setAvailableVidModes(uInt32 baseWidth, uInt32 baseHeight)
|
|||
VideoMode mode1(baseWidth * myTIAMaxZoom, baseHeight * myTIAMaxZoom,
|
||||
myFullscreenDisplays[i].w, myFullscreenDisplays[i].h,
|
||||
VideoMode::Stretch::Preserve, overscan,
|
||||
"Preserve aspect, no stretch", myTIAMaxZoom, i);
|
||||
"Fullscreen: Preserve aspect, no stretch", myTIAMaxZoom, i);
|
||||
myFullscreenModeLists[i].add(mode1);
|
||||
VideoMode mode2(baseWidth * myTIAMaxZoom, baseHeight * myTIAMaxZoom,
|
||||
myFullscreenDisplays[i].w, myFullscreenDisplays[i].h,
|
||||
VideoMode::Stretch::Fill, overscan,
|
||||
"Ignore aspect, full stretch", myTIAMaxZoom, i);
|
||||
"Fullscreen: Ignore aspect, full stretch", myTIAMaxZoom, i);
|
||||
myFullscreenModeLists[i].add(mode2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -265,9 +265,9 @@ class FrameBuffer
|
|||
/**
|
||||
Changes the fullscreen overscan.
|
||||
|
||||
@param increase Increase if true, else decrease
|
||||
@param direction +1 indicates increase, -1 indicates decrease.
|
||||
*/
|
||||
AdjustFunction changeOverscan(bool increase = true);
|
||||
void changeOverscan(int direction = +1);
|
||||
|
||||
/**
|
||||
This method is called when the user wants to switch to the next
|
||||
|
@ -277,9 +277,9 @@ class FrameBuffer
|
|||
direction = -1 means go to the next lower video mode
|
||||
direction = +1 means go to the next higher video mode
|
||||
|
||||
@param next Select next if true, else previous
|
||||
@param direction +1 indicates increase, -1 indicates decrease.
|
||||
*/
|
||||
AdjustFunction selectVidMode(bool next = true);
|
||||
void selectVidMode(int direction = +1);
|
||||
|
||||
/**
|
||||
Sets the state of the cursor (hidden or grabbed) based on the
|
||||
|
|
|
@ -88,10 +88,9 @@ class Sound
|
|||
/**
|
||||
Adjusts the volume of the sound device based on the given direction.
|
||||
|
||||
@param increase Increase or decrease the current volume by a predefined
|
||||
amount
|
||||
@param direction +1 indicates increase, -1 indicates decrease.
|
||||
*/
|
||||
virtual AdjustFunction adjustVolume(bool increase) = 0;
|
||||
virtual void adjustVolume(int direction = 1) = 0;
|
||||
|
||||
/**
|
||||
This method is called to provide information about the sound device.
|
||||
|
|
|
@ -200,7 +200,7 @@ void TIASurface::setNTSC(NTSCFilter::Preset preset, bool show)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AdjustFunction TIASurface::changeNTSC(bool next)
|
||||
void TIASurface::changeNTSC(int direction)
|
||||
{
|
||||
constexpr NTSCFilter::Preset PRESETS[] = {
|
||||
NTSCFilter::Preset::OFF, NTSCFilter::Preset::RGB, NTSCFilter::Preset::SVIDEO,
|
||||
|
@ -208,14 +208,14 @@ AdjustFunction TIASurface::changeNTSC(bool next)
|
|||
};
|
||||
int preset = myOSystem.settings().getInt("tv.filter");
|
||||
|
||||
if(next)
|
||||
if(direction == +1)
|
||||
{
|
||||
if(preset == int(NTSCFilter::Preset::CUSTOM))
|
||||
preset = int(NTSCFilter::Preset::OFF);
|
||||
else
|
||||
preset++;
|
||||
}
|
||||
else
|
||||
else if (direction == -1)
|
||||
{
|
||||
if(preset == int(NTSCFilter::Preset::OFF))
|
||||
preset = int(NTSCFilter::Preset::CUSTOM);
|
||||
|
@ -223,39 +223,46 @@ AdjustFunction TIASurface::changeNTSC(bool next)
|
|||
preset--;
|
||||
}
|
||||
setNTSC(PRESETS[preset], true);
|
||||
return std::bind(&TIASurface::changeNTSC, this, std::placeholders::_1);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AdjustFunction TIASurface::setNTSCAdjustable(bool next)
|
||||
void TIASurface::setNTSCAdjustable(int direction)
|
||||
{
|
||||
string text, valueText;
|
||||
Int32 value;
|
||||
|
||||
setNTSC(NTSCFilter::Preset::CUSTOM);
|
||||
ntsc().selectAdjustable(next, text, valueText, value);
|
||||
ntsc().selectAdjustable(direction, text, valueText, value);
|
||||
myOSystem.frameBuffer().showMessage(text, valueText, value);
|
||||
return std::bind(&TIASurface::changeNTSCAdjustable, this, std::placeholders::_1);
|
||||
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AdjustFunction TIASurface::changeNTSCAdjustable(bool increase)
|
||||
void TIASurface::changeNTSCAdjustable(int adjustable, int direction)
|
||||
{
|
||||
string text, valueText;
|
||||
Int32 newValue;
|
||||
|
||||
setNTSC(NTSCFilter::Preset::CUSTOM);
|
||||
ntsc().changeAdjustable(increase, text, valueText, newValue);
|
||||
ntsc().changeAdjustable(adjustable, direction, text, valueText, newValue);
|
||||
myOSystem.frameBuffer().showMessage(text, valueText, newValue);
|
||||
return std::bind(&TIASurface::changeNTSCAdjustable, this, std::placeholders::_1);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AdjustFunction TIASurface::setScanlineIntensity(bool increase)
|
||||
void TIASurface::changeCurrentNTSCAdjustable(int direction)
|
||||
{
|
||||
string text, valueText;
|
||||
Int32 newValue;
|
||||
|
||||
setNTSC(NTSCFilter::Preset::CUSTOM);
|
||||
ntsc().changeCurrentAdjustable(direction, text, valueText, newValue);
|
||||
myOSystem.frameBuffer().showMessage(text, valueText, newValue);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TIASurface::setScanlineIntensity(int direction)
|
||||
{
|
||||
ostringstream buf;
|
||||
uInt32 intensity = enableScanlines(increase ? 2 : -2);
|
||||
uInt32 intensity = enableScanlines(direction * 2);
|
||||
|
||||
myOSystem.settings().setValue("tv.scanlines", intensity);
|
||||
enableNTSC(ntscEnabled());
|
||||
|
@ -265,18 +272,15 @@ AdjustFunction TIASurface::setScanlineIntensity(bool increase)
|
|||
else
|
||||
buf << "Off";
|
||||
myFB.showMessage("Scanline intensity", buf.str(), intensity);
|
||||
return std::bind(&TIASurface::setScanlineIntensity, this, std::placeholders::_1);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt32 TIASurface::enableScanlines(int relative, int absolute)
|
||||
uInt32 TIASurface::enableScanlines(int change)
|
||||
{
|
||||
FBSurface::Attributes& attr = mySLineSurface->attributes();
|
||||
if(relative == 0) attr.blendalpha = absolute;
|
||||
else attr.blendalpha += relative;
|
||||
attr.blendalpha = std::max(0, Int32(attr.blendalpha));
|
||||
attr.blendalpha = std::min(100U, attr.blendalpha);
|
||||
|
||||
attr.blendalpha += change;
|
||||
attr.blendalpha = BSPF::clamp(Int32(attr.blendalpha), 0, 100);
|
||||
mySLineSurface->applyAttributes();
|
||||
|
||||
return attr.blendalpha;
|
||||
|
|
|
@ -91,18 +91,32 @@ class TIASurface
|
|||
|
||||
/**
|
||||
Switch to next/previous NTSC filtering effect.
|
||||
|
||||
@param direction +1 indicates increase, -1 indicates decrease.
|
||||
*/
|
||||
AdjustFunction changeNTSC(bool next);
|
||||
void changeNTSC(int direction = +1);
|
||||
|
||||
/**
|
||||
Switch to next/previous NTSC filtering adjustable.
|
||||
|
||||
@param direction +1 indicates increase, -1 indicates decrease.
|
||||
*/
|
||||
AdjustFunction setNTSCAdjustable(bool next = true);
|
||||
void setNTSCAdjustable(int direction = +1);
|
||||
|
||||
/**
|
||||
Increase/decrease given NTSC filtering adjustable.
|
||||
|
||||
@param adjustable The adjustable to change
|
||||
@param direction +1 indicates increase, -1 indicates decrease.
|
||||
*/
|
||||
void changeNTSCAdjustable(int adjustable, int direction);
|
||||
|
||||
/**
|
||||
Increase/decrease current NTSC filtering adjustable.
|
||||
|
||||
@param direction +1 indicates increase, -1 indicates decrease.
|
||||
*/
|
||||
AdjustFunction changeNTSCAdjustable(bool increase = true);
|
||||
void changeCurrentNTSCAdjustable(int direction = +1);
|
||||
|
||||
/**
|
||||
Retrieve palette handler.
|
||||
|
@ -111,17 +125,18 @@ class TIASurface
|
|||
|
||||
/**
|
||||
Increase/decrease current scanline intensity by given relative amount.
|
||||
|
||||
@param direction +1 indicates increase, -1 indicates decrease.
|
||||
*/
|
||||
AdjustFunction setScanlineIntensity(bool increase);
|
||||
void setScanlineIntensity(int direction = +1);
|
||||
|
||||
/**
|
||||
Change scanline intensity and interpolation.
|
||||
|
||||
@param relative If non-zero, change current intensity by
|
||||
'relative' amount, otherwise set to 'absolute'
|
||||
@param change change current intensity by 'change'
|
||||
@return New current intensity
|
||||
*/
|
||||
uInt32 enableScanlines(int relative, int absolute = 50);
|
||||
uInt32 enableScanlines(int change);
|
||||
|
||||
/**
|
||||
Enable/disable/query phosphor effect.
|
||||
|
|
|
@ -95,10 +95,9 @@ class SoundLIBRETRO : public Sound
|
|||
/**
|
||||
Adjusts the volume of the sound device based on the given direction.
|
||||
|
||||
@param increase Increase or decrease the current volume by a predefined
|
||||
amount
|
||||
@param direction +1 indicates increase, -1 indicates decrease.
|
||||
*/
|
||||
AdjustFunction adjustVolume(bool increase) override { return nullptr; }
|
||||
void adjustVolume(int direction = +1) override { }
|
||||
|
||||
/**
|
||||
This method is called to provide information about the sound device.
|
||||
|
|
Loading…
Reference in New Issue