mirror of https://github.com/stella-emu/stella.git
finalized new paddle settings
This commit is contained in:
parent
fb41c41470
commit
4d78865ab2
|
@ -21,6 +21,8 @@
|
||||||
|
|
||||||
* Added web links for many games
|
* Added web links for many games
|
||||||
|
|
||||||
|
* Added dead zone and linearity settings for analog controllers
|
||||||
|
|
||||||
* Fixed MindLink controller
|
* Fixed MindLink controller
|
||||||
|
|
||||||
* Added TIA randomization on startup option
|
* Added TIA randomization on startup option
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
|
@ -1607,12 +1607,12 @@
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><i>Decrease</i> analog paddle acceleration</td>
|
<td><i>Decrease</i> analog paddle linearity</td>
|
||||||
<td>Shift-Control-Alt + F2</td>
|
<td>Shift-Control-Alt + F2</td>
|
||||||
<td>Shift-Control-Cmd + F2</td>
|
<td>Shift-Control-Cmd + F2</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><i>Increase</i> analog paddle acceleration</td>
|
<td><i>Increase</i> analog paddle linearity</td>
|
||||||
<td>Control-Alt + F2</td>
|
<td>Control-Alt + F2</td>
|
||||||
<td>Control-Cmd + F2</td>
|
<td>Control-Cmd + F2</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -2965,29 +2965,31 @@
|
||||||
<td>Set the joystick axis dead zone area for analog joysticks/gamepads
|
<td>Set the joystick axis dead zone area for analog joysticks/gamepads
|
||||||
emulating digital controllers.
|
emulating digital controllers.
|
||||||
All values within the dead zone are treated as zero-axis values,
|
All values within the dead zone are treated as zero-axis values,
|
||||||
while only those values outside are registered as valid input.
|
while only those values outside are registered as valid input.</br>
|
||||||
Dead zone is calculated as 3200 + value * 1000. So the possible dead
|
Dead zone is calculated as 3200 + value * 1000. So the possible dead
|
||||||
zone values range from 3200 to 32200 (= 10% - 98%).</td>
|
zone values range from 3200 to 32200 (= 10% - 98%).</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><pre>-adeadzone <0 - 16500></pre></td>
|
<td><pre>-adeadzone <0 - 29></pre></td>
|
||||||
<td>Set the joystick axis dead zone area for analog joysticks/gamepads
|
<td>Set the joystick axis dead zone area for analog joysticks/gamepads
|
||||||
emulating analog controllers. All values within the
|
emulating analog controllers. All values within the dead zone are
|
||||||
dead zone are treated as zero-axis values, while only those values
|
treated as zero-axis values, while only those values outside are
|
||||||
outside are registered as valid input. Range: 0% - 50%</td>
|
registered as valid input. </br>
|
||||||
|
Dead zone is calculated as value * 565. So the possible dead zone
|
||||||
|
values range from 0 to 16384 (= 0% - 50%)</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><pre>-psense <number></pre></td>
|
<td><pre>-psense <0 - 30></pre></td>
|
||||||
<td>Sensitivity for emulation of paddles when using analog paddles.
|
<td>Sensitivity for emulation of paddles when using analog controllers.
|
||||||
Valid range of values is from 0 to 30, with larger numbers causing
|
Larger numbers are causing faster movement.</td>
|
||||||
faster movement.</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><pre>-paccel <0 - 100></pre></td>
|
<td><pre>-plinear <25 - 100></pre></td>
|
||||||
<td>Acceleration of analog paddles while moving them fast.</td>
|
<td>Linearity of analog paddles. Lower numbers allow finer control
|
||||||
|
around the paddle center.</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -4036,8 +4038,8 @@
|
||||||
<tr><td>Analog dead zone size</td><td>Dead zone area for axes on joysticks/gamepads emulating
|
<tr><td>Analog dead zone size</td><td>Dead zone area for axes on joysticks/gamepads emulating
|
||||||
analog controllers
|
analog controllers
|
||||||
</td><td>-adeadzone</td></tr>
|
</td><td>-adeadzone</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 analog paddles</td><td>-psense</td></tr>
|
||||||
<tr><td>(Analog paddle) Acceleration</td><td>Acceleration of analog paddles when moving them fast</td><td>-paccel</td></tr>
|
<tr><td>(Analog paddle) Linearity</td><td>Linearity of analog paddles</td><td>-plinear</td></tr>
|
||||||
<tr><td>(Analog paddle) Dejitter averaging</td><td>Strength of paddle input averaging, suppresses paddle jitter<br>
|
<tr><td>(Analog paddle) Dejitter averaging</td><td>Strength of paddle input averaging, suppresses paddle jitter<br>
|
||||||
Note: The 2600-daptor has built-in dejitter, so there should be no need to use Stella's dejitter.
|
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>
|
</td><td>-dejitter.base</td></tr>
|
||||||
|
|
|
@ -789,22 +789,7 @@ void PhysicalJoystickHandler::handleRegularAxisEvent(const PhysicalJoystickPtr j
|
||||||
if((abs(j->axisLastValue[axis] - value) < 30000)
|
if((abs(j->axisLastValue[axis] - value) < 30000)
|
||||||
&& (eventAxisAnalog = j->joyMap.get(EventMode::kEmulationMode, button, JoyAxis(axis), JoyDir::ANALOG)) != Event::Type::NoType)
|
&& (eventAxisAnalog = j->joyMap.get(EventMode::kEmulationMode, button, JoyAxis(axis), JoyDir::ANALOG)) != Event::Type::NoType)
|
||||||
{
|
{
|
||||||
// TODO: TEST!!!
|
|
||||||
if(abs(value) > Controller::analogDeadZone())
|
|
||||||
myHandler.handleEvent(eventAxisAnalog, value);
|
myHandler.handleEvent(eventAxisAnalog, value);
|
||||||
else
|
|
||||||
{
|
|
||||||
// Treat any dead zone value as zero
|
|
||||||
value = 0;
|
|
||||||
|
|
||||||
// Now filter out consecutive, similar values
|
|
||||||
// (only pass on the event if the state has changed)
|
|
||||||
if(j->axisLastValue[axis] != value)
|
|
||||||
{
|
|
||||||
// Turn off events
|
|
||||||
myHandler.handleEvent(eventAxisAnalog, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -978,13 +963,14 @@ void PhysicalJoystickHandler::changeDigitalDeadZone(int direction)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void PhysicalJoystickHandler::changeAnalogPaddleDeadZone(int direction)
|
void PhysicalJoystickHandler::changeAnalogPaddleDeadZone(int direction)
|
||||||
{
|
{
|
||||||
int deadZone = BSPF::clamp(myOSystem.settings().getInt("adeadzone") + direction * 500,
|
int deadZone = BSPF::clamp(myOSystem.settings().getInt("adeadzone") + direction,
|
||||||
Controller::MIN_ANALOG_DEADZONE, Controller::MAX_ANALOG_DEADZONE);
|
Controller::MIN_ANALOG_DEADZONE, Controller::MAX_ANALOG_DEADZONE);
|
||||||
myOSystem.settings().setValue("adeadzone", deadZone);
|
myOSystem.settings().setValue("adeadzone", deadZone);
|
||||||
|
|
||||||
Controller::setAnalogDeadZone(deadZone);
|
Controller::setAnalogDeadZone(deadZone);
|
||||||
|
|
||||||
ostringstream ss;
|
ostringstream ss;
|
||||||
ss << std::round(deadZone * 100.F / 32768) << "%";
|
ss << std::round(Controller::analogDeadZoneValue(deadZone) * 100.F / 32768) << "%";
|
||||||
|
|
||||||
myOSystem.frameBuffer().showGaugeMessage("Analog controller dead zone", ss.str(), deadZone,
|
myOSystem.frameBuffer().showGaugeMessage("Analog controller dead zone", ss.str(), deadZone,
|
||||||
Controller::MIN_ANALOG_DEADZONE, Controller::MAX_ANALOG_DEADZONE);
|
Controller::MIN_ANALOG_DEADZONE, Controller::MAX_ANALOG_DEADZONE);
|
||||||
|
@ -1007,22 +993,22 @@ void PhysicalJoystickHandler::changeAnalogPaddleSensitivity(int direction)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void PhysicalJoystickHandler::changeAnalogPaddleAcceleration(int direction)
|
void PhysicalJoystickHandler::changeAnalogPaddleLinearity(int direction)
|
||||||
{
|
{
|
||||||
int accel = BSPF::clamp(myOSystem.settings().getInt("paccel") + direction * 5,
|
int linear = BSPF::clamp(myOSystem.settings().getInt("plinear") + direction * 5,
|
||||||
Paddles::MIN_ANALOG_ACCEL, Paddles::MAX_ANALOG_ACCEL);
|
Paddles::MIN_ANALOG_LINEARITY, Paddles::MAX_ANALOG_LINEARITY);
|
||||||
myOSystem.settings().setValue("paccel", accel);
|
myOSystem.settings().setValue("plinear", linear);
|
||||||
|
|
||||||
Paddles::setAnalogAccel(accel);
|
Paddles::setAnalogLinearity(linear);
|
||||||
|
|
||||||
ostringstream ss;
|
ostringstream ss;
|
||||||
if(accel)
|
if(linear)
|
||||||
ss << accel << "%";
|
ss << linear << "%";
|
||||||
else
|
else
|
||||||
ss << "Off";
|
ss << "Off";
|
||||||
|
|
||||||
myOSystem.frameBuffer().showGaugeMessage("Analog paddle acceleration", ss.str(), accel,
|
myOSystem.frameBuffer().showGaugeMessage("Analog paddle linearity", ss.str(), linear,
|
||||||
Paddles::MIN_ANALOG_ACCEL, Paddles::MAX_ANALOG_ACCEL);
|
Paddles::MIN_ANALOG_LINEARITY, Paddles::MAX_ANALOG_LINEARITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -113,7 +113,7 @@ class PhysicalJoystickHandler
|
||||||
void changeDigitalDeadZone(int direction = +1);
|
void changeDigitalDeadZone(int direction = +1);
|
||||||
void changeAnalogPaddleDeadZone(int direction = +1);
|
void changeAnalogPaddleDeadZone(int direction = +1);
|
||||||
void changeAnalogPaddleSensitivity(int direction = +1);
|
void changeAnalogPaddleSensitivity(int direction = +1);
|
||||||
void changeAnalogPaddleAcceleration(int direction = +1);
|
void changeAnalogPaddleLinearity(int direction = +1);
|
||||||
void changePaddleDejitterAveraging(int direction = +1);
|
void changePaddleDejitterAveraging(int direction = +1);
|
||||||
void changePaddleDejitterReaction(int direction = +1);
|
void changePaddleDejitterReaction(int direction = +1);
|
||||||
void changeDigitalPaddleSensitivity(int direction = +1);
|
void changeDigitalPaddleSensitivity(int direction = +1);
|
||||||
|
|
|
@ -693,8 +693,8 @@ PhysicalKeyboardHandler::DefaultCommonMapping = {
|
||||||
{ Event::IncAnalogDeadzone, KBDK_F1, KBDM_CTRL | MOD3},
|
{ Event::IncAnalogDeadzone, KBDK_F1, KBDM_CTRL | MOD3},
|
||||||
{ Event::DecAnalogSense, KBDK_F2, KBDM_CTRL | KBDM_SHIFT },
|
{ Event::DecAnalogSense, KBDK_F2, KBDM_CTRL | KBDM_SHIFT },
|
||||||
{ Event::IncAnalogSense, KBDK_F2, KBDM_CTRL },
|
{ Event::IncAnalogSense, KBDK_F2, KBDM_CTRL },
|
||||||
{ Event::DecAnalogAccel, KBDK_F2, KBDM_CTRL | MOD3 | KBDM_SHIFT},
|
{ Event::DecAnalogLinear, KBDK_F2, KBDM_CTRL | MOD3 | KBDM_SHIFT},
|
||||||
{ Event::IncAnalogAccel, KBDK_F2, KBDM_CTRL | MOD3},
|
{ Event::IncAnalogLinear, KBDK_F2, KBDM_CTRL | MOD3},
|
||||||
{ Event::DecDejtterAveraging, KBDK_F3, KBDM_CTRL | KBDM_SHIFT },
|
{ Event::DecDejtterAveraging, KBDK_F3, KBDM_CTRL | KBDM_SHIFT },
|
||||||
{ Event::IncDejtterAveraging, KBDK_F3, KBDM_CTRL },
|
{ Event::IncDejtterAveraging, KBDK_F3, KBDM_CTRL },
|
||||||
{ Event::DecDejtterReaction, KBDK_F4, KBDM_CTRL | KBDM_SHIFT },
|
{ Event::DecDejtterReaction, KBDK_F4, KBDM_CTRL | KBDM_SHIFT },
|
||||||
|
|
|
@ -199,8 +199,8 @@ NLOHMANN_JSON_SERIALIZE_ENUM(Event::Type, {
|
||||||
{Event::IncAnalogDeadzone, "IncAnalogDeadzone"},
|
{Event::IncAnalogDeadzone, "IncAnalogDeadzone"},
|
||||||
{Event::DecAnalogSense, "DecAnalogSense"},
|
{Event::DecAnalogSense, "DecAnalogSense"},
|
||||||
{Event::IncAnalogSense, "IncAnalogSense"},
|
{Event::IncAnalogSense, "IncAnalogSense"},
|
||||||
{Event::DecAnalogAccel, "DecAnalogAccel"},
|
{Event::DecAnalogLinear, "DecAnalogLinear"},
|
||||||
{Event::IncAnalogAccel, "IncAnalogAccel"},
|
{Event::IncAnalogLinear, "IncAnalogLinear"},
|
||||||
{Event::DecDejtterAveraging, "DecDejtterAveraging"},
|
{Event::DecDejtterAveraging, "DecDejtterAveraging"},
|
||||||
{Event::IncDejtterAveraging, "IncDejtterAveraging"},
|
{Event::IncDejtterAveraging, "IncDejtterAveraging"},
|
||||||
{Event::DecDejtterReaction, "DecDejtterReaction"},
|
{Event::DecDejtterReaction, "DecDejtterReaction"},
|
||||||
|
|
|
@ -165,9 +165,18 @@ int Controller::digitalDeadZoneValue(int deadZone)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Controller::setAnalogDeadZone(int deadZone)
|
void Controller::setAnalogDeadZone(int deadZone)
|
||||||
{
|
{
|
||||||
ANALOG_DEAD_ZONE = BSPF::clamp(deadZone, MIN_ANALOG_DEADZONE, MAX_ANALOG_DEADZONE);
|
ANALOG_DEAD_ZONE = analogDeadZoneValue(deadZone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
int Controller::analogDeadZoneValue(int deadZone)
|
||||||
|
{
|
||||||
|
deadZone = BSPF::clamp(deadZone, MIN_ANALOG_DEADZONE, MAX_ANALOG_DEADZONE);
|
||||||
|
|
||||||
|
return deadZone * std::round(32768 / 2. / MAX_DIGITAL_DEADZONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Controller::setMouseSensitivity(int sensitivity)
|
void Controller::setMouseSensitivity(int sensitivity)
|
||||||
{
|
{
|
||||||
|
|
|
@ -74,7 +74,7 @@ class Controller : public Serializable
|
||||||
static constexpr int MIN_DIGITAL_DEADZONE = 0;
|
static constexpr int MIN_DIGITAL_DEADZONE = 0;
|
||||||
static constexpr int MAX_DIGITAL_DEADZONE = 29;
|
static constexpr int MAX_DIGITAL_DEADZONE = 29;
|
||||||
static constexpr int MIN_ANALOG_DEADZONE = 0;
|
static constexpr int MIN_ANALOG_DEADZONE = 0;
|
||||||
static constexpr int MAX_ANALOG_DEADZONE = 16500;
|
static constexpr int MAX_ANALOG_DEADZONE = 29;
|
||||||
static constexpr int MIN_MOUSE_SENSE = 1;
|
static constexpr int MIN_MOUSE_SENSE = 1;
|
||||||
static constexpr int MAX_MOUSE_SENSE = 20;
|
static constexpr int MAX_MOUSE_SENSE = 20;
|
||||||
|
|
||||||
|
@ -290,7 +290,7 @@ class Controller : public Serializable
|
||||||
/**
|
/**
|
||||||
Sets the dead zone for analog paddles.
|
Sets the dead zone for analog paddles.
|
||||||
|
|
||||||
@param deadZone Value from 0 to 16500
|
@param deadZone Value from 0 to 29
|
||||||
*/
|
*/
|
||||||
static void setAnalogDeadZone(int deadZone);
|
static void setAnalogDeadZone(int deadZone);
|
||||||
|
|
||||||
|
@ -299,6 +299,11 @@ class Controller : public Serializable
|
||||||
*/
|
*/
|
||||||
static int digitalDeadZoneValue(int deadZone);
|
static int digitalDeadZoneValue(int deadZone);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Retrieves the effective analog dead zone value
|
||||||
|
*/
|
||||||
|
static int Controller::analogDeadZoneValue(int deadZone);
|
||||||
|
|
||||||
inline static int digitalDeadZone() { return DIGITAL_DEAD_ZONE; }
|
inline static int digitalDeadZone() { return DIGITAL_DEAD_ZONE; }
|
||||||
|
|
||||||
inline static int analogDeadZone() { return ANALOG_DEAD_ZONE; }
|
inline static int analogDeadZone() { return ANALOG_DEAD_ZONE; }
|
||||||
|
|
|
@ -149,7 +149,7 @@ class Event
|
||||||
DecreaseDeadzone, IncreaseDeadzone,
|
DecreaseDeadzone, IncreaseDeadzone,
|
||||||
DecAnalogDeadzone, IncAnalogDeadzone,
|
DecAnalogDeadzone, IncAnalogDeadzone,
|
||||||
DecAnalogSense, IncAnalogSense,
|
DecAnalogSense, IncAnalogSense,
|
||||||
DecAnalogAccel, IncAnalogAccel,
|
DecAnalogLinear, IncAnalogLinear,
|
||||||
DecDejtterAveraging, IncDejtterAveraging,
|
DecDejtterAveraging, IncDejtterAveraging,
|
||||||
DecDejtterReaction, IncDejtterReaction,
|
DecDejtterReaction, IncDejtterReaction,
|
||||||
DecDigitalSense, IncDigitalSense,
|
DecDigitalSense, IncDigitalSense,
|
||||||
|
|
|
@ -101,7 +101,7 @@ void EventHandler::initialize()
|
||||||
|
|
||||||
Controller::setDigitalDeadZone(myOSystem.settings().getInt("joydeadzone"));
|
Controller::setDigitalDeadZone(myOSystem.settings().getInt("joydeadzone"));
|
||||||
Controller::setAnalogDeadZone(myOSystem.settings().getInt("adeadzone"));
|
Controller::setAnalogDeadZone(myOSystem.settings().getInt("adeadzone"));
|
||||||
Paddles::setAnalogAccel(myOSystem.settings().getInt("paccel"));
|
Paddles::setAnalogLinearity(myOSystem.settings().getInt("plinear"));
|
||||||
Paddles::setDejitterDiff(myOSystem.settings().getInt("dejitter.diff"));
|
Paddles::setDejitterDiff(myOSystem.settings().getInt("dejitter.diff"));
|
||||||
Paddles::setDejitterBase(myOSystem.settings().getInt("dejitter.base"));
|
Paddles::setDejitterBase(myOSystem.settings().getInt("dejitter.base"));
|
||||||
Paddles::setDejitterDiff(myOSystem.settings().getInt("dejitter.diff"));
|
Paddles::setDejitterDiff(myOSystem.settings().getInt("dejitter.diff"));
|
||||||
|
@ -461,7 +461,7 @@ bool EventHandler::skipInputSetting() const
|
||||||
|| (!paddle
|
|| (!paddle
|
||||||
&& (myAdjustSetting == AdjustSetting::ANALOG_DEADZONE
|
&& (myAdjustSetting == AdjustSetting::ANALOG_DEADZONE
|
||||||
|| myAdjustSetting == AdjustSetting::ANALOG_SENSITIVITY
|
|| myAdjustSetting == AdjustSetting::ANALOG_SENSITIVITY
|
||||||
|| myAdjustSetting == AdjustSetting::ANALOG_ACCEL
|
|| myAdjustSetting == AdjustSetting::ANALOG_LINEARITY
|
||||||
|| myAdjustSetting == AdjustSetting::DEJITTER_AVERAGING
|
|| myAdjustSetting == AdjustSetting::DEJITTER_AVERAGING
|
||||||
|| myAdjustSetting == AdjustSetting::DEJITTER_REACTION
|
|| myAdjustSetting == AdjustSetting::DEJITTER_REACTION
|
||||||
|| myAdjustSetting == AdjustSetting::DIGITAL_SENSITIVITY
|
|| myAdjustSetting == AdjustSetting::DIGITAL_SENSITIVITY
|
||||||
|
@ -599,7 +599,7 @@ AdjustFunction EventHandler::getAdjustSetting(AdjustSetting setting)
|
||||||
std::bind(&PhysicalJoystickHandler::changeDigitalDeadZone, &joyHandler(), _1),
|
std::bind(&PhysicalJoystickHandler::changeDigitalDeadZone, &joyHandler(), _1),
|
||||||
std::bind(&PhysicalJoystickHandler::changeAnalogPaddleDeadZone, &joyHandler(), _1),
|
std::bind(&PhysicalJoystickHandler::changeAnalogPaddleDeadZone, &joyHandler(), _1),
|
||||||
std::bind(&PhysicalJoystickHandler::changeAnalogPaddleSensitivity, &joyHandler(), _1),
|
std::bind(&PhysicalJoystickHandler::changeAnalogPaddleSensitivity, &joyHandler(), _1),
|
||||||
std::bind(&PhysicalJoystickHandler::changeAnalogPaddleAcceleration, &joyHandler(), _1),
|
std::bind(&PhysicalJoystickHandler::changeAnalogPaddleLinearity, &joyHandler(), _1),
|
||||||
std::bind(&PhysicalJoystickHandler::changePaddleDejitterAveraging, &joyHandler(), _1),
|
std::bind(&PhysicalJoystickHandler::changePaddleDejitterAveraging, &joyHandler(), _1),
|
||||||
std::bind(&PhysicalJoystickHandler::changePaddleDejitterReaction, &joyHandler(), _1),
|
std::bind(&PhysicalJoystickHandler::changePaddleDejitterReaction, &joyHandler(), _1),
|
||||||
std::bind(&PhysicalJoystickHandler::changeDigitalPaddleSensitivity, &joyHandler(), _1),
|
std::bind(&PhysicalJoystickHandler::changeDigitalPaddleSensitivity, &joyHandler(), _1),
|
||||||
|
@ -1415,20 +1415,20 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Event::DecAnalogAccel:
|
case Event::DecAnalogLinear:
|
||||||
if(pressed)
|
if(pressed)
|
||||||
{
|
{
|
||||||
myPJoyHandler->changeAnalogPaddleAcceleration(-1);
|
myPJoyHandler->changeAnalogPaddleLinearity(-1);
|
||||||
myAdjustSetting = AdjustSetting::ANALOG_ACCEL;
|
myAdjustSetting = AdjustSetting::ANALOG_LINEARITY;
|
||||||
myAdjustActive = true;
|
myAdjustActive = true;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Event::IncAnalogAccel:
|
case Event::IncAnalogLinear:
|
||||||
if(pressed)
|
if(pressed)
|
||||||
{
|
{
|
||||||
myPJoyHandler->changeAnalogPaddleAcceleration(+1);
|
myPJoyHandler->changeAnalogPaddleLinearity(+1);
|
||||||
myAdjustSetting = AdjustSetting::ANALOG_ACCEL;
|
myAdjustSetting = AdjustSetting::ANALOG_LINEARITY;
|
||||||
myAdjustActive = true;
|
myAdjustActive = true;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -3328,8 +3328,8 @@ EventHandler::EmulActionList EventHandler::ourEmulActionList = { {
|
||||||
{ Event::IncAnalogDeadzone, "Increase analog dead zone", "" },
|
{ Event::IncAnalogDeadzone, "Increase analog dead zone", "" },
|
||||||
{ Event::DecAnalogSense, "Decrease analog paddle sensitivity", "" },
|
{ Event::DecAnalogSense, "Decrease analog paddle sensitivity", "" },
|
||||||
{ Event::IncAnalogSense, "Increase analog paddle sensitivity", "" },
|
{ Event::IncAnalogSense, "Increase analog paddle sensitivity", "" },
|
||||||
{ Event::DecAnalogAccel, "Decrease analog paddle acceleration", "" },
|
{ Event::DecAnalogLinear, "Decrease analog paddle linearity", "" },
|
||||||
{ Event::IncAnalogAccel, "Increase analog paddle acceleration", "" },
|
{ Event::IncAnalogLinear, "Increase analog paddle linearity", "" },
|
||||||
{ Event::DecDejtterAveraging, "Decrease paddle dejitter averaging", "" },
|
{ Event::DecDejtterAveraging, "Decrease paddle dejitter averaging", "" },
|
||||||
{ Event::IncDejtterAveraging, "Increase paddle dejitter averaging", "" },
|
{ Event::IncDejtterAveraging, "Increase paddle dejitter averaging", "" },
|
||||||
{ Event::DecDejtterReaction, "Decrease paddle dejitter reaction", "" },
|
{ Event::DecDejtterReaction, "Decrease paddle dejitter reaction", "" },
|
||||||
|
@ -3515,7 +3515,7 @@ const Event::EventSet EventHandler::DevicesEvents = {
|
||||||
Event::DecreaseDeadzone, Event::IncreaseDeadzone,
|
Event::DecreaseDeadzone, Event::IncreaseDeadzone,
|
||||||
Event::DecAnalogDeadzone, Event::IncAnalogDeadzone,
|
Event::DecAnalogDeadzone, Event::IncAnalogDeadzone,
|
||||||
Event::DecAnalogSense, Event::IncAnalogSense,
|
Event::DecAnalogSense, Event::IncAnalogSense,
|
||||||
Event::DecAnalogAccel, Event::IncAnalogAccel,
|
Event::DecAnalogLinear, Event::IncAnalogLinear,
|
||||||
Event::DecDejtterAveraging, Event::IncDejtterAveraging,
|
Event::DecDejtterAveraging, Event::IncDejtterAveraging,
|
||||||
Event::DecDejtterReaction, Event::IncDejtterReaction,
|
Event::DecDejtterReaction, Event::IncDejtterReaction,
|
||||||
Event::DecDigitalSense, Event::IncDigitalSense,
|
Event::DecDigitalSense, Event::IncDigitalSense,
|
||||||
|
|
|
@ -475,7 +475,7 @@ class EventHandler
|
||||||
DEADZONE,
|
DEADZONE,
|
||||||
ANALOG_DEADZONE,
|
ANALOG_DEADZONE,
|
||||||
ANALOG_SENSITIVITY,
|
ANALOG_SENSITIVITY,
|
||||||
ANALOG_ACCEL,
|
ANALOG_LINEARITY,
|
||||||
DEJITTER_AVERAGING,
|
DEJITTER_AVERAGING,
|
||||||
DEJITTER_REACTION,
|
DEJITTER_REACTION,
|
||||||
DIGITAL_SENSITIVITY,
|
DIGITAL_SENSITIVITY,
|
||||||
|
|
|
@ -25,8 +25,8 @@ Paddles::Paddles(Jack jack, const Event& event, const System& system,
|
||||||
bool swappaddle, bool swapaxis, bool swapdir, bool altmap)
|
bool swappaddle, bool swapaxis, bool swapdir, bool altmap)
|
||||||
: Controller(jack, event, system, Controller::Type::Paddles)
|
: Controller(jack, event, system, Controller::Type::Paddles)
|
||||||
{
|
{
|
||||||
// We must start with minimum resistance; see commit
|
// We must start with a physical valid resistance (e.g. 0);
|
||||||
// 38b452e1a047a0dca38c5bcce7c271d40f76736e for more information
|
// see commit 38b452e1a047a0dca38c5bcce7c271d40f76736e for more information
|
||||||
setPin(AnalogPin::Five, AnalogReadout::connectToVcc());
|
setPin(AnalogPin::Five, AnalogReadout::connectToVcc());
|
||||||
setPin(AnalogPin::Nine, AnalogReadout::connectToVcc());
|
setPin(AnalogPin::Nine, AnalogReadout::connectToVcc());
|
||||||
|
|
||||||
|
@ -197,6 +197,16 @@ void Paddles::update()
|
||||||
|
|
||||||
AnalogReadout::Connection Paddles::getReadOut(int lastAxis, int& newAxis, int center)
|
AnalogReadout::Connection Paddles::getReadOut(int lastAxis, int& newAxis, int center)
|
||||||
{
|
{
|
||||||
|
const double range = ANALOG_RANGE - analogDeadZone() * 2;
|
||||||
|
|
||||||
|
// dead zone, ignore changes inside the dead zone
|
||||||
|
if(newAxis > analogDeadZone())
|
||||||
|
newAxis -= analogDeadZone();
|
||||||
|
else if(newAxis < -analogDeadZone())
|
||||||
|
newAxis += analogDeadZone();
|
||||||
|
else
|
||||||
|
newAxis = 0; // treat any dead zone value as zero
|
||||||
|
|
||||||
static constexpr std::array<double, MAX_DEJITTER - MIN_DEJITTER + 1> bFac = {
|
static constexpr std::array<double, MAX_DEJITTER - MIN_DEJITTER + 1> bFac = {
|
||||||
// higher values mean more dejitter strength
|
// higher values mean more dejitter strength
|
||||||
0, // off
|
0, // off
|
||||||
|
@ -220,24 +230,30 @@ AnalogReadout::Connection Paddles::getReadOut(int lastAxis, int& newAxis, int ce
|
||||||
if(abs(newVal - newAxis) > 10)
|
if(abs(newVal - newAxis) > 10)
|
||||||
newAxis = newVal;
|
newAxis = newVal;
|
||||||
|
|
||||||
// TODO: deadzone
|
// apply linearity
|
||||||
// here or in PJoystickhandler?
|
double linearVal = newAxis / (range / 2); // scale to -1.0..+1.0
|
||||||
|
|
||||||
// accelerate, reduces sensitivity accordingly
|
if(newAxis >= 0)
|
||||||
int diff = newAxis - lastAxis;
|
linearVal = pow(abs(linearVal), LINEARITY);
|
||||||
float factor = diff ? pow(abs(diff), ACCEL) / abs(diff) : 0;
|
else
|
||||||
|
linearVal = -pow(abs(linearVal), LINEARITY);
|
||||||
|
|
||||||
newAxis = lastAxis - diff * factor * pow(MOUSE_SENSITIVITY, 1.f/ACCEL); // TODO: predefine pow(...)
|
newAxis = linearVal * (range / 2); // scale back to ANALOG_RANGE
|
||||||
|
|
||||||
|
// scale axis to range including dead zone
|
||||||
|
const Int32 scaledAxis = newAxis * ANALOG_RANGE / range;
|
||||||
|
|
||||||
// scale result
|
// scale result
|
||||||
return AnalogReadout::connectToVcc(MAX_RESISTANCE *
|
return AnalogReadout::connectToVcc(MAX_RESISTANCE *
|
||||||
(BSPF::clamp(32768 - Int32(Int32(newAxis) * SENSITIVITY + center), 0, 65536) / 65536.0));
|
BSPF::clamp((ANALOG_MAX_VALUE - (scaledAxis * SENSITIVITY + center)) / double(ANALOG_RANGE),
|
||||||
|
0.0, 1.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool Paddles::updateAnalogAxes()
|
bool Paddles::updateAnalogAxes()
|
||||||
{
|
{
|
||||||
// Analog axis events from Stelladaptor-like devices
|
// Analog axis events from Stelladaptor-like devices,
|
||||||
|
// (which includes analog USB controllers)
|
||||||
// These devices generate data in the range -32768 to 32767,
|
// These devices generate data in the range -32768 to 32767,
|
||||||
// so we have to scale appropriately
|
// so we have to scale appropriately
|
||||||
// Since these events are generated and stored indefinitely,
|
// Since these events are generated and stored indefinitely,
|
||||||
|
@ -245,20 +261,6 @@ bool Paddles::updateAnalogAxes()
|
||||||
// previous values by a pre-defined amount)
|
// previous values by a pre-defined amount)
|
||||||
// Otherwise, it would always override input from digital and mouse
|
// Otherwise, it would always override input from digital and mouse
|
||||||
|
|
||||||
//static constexpr std::array<double, MAX_DEJITTER - MIN_DEJITTER + 1> bFac = {
|
|
||||||
// // higher values mean more dejitter strength
|
|
||||||
// 0, // off
|
|
||||||
// 0.50, 0.59, 0.67, 0.74, 0.80,
|
|
||||||
// 0.85, 0.89, 0.92, 0.94, 0.95
|
|
||||||
//};
|
|
||||||
//static constexpr std::array<double, MAX_DEJITTER - MIN_DEJITTER + 1> dFac = {
|
|
||||||
// // lower values mean more dejitter strength
|
|
||||||
// 1, // off
|
|
||||||
// 1.0 / 181, 1.0 / 256, 1.0 / 362, 1.0 / 512, 1.0 / 724,
|
|
||||||
// 1.0 / 1024, 1.0 / 1448, 1.0 / 2048, 1.0 / 2896, 1.0 / 4096
|
|
||||||
//};
|
|
||||||
//const double baseFactor = bFac[DEJITTER_BASE];
|
|
||||||
//const double diffFactor = dFac[DEJITTER_DIFF];
|
|
||||||
|
|
||||||
int sa_xaxis = myEvent.get(myAAxisValue);
|
int sa_xaxis = myEvent.get(myAAxisValue);
|
||||||
int sa_yaxis = myEvent.get(myBAxisValue);
|
int sa_yaxis = myEvent.get(myBAxisValue);
|
||||||
|
@ -266,34 +268,13 @@ bool Paddles::updateAnalogAxes()
|
||||||
|
|
||||||
if(abs(myLastAxisX - sa_xaxis) > 10)
|
if(abs(myLastAxisX - sa_xaxis) > 10)
|
||||||
{
|
{
|
||||||
|
|
||||||
//// dejitter, suppress small changes only
|
|
||||||
//double dejitter = pow(baseFactor, abs(sa_xaxis - myLastAxisX) * diffFactor);
|
|
||||||
//int new_val = sa_xaxis * (1 - dejitter) + myLastAxisX * dejitter;
|
|
||||||
|
|
||||||
//// only use new dejittered value for larger differences
|
|
||||||
//if(abs(new_val - sa_xaxis) > 10)
|
|
||||||
// sa_xaxis = new_val;
|
|
||||||
|
|
||||||
//setPin(AnalogPin::Nine, AnalogReadout::connectToVcc(MAX_RESISTANCE *
|
|
||||||
// (BSPF::clamp(32768 - Int32(Int32(sa_xaxis) * SENSITIVITY + XCENTER), 0, 65536) / 65536.0)));
|
|
||||||
setPin(AnalogPin::Nine, getReadOut(myLastAxisX, sa_xaxis, XCENTER));
|
setPin(AnalogPin::Nine, getReadOut(myLastAxisX, sa_xaxis, XCENTER));
|
||||||
sa_changed = true;
|
sa_changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(abs(myLastAxisY - sa_yaxis) > 10)
|
if(abs(myLastAxisY - sa_yaxis) > 10)
|
||||||
{
|
{
|
||||||
//// dejitter, suppress small changes only
|
setPin(AnalogPin::Five, getReadOut(myLastAxisY, sa_yaxis, YCENTER));
|
||||||
//double dejitter = pow(baseFactor, abs(sa_yaxis - myLastAxisY) * diffFactor);
|
|
||||||
//int new_val = sa_yaxis * (1 - dejitter) + myLastAxisY * dejitter;
|
|
||||||
|
|
||||||
//// only use new dejittered value for larger differences
|
|
||||||
//if(abs(new_val - sa_yaxis) > 10)
|
|
||||||
// sa_yaxis = new_val;
|
|
||||||
|
|
||||||
//setPin(AnalogPin::Five, AnalogReadout::connectToVcc(MAX_RESISTANCE *
|
|
||||||
// (BSPF::clamp(32768 - Int32(Int32(sa_yaxis) * SENSITIVITY + YCENTER), 0, 65536) / 65536.0)));
|
|
||||||
setPin(AnalogPin::Nine, getReadOut(myLastAxisY, sa_yaxis, YCENTER));
|
|
||||||
sa_changed = true;
|
sa_changed = true;
|
||||||
}
|
}
|
||||||
myLastAxisX = sa_xaxis;
|
myLastAxisX = sa_xaxis;
|
||||||
|
@ -329,20 +310,9 @@ void Paddles::updateMouse(bool& firePressedA, bool& firePressedB)
|
||||||
// mapped to a separate paddle
|
// mapped to a separate paddle
|
||||||
if(myMPaddleIDX > -1)
|
if(myMPaddleIDX > -1)
|
||||||
{
|
{
|
||||||
// TODO: REMOVE! Test for 2600-daptor paddles only!
|
myCharge[myMPaddleIDX] = BSPF::clamp(myCharge[myMPaddleIDX] -
|
||||||
// deadzone
|
|
||||||
// TODO
|
|
||||||
//
|
|
||||||
// accelerate
|
|
||||||
int diff = myEvent.get(myAxisMouseMotion);
|
|
||||||
float factor = diff ? pow(abs(diff), ACCEL) / abs(diff) : 0;
|
|
||||||
int newVal = myCharge[myMPaddleIDX] - diff * factor * pow(MOUSE_SENSITIVITY, 1.f/ACCEL);
|
|
||||||
|
|
||||||
myCharge[myMPaddleIDX] = BSPF::clamp(newVal, TRIGMIN, TRIGRANGE);
|
|
||||||
|
|
||||||
/* myCharge[myMPaddleIDX] = BSPF::clamp(myCharge[myMPaddleIDX] -
|
|
||||||
(myEvent.get(Event::MouseAxisXMove) * MOUSE_SENSITIVITY),
|
(myEvent.get(Event::MouseAxisXMove) * MOUSE_SENSITIVITY),
|
||||||
TRIGMIN, TRIGRANGE);*/
|
TRIGMIN, TRIGRANGE);
|
||||||
if(myMPaddleIDX == 0)
|
if(myMPaddleIDX == 0)
|
||||||
firePressedA = firePressedA
|
firePressedA = firePressedA
|
||||||
|| myEvent.get(Event::MouseButtonLeftValue);
|
|| myEvent.get(Event::MouseButtonLeftValue);
|
||||||
|
@ -479,9 +449,9 @@ float Paddles::analogSensitivityValue(int sensitivity)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Paddles::setAnalogAccel(int accel)
|
void Paddles::setAnalogLinearity(int linearity)
|
||||||
{
|
{
|
||||||
ACCEL = 1.f + BSPF::clamp(accel, MIN_ANALOG_ACCEL, MAX_ANALOG_ACCEL) / 100.f;
|
LINEARITY = 100.f / BSPF::clamp(linearity, MIN_ANALOG_LINEARITY, MAX_ANALOG_LINEARITY);
|
||||||
}
|
}
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Paddles::setDejitterBase(int strength)
|
void Paddles::setDejitterBase(int strength)
|
||||||
|
@ -513,7 +483,7 @@ void Paddles::setDigitalPaddleRange(int range)
|
||||||
int Paddles::XCENTER = 0;
|
int Paddles::XCENTER = 0;
|
||||||
int Paddles::YCENTER = 0;
|
int Paddles::YCENTER = 0;
|
||||||
float Paddles::SENSITIVITY = 1.0;
|
float Paddles::SENSITIVITY = 1.0;
|
||||||
float Paddles::ACCEL = 1.0;
|
float Paddles::LINEARITY = 1.0;
|
||||||
int Paddles::DEJITTER_BASE = 0;
|
int Paddles::DEJITTER_BASE = 0;
|
||||||
int Paddles::DEJITTER_DIFF = 0;
|
int Paddles::DEJITTER_DIFF = 0;
|
||||||
int Paddles::TRIGRANGE = Paddles::TRIGMAX;
|
int Paddles::TRIGRANGE = Paddles::TRIGMAX;
|
||||||
|
|
|
@ -48,11 +48,14 @@ class Paddles : public Controller
|
||||||
~Paddles() override = default;
|
~Paddles() override = default;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
static constexpr int ANALOG_MIN_VALUE = -32768;
|
||||||
|
static constexpr int ANALOG_MAX_VALUE = 32767;
|
||||||
|
static constexpr int ANALOG_RANGE = ANALOG_MAX_VALUE - ANALOG_MIN_VALUE + 1;
|
||||||
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 MIN_ANALOG_SENSE = 0;
|
||||||
static constexpr int MAX_ANALOG_SENSE = 30;
|
static constexpr int MAX_ANALOG_SENSE = 30;
|
||||||
static constexpr int MIN_ANALOG_ACCEL = 0;
|
static constexpr int MIN_ANALOG_LINEARITY = 25;
|
||||||
static constexpr int MAX_ANALOG_ACCEL = 100;
|
static constexpr int MAX_ANALOG_LINEARITY = 100;
|
||||||
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 MIN_DIGITAL_SENSE = 1;
|
||||||
|
@ -112,11 +115,11 @@ class Paddles : public Controller
|
||||||
static void setAnalogYCenter(int ycenter);
|
static void setAnalogYCenter(int ycenter);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Sets the acceleration for analog paddles.
|
Sets the linearity of analog paddles.
|
||||||
|
|
||||||
@param accel Value from 100 to 300
|
@param linearity Value from 25 to 100
|
||||||
*/
|
*/
|
||||||
static void setAnalogAccel(int accel);
|
static void setAnalogLinearity(int linearity);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Sets the sensitivity for analog paddles.
|
Sets the sensitivity for analog paddles.
|
||||||
|
@ -191,7 +194,7 @@ class Paddles : public Controller
|
||||||
|
|
||||||
static int XCENTER;
|
static int XCENTER;
|
||||||
static int YCENTER;
|
static int YCENTER;
|
||||||
static float SENSITIVITY, ACCEL;
|
static float SENSITIVITY, LINEARITY;
|
||||||
|
|
||||||
static int DIGITAL_SENSITIVITY, DIGITAL_DISTANCE;
|
static int DIGITAL_SENSITIVITY, DIGITAL_DISTANCE;
|
||||||
static int DEJITTER_BASE, DEJITTER_DIFF;
|
static int DEJITTER_BASE, DEJITTER_DIFF;
|
||||||
|
|
|
@ -116,7 +116,7 @@ Settings::Settings()
|
||||||
setPermanent("grabmouse", "true");
|
setPermanent("grabmouse", "true");
|
||||||
setPermanent("cursor", "2");
|
setPermanent("cursor", "2");
|
||||||
setPermanent("adeadzone", "0");
|
setPermanent("adeadzone", "0");
|
||||||
setPermanent("paccel", "100");
|
setPermanent("plinear", "100");
|
||||||
setPermanent("dejitter.base", "0");
|
setPermanent("dejitter.base", "0");
|
||||||
setPermanent("dejitter.diff", "0");
|
setPermanent("dejitter.diff", "0");
|
||||||
setPermanent("dsense", "10");
|
setPermanent("dsense", "10");
|
||||||
|
@ -368,8 +368,8 @@ void Settings::validate()
|
||||||
setValue("psense", BSPF::clamp(getInt("psense"),
|
setValue("psense", BSPF::clamp(getInt("psense"),
|
||||||
Paddles::MIN_ANALOG_SENSE, Paddles::MAX_ANALOG_SENSE));
|
Paddles::MIN_ANALOG_SENSE, Paddles::MAX_ANALOG_SENSE));
|
||||||
|
|
||||||
setValue("paccel", BSPF::clamp(getInt("paccel"),
|
setValue("plinear", BSPF::clamp(getInt("plinear"),
|
||||||
Paddles::MIN_ANALOG_ACCEL, Paddles::MAX_ANALOG_ACCEL));
|
Paddles::MIN_ANALOG_LINEARITY, Paddles::MAX_ANALOG_LINEARITY));
|
||||||
|
|
||||||
setValue("dejitter.base", BSPF::clamp(getInt("dejitter.base"),
|
setValue("dejitter.base", BSPF::clamp(getInt("dejitter.base"),
|
||||||
Paddles::MIN_DEJITTER, Paddles::MAX_DEJITTER));
|
Paddles::MIN_DEJITTER, Paddles::MAX_DEJITTER));
|
||||||
|
@ -525,9 +525,8 @@ void Settings::usage() const
|
||||||
<< " properties in given mode(see manual)\n"
|
<< " properties in given mode(see manual)\n"
|
||||||
<< " -grabmouse <1|0> Locks the mouse cursor in the TIA window\n"
|
<< " -grabmouse <1|0> Locks the mouse cursor in the TIA window\n"
|
||||||
<< " -cursor <0,1,2,3> Set cursor state in UI/emulation modes\n"
|
<< " -cursor <0,1,2,3> Set cursor state in UI/emulation modes\n"
|
||||||
<< " -adeadzone <number> Sets analog 'dead zone' area for analog joysticks\n"
|
<< " -adeadzone <0-29> Sets analog 'dead zone' area for analog joysticks\n"
|
||||||
<< " (0-16500)\n"
|
<< " -plinear <25-100> Sets paddle linearity\n"
|
||||||
<< " -paccel <0-100> Sets paddle acceleration strength\n"
|
|
||||||
<< " -dejitter.base <0-10> Strength of analog paddle value averaging\n"
|
<< " -dejitter.base <0-10> Strength of analog paddle value averaging\n"
|
||||||
<< " -dejitter.diff <0-10> Strength of analog paddle reaction to fast movements\n"
|
<< " -dejitter.diff <0-10> Strength of analog paddle reaction to fast movements\n"
|
||||||
<< " -psense <0-30> Sensitivity of analog paddle movement\n"
|
<< " -psense <0-30> Sensitivity of analog paddle movement\n"
|
||||||
|
|
|
@ -121,7 +121,7 @@ void InputDialog::addDevicePortTab()
|
||||||
lwidth, kDDeadzoneChanged, 3 * fontWidth, "%");
|
lwidth, kDDeadzoneChanged, 3 * fontWidth, "%");
|
||||||
myDigitalDeadzone->setMinValue(Controller::MIN_DIGITAL_DEADZONE);
|
myDigitalDeadzone->setMinValue(Controller::MIN_DIGITAL_DEADZONE);
|
||||||
myDigitalDeadzone->setMaxValue(Controller::MAX_DIGITAL_DEADZONE);
|
myDigitalDeadzone->setMaxValue(Controller::MAX_DIGITAL_DEADZONE);
|
||||||
myDigitalDeadzone->setTickmarkIntervals(4);
|
myDigitalDeadzone->setTickmarkIntervals(5);
|
||||||
myDigitalDeadzone->setToolTip("Adjust dead zone size for analog joysticks when emulating digital controllers.");
|
myDigitalDeadzone->setToolTip("Adjust dead zone size for analog joysticks when emulating digital controllers.");
|
||||||
wid.push_back(myDigitalDeadzone);
|
wid.push_back(myDigitalDeadzone);
|
||||||
|
|
||||||
|
@ -132,8 +132,7 @@ void InputDialog::addDevicePortTab()
|
||||||
lwidth, kADeadzoneChanged, 3 * fontWidth, "%");
|
lwidth, kADeadzoneChanged, 3 * fontWidth, "%");
|
||||||
myAnalogDeadzone->setMinValue(Controller::MIN_ANALOG_DEADZONE);
|
myAnalogDeadzone->setMinValue(Controller::MIN_ANALOG_DEADZONE);
|
||||||
myAnalogDeadzone->setMaxValue(Controller::MAX_ANALOG_DEADZONE);
|
myAnalogDeadzone->setMaxValue(Controller::MAX_ANALOG_DEADZONE);
|
||||||
myAnalogDeadzone->setStepValue(500);
|
myAnalogDeadzone->setTickmarkIntervals(5);
|
||||||
myAnalogDeadzone->setTickmarkIntervals(3);
|
|
||||||
myAnalogDeadzone->setToolTip("Adjust dead zone size for analog joysticks when emulating analog controllers.");
|
myAnalogDeadzone->setToolTip("Adjust dead zone size for analog joysticks when emulating analog controllers.");
|
||||||
wid.push_back(myAnalogDeadzone);
|
wid.push_back(myAnalogDeadzone);
|
||||||
|
|
||||||
|
@ -151,17 +150,16 @@ void InputDialog::addDevicePortTab()
|
||||||
myPaddleSpeed->setTickmarkIntervals(3);
|
myPaddleSpeed->setTickmarkIntervals(3);
|
||||||
wid.push_back(myPaddleSpeed);
|
wid.push_back(myPaddleSpeed);
|
||||||
|
|
||||||
// Add analog paddle acceleration
|
// Add analog paddle linearity
|
||||||
ypos += lineHeight + VGAP;
|
ypos += lineHeight + VGAP;
|
||||||
myPaddleAccel = new SliderWidget(myTab, _font, xpos, ypos - 1, 13 * fontWidth, lineHeight,
|
myPaddleLinearity = new SliderWidget(myTab, _font, xpos, ypos - 1, 13 * fontWidth, lineHeight,
|
||||||
"Acceleration",
|
"Linearity", lwidth - fontWidth * 2, 0, 4 * fontWidth, "%");
|
||||||
lwidth - fontWidth * 2, kPAccelChanged, 4 * fontWidth);
|
myPaddleLinearity->setMinValue(Paddles::MIN_ANALOG_LINEARITY);
|
||||||
myPaddleAccel->setMinValue(Paddles::MIN_ANALOG_ACCEL);
|
myPaddleLinearity->setMaxValue(Paddles::MAX_ANALOG_LINEARITY);
|
||||||
myPaddleAccel->setMaxValue(Paddles::MAX_ANALOG_ACCEL);
|
myPaddleLinearity->setStepValue(5);
|
||||||
myPaddleAccel->setStepValue(5);
|
myPaddleLinearity->setTickmarkIntervals(3);
|
||||||
myPaddleAccel->setTickmarkIntervals(4);
|
myPaddleLinearity->setToolTip("Adjust paddle movement linearity.");
|
||||||
myPaddleAccel->setToolTip("Adjust fast paddle movement acceleration.");
|
wid.push_back(myPaddleLinearity);
|
||||||
wid.push_back(myPaddleAccel);
|
|
||||||
|
|
||||||
// Add dejitter (analog paddles)
|
// Add dejitter (analog paddles)
|
||||||
ypos += lineHeight + VGAP;
|
ypos += lineHeight + VGAP;
|
||||||
|
@ -371,8 +369,8 @@ void InputDialog::loadConfig()
|
||||||
|
|
||||||
// Paddle speed (analog)
|
// Paddle speed (analog)
|
||||||
myPaddleSpeed->setValue(settings.getInt("psense"));
|
myPaddleSpeed->setValue(settings.getInt("psense"));
|
||||||
// Paddle acceleration (analog)
|
// Paddle linearity (analog)
|
||||||
myPaddleAccel->setValue(settings.getInt("paccel"));
|
myPaddleLinearity->setValue(settings.getInt("plinear"));
|
||||||
// Paddle dejitter (analog)
|
// Paddle dejitter (analog)
|
||||||
myDejitterBase->setValue(settings.getInt("dejitter.base"));
|
myDejitterBase->setValue(settings.getInt("dejitter.base"));
|
||||||
myDejitterDiff->setValue(settings.getInt("dejitter.diff"));
|
myDejitterDiff->setValue(settings.getInt("dejitter.diff"));
|
||||||
|
@ -447,10 +445,10 @@ void InputDialog::saveConfig()
|
||||||
int sensitivity = myPaddleSpeed->getValue();
|
int sensitivity = myPaddleSpeed->getValue();
|
||||||
settings.setValue("psense", sensitivity);
|
settings.setValue("psense", sensitivity);
|
||||||
Paddles::setAnalogSensitivity(sensitivity);
|
Paddles::setAnalogSensitivity(sensitivity);
|
||||||
// Paddle acceleration (analog)
|
// Paddle linearity (analog)
|
||||||
int accel = myPaddleAccel->getValue();
|
int linearity = myPaddleLinearity->getValue();
|
||||||
settings.setValue("paccel", accel);
|
settings.setValue("plinear", linearity);
|
||||||
Paddles::setAnalogAccel(accel);
|
Paddles::setAnalogLinearity(linearity);
|
||||||
|
|
||||||
// Paddle dejitter (analog)
|
// Paddle dejitter (analog)
|
||||||
int dejitter = myDejitterBase->getValue();
|
int dejitter = myDejitterBase->getValue();
|
||||||
|
@ -539,8 +537,8 @@ void InputDialog::setDefaults()
|
||||||
// Paddle speed (analog)
|
// Paddle speed (analog)
|
||||||
myPaddleSpeed->setValue(20);
|
myPaddleSpeed->setValue(20);
|
||||||
|
|
||||||
// Paddle acceleration
|
// Paddle linearity
|
||||||
myPaddleAccel->setValue(0);
|
myPaddleLinearity->setValue(100);
|
||||||
#if defined(RETRON77)
|
#if defined(RETRON77)
|
||||||
myDejitterBase->setValue(2);
|
myDejitterBase->setValue(2);
|
||||||
myDejitterDiff->setValue(6);
|
myDejitterDiff->setValue(6);
|
||||||
|
@ -700,11 +698,13 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kDDeadzoneChanged:
|
case kDDeadzoneChanged:
|
||||||
myDigitalDeadzone->setValueLabel(std::round(Controller::digitalDeadZoneValue(myDigitalDeadzone->getValue()) * 100.f / 32768));
|
myDigitalDeadzone->setValueLabel(std::round(Controller::digitalDeadZoneValue(myDigitalDeadzone->getValue()) * 100.f /
|
||||||
|
(Paddles::ANALOG_RANGE / 2)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kADeadzoneChanged:
|
case kADeadzoneChanged:
|
||||||
myAnalogDeadzone->setValueLabel(std::round(myAnalogDeadzone->getValue() * 100.f / 32768));
|
myAnalogDeadzone->setValueLabel(std::round(Controller::analogDeadZoneValue(myAnalogDeadzone->getValue()) * 100.f /
|
||||||
|
(Paddles::ANALOG_RANGE / 2)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kPSpeedChanged:
|
case kPSpeedChanged:
|
||||||
|
@ -712,10 +712,6 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
myPaddleSpeed->getValue()) * 100.F));
|
myPaddleSpeed->getValue()) * 100.F));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kPAccelChanged:
|
|
||||||
updatePaddleAccel();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case kDejitterAvChanged:
|
case kDejitterAvChanged:
|
||||||
updateDejitterAveraging();
|
updateDejitterAveraging();
|
||||||
break;
|
break;
|
||||||
|
@ -791,13 +787,6 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputDialog::updatePaddleAccel()
|
|
||||||
{
|
|
||||||
int strength = myPaddleAccel->getValue();
|
|
||||||
|
|
||||||
myPaddleAccel->setValueLabel(strength ? std::to_string(strength) + "%" : "Off");
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void InputDialog::updateDejitterAveraging()
|
void InputDialog::updateDejitterAveraging()
|
||||||
{
|
{
|
||||||
|
|
|
@ -64,7 +64,6 @@ class InputDialog : public Dialog
|
||||||
|
|
||||||
void handleMouseControlState();
|
void handleMouseControlState();
|
||||||
void handleCursorState();
|
void handleCursorState();
|
||||||
void updatePaddleAccel();
|
|
||||||
void updateDejitterAveraging();
|
void updateDejitterAveraging();
|
||||||
void updateDejitterReaction();
|
void updateDejitterReaction();
|
||||||
void updateAutoFireRate();
|
void updateAutoFireRate();
|
||||||
|
@ -75,7 +74,6 @@ class InputDialog : public Dialog
|
||||||
kDDeadzoneChanged = 'DDch',
|
kDDeadzoneChanged = 'DDch',
|
||||||
kADeadzoneChanged = 'ADch',
|
kADeadzoneChanged = 'ADch',
|
||||||
kPSpeedChanged = 'Ppch',
|
kPSpeedChanged = 'Ppch',
|
||||||
kPAccelChanged = 'PAch',
|
|
||||||
kDejitterAvChanged = 'JAch',
|
kDejitterAvChanged = 'JAch',
|
||||||
kDejitterReChanged = 'JRch',
|
kDejitterReChanged = 'JRch',
|
||||||
kDPSpeedChanged = 'DSch',
|
kDPSpeedChanged = 'DSch',
|
||||||
|
@ -102,7 +100,7 @@ class InputDialog : public Dialog
|
||||||
SliderWidget* myDigitalDeadzone{nullptr};
|
SliderWidget* myDigitalDeadzone{nullptr};
|
||||||
SliderWidget* myAnalogDeadzone{nullptr};
|
SliderWidget* myAnalogDeadzone{nullptr};
|
||||||
SliderWidget* myPaddleSpeed{nullptr};
|
SliderWidget* myPaddleSpeed{nullptr};
|
||||||
SliderWidget* myPaddleAccel{nullptr};
|
SliderWidget* myPaddleLinearity{nullptr};
|
||||||
SliderWidget* myDejitterBase{nullptr};
|
SliderWidget* myDejitterBase{nullptr};
|
||||||
SliderWidget* myDejitterDiff{nullptr};
|
SliderWidget* myDejitterDiff{nullptr};
|
||||||
SliderWidget* myDPaddleSpeed{nullptr};
|
SliderWidget* myDPaddleSpeed{nullptr};
|
||||||
|
|
Loading…
Reference in New Issue