added hotkeys for adjusting TV jitter roll

This commit is contained in:
Thomas Jentzsch 2021-10-30 09:20:51 +02:00
parent 375c56ae2d
commit 913e96942f
9 changed files with 77 additions and 5 deletions

View File

@ -1947,6 +1947,19 @@
<td>Alt + J</td>
<td>Cmd + J</td>
</tr>
<tr>
<td><i>Decrease</i> TV jitter roll</td>
<td>Shift-Control + J</td>
<td>Shift-Control + J</td>
</tr>
<tr>
<td><i>Increase</i> TV jitter roll</td>
<td>Control + J</td>
<td>Control + J</td>
</tr>
<tr>
<td colspan="3"><center><font size="-1">
These settings can also be changed using <a href="#GlobalKeys"><b>Global Keys</a></font></center>

View File

@ -678,6 +678,8 @@ PhysicalKeyboardHandler::DefaultCommonMapping = {
{ Event::DecreaseSpeed, KBDK_S, KBDM_SHIFT | KBDM_CTRL },
{ Event::IncreaseSpeed, KBDK_S, KBDM_CTRL },
{ Event::ToggleTurbo, KBDK_T, KBDM_CTRL },
{ Event::JitterDecrease, KBDK_J, KBDM_SHIFT | KBDM_CTRL },
{ Event::JitterIncrease, KBDK_J, KBDM_CTRL },
{ Event::ToggleJitter, KBDK_J, MOD3 },
{ Event::ToggleFrameStats, KBDK_L, MOD3 },
{ Event::ToggleTimeMachine, KBDK_T, MOD3 },

View File

@ -351,6 +351,8 @@ NLOHMANN_JSON_SERIALIZE_ENUM(Event::Type, {
{Event::PhosphorIncrease, "PhosphorIncrease"},
{Event::TogglePhosphor, "TogglePhosphor"},
{Event::ToggleInter, "ToggleInter"},
{Event::JitterDecrease, "JitterDecrease"},
{Event::JitterIncrease, "JitterIncrease"},
{Event::ToggleJitter, "ToggleJitter"},
{Event::VolumeDecrease, "VolumeDecrease"},
{Event::VolumeIncrease, "VolumeIncrease"},

View File

@ -1201,6 +1201,37 @@ void Console::toggleJitter(bool toggle) const
myOSystem.frameBuffer().showTextMessage(message);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::changeJitter(int direction) const
{
const string prefix = myOSystem.settings().getBool("dev.settings") ? "dev." : "plr.";
int recovery = myOSystem.settings().getInt(prefix + "tv.jitter_recovery");
bool enabled = direction ? recovery + direction > 0 : myTIA->toggleJitter(3);
// if disabled, enable before first before increasing recovery
if(!myTIA->toggleJitter(3))
direction = 0;
recovery = BSPF::clamp(recovery + direction, 1, 20);
myOSystem.settings().setValue(prefix + "tv.jitter", enabled);
if(enabled)
{
ostringstream val;
myTIA->toggleJitter(1);
myTIA->setJitterRecoveryFactor(recovery);
myOSystem.settings().setValue(prefix + "tv.jitter_recovery", recovery);
val << recovery;
myOSystem.frameBuffer().showGaugeMessage("TV jitter roll", val.str(), recovery, 0, 20);
}
else
{
myTIA->toggleJitter(0);
myOSystem.frameBuffer().showTextMessage("TV scanline jitter disabled");
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::attachDebugger(Debugger& dbg)
{

View File

@ -356,6 +356,11 @@ class Console : public Serializable, public ConsoleIO
*/
void toggleJitter(bool toggle = true) const;
/**
Changes the TIA 'scanline jitter' revcovery rate.
*/
void changeJitter(int direction = +1) const;
/**
* Update vcenter
*/

View File

@ -111,7 +111,8 @@ class Event
PreviousVideoMode, NextVideoMode,
PreviousAttribute, NextAttribute, DecreaseAttribute, IncreaseAttribute,
ScanlinesDecrease, ScanlinesIncrease,
PhosphorDecrease, PhosphorIncrease, TogglePhosphor, ToggleInter, ToggleJitter,
PhosphorDecrease, PhosphorIncrease, TogglePhosphor, ToggleInter,
JitterDecrease, JitterIncrease, ToggleJitter,
VolumeDecrease, VolumeIncrease, SoundToggle,

View File

@ -945,6 +945,22 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
}
return;
case Event::JitterDecrease:
if(pressed)
{
myOSystem.console().changeJitter(-1);
myGlobalKeyHandler->setSetting(GlobalKeyHandler::Setting::JITTER);
}
return;
case Event::JitterIncrease:
if(pressed)
{
myOSystem.console().changeJitter(+1);
myGlobalKeyHandler->setSetting(GlobalKeyHandler::Setting::JITTER);
}
return;
///////////////////////////////////////////////////////////////////////////
// Input events
case Event::DecreaseDeadzone:
@ -2883,7 +2899,9 @@ EventHandler::EmulActionList EventHandler::ourEmulActionList = { {
{ Event::ToggleCollisions, "Toggle all TIA collisions", "" },
{ Event::ToggleFixedColors, "Toggle TIA 'Fixed Debug Colors' mode", "" },
{ Event::ToggleColorLoss, "Toggle PAL color-loss effect", "" },
{ Event::ToggleJitter, "Toggle TV 'Jitter' effect", "" },
{ Event::ToggleJitter, "Toggle TV scanline 'Jitter' effect", "" },
{ Event::JitterDecrease, "Decrease TV 'Jitter' roll", "" },
{ Event::JitterIncrease, "Increase TV 'Jitter' roll", "" },
// Other keys:
{ Event::SoundToggle, "Toggle sound", "" },
{ Event::VolumeDecrease, "Decrease volume", "" },
@ -3120,5 +3138,5 @@ const Event::EventSet EventHandler::DebugEvents = {
Event::ToggleBLCollision, Event::ToggleBLBit, Event::TogglePFCollision, Event::TogglePFBit,
Event::ToggleCollisions, Event::ToggleBits, Event::ToggleFixedColors,
Event::ToggleColorLoss,
Event::ToggleJitter,
Event::ToggleJitter, Event::JitterDecrease,Event::JitterIncrease,
};

View File

@ -522,7 +522,7 @@ class EventHandler
#else
REFRESH_SIZE = 0,
#endif
EMUL_ACTIONLIST_SIZE = 216 + PNG_SIZE + COMBO_SIZE + REFRESH_SIZE,
EMUL_ACTIONLIST_SIZE = 218 + PNG_SIZE + COMBO_SIZE + REFRESH_SIZE,
MENU_ACTIONLIST_SIZE = 19
;

View File

@ -421,7 +421,7 @@ GlobalKeyHandler::SettingData GlobalKeyHandler::getSettingData(const Setting set
{Setting::ALL_CX, {false, std::bind(&Console::toggleCollisions, &myOSystem.console(), _1)}}, // debug, not persisted
{Setting::FIXED_COL, {false, std::bind(&Console::toggleFixedColors, &myOSystem.console(), _1)}}, // debug, not persisted
{Setting::COLOR_LOSS, {false, std::bind(&Console::toggleColorLoss, &myOSystem.console(), _1)}},
{Setting::JITTER, {false, std::bind(&Console::toggleJitter, &myOSystem.console(), _1)}},
{Setting::JITTER, {true, std::bind(&Console::changeJitter, &myOSystem.console(), _1)}},
// *** Following functions are not used when cycling settings, but for "direct only" hotkeys ***
{Setting::STATE, {true, std::bind(&StateManager::changeState, &myOSystem.state(), _1)}}, // temporary, not persisted
{Setting::PALETTE_ATTRIBUTE, {true, std::bind(&PaletteHandler::changeCurrentAdjustable, &myOSystem.frameBuffer().tiaSurface().paletteHandler(), _1)}},