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