added hotkeys for Input Devices & Ports settings

added hotkeys for Game Properties/Controller settings
added new global hotkey group for new hotkeys
add a few more tooltips
updated doc
This commit is contained in:
thrust26 2020-12-17 16:37:51 +01:00
parent e7715aea9d
commit d7bb07fc55
34 changed files with 1547 additions and 225 deletions

View File

@ -30,6 +30,8 @@
* Added sound to Time Machine playback. * Added sound to Time Machine playback.
* Extended global hotkeys for input devices & ports settings.
* Increased sample size for CDFJ+. * Increased sample size for CDFJ+.
* Fixed autofire bug for trackball controllers. * Fixed autofire bug for trackball controllers.

View File

@ -1561,6 +1561,253 @@
</tr> </tr>
</table> </table>
<p><b>Input Devices & Ports Keys (can be remapped)</b></p>
<table BORDER=2 cellpadding=4>
<tr>
<th>Function</th>
<th>Key (Standard)</th>
<th>Key (macOS)</th>
</tr>
<tr>
<td><i>Decrease</i> joystick deadzone</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td><i>Increase</i> joystick deadzone</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td><i>Decrease</i> analog paddle sensitivity</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td><i>Increase</i> analog paddle sensitivity</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td><i>Decrease</i> analog paddle dejitter averaging</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td><i>Increase</i> analog paddle dejitter averaging</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td><i>Decrease</i> analog paddle dejitter reaction</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td><i>Increase</i> analog paddle dejitter reaction</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td><i>Decrease</i> digital paddle sensitivity</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td><i>Increase</i> digital paddle sensitivity</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td><i>Decrease</i> digital and mouse driving controller sensitivity</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td><i>Increase</i> digital and mouse driving controller sensitivity</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td><i>Decrease</i> autofire rate</td>
<td>Shift-Control + a</td>
<td>Shift-Control + a</td>
</tr>
<tr>
<td><i>Increase</i> autofire rate</td>
<td>Control + a</td>
<td>Control + a</td>
</tr>
<tr>
<td>Toggle allowing all four directions on joystick</br>
to be pressed simultaneously</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td>Toggle use of modifier key combos</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td>Swap Stelladaptor/2600-daptor port ordering</td>
<td>Control + 1</td>
<td>Control + 1</td>
</tr>
<tr>
<td>Select <i>previous</i> controllers emulated by the mouse
</br>(all, analog, none)</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td>Select <i>next</i> controllers emulated by the mouse
</br>(all, analog, none)</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td><i>Decrease</i> mouse paddle sensitivity</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td><i>Increase</i> mouse paddle sensitivity</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td><i>Decrease</i> mouse trackball sensitivity</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td><i>Increase</i> mouse trackball sensitivity</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td>Select <i>previous</i> mouse cursor visiblity option
(-UI, -Emulation/</br>-UI, +Emulation/+UI, -Emulation/+UI, +Emulation)</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td>Select <i>next</i> mouse cursor visiblity option
(-UI, -Emulation/</br>-UI, +Emulation/+UI, -Emulation/+UI, +Emulation)</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td>Toggle grab mouse</td>
<td>Control + g</td>
<td>Control + g</td>
</tr>
<tr>
<td>Select <i>previous</i> left port controller type</td>
<td>Shift-Control-Alt + L</td>
<td>Shift-Control-Cmd + L</td>
</tr>
<tr>
<td>Select <i>next</i> left port controller type</td>
<td>Control-Alt + L</td>
<td>Control-Cmd + L</td>
</tr>
<tr>
<td>Select <i>previous</i> right port controller type</td>
<td>Shift-Control-Alt + r</td>
<td>Shift-Control-Cmd + r</td>
</tr>
<tr>
<td>Select <i>next</i> right port controller type</td>
<td>Control-Alt + r</td>
<td>Control-Cmd + r</td>
</tr>
<tr>
<td>Toggle swap left and right controller ports</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td>Toggle swap paddles</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td><i>Decrease</i> horizontal center of paddles </td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td><i>Increase</i> horizontal center of paddles </td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td><i>Decrease</i> vertical center of paddles </td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td><i>Increase</i> vertical center of paddles </td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td>Switch mouse to <i>previous</i> controller emulation mode</br>(see <b><a href="#Controller">Controller Properties</a></b>)</td>
<td>Shift-Control + 0</td>
<td>Shift-Control + 0</td>
</tr>
<tr>
<td>Switch mouse to <i>next</i> controller emulation modes</br>(see <b><a href="#Controller">Controller Properties</a></b>)</td>
<td>Control + 0</td>
<td>Control + 0</td>
</tr>
<tr>
<td><i>Decrease</i> mouse paddle axes range</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td><i>Increase</i> mouse paddle axes range</td>
<td>-</td>
<td>-</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>
<a name="DeveloperKeys"></a> <a name="DeveloperKeys"></a>
<p><b>Developer Keys (can be remapped)</b></p> <p><b>Developer Keys (can be remapped)</b></p>
@ -1687,7 +1934,7 @@
<p><b><a name="GlobalKeys">Global Keys</a> (can be remapped)</b></p> <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 <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> dedicated keys. They keys are grouped by 'Audio & Video', 'Input Device & Ports' and 'Debug' settings.</p>
<table BORDER=2 cellpadding=4> <table BORDER=2 cellpadding=4>
<tr> <tr>
<th>Function</th> <th>Function</th>
@ -1729,7 +1976,7 @@
<ul> <ul>
<li>Only available if UI messages are enabled.</li> <li>Only available if UI messages are enabled.</li>
<li>Currently not available settings are automatically skipped.</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 <li>If a setting was previously selected via a dedicated key, its value can also be changed with the
global keys.</li> global keys.</li>
</ul> </ul>
</p> </p>
@ -1778,33 +2025,7 @@
<td>Control + t</td> <td>Control + t</td>
<td>Control + t</td> <td>Control + t</td>
</tr> </tr>
<tr>
<td><i>Decrease</i> autofire rate</td>
<td>Shift-Control + a</td>
<td>Shift-Control + a</td>
</tr>
<tr>
<td><i>Increase</i> autofire rate</td>
<td>Control + a</td>
<td>Control + a</td>
</tr>
<tr>
<td>Switch mouse between controller emulation modes</br>(see <b><a href="#Controller">Controller Properties</a></b>)</td>
<td>Control + 0</td>
<td>Control + 0</td>
</tr>
<tr>
<td>Toggle grab mouse</td>
<td>Control + g</td>
<td>Control + g</td>
</tr>
<tr>
<td>Swap Stelladaptor/2600-daptor port ordering</td>
<td>Control + 1</td>
<td>Control + 1</td>
</tr>
<tr> <tr>
<td>Save continuous PNG snapshots</br>(per interval defined in <a href="#Snapshots"><b>Snapshot Settings</b></a>)</td> <td>Save continuous PNG snapshots</br>(per interval defined in <a href="#Snapshots"><b>Snapshot Settings</b></a>)</td>
<td>Control-Alt + s</td> <td>Control-Alt + s</td>
@ -3684,8 +3905,10 @@
<tr><th>Item</th><th>Brief description</th><th>For more information,<br>see <a href="#CommandLine">Command Line</a></th></tr> <tr><th>Item</th><th>Brief description</th><th>For more information,<br>see <a href="#CommandLine">Command Line</a></th></tr>
<tr><td>Joystick deadzone size</td><td>Deadzone area for axes on joysticks/gamepads</td><td>-joydeadzone</td></tr> <tr><td>Joystick deadzone size</td><td>Deadzone area for axes on joysticks/gamepads</td><td>-joydeadzone</td></tr>
<tr><td>(Analog paddle) Sensitivity</td><td>Sensitivity of an analog paddle</td><td>-psense</td></tr> <tr><td>(Analog paddle) Sensitivity</td><td>Sensitivity of an analog paddle</td><td>-psense</td></tr>
<tr><td>Analog paddle) Dejitter averaging</td><td>Strength of paddle input averaging, suppresses mouse jitter</td><td>-dejitter.base</td></tr> <tr><td>(Analog paddle) Dejitter averaging</td><td>Strength of paddle input averaging, suppresses paddle jitter.<br>
<tr><td>(Analog paddle) Dejitter reaction</td><td>Strength of paddle reaction to fast paddle movements, suppresses mouse jitter</td><td>-dejitter.diff</td></tr> Note: The 2600-daptor has built-in dejitter, so there should be no need to use Stella's dejitter.
</td><td>-dejitter.base</td></tr>
<tr><td>(Analog paddle) Dejitter reaction</td><td>Strength of paddle reaction to fast paddle movements, suppresses paddle jitter.</td><td>-dejitter.diff</td></tr>
<tr><td>Digital paddle sensitivity</td><td>Sensitivity used when emulating a paddle using a digital device</td><td>-dsense</td></tr> <tr><td>Digital paddle sensitivity</td><td>Sensitivity used when emulating a paddle using a digital device</td><td>-dsense</td></tr>
<tr><td>Autofire rate</td><td>Automatic trigger rate of the fire buttons in Hz</td><td>-autofirerate</td></tr> <tr><td>Autofire rate</td><td>Automatic trigger rate of the fire buttons in Hz</td><td>-autofirerate</td></tr>
<tr><td>Allow all 4 directions ...</td><td>Allow all 4 joystick directions to be pressed simultaneously</td><td>-joyallow4</td></tr> <tr><td>Allow all 4 directions ...</td><td>Allow all 4 joystick directions to be pressed simultaneously</td><td>-joyallow4</td></tr>
@ -3820,7 +4043,9 @@
</tr> </tr>
</table> </table>
</li> </li>
<br><li><b>High scores</b>: This option displays the <a href="#HighScores">High Scores</a> dialog for the selected ROM.</li> <br><li><b>High scores</b>: This option displays the <a href="#HighScores">
High Scores</a> dialog for the selected ROM. Only available if high score
properties have been setup for the ROM.</li>
</li> </li>
<br><li><b>Reload listing</b>: Selecting this performs a reload of the <br><li><b>Reload listing</b>: Selecting this performs a reload of the
current listing. It is an alternative to pressing the 'Control + r' current listing. It is an alternative to pressing the 'Control + r'

View File

@ -137,13 +137,17 @@ MouseControl::MouseControl(Console& console, const string& mode)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const string& MouseControl::next() const string& MouseControl::change(int direction)
{ {
myCurrentModeNum = BSPF::clampw(myCurrentModeNum + direction, 0, int(myModeList.size() - 1));
const MouseMode& mode = myModeList[myCurrentModeNum]; const MouseMode& mode = myModeList[myCurrentModeNum];
myCurrentModeNum = (myCurrentModeNum + 1) % myModeList.size();
myLeftController.setMouseControl(mode.xtype, mode.xid, mode.ytype, mode.yid); bool leftControl =
myRightController.setMouseControl(mode.xtype, mode.xid, mode.ytype, mode.yid); myLeftController.setMouseControl(mode.xtype, mode.xid, mode.ytype, mode.yid);
bool rightControl =
myRightController.setMouseControl(mode.xtype, mode.xid, mode.ytype, mode.yid);
myHasMouseControl = leftControl || rightControl;
return mode.message; return mode.message;
} }

View File

@ -62,7 +62,12 @@ class MouseControl
@return A message explaining the current mouse mode @return A message explaining the current mouse mode
*/ */
const string& next(); const string& change(int direction = +1);
/**
Get whether any current controller supports mouse control
*/
bool hasMouseControl() const { return myHasMouseControl; }
private: private:
void addLeftControllerModes(bool noswap); void addLeftControllerModes(bool noswap);
@ -101,6 +106,7 @@ class MouseControl
int myCurrentModeNum{0}; int myCurrentModeNum{0};
vector<MouseMode> myModeList; vector<MouseMode> myModeList;
bool myHasMouseControl{false};
private: private:
// Following constructors and assignment operators not supported // Following constructors and assignment operators not supported

View File

@ -19,6 +19,9 @@
#include "OSystem.hxx" #include "OSystem.hxx"
#include "Console.hxx" #include "Console.hxx"
#include "Joystick.hxx" #include "Joystick.hxx"
#include "Paddles.hxx"
#include "PointingDevice.hxx"
#include "Driving.hxx"
#include "Settings.hxx" #include "Settings.hxx"
#include "EventHandler.hxx" #include "EventHandler.hxx"
#include "PJoystickHandler.hxx" #include "PJoystickHandler.hxx"
@ -850,6 +853,147 @@ ostream& operator<<(ostream& os, const PhysicalJoystickHandler& jh)
return os; return os;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PhysicalJoystickHandler::changeDeadzone(int direction)
{
int deadzone = BSPF::clamp(myOSystem.settings().getInt("joydeadzone") + direction,
Joystick::DEAD_ZONE_MIN, Joystick::DEAD_ZONE_MAX);
myOSystem.settings().setValue("joydeadzone", deadzone);
Joystick::setDeadZone(deadzone);
int value = Joystick::deadZoneValue(deadzone);
myOSystem.frameBuffer().showGaugeMessage("Joystick deadzone", std::to_string(value),
value, 3200, 32200);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PhysicalJoystickHandler::changeAnalogPaddleSensitivity(int direction)
{
int sense = BSPF::clamp(myOSystem.settings().getInt("psense") + direction,
Paddles::MIN_ANALOG_SENSE, Paddles::MAX_ANALOG_SENSE);
myOSystem.settings().setValue("psense", sense);
Paddles::setAnalogSensitivity(sense);
ostringstream ss;
ss << std::round(Paddles::analogSensitivityValue(sense) * 100.F) << "%";
myOSystem.frameBuffer().showGaugeMessage("Analog paddle sensitivity", ss.str(), sense,
Paddles::MIN_ANALOG_SENSE, Paddles::MAX_ANALOG_SENSE);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PhysicalJoystickHandler::changePaddleDejitterAveraging(int direction)
{
int dejitter = BSPF::clamp(myOSystem.settings().getInt("dejitter.base") + direction,
Paddles::MIN_DEJITTER, Paddles::MAX_DEJITTER);
myOSystem.settings().setValue("dejitter.base", dejitter);
Paddles::setDejitterBase(dejitter);
ostringstream ss;
if(dejitter)
ss << dejitter;
else
ss << "Off";
myOSystem.frameBuffer().showGaugeMessage("Analog paddle dejitter averaging",
ss.str(), dejitter,
Paddles::MIN_DEJITTER, Paddles::MAX_DEJITTER);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PhysicalJoystickHandler::changePaddleDejitterReaction(int direction)
{
int dejitter = BSPF::clamp(myOSystem.settings().getInt("dejitter.diff") + direction,
Paddles::MIN_DEJITTER, Paddles::MAX_DEJITTER);
myOSystem.settings().setValue("dejitter.diff", dejitter);
Paddles::setDejitterDiff(dejitter);
ostringstream ss;
if(dejitter)
ss << dejitter;
else
ss << "Off";
myOSystem.frameBuffer().showGaugeMessage("Analog paddle dejitter reaction",
ss.str(), dejitter,
Paddles::MIN_DEJITTER, Paddles::MAX_DEJITTER);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PhysicalJoystickHandler::changeDigitalPaddleSensitivity(int direction)
{
int sense = BSPF::clamp(myOSystem.settings().getInt("dsense") + direction,
Paddles::MIN_DIGITAL_SENSE, Paddles::MAX_DIGITAL_SENSE);
myOSystem.settings().setValue("dsense", sense);
Paddles::setDigitalSensitivity(sense);
ostringstream ss;
if(sense)
ss << sense * 10 << "%";
else
ss << "Off";
myOSystem.frameBuffer().showGaugeMessage("Digital sensitivity",
ss.str(), sense,
Paddles::MIN_DIGITAL_SENSE, Paddles::MAX_DIGITAL_SENSE);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PhysicalJoystickHandler::changeMousePaddleSensitivity(int direction)
{
int sense = BSPF::clamp(myOSystem.settings().getInt("msense") + direction,
Paddles::MIN_MOUSE_SENSE, Paddles::MAX_MOUSE_SENSE);
myOSystem.settings().setValue("msense", sense);
Paddles::setMouseSensitivity(sense);
ostringstream ss;
ss << sense * 10 << "%";
myOSystem.frameBuffer().showGaugeMessage("Mouse paddle sensitivity",
ss.str(), sense,
Paddles::MIN_MOUSE_SENSE, Paddles::MAX_MOUSE_SENSE);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PhysicalJoystickHandler::changeMouseTrackballSensitivity(int direction)
{
int sense = BSPF::clamp(myOSystem.settings().getInt("tsense") + direction,
PointingDevice::MIN_SENSE, PointingDevice::MAX_SENSE);
myOSystem.settings().setValue("tsense", sense);
PointingDevice::setSensitivity(sense);
ostringstream ss;
ss << sense * 10 << "%";
myOSystem.frameBuffer().showGaugeMessage("Mouse trackball sensitivity",
ss.str(), sense,
PointingDevice::MIN_SENSE, PointingDevice::MAX_SENSE);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PhysicalJoystickHandler::changeDrivingSensitivity(int direction)
{
int sense = BSPF::clamp(myOSystem.settings().getInt("dcsense") + direction,
Driving::MIN_SENSE, Driving::MAX_SENSE);
myOSystem.settings().setValue("dcsense", sense);
Driving::setSensitivity(sense);
ostringstream ss;
ss << sense * 10 << "%";
myOSystem.frameBuffer().showGaugeMessage("Mouse driving controller sensitivity",
ss.str(), sense,
Driving::MIN_SENSE, Driving::MAX_SENSE);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PhysicalJoystickHandler::EventMappingArray PhysicalJoystickHandler::DefaultLeftJoystickMapping = { PhysicalJoystickHandler::EventMappingArray PhysicalJoystickHandler::DefaultLeftJoystickMapping = {
// Left joystick (assume buttons zero..two) // Left joystick (assume buttons zero..two)

View File

@ -109,6 +109,15 @@ class PhysicalJoystickHandler
/** Returns a list of pairs consisting of joystick name and associated ID. */ /** Returns a list of pairs consisting of joystick name and associated ID. */
VariantList database() const; VariantList database() const;
void changeDeadzone(int direction = +1);
void changeAnalogPaddleSensitivity(int direction = +1);
void changePaddleDejitterAveraging(int direction = +1);
void changePaddleDejitterReaction(int direction = +1);
void changeDigitalPaddleSensitivity(int direction = +1);
void changeMousePaddleSensitivity(int direction = +1);
void changeMouseTrackballSensitivity(int direction = +1);
void changeDrivingSensitivity(int direction = +1);
private: private:
using StickDatabase = std::map<string,StickInfo>; using StickDatabase = std::map<string,StickInfo>;
using StickList = std::map<int, PhysicalJoystickPtr>; using StickList = std::map<int, PhysicalJoystickPtr>;

View File

@ -1,4 +1,5 @@
//============================================================================ //============================================================================
//============================================================================
// //
// SSSS tt lll lll // SSSS tt lll lll
// SS SS tt ll ll // SS SS tt ll ll
@ -480,6 +481,24 @@ void PhysicalKeyboardHandler::handleEvent(StellaKey key, StellaMod mod,
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PhysicalKeyboardHandler::toggleModKeys(bool toggle)
{
bool modCombo = myOSystem.settings().getBool("modcombo");
if(toggle)
{
modCombo = !modCombo;
myKeyMap.enableMod() = modCombo;
myOSystem.settings().setValue("modcombo", modCombo);
}
ostringstream ss;
ss << "Modifier key combos ";
ss << (modCombo ? "enabled" : "disabled");
myOSystem.frameBuffer().showTextMessage(ss.str());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PhysicalKeyboardHandler::EventMappingArray PhysicalKeyboardHandler::EventMappingArray
PhysicalKeyboardHandler::DefaultCommonMapping = { PhysicalKeyboardHandler::DefaultCommonMapping = {
@ -554,7 +573,6 @@ PhysicalKeyboardHandler::DefaultCommonMapping = {
{Event::ToggleColorLoss, KBDK_L, KBDM_CTRL}, {Event::ToggleColorLoss, KBDK_L, KBDM_CTRL},
{Event::PaletteDecrease, KBDK_P, KBDM_SHIFT | KBDM_CTRL}, {Event::PaletteDecrease, KBDK_P, KBDM_SHIFT | KBDM_CTRL},
{Event::PaletteIncrease, KBDK_P, KBDM_CTRL}, {Event::PaletteIncrease, KBDK_P, KBDM_CTRL},
#ifndef BSPF_MACOS #ifndef BSPF_MACOS
{Event::PreviousSetting, KBDK_END}, {Event::PreviousSetting, KBDK_END},
{Event::NextSetting, KBDK_HOME}, {Event::NextSetting, KBDK_HOME},
@ -589,11 +607,18 @@ PhysicalKeyboardHandler::DefaultCommonMapping = {
{Event::ToggleContSnapshotsFrame, KBDK_S, KBDM_SHIFT | MOD3 | KBDM_CTRL}, {Event::ToggleContSnapshotsFrame, KBDK_S, KBDM_SHIFT | MOD3 | KBDM_CTRL},
#endif #endif
{Event::DecreaseAutoFire, KBDK_A, KBDM_SHIFT | KBDM_CTRL}, {Event::DecreaseAutoFire, KBDK_A, KBDM_CTRL | KBDM_SHIFT},
{Event::IncreaseAutoFire, KBDK_A, KBDM_CTRL }, {Event::IncreaseAutoFire, KBDK_A, KBDM_CTRL},
{Event::HandleMouseControl, KBDK_0, KBDM_CTRL},
{Event::ToggleGrabMouse, KBDK_G, KBDM_CTRL},
{Event::ToggleSAPortOrder, KBDK_1, KBDM_CTRL}, {Event::ToggleSAPortOrder, KBDK_1, KBDM_CTRL},
{Event::ToggleGrabMouse, KBDK_G, KBDM_CTRL},
{Event::PreviousLeftPort, KBDK_L, KBDM_CTRL | MOD3 | KBDM_SHIFT},
{Event::NextLeftPort, KBDK_L, KBDM_CTRL | MOD3},
{Event::PreviousRightPort, KBDK_R, KBDM_CTRL | MOD3 | KBDM_SHIFT},
{Event::NextRightPort, KBDK_R, KBDM_CTRL | MOD3},
{Event::PreviousMouseControl, KBDK_0, KBDM_CTRL | KBDM_SHIFT},
{Event::NextMouseControl, KBDK_0, KBDM_CTRL},
{Event::FormatDecrease, KBDK_F, KBDM_SHIFT | KBDM_CTRL}, {Event::FormatDecrease, KBDK_F, KBDM_SHIFT | KBDM_CTRL},
{Event::FormatIncrease, KBDK_F, KBDM_CTRL}, {Event::FormatIncrease, KBDK_F, KBDM_CTRL},

View File

@ -79,6 +79,8 @@ class PhysicalKeyboardHandler
/** See comments on KeyMap.myModEnabled for more information. */ /** See comments on KeyMap.myModEnabled for more information. */
bool& useModKeys() { return myKeyMap.enableMod(); } bool& useModKeys() { return myKeyMap.enableMod(); }
void toggleModKeys(bool toggle = true);
private: private:
// Structure used for action menu items // Structure used for action menu items

View File

@ -69,6 +69,16 @@ NLOHMANN_JSON_SERIALIZE_ENUM(Event::Type, {
{Event::JoystickOneFire, "JoystickOneFire"}, {Event::JoystickOneFire, "JoystickOneFire"},
{Event::JoystickOneFire5, "JoystickOneFire5"}, {Event::JoystickOneFire5, "JoystickOneFire5"},
{Event::JoystickOneFire9, "JoystickOneFire9"}, {Event::JoystickOneFire9, "JoystickOneFire9"},
{Event::JoystickTwoUp, "JoystickTwoUp"},
{Event::JoystickTwoDown, "JoystickTwoDown"},
{Event::JoystickTwoLeft, "JoystickTwoLeft"},
{Event::JoystickTwoRight, "JoystickTwoRight"},
{Event::JoystickTwoFire, "JoystickTwoFire"},
{Event::JoystickThreeUp, "JoystickThreeUp"},
{Event::JoystickThreeDown, "JoystickThreeDown"},
{Event::JoystickThreeLeft, "JoystickThreeLeft"},
{Event::JoystickThreeRight, "JoystickThreeRight"},
{Event::JoystickThreeFire, "JoystickThreeFire"},
{Event::PaddleZeroDecrease, "PaddleZeroDecrease"}, {Event::PaddleZeroDecrease, "PaddleZeroDecrease"},
{Event::PaddleZeroIncrease, "PaddleZeroIncrease"}, {Event::PaddleZeroIncrease, "PaddleZeroIncrease"},
{Event::PaddleZeroAnalog, "PaddleZeroAnalog"}, {Event::PaddleZeroAnalog, "PaddleZeroAnalog"},
@ -160,6 +170,50 @@ NLOHMANN_JSON_SERIALIZE_ENUM(Event::Type, {
{Event::CompuMateEquals, "CompuMateEquals"}, {Event::CompuMateEquals, "CompuMateEquals"},
{Event::CompuMatePlus, "CompuMatePlus"}, {Event::CompuMatePlus, "CompuMatePlus"},
{Event::CompuMateSlash, "CompuMateSlash"}, {Event::CompuMateSlash, "CompuMateSlash"},
{Event::DecreaseDeadzone, "DecreaseDeadzone"},
{Event::IncreaseDeadzone, "IncreaseDeadzone"},
{Event::DecAnalogSense, "DecAnalogSense"},
{Event::IncAnalogSense, "IncAnalogSense"},
{Event::DecDejtterAveraging, "DecDejtterAveraging"},
{Event::IncDejtterAveraging, "IncDejtterAveraging"},
{Event::DecDejtterReaction, "DecDejtterReaction"},
{Event::IncDejtterReaction, "IncDejtterReaction"},
{Event::DecDigitalSense, "DecDigitalSense"},
{Event::IncDigitalSense, "IncDigitalSense"},
{Event::DecreaseAutoFire, "DecreaseAutoFire"},
{Event::IncreaseAutoFire, "IncreaseAutoFire"},
{Event::ToggleFourDirections, "ToggleFourDirections"},
{Event::ToggleKeyCombos, "ToggleKeyCombos"},
{Event::ToggleSAPortOrder, "ToggleSAPortOrder"},
{Event::PrevMouseAsController, "PrevMouseAsController"},
{Event::NextMouseAsController, "NextMouseAsController"},
{Event::DecMousePaddleSense, "DecMousePaddleSense"},
{Event::IncMousePaddleSense, "IncMousePaddleSense"},
{Event::DecMouseTrackballSense, "DecMouseTrackballSense"},
{Event::IncMouseTrackballSense, "IncMouseTrackballSense"},
{Event::DecreaseDrivingSense, "DecreaseDrivingSense"},
{Event::IncreaseDrivingSense, "IncreaseDrivingSense"},
{Event::PreviousCursorVisbility, "PreviousCursorVisbility"},
{Event::NextCursorVisbility, "NextCursorVisbility"},
{Event::ToggleGrabMouse, "ToggleGrabMouse"},
{Event::PreviousLeftPort, "PreviousLeftPort"},
{Event::NextLeftPort, "NextLeftPort"},
{Event::PreviousRightPort, "PreviousRightPort"},
{Event::NextRightPort, "NextRightPort"},
{Event::ToggleSwapPorts, "ToggleSwapPorts"},
{Event::ToggleSwapPaddles,"ToggleSwapPaddles"},
{Event::DecreasePaddleCenterX, "DecreasePaddleCenterX"},
{Event::IncreasePaddleCenterX, "IncreasePaddleCenterX"},
{Event::DecreasePaddleCenterY, "DecreasePaddleCenterY"},
{Event::IncreasePaddleCenterY, "IncreasePaddleCenterY"},
{Event::PreviousMouseControl, "PreviousMouseControl"},
{Event::NextMouseControl, "NextMouseControl"},
{Event::DecreaseMouseAxesRange, "DecreaseMouseAxesRange"},
{Event::IncreaseMouseAxesRange, "IncreaseMouseAxesRange"},
{Event::Combo1, "Combo1"}, {Event::Combo1, "Combo1"},
{Event::Combo2, "Combo2"}, {Event::Combo2, "Combo2"},
{Event::Combo3, "Combo3"}, {Event::Combo3, "Combo3"},
@ -192,8 +246,6 @@ NLOHMANN_JSON_SERIALIZE_ENUM(Event::Type, {
{Event::UIPrevDir, "UIPrevDir"}, {Event::UIPrevDir, "UIPrevDir"},
{Event::UITabPrev, "UITabPrev"}, {Event::UITabPrev, "UITabPrev"},
{Event::UITabNext, "UITabNext"}, {Event::UITabNext, "UITabNext"},
{Event::HandleMouseControl, "HandleMouseControl"},
{Event::ToggleGrabMouse, "ToggleGrabMouse"},
{Event::MouseAxisXMove, "MouseAxisXMove"}, {Event::MouseAxisXMove, "MouseAxisXMove"},
{Event::MouseAxisYMove, "MouseAxisYMove"}, {Event::MouseAxisYMove, "MouseAxisYMove"},
{Event::MouseAxisXValue, "MouseAxisXValue"}, {Event::MouseAxisXValue, "MouseAxisXValue"},
@ -287,7 +339,6 @@ NLOHMANN_JSON_SERIALIZE_ENUM(Event::Type, {
{Event::ToggleBits, "ToggleBits"}, {Event::ToggleBits, "ToggleBits"},
{Event::ToggleFixedColors, "ToggleFixedColors"}, {Event::ToggleFixedColors, "ToggleFixedColors"},
{Event::ToggleFrameStats, "ToggleFrameStats"}, {Event::ToggleFrameStats, "ToggleFrameStats"},
{Event::ToggleSAPortOrder, "ToggleSAPortOrder"},
{Event::ExitGame, "ExitGame"}, {Event::ExitGame, "ExitGame"},
{Event::SettingDecrease, "SettingDecrease"}, {Event::SettingDecrease, "SettingDecrease"},
{Event::SettingIncrease, "SettingIncrease"}, {Event::SettingIncrease, "SettingIncrease"},
@ -302,16 +353,6 @@ NLOHMANN_JSON_SERIALIZE_ENUM(Event::Type, {
{Event::IncreaseAutoFire, "IncreaseAutoFire"}, {Event::IncreaseAutoFire, "IncreaseAutoFire"},
{Event::DecreaseSpeed, "DecreaseSpeed"}, {Event::DecreaseSpeed, "DecreaseSpeed"},
{Event::IncreaseSpeed, "IncreaseSpeed"}, {Event::IncreaseSpeed, "IncreaseSpeed"},
{Event::JoystickTwoUp, "JoystickTwoUp"},
{Event::JoystickTwoDown, "JoystickTwoDown"},
{Event::JoystickTwoLeft, "JoystickTwoLeft"},
{Event::JoystickTwoRight, "JoystickTwoRight"},
{Event::JoystickTwoFire, "JoystickTwoFire"},
{Event::JoystickThreeUp, "JoystickThreeUp"},
{Event::JoystickThreeDown, "JoystickThreeDown"},
{Event::JoystickThreeLeft, "JoystickThreeLeft"},
{Event::JoystickThreeRight, "JoystickThreeRight"},
{Event::JoystickThreeFire, "JoystickThreeFire"},
{Event::ToggleCorrectAspectRatio, "ToggleCorrectAspectRatio"}, {Event::ToggleCorrectAspectRatio, "ToggleCorrectAspectRatio"},
{Event::MoveLeftChar, "MoveLeftChar"}, {Event::MoveLeftChar, "MoveLeftChar"},
{Event::MoveRightChar, "MoveRightChar"}, {Event::MoveRightChar, "MoveRightChar"},

View File

@ -858,6 +858,40 @@ void Console::setControllers(const string& romMd5)
myOSystem.eventHandler().setMouseControllerMode(myOSystem.settings().getString("usemouse")); myOSystem.eventHandler().setMouseControllerMode(myOSystem.settings().getString("usemouse"));
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::changeLeftController(int direction)
{
int type = int(Controller::getType(myProperties.get(PropType::Controller_Left)));
if(!type)
type = int(Controller::getType(leftController().name()));
type = BSPF::clampw(type + direction,
1, int(Controller::Type::LastType) - 1);
myProperties.set(PropType::Controller_Left, Controller::getPropName(Controller::Type(type)));
setControllers(myProperties.get(PropType::Cart_MD5));
ostringstream msg;
msg << "Left controller " << Controller::getName(Controller::Type(type));
myOSystem.frameBuffer().showTextMessage(msg.str());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::changeRightController(int direction)
{
int type = int(Controller::getType(myProperties.get(PropType::Controller_Right)));
if(!type)
type = int(Controller::getType(rightController().name()));
type = BSPF::clampw(type + direction,
1, int(Controller::Type::LastType) - 1);
myProperties.set(PropType::Controller_Right, Controller::getPropName(Controller::Type(type)));
setControllers(myProperties.get(PropType::Cart_MD5));
ostringstream msg;
msg << "Right controller " << Controller::getName(Controller::Type(type));
myOSystem.frameBuffer().showTextMessage(msg.str());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
unique_ptr<Controller> Console::getControllerPort(const Controller::Type type, unique_ptr<Controller> Console::getControllerPort(const Controller::Type type,
const Controller::Jack port, const string& romMd5) const Controller::Jack port, const string& romMd5)
@ -967,6 +1001,99 @@ unique_ptr<Controller> Console::getControllerPort(const Controller::Type type,
return controller; return controller;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::toggleSwapPorts(bool toggle)
{
bool swapped = myProperties.get(PropType::Console_SwapPorts) == "YES";
if(toggle)
{
swapped = !swapped;
myProperties.set(PropType::Console_SwapPorts, (swapped ? "YES" : "NO"));
//myOSystem.propSet().insert(myProperties);
setControllers(myProperties.get(PropType::Cart_MD5));
}
ostringstream msg;
msg << "Swap ports " << (swapped ? "enabled" : "disabled");
myOSystem.frameBuffer().showTextMessage(msg.str());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::toggleSwapPaddles(bool toggle)
{
bool swapped = myProperties.get(PropType::Controller_SwapPaddles) == "YES";
if(toggle)
{
swapped = !swapped;
myProperties.set(PropType::Controller_SwapPaddles, (swapped ? "YES" : "NO"));
//myOSystem.propSet().insert(myProperties);
setControllers(myProperties.get(PropType::Cart_MD5));
}
ostringstream msg;
msg << "Swap paddles " << (swapped ? "enabled" : "disabled");
myOSystem.frameBuffer().showTextMessage(msg.str());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::changePaddleCenterX(int direction)
{
int center =
BSPF::clamp(BSPF::stringToInt(myProperties.get(PropType::Controller_PaddlesXCenter)) + direction,
Paddles::MIN_ANALOG_CENTER, Paddles::MAX_ANALOG_CENTER);
myProperties.set(PropType::Controller_PaddlesXCenter, std::to_string(center));
Paddles::setAnalogXCenter(center);
ostringstream val;
val << (center ? center > 0 ? "+" : "" : " ") << center * 5 << "px";
myOSystem.frameBuffer().showGaugeMessage("Paddles x-center ", val.str(), center,
Paddles::MIN_ANALOG_CENTER, Paddles::MAX_ANALOG_CENTER);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::changePaddleCenterY(int direction)
{
int center =
BSPF::clamp(BSPF::stringToInt(myProperties.get(PropType::Controller_PaddlesYCenter)) + direction,
Paddles::MIN_ANALOG_CENTER, Paddles::MAX_ANALOG_CENTER);
myProperties.set(PropType::Controller_PaddlesYCenter, std::to_string(center));
Paddles::setAnalogYCenter(center);
ostringstream val;
val << (center ? center > 0 ? "+" : "" : " ") << center * 5 << "px";
myOSystem.frameBuffer().showGaugeMessage("Paddles y-center ", val.str(), center,
Paddles::MIN_ANALOG_CENTER, Paddles::MAX_ANALOG_CENTER);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::changePaddleAxesRange(int direction)
{
istringstream m_axis(myProperties.get(PropType::Controller_MouseAxis));
string mode = "AUTO";
int range;
m_axis >> mode;
if(!(m_axis >> range))
range = Paddles::MAX_MOUSE_RANGE;
range = BSPF::clamp(range + direction,
Paddles::MIN_MOUSE_RANGE, Paddles::MAX_MOUSE_RANGE);
ostringstream control;
control << mode;
if(range != 100)
control << " " << std::to_string(range);
myProperties.set(PropType::Controller_MouseAxis, control.str());
Paddles::setDigitalPaddleRange(range);
ostringstream val;
val << range << "%";
myOSystem.frameBuffer().showGaugeMessage("Mouse axes range", val.str(), range);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::changeAutoFireRate(int direction) void Console::changeAutoFireRate(int direction)
{ {

View File

@ -85,7 +85,7 @@ class Console : public Serializable, public ConsoleIO
/** /**
Sets the left and right controllers for the console. Sets the left and right controllers for the console.
*/ */
void setControllers(const string& roMd5); void setControllers(const string& romMd5);
/** /**
Get the controller plugged into the specified jack Get the controller plugged into the specified jack
@ -95,6 +95,12 @@ class Console : public Serializable, public ConsoleIO
Controller& leftController() const override { return *myLeftControl; } Controller& leftController() const override { return *myLeftControl; }
Controller& rightController() const override { return *myRightControl; } Controller& rightController() const override { return *myRightControl; }
/**
Change to next or previous controller type
*/
void changeLeftController(int direction = +1);
void changeRightController(int direction = +1);
/** /**
Get the TIA for this console Get the TIA for this console
@ -190,6 +196,31 @@ class Console : public Serializable, public ConsoleIO
*/ */
int refreshRate() const; int refreshRate() const;
/**
Toggle left and right controller ports swapping
*/
void toggleSwapPorts(bool toggle = true);
/**
Toggle paddle controllers swapping
*/
void toggleSwapPaddles(bool toggle = true);
/**
Change x-center of paddles
*/
void changePaddleCenterX(int direction = +1);
/**
Change y-center of paddles
*/
void changePaddleCenterY(int direction = +1);
/**
Change paddle range for digital/mouse emulation
*/
void changePaddleAxesRange(int direction = +1);
public: public:
/** /**
Toggle between NTSC/PAL/SECAM (and variants) display format. Toggle between NTSC/PAL/SECAM (and variants) display format.

View File

@ -177,7 +177,7 @@ bool Driving::setMouseControl(
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Driving::setSensitivity(int sensitivity) void Driving::setSensitivity(int sensitivity)
{ {
BSPF::clamp(sensitivity, 1, 20, 10); BSPF::clamp(sensitivity, MIN_SENSE, MAX_SENSE, (MIN_SENSE + MAX_SENSE) / 2);
SENSITIVITY = sensitivity / 10.0F; SENSITIVITY = sensitivity / 10.0F;
} }

View File

@ -41,6 +41,10 @@ class Driving : public Controller
Driving(Jack jack, const Event& event, const System& system, bool altmap = false); Driving(Jack jack, const Event& event, const System& system, bool altmap = false);
~Driving() override = default; ~Driving() override = default;
public:
static constexpr int MIN_SENSE = 1;
static constexpr int MAX_SENSE = 20;
public: public:
/** /**
Update the entire digital and analog pin state according to the Update the entire digital and analog pin state according to the

View File

@ -43,9 +43,9 @@ class Event
ConsoleSelect, ConsoleReset, ConsoleSelect, ConsoleReset,
JoystickZeroUp, JoystickZeroDown, JoystickZeroLeft, JoystickZeroRight, JoystickZeroUp, JoystickZeroDown, JoystickZeroLeft, JoystickZeroRight,
JoystickZeroFire, JoystickZeroFire5, JoystickZeroFire9, JoystickZeroFire, JoystickZeroFire5, JoystickZeroFire9,
JoystickOneUp, JoystickOneDown, JoystickOneLeft, JoystickOneRight, JoystickOneUp, JoystickOneDown, JoystickOneLeft, JoystickOneRight,
JoystickOneFire, JoystickOneFire5, JoystickOneFire9, JoystickOneFire, JoystickOneFire5, JoystickOneFire9,
PaddleZeroDecrease, PaddleZeroIncrease, PaddleZeroAnalog, PaddleZeroFire, PaddleZeroDecrease, PaddleZeroIncrease, PaddleZeroAnalog, PaddleZeroFire,
PaddleOneDecrease, PaddleOneIncrease, PaddleOneAnalog, PaddleOneFire, PaddleOneDecrease, PaddleOneIncrease, PaddleOneAnalog, PaddleOneFire,
@ -83,7 +83,7 @@ class Event
UISelect, UINavPrev, UINavNext, UIOK, UICancel, UIPrevDir, UISelect, UINavPrev, UINavNext, UIOK, UICancel, UIPrevDir,
UITabPrev, UITabNext, UITabPrev, UITabNext,
HandleMouseControl, ToggleGrabMouse, NextMouseControl, ToggleGrabMouse,
MouseAxisXMove, MouseAxisYMove, MouseAxisXValue, MouseAxisYValue, MouseAxisXMove, MouseAxisYMove, MouseAxisXValue, MouseAxisYValue,
MouseButtonLeftValue, MouseButtonRightValue, MouseButtonLeftValue, MouseButtonRightValue,
@ -145,6 +145,26 @@ class Event
AbortEdit, EndEdit, AbortEdit, EndEdit,
HighScoresMenuMode, HighScoresMenuMode,
// Input settings
DecreaseDeadzone, IncreaseDeadzone,
DecAnalogSense, IncAnalogSense,
DecDejtterAveraging, IncDejtterAveraging,
DecDejtterReaction, IncDejtterReaction,
DecDigitalSense, IncDigitalSense,
ToggleFourDirections, ToggleKeyCombos,
PrevMouseAsController, NextMouseAsController,
DecMousePaddleSense, IncMousePaddleSense,
DecMouseTrackballSense, IncMouseTrackballSense,
DecreaseDrivingSense, IncreaseDrivingSense,
PreviousCursorVisbility, NextCursorVisbility,
// GameInfoDialog/Controllers
PreviousLeftPort, NextLeftPort,
PreviousRightPort, NextRightPort,
ToggleSwapPorts, ToggleSwapPaddles,
DecreasePaddleCenterX, IncreasePaddleCenterX,
DecreasePaddleCenterY, IncreasePaddleCenterY,
PreviousMouseControl,
DecreaseMouseAxesRange, IncreaseMouseAxesRange,
LastType LastType
}; };
@ -153,6 +173,7 @@ class Event
{ {
Menu, Emulation, Menu, Emulation,
Misc, AudioVideo, States, Console, Joystick, Paddles, Keyboard, Misc, AudioVideo, States, Console, Joystick, Paddles, Keyboard,
Devices,
Debug, Combo, Debug, Combo,
LastGroup LastGroup
}; };

File diff suppressed because it is too large Load Diff

View File

@ -81,10 +81,15 @@ class EventHandler
*/ */
void mapStelladaptors(const string& saport); void mapStelladaptors(const string& saport);
/**
Toggles if all four joystick directions are allowed at once
*/
void toggleAllow4JoyDirections(bool toggle = true);
/** /**
Swaps the ordering of Stelladaptor/2600-daptor(s) devices. Swaps the ordering of Stelladaptor/2600-daptor(s) devices.
*/ */
void toggleSAPortOrder(); void toggleSAPortOrder(bool toggle = true);
/** /**
Toggle whether the console is in 2600 or 7800 mode. Toggle whether the console is in 2600 or 7800 mode.
@ -141,6 +146,8 @@ class EventHandler
'always', 'analog', 'never' 'always', 'analog', 'never'
*/ */
void setMouseControllerMode(const string& enable); void setMouseControllerMode(const string& enable);
void changeMouseControllerMode(int direction = +1);
void changeMouseCursor(int direction = +1);
void enterMenuMode(EventHandlerState state); void enterMenuMode(EventHandlerState state);
void leaveMenuMode(); void leaveMenuMode();
@ -353,7 +360,8 @@ class EventHandler
/** /**
Handle changing mouse modes. Handle changing mouse modes.
*/ */
void handleMouseControl(); void changeMouseControl(int direction = +1);
bool hasMouseControl();
void saveKeyMapping(); void saveKeyMapping();
void saveJoyMapping(); void saveJoyMapping();
@ -462,6 +470,34 @@ class EventHandler
PHOSPHOR, PHOSPHOR,
SCANLINES, SCANLINES,
INTERPOLATION, INTERPOLATION,
// *** Input group ***
#ifdef JOYSTICK_SUPPORT
DEADZONE,
ANALOG_SENSITIVITY,
DEJITTER_AVERAGING,
DEJITTER_REACTION,
#endif
DIGITAL_SENSITIVITY,
AUTO_FIRE,
FOUR_DIRECTIONS,
MOD_KEY_COMBOS,
#ifdef JOYSTICK_SUPPORT
SA_PORT_ORDER,
#endif
USE_MOUSE,
PADDLE_SENSITIVITY,
TRACKBALL_SENSITIVITY,
DRIVING_SENSITIVITY,
MOUSE_CURSOR,
GRAB_MOUSE,
LEFT_PORT,
RIGHT_PORT,
SWAP_PORTS,
SWAP_PADDLES,
PADDLE_CENTER_X,
PADDLE_CENTER_Y,
MOUSE_CONTROL,
MOUSE_RANGE,
// *** Debug group *** // *** Debug group ***
STATS, STATS,
P0_ENAM, P0_ENAM,
@ -490,12 +526,15 @@ class EventHandler
NUM_ADJ, NUM_ADJ,
START_AV_ADJ = VOLUME, START_AV_ADJ = VOLUME,
END_AV_ADJ = INTERPOLATION, END_AV_ADJ = INTERPOLATION,
START_INPUT_ADJ = DEADZONE,
END_INPUT_ADJ = MOUSE_RANGE,
START_DEBUG_ADJ = STATS, START_DEBUG_ADJ = STATS,
END_DEBUG_ADJ = JITTER, END_DEBUG_ADJ = JITTER,
}; };
enum class AdjustGroup enum class AdjustGroup
{ {
AV, AV,
INPUT,
DEBUG, DEBUG,
NUM_GROUPS NUM_GROUPS
}; };
@ -509,6 +548,7 @@ class EventHandler
static const Event::EventSet JoystickEvents; static const Event::EventSet JoystickEvents;
static const Event::EventSet PaddlesEvents; static const Event::EventSet PaddlesEvents;
static const Event::EventSet KeyboardEvents; static const Event::EventSet KeyboardEvents;
static const Event::EventSet DevicesEvents;
static const Event::EventSet ComboEvents; static const Event::EventSet ComboEvents;
static const Event::EventSet DebugEvents; static const Event::EventSet DebugEvents;
static const Event::EventSet EditEvents; static const Event::EventSet EditEvents;
@ -533,6 +573,13 @@ class EventHandler
AdjustFunction cycleAdjustSetting(int direction); AdjustFunction cycleAdjustSetting(int direction);
AdjustFunction getAdjustSetting(AdjustSetting setting); AdjustFunction getAdjustSetting(AdjustSetting setting);
PhysicalJoystickHandler& joyHandler() { return *myPJoyHandler; }
PhysicalKeyboardHandler& keyHandler() { return *myPKeyHandler; }
bool isJoystick(const Controller& controller) const;
bool isPaddle(const Controller& controller) const;
bool isTrackball(const Controller& controller) const;
private: private:
// Structure used for action menu items // Structure used for action menu items
struct ActionList { struct ActionList {
@ -596,7 +643,7 @@ class EventHandler
#else #else
REFRESH_SIZE = 0, REFRESH_SIZE = 0,
#endif #endif
EMUL_ACTIONLIST_SIZE = 176 + PNG_SIZE + COMBO_SIZE + REFRESH_SIZE, EMUL_ACTIONLIST_SIZE = 207 + PNG_SIZE + COMBO_SIZE + REFRESH_SIZE,
MENU_ACTIONLIST_SIZE = 18 MENU_ACTIONLIST_SIZE = 18
; ;

View File

@ -1254,21 +1254,18 @@ float FrameBuffer::maxWindowZoom(uInt32 baseWidth, uInt32 baseHeight) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::setCursorState() void FrameBuffer::setCursorState()
{ {
myGrabMouse = myOSystem.settings().getBool("grabmouse");
// Always grab mouse in emulation (if enabled) and emulating a controller // Always grab mouse in emulation (if enabled) and emulating a controller
// that always uses the mouse // that always uses the mouse
bool emulation = const bool emulation =
myOSystem.eventHandler().state() == EventHandlerState::EMULATION; myOSystem.eventHandler().state() == EventHandlerState::EMULATION;
bool analog = myOSystem.hasConsole() ? const bool usesLightgun = emulation && myOSystem.hasConsole() ?
(myOSystem.console().leftController().isAnalog() ||
myOSystem.console().rightController().isAnalog()) : false;
bool usesLightgun = emulation && myOSystem.hasConsole() ?
myOSystem.console().leftController().type() == Controller::Type::Lightgun || myOSystem.console().leftController().type() == Controller::Type::Lightgun ||
myOSystem.console().rightController().type() == Controller::Type::Lightgun : false; myOSystem.console().rightController().type() == Controller::Type::Lightgun : false;
bool alwaysUseMouse = BSPF::equalsIgnoreCase("always", myOSystem.settings().getString("usemouse"));
// Show/hide cursor in UI/emulation mode based on 'cursor' setting // Show/hide cursor in UI/emulation mode based on 'cursor' setting
int cursor = myOSystem.settings().getInt("cursor"); int cursor = myOSystem.settings().getInt("cursor");
// always enable cursor in lightgun games
// Always enable cursor in lightgun games
if (usesLightgun && !myGrabMouse) if (usesLightgun && !myGrabMouse)
cursor |= 1; // +Emulation cursor |= 1; // +Emulation
@ -1278,19 +1275,39 @@ void FrameBuffer::setCursorState()
showCursor(false); showCursor(false);
break; break;
case 1: case 1:
showCursor(emulation); //-UI, +Emulation showCursor(emulation); // -UI, +Emulation
myGrabMouse = false; // disable grab while cursor is shown in emulation
break; break;
case 2: // +UI, -Emulation case 2: // +UI, -Emulation
showCursor(!emulation); showCursor(!emulation);
break; break;
case 3: case 3:
showCursor(true); // +UI, +Emulation showCursor(true); // +UI, +Emulation
myGrabMouse = false; // disable grab while cursor is shown in emulation
break; break;
} }
myBackend->grabMouse(emulation && (analog || alwaysUseMouse) && myGrabMouse); myGrabMouse &= grabMouseAllowed();
myBackend->grabMouse(myGrabMouse);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FrameBuffer::grabMouseAllowed()
{
// Allow grabbing mouse in emulation (if enabled) and emulating a controller
// that always uses the mouse
bool emulation =
myOSystem.eventHandler().state() == EventHandlerState::EMULATION;
bool analog = myOSystem.hasConsole() ?
(myOSystem.console().leftController().isAnalog() ||
myOSystem.console().rightController().isAnalog()) : false;
bool usesLightgun = emulation && myOSystem.hasConsole() ?
myOSystem.console().leftController().type() == Controller::Type::Lightgun ||
myOSystem.console().rightController().type() == Controller::Type::Lightgun : false;
bool alwaysUseMouse = BSPF::equalsIgnoreCase("always", myOSystem.settings().getString("usemouse"));
// Disable grab while cursor is shown in emulation
bool cursorHidden = !(myOSystem.settings().getInt("cursor") & 1);
return emulation && (analog || usesLightgun || alwaysUseMouse) && cursorHidden;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -1301,16 +1318,25 @@ void FrameBuffer::enableGrabMouse(bool enable)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::toggleGrabMouse() void FrameBuffer::toggleGrabMouse(bool toggle)
{ {
const bool oldState = myGrabMouse; bool oldState = myGrabMouse = myOSystem.settings().getBool("grabmouse");
if(toggle)
{
if(grabMouseAllowed())
{
myGrabMouse = !myGrabMouse;
myOSystem.settings().setValue("grabmouse", myGrabMouse);
setCursorState();
}
}
else
oldState = !myGrabMouse; // display current state
myGrabMouse = !myGrabMouse;
setCursorState();
myOSystem.settings().setValue("grabmouse", myGrabMouse);
myOSystem.frameBuffer().showTextMessage(oldState != myGrabMouse ? myGrabMouse myOSystem.frameBuffer().showTextMessage(oldState != myGrabMouse ? myGrabMouse
? "Grab mouse enabled" : "Grab mouse disabled" ? "Grab mouse enabled" : "Grab mouse disabled"
: "Grab mouse not allowed while cursor shown"); : "Grab mouse not allowed");
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -252,6 +252,11 @@ class FrameBuffer
*/ */
void setCursorState(); void setCursorState();
/**
Checks if mouse grabbing is allowed.
*/
bool grabMouseAllowed();
/** /**
Sets the use of grabmouse. Sets the use of grabmouse.
*/ */
@ -260,7 +265,7 @@ class FrameBuffer
/** /**
Toggles the use of grabmouse (only has effect in emulation mode). Toggles the use of grabmouse (only has effect in emulation mode).
*/ */
void toggleGrabMouse(); void toggleGrabMouse(bool toggle = true);
/** /**
Query whether grabmouse is enabled. Query whether grabmouse is enabled.

View File

@ -153,9 +153,15 @@ bool Joystick::setMouseControl(
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Joystick::setDeadZone(int deadzone) void Joystick::setDeadZone(int deadzone)
{ {
deadzone = BSPF::clamp(deadzone, 0, 29); _DEAD_ZONE = deadZoneValue(deadzone);
}
_DEAD_ZONE = 3200 + deadzone * 1000; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int Joystick::deadZoneValue(int deadzone)
{
deadzone = BSPF::clamp(deadzone, DEAD_ZONE_MIN, DEAD_ZONE_MAX);
return 3200 + deadzone * 1000;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -30,6 +30,9 @@
class Joystick : public Controller class Joystick : public Controller
{ {
public: public:
static constexpr int DEAD_ZONE_MIN = 0;
static constexpr int DEAD_ZONE_MAX = 29;
/** /**
Create a new joystick controller plugged into the specified jack Create a new joystick controller plugged into the specified jack
@ -78,6 +81,11 @@ class Joystick : public Controller
but it seemed like the best place to put it. but it seemed like the best place to put it.
*/ */
static void setDeadZone(int deadzone); static void setDeadZone(int deadzone);
/**
Retrieves the effective deadzone value
*/
static int deadZoneValue(int deadzone);
inline static int deadzone() { return _DEAD_ZONE; } inline static int deadzone() { return _DEAD_ZONE; }
private: private:

View File

@ -416,11 +416,15 @@ void Paddles::setAnalogYCenter(int ycenter)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
float Paddles::setAnalogSensitivity(int sensitivity) float Paddles::setAnalogSensitivity(int sensitivity)
{ {
// BASE_ANALOG_SENSE * (1.1 ^ 20) = 1.0 return SENSITIVITY = analogSensitivityValue(sensitivity);
SENSITIVITY = BASE_ANALOG_SENSE * std::pow(1.1F, }
static_cast<float>(BSPF::clamp(sensitivity, 0, MAX_ANALOG_SENSE)));
return SENSITIVITY; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
float Paddles::analogSensitivityValue(int sensitivity)
{
// BASE_ANALOG_SENSE * (1.1 ^ 20) = 1.0
return BASE_ANALOG_SENSE * std::pow(1.1F,
static_cast<float>(BSPF::clamp(sensitivity, MIN_ANALOG_SENSE, MAX_ANALOG_SENSE)));
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -438,20 +442,20 @@ void Paddles::setDejitterDiff(int strength)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Paddles::setDigitalSensitivity(int sensitivity) void Paddles::setDigitalSensitivity(int sensitivity)
{ {
DIGITAL_SENSITIVITY = BSPF::clamp(sensitivity, 1, MAX_DIGITAL_SENSE); DIGITAL_SENSITIVITY = BSPF::clamp(sensitivity, MIN_DIGITAL_SENSE, MAX_DIGITAL_SENSE);
DIGITAL_DISTANCE = 20 + (DIGITAL_SENSITIVITY << 3); DIGITAL_DISTANCE = 20 + (DIGITAL_SENSITIVITY << 3);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Paddles::setMouseSensitivity(int sensitivity) void Paddles::setMouseSensitivity(int sensitivity)
{ {
MOUSE_SENSITIVITY = BSPF::clamp(sensitivity, 1, MAX_MOUSE_SENSE); MOUSE_SENSITIVITY = BSPF::clamp(sensitivity, MIN_MOUSE_SENSE, MAX_MOUSE_SENSE);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Paddles::setDigitalPaddleRange(int range) void Paddles::setDigitalPaddleRange(int range)
{ {
range = BSPF::clamp(range, 1, 100); range = BSPF::clamp(range, MIN_MOUSE_RANGE, MAX_MOUSE_RANGE);
TRIGRANGE = int(TRIGMAX * (range / 100.0)); TRIGRANGE = int(TRIGMAX * (range / 100.0));
} }

View File

@ -49,13 +49,19 @@ class Paddles : public Controller
public: public:
static constexpr float BASE_ANALOG_SENSE = 0.148643628F; static constexpr float BASE_ANALOG_SENSE = 0.148643628F;
static constexpr int MIN_ANALOG_SENSE = 0;
static constexpr int MAX_ANALOG_SENSE = 30; static constexpr int MAX_ANALOG_SENSE = 30;
static constexpr int MIN_ANALOG_CENTER = -10; static constexpr int MIN_ANALOG_CENTER = -10;
static constexpr int MAX_ANALOG_CENTER = 30; static constexpr int MAX_ANALOG_CENTER = 30;
static constexpr int MIN_DIGITAL_SENSE = 1;
static constexpr int MAX_DIGITAL_SENSE = 20; static constexpr int MAX_DIGITAL_SENSE = 20;
static constexpr int MIN_MOUSE_SENSE = 1;
static constexpr int MAX_MOUSE_SENSE = 20; static constexpr int MAX_MOUSE_SENSE = 20;
static constexpr int MIN_DEJITTER = 0; static constexpr int MIN_DEJITTER = 0;
static constexpr int MAX_DEJITTER = 10; static constexpr int MAX_DEJITTER = 10;
static constexpr int MIN_MOUSE_RANGE = 1;
static constexpr int MAX_MOUSE_RANGE = 100;
/** /**
Update the entire digital and analog pin state according to the Update the entire digital and analog pin state according to the
@ -114,6 +120,8 @@ class Paddles : public Controller
*/ */
static float setAnalogSensitivity(int sensitivity); static float setAnalogSensitivity(int sensitivity);
static float analogSensitivityValue(int sensitivity);
/** /**
@param strength Value from 0 to 10 @param strength Value from 0 to 10
*/ */

View File

@ -110,7 +110,7 @@ bool PointingDevice::setMouseControl(
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PointingDevice::setSensitivity(int sensitivity) void PointingDevice::setSensitivity(int sensitivity)
{ {
BSPF::clamp(sensitivity, 1, 20, 10); BSPF::clamp(sensitivity, MIN_SENSE, MAX_SENSE, (MIN_SENSE + MAX_SENSE) / 2);
TB_SENSITIVITY = sensitivity / 10.0F; TB_SENSITIVITY = sensitivity / 10.0F;
} }

View File

@ -39,6 +39,10 @@ class PointingDevice : public Controller
float sensitivity); float sensitivity);
~PointingDevice() override = default; ~PointingDevice() override = default;
public:
static constexpr int MIN_SENSE = 1;
static constexpr int MAX_SENSE = 20;
public: public:
using Controller::read; using Controller::read;

View File

@ -351,11 +351,11 @@ void Settings::validate()
setValue("cursor", "2"); setValue("cursor", "2");
i = getInt("psense"); i = getInt("psense");
if(i < 0|| i > Paddles::MAX_ANALOG_SENSE) if(i < Paddles::MIN_ANALOG_SENSE || i > Paddles::MAX_ANALOG_SENSE)
setValue("psense", "20"); setValue("psense", "20");
i = getInt("dsense"); i = getInt("dsense");
if(i < 1 || i > 20) if(i < Paddles::MIN_DIGITAL_SENSE || i > Paddles::MAX_DIGITAL_SENSE)
setValue("dsense", "10"); setValue("dsense", "10");
i = getInt("msense"); i = getInt("msense");

View File

@ -68,6 +68,7 @@ EventMappingWidget::EventMappingWidget(GuiObject* boss, const GUI::Font& font,
VarList::push_back(items, "Joystick", Event::Group::Joystick); VarList::push_back(items, "Joystick", Event::Group::Joystick);
VarList::push_back(items, "Paddles", Event::Group::Paddles); VarList::push_back(items, "Paddles", Event::Group::Paddles);
VarList::push_back(items, "Keyboard", Event::Group::Keyboard); VarList::push_back(items, "Keyboard", Event::Group::Keyboard);
VarList::push_back(items, "Input Devices & Ports", Event::Group::Devices);
VarList::push_back(items, "Combo", Event::Group::Combo); VarList::push_back(items, "Combo", Event::Group::Combo);
VarList::push_back(items, "Debug", Event::Group::Debug); VarList::push_back(items, "Debug", Event::Group::Debug);

View File

@ -394,6 +394,7 @@ void GameInfoDialog::addControllersTab()
"Mouse axes range ", 0, 0, fontWidth * 4, "%"); "Mouse axes range ", 0, 0, fontWidth * 4, "%");
myMouseRange->setMinValue(1); myMouseRange->setMaxValue(100); myMouseRange->setMinValue(1); myMouseRange->setMaxValue(100);
myMouseRange->setTickmarkIntervals(4); myMouseRange->setTickmarkIntervals(4);
myMouseRange->setToolTip("Adjust paddle range emulated by the mouse.");
wid.push_back(myMouseRange); wid.push_back(myMouseRange);
// Add items for tab 2 // Add items for tab 2
@ -989,6 +990,7 @@ void GameInfoDialog::saveConfig()
Paddles::setAnalogXCenter(myPaddleXCenter->getValue()); Paddles::setAnalogXCenter(myPaddleXCenter->getValue());
Paddles::setAnalogYCenter(myPaddleYCenter->getValue()); Paddles::setAnalogYCenter(myPaddleYCenter->getValue());
Paddles::setDigitalPaddleRange(myMouseRange->getValue());
} }
} }
@ -1194,9 +1196,10 @@ void GameInfoDialog::updateControllerStates()
BSPF::startsWithIgnoreCase(contrRight, "MindLink"); BSPF::startsWithIgnoreCase(contrRight, "MindLink");
myMouseControl->setEnabled(enableMouse); myMouseControl->setEnabled(enableMouse);
myMouseX->setEnabled(enableMouse); myMouseX->setEnabled(enableMouse && myMouseControl->getState());
myMouseY->setEnabled(enableMouse); myMouseY->setEnabled(enableMouse && myMouseControl->getState());
myMouseRange->setEnabled(enableMouse);
myMouseRange->setEnabled(enablePaddles);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -125,7 +125,7 @@ void HelpDialog::updateStrings(uInt8 page, uInt8 lines, string& title)
ADD_EVENT(Event::TogglePhosphor, "Toggle 'phosphor' effect"); ADD_EVENT(Event::TogglePhosphor, "Toggle 'phosphor' effect");
ADD_LINE(); ADD_LINE();
ADD_EVENT(Event::ToggleGrabMouse, "Grab mouse (keep in window)"); ADD_EVENT(Event::ToggleGrabMouse, "Grab mouse (keep in window)");
ADD_EVENT(Event::HandleMouseControl, "Toggle controller for mouse"); ADD_EVENT(Event::NextMouseControl, "Toggle controller for mouse");
ADD_EVENT(Event::ToggleSAPortOrder, "Toggle Stelladaptor left/right"); ADD_EVENT(Event::ToggleSAPortOrder, "Toggle Stelladaptor left/right");
ADD_LINE(); ADD_LINE();
ADD_EVENT(Event::VolumeIncrease, "Increase volume by 2%"); ADD_EVENT(Event::VolumeIncrease, "Increase volume by 2%");

View File

@ -126,7 +126,8 @@ void InputDialog::addDevicePortTab()
// Add joystick deadzone setting // Add joystick deadzone setting
myDeadzone = new SliderWidget(myTab, _font, HBORDER, ypos - 1, 13 * fontWidth, lineHeight, myDeadzone = new SliderWidget(myTab, _font, HBORDER, ypos - 1, 13 * fontWidth, lineHeight,
"Joystick deadzone size", lwidth, kDeadzoneChanged, 5 * fontWidth); "Joystick deadzone size", lwidth, kDeadzoneChanged, 5 * fontWidth);
myDeadzone->setMinValue(0); myDeadzone->setMaxValue(29); myDeadzone->setMinValue(Joystick::DEAD_ZONE_MIN);
myDeadzone->setMaxValue(Joystick::DEAD_ZONE_MAX);
myDeadzone->setTickmarkIntervals(4); myDeadzone->setTickmarkIntervals(4);
wid.push_back(myDeadzone); wid.push_back(myDeadzone);
@ -152,6 +153,8 @@ void InputDialog::addDevicePortTab()
myDejitterBase->setMinValue(Paddles::MIN_DEJITTER); myDejitterBase->setMinValue(Paddles::MIN_DEJITTER);
myDejitterBase->setMaxValue(Paddles::MAX_DEJITTER); myDejitterBase->setMaxValue(Paddles::MAX_DEJITTER);
myDejitterBase->setTickmarkIntervals(5); myDejitterBase->setTickmarkIntervals(5);
myDejitterBase->setToolTip("Adjust paddle input averaging.\n"
"Note: Already implemented in 2600-daptor");
//xpos += myDejitterBase->getWidth() + fontWidth - 4; //xpos += myDejitterBase->getWidth() + fontWidth - 4;
wid.push_back(myDejitterBase); wid.push_back(myDejitterBase);
@ -162,6 +165,7 @@ void InputDialog::addDevicePortTab()
myDejitterDiff->setMinValue(Paddles::MIN_DEJITTER); myDejitterDiff->setMinValue(Paddles::MIN_DEJITTER);
myDejitterDiff->setMaxValue(Paddles::MAX_DEJITTER); myDejitterDiff->setMaxValue(Paddles::MAX_DEJITTER);
myDejitterDiff->setTickmarkIntervals(5); myDejitterDiff->setTickmarkIntervals(5);
myDejitterDiff->setToolTip("Adjust paddle reaction to fast movements.");
wid.push_back(myDejitterDiff); wid.push_back(myDejitterDiff);
// Add paddle speed (digital emulation) // Add paddle speed (digital emulation)
@ -403,14 +407,7 @@ void InputDialog::saveConfig()
{ {
Settings& settings = instance().settings(); Settings& settings = instance().settings();
// Left & right ports // *** Device & Ports ***
instance().eventHandler().mapStelladaptors(mySAPort->getState() ? "rl": "lr");
// Use mouse as a controller
const string& usemouse = myMouseControl->getSelectedTag().toString();
settings.setValue("usemouse", usemouse);
instance().eventHandler().setMouseControllerMode(usemouse);
// Joystick deadzone // Joystick deadzone
int deadzone = myDeadzone->getValue(); int deadzone = myDeadzone->getValue();
settings.setValue("joydeadzone", deadzone); settings.setValue("joydeadzone", deadzone);
@ -433,6 +430,31 @@ void InputDialog::saveConfig()
settings.setValue("dsense", sensitivity); settings.setValue("dsense", sensitivity);
Paddles::setDigitalSensitivity(sensitivity); Paddles::setDigitalSensitivity(sensitivity);
// Autofire rate
int rate = myAutoFireRate->getValue();
settings.setValue("autofirerate", rate);
Controller::setAutoFireRate(rate);
// Allow all 4 joystick directions
bool allowall4 = myAllowAll4->getState();
settings.setValue("joyallow4", allowall4);
instance().eventHandler().allowAllDirections(allowall4);
// Enable/disable modifier key-combos
settings.setValue("modcombo", myModCombo->getState());
// Left & right ports
instance().eventHandler().mapStelladaptors(mySAPort->getState() ? "rl" : "lr");
// AtariVox serial port
settings.setValue("avoxport", myAVoxPort->getText());
// *** Mouse ***
// Use mouse as a controller
const string& usemouse = myMouseControl->getSelectedTag().toString();
settings.setValue("usemouse", usemouse);
instance().eventHandler().setMouseControllerMode(usemouse);
sensitivity = myMPaddleSpeed->getValue(); sensitivity = myMPaddleSpeed->getValue();
settings.setValue("msense", sensitivity); settings.setValue("msense", sensitivity);
Paddles::setMouseSensitivity(sensitivity); Paddles::setMouseSensitivity(sensitivity);
@ -447,22 +469,10 @@ void InputDialog::saveConfig()
settings.setValue("dcsense", sensitivity); settings.setValue("dcsense", sensitivity);
Driving::setSensitivity(sensitivity); Driving::setSensitivity(sensitivity);
// Autofire rate
int rate = myAutoFireRate->getValue();
settings.setValue("autofirerate", rate);
Controller::setAutoFireRate(rate);
// AtariVox serial port
settings.setValue("avoxport", myAVoxPort->getText());
// Allow all 4 joystick directions
bool allowall4 = myAllowAll4->getState();
settings.setValue("joyallow4", allowall4);
instance().eventHandler().allowAllDirections(allowall4);
// Grab mouse and hide cursor // Grab mouse and hide cursor
const string& cursor = myCursorState->getSelectedTag().toString(); const string& cursor = myCursorState->getSelectedTag().toString();
settings.setValue("cursor", cursor); settings.setValue("cursor", cursor);
// only allow grab mouse if cursor is hidden in emulation // only allow grab mouse if cursor is hidden in emulation
int state = myCursorState->getSelected(); int state = myCursorState->getSelected();
bool enableGrab = state != 1 && state != 3; bool enableGrab = state != 1 && state != 3;
@ -470,9 +480,6 @@ void InputDialog::saveConfig()
settings.setValue("grabmouse", grab); settings.setValue("grabmouse", grab);
instance().frameBuffer().enableGrabMouse(grab); instance().frameBuffer().enableGrabMouse(grab);
// Enable/disable modifier key-combos
settings.setValue("modcombo", myModCombo->getState());
instance().eventHandler().saveKeyMapping(); instance().eventHandler().saveKeyMapping();
instance().eventHandler().saveJoyMapping(); instance().eventHandler().saveJoyMapping();
// instance().saveConfig(); // instance().saveConfig();
@ -668,7 +675,7 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd,
break; break;
case kDeadzoneChanged: case kDeadzoneChanged:
myDeadzone->setValueLabel(3200 + 1000 * myDeadzone->getValue()); myDeadzone->setValueLabel(Joystick::deadZoneValue(myDeadzone->getValue()));
break; break;
case kPSpeedChanged: case kPSpeedChanged:

View File

@ -219,6 +219,7 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
xpos = _w - HBORDER - font.getStringWidth("Follow Launcher path") - CheckboxWidget::prefixSize(font) - 1; xpos = _w - HBORDER - font.getStringWidth("Follow Launcher path") - CheckboxWidget::prefixSize(font) - 1;
ypos += lineHeight + VGAP * 2; ypos += lineHeight + VGAP * 2;
myFollowLauncherWidget = new CheckboxWidget(myTab, font, xpos, ypos, "Follow Launcher path"); myFollowLauncherWidget = new CheckboxWidget(myTab, font, xpos, ypos, "Follow Launcher path");
myFollowLauncherWidget->setToolTip("The ROM path is updated during Launcher navigation.");
wid.push_back(myFollowLauncherWidget); wid.push_back(myFollowLauncherWidget);
xpos = HBORDER; xpos = HBORDER;
@ -272,6 +273,7 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
bwidth = font.getStringWidth("Image path" + ELLIPSIS) + fontWidth * 2 + 1; bwidth = font.getStringWidth("Image path" + ELLIPSIS) + fontWidth * 2 + 1;
myOpenBrowserButton = new ButtonWidget(myTab, font, xpos, ypos, bwidth, buttonHeight, myOpenBrowserButton = new ButtonWidget(myTab, font, xpos, ypos, bwidth, buttonHeight,
"Image path" + ELLIPSIS, kChooseSnapLoadDirCmd); "Image path" + ELLIPSIS, kChooseSnapLoadDirCmd);
myOpenBrowserButton->setToolTip("Select path for snapshot images used in Launcher.");
wid.push_back(myOpenBrowserButton); wid.push_back(myOpenBrowserButton);
mySnapLoadPath = new EditTextWidget(myTab, font, HBORDER + lwidth, mySnapLoadPath = new EditTextWidget(myTab, font, HBORDER + lwidth,

View File

@ -48,8 +48,7 @@ WhatsNewDialog::WhatsNewDialog(OSystem& osystem, DialogContainer& parent, const
add(ypos, "fixed autofire bug for trackball controllers"); add(ypos, "fixed autofire bug for trackball controllers");
#else #else
add(ypos, "added high scores saving"); add(ypos, "added high scores saving");
add(ypos, "enhanced cut/copy/paste for text editing"); add(ypos, "enhanced cut/copy/paste and undo/redo for text editing");
add(ypos, "added undo and redo to text editing");
add(ypos, "added wildcard support to launcher dialog filter"); add(ypos, "added wildcard support to launcher dialog filter");
add(ypos, "added option to search subdirectories in launcher"); add(ypos, "added option to search subdirectories in launcher");
add(ypos, "added tooltips to many UI items"); add(ypos, "added tooltips to many UI items");

View File

@ -1521,6 +1521,7 @@
<ClInclude Include="..\common\FSNodeZIP.hxx" /> <ClInclude Include="..\common\FSNodeZIP.hxx" />
<ClInclude Include="..\common\HighScoresManager.hxx" /> <ClInclude Include="..\common\HighScoresManager.hxx" />
<ClInclude Include="..\common\JoyMap.hxx" /> <ClInclude Include="..\common\JoyMap.hxx" />
<ClInclude Include="..\common\jsonDefinitions.hxx" />
<ClInclude Include="..\common\KeyMap.hxx" /> <ClInclude Include="..\common\KeyMap.hxx" />
<ClInclude Include="..\common\LinkedObjectPool.hxx" /> <ClInclude Include="..\common\LinkedObjectPool.hxx" />
<ClInclude Include="..\common\Logger.hxx" /> <ClInclude Include="..\common\Logger.hxx" />

View File

@ -2162,6 +2162,9 @@
<ClInclude Include="..\json\json_lib.hxx"> <ClInclude Include="..\json\json_lib.hxx">
<Filter>Header Files\json</Filter> <Filter>Header Files\json</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\common\jsonDefinitions.hxx">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="stella.ico"> <None Include="stella.ico">