mirror of https://github.com/stella-emu/stella.git
refactored dead zone and mouse sensitivity setting management
This commit is contained in:
parent
a2ef881042
commit
8e1c45a408
|
@ -798,9 +798,9 @@ void PhysicalJoystickHandler::handleRegularAxisEvent(const PhysicalJoystickPtr j
|
||||||
Event::Type eventAxisNeg = j->joyMap.get(EventMode::kEmulationMode, button, JoyAxis(axis), JoyDir::NEG);
|
Event::Type eventAxisNeg = j->joyMap.get(EventMode::kEmulationMode, button, JoyAxis(axis), JoyDir::NEG);
|
||||||
Event::Type eventAxisPos = j->joyMap.get(EventMode::kEmulationMode, button, JoyAxis(axis), JoyDir::POS);
|
Event::Type eventAxisPos = j->joyMap.get(EventMode::kEmulationMode, button, JoyAxis(axis), JoyDir::POS);
|
||||||
|
|
||||||
if(value > Joystick::deadzone())
|
if(value > Controller::digitalDeadzone())
|
||||||
myHandler.handleEvent(eventAxisPos);
|
myHandler.handleEvent(eventAxisPos);
|
||||||
else if(value < -Joystick::deadzone())
|
else if(value < -Controller::digitalDeadzone())
|
||||||
myHandler.handleEvent(eventAxisNeg);
|
myHandler.handleEvent(eventAxisNeg);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -823,14 +823,14 @@ void PhysicalJoystickHandler::handleRegularAxisEvent(const PhysicalJoystickPtr j
|
||||||
#ifdef GUI_SUPPORT
|
#ifdef GUI_SUPPORT
|
||||||
else if(myHandler.hasOverlay())
|
else if(myHandler.hasOverlay())
|
||||||
{
|
{
|
||||||
// A value change lower than Joystick::deadzone indicates analog input which is ignored
|
// A value change lower than Controller::digitalDeadzone indicates analog input which is ignored
|
||||||
if((abs(j->axisLastValue[axis] - value) > Joystick::deadzone()))
|
if((abs(j->axisLastValue[axis] - value) > Controller::digitalDeadzone()))
|
||||||
{
|
{
|
||||||
// First, clamp the values to simulate digital input
|
// First, clamp the values to simulate digital input
|
||||||
// (the only thing that the underlying code understands)
|
// (the only thing that the underlying code understands)
|
||||||
if(value > Joystick::deadzone())
|
if(value > Controller::digitalDeadzone())
|
||||||
value = 32000;
|
value = 32000;
|
||||||
else if(value < -Joystick::deadzone())
|
else if(value < -Controller::digitalDeadzone())
|
||||||
value = -32000;
|
value = -32000;
|
||||||
else
|
else
|
||||||
value = 0;
|
value = 0;
|
||||||
|
@ -945,31 +945,34 @@ ostream& operator<<(ostream& os, const PhysicalJoystickHandler& jh)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void PhysicalJoystickHandler::changeDeadzone(int direction)
|
void PhysicalJoystickHandler::changeDigitalDeadzone(int direction)
|
||||||
{
|
{
|
||||||
int deadzone = BSPF::clamp(myOSystem.settings().getInt("joydeadzone") + direction,
|
int deadzone = BSPF::clamp(myOSystem.settings().getInt("joydeadzone") + direction,
|
||||||
Joystick::DEAD_ZONE_MIN, Joystick::DEAD_ZONE_MAX);
|
Controller::MIN_DIGITAL_DEADZONE, Controller::MAX_DIGITAL_DEADZONE);
|
||||||
myOSystem.settings().setValue("joydeadzone", deadzone);
|
myOSystem.settings().setValue("joydeadzone", deadzone);
|
||||||
|
|
||||||
Joystick::setDeadZone(deadzone);
|
Controller::setDigitalDeadZone(deadzone);
|
||||||
|
|
||||||
int value = Joystick::deadZoneValue(deadzone);
|
ostringstream ss;
|
||||||
|
ss << std::round(Controller::digitalDeadzoneValue(deadzone) * 100.F / 32768) << "%";
|
||||||
|
|
||||||
myOSystem.frameBuffer().showGaugeMessage("Joystick deadzone", std::to_string(value),
|
myOSystem.frameBuffer().showGaugeMessage("Digital controller dead zone", ss. str(), deadzone,
|
||||||
deadzone, Joystick::DEAD_ZONE_MIN, Joystick::DEAD_ZONE_MAX);
|
Controller::MIN_DIGITAL_DEADZONE, Controller::MAX_DIGITAL_DEADZONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void PhysicalJoystickHandler::changeAnalogPaddleDeadzone(int direction)
|
void PhysicalJoystickHandler::changeAnalogPaddleDeadzone(int direction)
|
||||||
{
|
{
|
||||||
int deadzone = BSPF::clamp(myOSystem.settings().getInt("pdeadzone") + direction * 500,
|
int deadzone = BSPF::clamp(myOSystem.settings().getInt("adeadzone") + direction * 500,
|
||||||
Paddles::MIN_ANALOG_DEADZONE, Paddles::MAX_ANALOG_DEADZONE);
|
Controller::MIN_ANALOG_DEADZONE, Controller::MAX_ANALOG_DEADZONE);
|
||||||
myOSystem.settings().setValue("pdeadzone", deadzone);
|
myOSystem.settings().setValue("adeadzone", deadzone);
|
||||||
|
|
||||||
Paddles::setAnalogDeadzone(deadzone);
|
Controller::setAnalogDeadzone(deadzone);
|
||||||
|
ostringstream ss;
|
||||||
|
ss << std::round(deadzone * 100.F / 32768) << "%";
|
||||||
|
|
||||||
myOSystem.frameBuffer().showGaugeMessage("Analog paddle deadzone", std::to_string(deadzone), deadzone,
|
myOSystem.frameBuffer().showGaugeMessage("Analog controller dead zone", ss.str(), deadzone,
|
||||||
Paddles::MIN_ANALOG_DEADZONE, Paddles::MAX_ANALOG_DEADZONE);
|
Controller::MIN_ANALOG_DEADZONE, Controller::MAX_ANALOG_DEADZONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -1071,18 +1074,17 @@ void PhysicalJoystickHandler::changeDigitalPaddleSensitivity(int direction)
|
||||||
void PhysicalJoystickHandler::changeMousePaddleSensitivity(int direction)
|
void PhysicalJoystickHandler::changeMousePaddleSensitivity(int direction)
|
||||||
{
|
{
|
||||||
int sense = BSPF::clamp(myOSystem.settings().getInt("msense") + direction,
|
int sense = BSPF::clamp(myOSystem.settings().getInt("msense") + direction,
|
||||||
Paddles::MIN_MOUSE_SENSE, Paddles::MAX_MOUSE_SENSE);
|
Controller::MIN_MOUSE_SENSE, Controller::MAX_MOUSE_SENSE);
|
||||||
myOSystem.settings().setValue("msense", sense);
|
myOSystem.settings().setValue("msense", sense);
|
||||||
|
|
||||||
Paddles::setMouseSensitivity(sense);
|
Controller::setMouseSensitivity(sense);
|
||||||
MindLink::setMouseSensitivity(sense);
|
|
||||||
|
|
||||||
ostringstream ss;
|
ostringstream ss;
|
||||||
ss << sense * 10 << "%";
|
ss << sense * 10 << "%";
|
||||||
|
|
||||||
myOSystem.frameBuffer().showGaugeMessage("Mouse paddle sensitivity",
|
myOSystem.frameBuffer().showGaugeMessage("Mouse paddle sensitivity",
|
||||||
ss.str(), sense,
|
ss.str(), sense,
|
||||||
Paddles::MIN_MOUSE_SENSE, Paddles::MAX_MOUSE_SENSE);
|
Controller::MIN_MOUSE_SENSE, Controller::MAX_MOUSE_SENSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -110,7 +110,7 @@ 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 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 changeAnalogPaddleAcceleration(int direction = +1);
|
||||||
|
|
|
@ -148,6 +148,32 @@ Controller::Type Controller::getType(const string& propName)
|
||||||
return Type::Unknown;
|
return Type::Unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Controller::setDigitalDeadZone(int deadzone)
|
||||||
|
{
|
||||||
|
DIGITAL_DEAD_ZONE = digitalDeadzoneValue(deadzone);
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
int Controller::digitalDeadzoneValue(int deadzone)
|
||||||
|
{
|
||||||
|
deadzone = BSPF::clamp(deadzone, MIN_DIGITAL_DEADZONE, MAX_DIGITAL_DEADZONE);
|
||||||
|
|
||||||
|
return 3200 + deadzone * 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Controller::setAnalogDeadzone(int deadzone)
|
||||||
|
{
|
||||||
|
ANALOG_DEAD_ZONE = BSPF::clamp(deadzone, MIN_ANALOG_DEADZONE, MAX_ANALOG_DEADZONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Controller::setMouseSensitivity(int sensitivity)
|
||||||
|
{
|
||||||
|
MOUSE_SENSITIVITY = BSPF::clamp(sensitivity, MIN_MOUSE_SENSE, MAX_MOUSE_SENSE);
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Controller::setAutoFireRate(int rate, bool isNTSC)
|
void Controller::setAutoFireRate(int rate, bool isNTSC)
|
||||||
{
|
{
|
||||||
|
@ -156,5 +182,7 @@ void Controller::setAutoFireRate(int rate, bool isNTSC)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
int Controller::DIGITAL_DEAD_ZONE = 3200;
|
||||||
|
int Controller::ANALOG_DEAD_ZONE = 0;
|
||||||
|
int Controller::MOUSE_SENSITIVITY = -1;
|
||||||
int Controller::AUTO_FIRE_RATE = 0;
|
int Controller::AUTO_FIRE_RATE = 0;
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,13 @@ class Controller : public Serializable
|
||||||
friend class ControllerLowLevel;
|
friend class ControllerLowLevel;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
static constexpr int MIN_DIGITAL_DEADZONE = 0;
|
||||||
|
static constexpr int MAX_DIGITAL_DEADZONE = 29;
|
||||||
|
static constexpr int MIN_ANALOG_DEADZONE = 0;
|
||||||
|
static constexpr int MAX_ANALOG_DEADZONE = 16500;
|
||||||
|
static constexpr int MIN_MOUSE_SENSE = 1;
|
||||||
|
static constexpr int MAX_MOUSE_SENSE = 20;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Enumeration of the controller jacks
|
Enumeration of the controller jacks
|
||||||
*/
|
*/
|
||||||
|
@ -273,6 +280,38 @@ class Controller : public Serializable
|
||||||
*/
|
*/
|
||||||
static Type getType(const string& propName);
|
static Type getType(const string& propName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the deadzone amount for real analog joysticks.
|
||||||
|
Technically, this isn't really used by the Joystick class at all,
|
||||||
|
but it seemed like the best place to put it.
|
||||||
|
*/
|
||||||
|
static void setDigitalDeadZone(int deadzone);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the deadzone for analog paddles.
|
||||||
|
|
||||||
|
@param deadzone Value from 0 to 16500
|
||||||
|
*/
|
||||||
|
static void setAnalogDeadzone(int deadzone);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Retrieves the effective digital deadzone value
|
||||||
|
*/
|
||||||
|
static int digitalDeadzoneValue(int deadzone);
|
||||||
|
|
||||||
|
inline static int digitalDeadzone() { return DIGITAL_DEAD_ZONE; }
|
||||||
|
|
||||||
|
inline static int analogDeadzone() { return ANALOG_DEAD_ZONE; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the sensitivity for analog emulation movement
|
||||||
|
using a mouse.
|
||||||
|
|
||||||
|
@param sensitivity Value from 1 to MAX_MOUSE_SENSE, with larger
|
||||||
|
values causing more movement
|
||||||
|
*/
|
||||||
|
static void setMouseSensitivity(int sensitivity);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Sets the auto fire rate. 0 disables auto fire.
|
Sets the auto fire rate. 0 disables auto fire.
|
||||||
|
|
||||||
|
@ -366,6 +405,14 @@ class Controller : public Serializable
|
||||||
/// The callback that is dispatched whenver an analog pin has changed
|
/// The callback that is dispatched whenver an analog pin has changed
|
||||||
onAnalogPinUpdateCallback myOnAnalogPinUpdateCallback{nullptr};
|
onAnalogPinUpdateCallback myOnAnalogPinUpdateCallback{nullptr};
|
||||||
|
|
||||||
|
/// Defines the dead zone of analog joysticks for digital Atari controllers</summary>
|
||||||
|
static int DIGITAL_DEAD_ZONE;
|
||||||
|
|
||||||
|
/// Defines the dead zone of analog joysticks for analog Atari controllers</summary>
|
||||||
|
static int ANALOG_DEAD_ZONE;
|
||||||
|
|
||||||
|
static int MOUSE_SENSITIVITY;
|
||||||
|
|
||||||
/// Defines the speed of the auto fire
|
/// Defines the speed of the auto fire
|
||||||
static int AUTO_FIRE_RATE;
|
static int AUTO_FIRE_RATE;
|
||||||
|
|
||||||
|
|
|
@ -99,15 +99,14 @@ void EventHandler::initialize()
|
||||||
setActionMappings(EventMode::kEmulationMode);
|
setActionMappings(EventMode::kEmulationMode);
|
||||||
setActionMappings(EventMode::kMenuMode);
|
setActionMappings(EventMode::kMenuMode);
|
||||||
|
|
||||||
Joystick::setDeadZone(myOSystem.settings().getInt("joydeadzone"));
|
Controller::setDigitalDeadZone(myOSystem.settings().getInt("joydeadzone"));
|
||||||
Paddles::setAnalogDeadzone(myOSystem.settings().getInt("pdeadzone"));
|
Controller::setAnalogDeadzone(myOSystem.settings().getInt("adeadzone"));
|
||||||
Paddles::setAnalogAccel(myOSystem.settings().getInt("paccel"));
|
Paddles::setAnalogAccel(myOSystem.settings().getInt("paccel"));
|
||||||
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"));
|
||||||
Paddles::setDigitalSensitivity(myOSystem.settings().getInt("dsense"));
|
Paddles::setDigitalSensitivity(myOSystem.settings().getInt("dsense"));
|
||||||
Paddles::setMouseSensitivity(myOSystem.settings().getInt("msense"));
|
Controller::setMouseSensitivity(myOSystem.settings().getInt("msense"));
|
||||||
MindLink::setMouseSensitivity(myOSystem.settings().getInt("msense"));
|
|
||||||
PointingDevice::setSensitivity(myOSystem.settings().getInt("tsense"));
|
PointingDevice::setSensitivity(myOSystem.settings().getInt("tsense"));
|
||||||
Driving::setSensitivity(myOSystem.settings().getInt("dcsense"));
|
Driving::setSensitivity(myOSystem.settings().getInt("dcsense"));
|
||||||
Controller::setAutoFireRate(myOSystem.settings().getInt("autofirerate"));
|
Controller::setAutoFireRate(myOSystem.settings().getInt("autofirerate"));
|
||||||
|
@ -597,7 +596,7 @@ AdjustFunction EventHandler::getAdjustSetting(AdjustSetting setting)
|
||||||
std::bind(&Console::toggleInter, &myOSystem.console(), _1),
|
std::bind(&Console::toggleInter, &myOSystem.console(), _1),
|
||||||
|
|
||||||
// *** Input settings ***
|
// *** Input settings ***
|
||||||
std::bind(&PhysicalJoystickHandler::changeDeadzone, &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::changeAnalogPaddleAcceleration, &joyHandler(), _1),
|
||||||
|
@ -1365,7 +1364,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
|
||||||
case Event::DecreaseDeadzone:
|
case Event::DecreaseDeadzone:
|
||||||
if(pressed)
|
if(pressed)
|
||||||
{
|
{
|
||||||
myPJoyHandler->changeDeadzone(-1);
|
myPJoyHandler->changeDigitalDeadzone(-1);
|
||||||
myAdjustSetting = AdjustSetting::DEADZONE;
|
myAdjustSetting = AdjustSetting::DEADZONE;
|
||||||
myAdjustActive = true;
|
myAdjustActive = true;
|
||||||
}
|
}
|
||||||
|
@ -1374,7 +1373,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
|
||||||
case Event::IncreaseDeadzone:
|
case Event::IncreaseDeadzone:
|
||||||
if(pressed)
|
if(pressed)
|
||||||
{
|
{
|
||||||
myPJoyHandler->changeDeadzone(+1);
|
myPJoyHandler->changeDigitalDeadzone(+1);
|
||||||
myAdjustSetting = AdjustSetting::DEADZONE;
|
myAdjustSetting = AdjustSetting::DEADZONE;
|
||||||
myAdjustActive = true;
|
myAdjustActive = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,20 +157,3 @@ bool Joystick::setMouseControl(
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
void Joystick::setDeadZone(int deadzone)
|
|
||||||
{
|
|
||||||
_DEAD_ZONE = deadZoneValue(deadzone);
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
int Joystick::deadZoneValue(int deadzone)
|
|
||||||
{
|
|
||||||
deadzone = BSPF::clamp(deadzone, DEAD_ZONE_MIN, DEAD_ZONE_MAX);
|
|
||||||
|
|
||||||
return 3200 + deadzone * 1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
int Joystick::_DEAD_ZONE = 3200;
|
|
||||||
|
|
|
@ -29,9 +29,6 @@
|
||||||
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
|
||||||
|
|
||||||
|
@ -88,19 +85,6 @@ class Joystick : public Controller
|
||||||
bool setMouseControl(
|
bool setMouseControl(
|
||||||
Controller::Type xtype, int xid, Controller::Type ytype, int yid) override;
|
Controller::Type xtype, int xid, Controller::Type ytype, int yid) override;
|
||||||
|
|
||||||
/**
|
|
||||||
Sets the deadzone amount for real analog joysticks.
|
|
||||||
Technically, this isn't really used by the Joystick class at all,
|
|
||||||
but it seemed like the best place to put it.
|
|
||||||
*/
|
|
||||||
static void setDeadZone(int deadzone);
|
|
||||||
|
|
||||||
/**
|
|
||||||
Retrieves the effective deadzone value
|
|
||||||
*/
|
|
||||||
static int deadZoneValue(int deadzone);
|
|
||||||
inline static int deadzone() { return _DEAD_ZONE; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
Update the button pin states.
|
Update the button pin states.
|
||||||
|
@ -123,8 +107,6 @@ class Joystick : public Controller
|
||||||
// Controller to emulate in normal mouse axis mode
|
// Controller to emulate in normal mouse axis mode
|
||||||
int myControlID{-1};
|
int myControlID{-1};
|
||||||
|
|
||||||
static int _DEAD_ZONE;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
Update the axes pin states according to the keyboard
|
Update the axes pin states according to the keyboard
|
||||||
|
|
|
@ -22,6 +22,10 @@
|
||||||
MindLink::MindLink(Jack jack, const Event& event, const System& system)
|
MindLink::MindLink(Jack jack, const Event& event, const System& system)
|
||||||
: Controller(jack, event, system, Controller::Type::MindLink)
|
: Controller(jack, event, system, Controller::Type::MindLink)
|
||||||
{
|
{
|
||||||
|
setPin(DigitalPin::One, true);
|
||||||
|
setPin(DigitalPin::Two, true);
|
||||||
|
setPin(DigitalPin::Three, true);
|
||||||
|
setPin(DigitalPin::Four, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -73,11 +77,3 @@ bool MindLink::setMouseControl(
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
void MindLink::setMouseSensitivity(int sensitivity)
|
|
||||||
{
|
|
||||||
MOUSE_SENSITIVITY = BSPF::clamp(sensitivity, MIN_MOUSE_SENSE, MAX_MOUSE_SENSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
int MindLink::MOUSE_SENSITIVITY = -1;
|
|
||||||
|
|
|
@ -101,15 +101,6 @@ class MindLink : public Controller
|
||||||
bool setMouseControl(
|
bool setMouseControl(
|
||||||
Controller::Type xtype, int xid, Controller::Type ytype, int yid) override;
|
Controller::Type xtype, int xid, Controller::Type ytype, int yid) override;
|
||||||
|
|
||||||
/**
|
|
||||||
Sets the sensitivity for analog emulation of MindLink movement
|
|
||||||
using a mouse.
|
|
||||||
|
|
||||||
@param sensitivity Value from 1 to MAX_MOUSE_SENSE, with larger
|
|
||||||
values causing more movement
|
|
||||||
*/
|
|
||||||
static void setMouseSensitivity(int sensitivity);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void nextMindlinkBit();
|
void nextMindlinkBit();
|
||||||
|
|
||||||
|
@ -118,11 +109,6 @@ class MindLink : public Controller
|
||||||
static constexpr int MAX_POS = 0x3e00;
|
static constexpr int MAX_POS = 0x3e00;
|
||||||
static constexpr int CALIBRATE_FLAG = 0x8000; // this causes a left side calibration
|
static constexpr int CALIBRATE_FLAG = 0x8000; // this causes a left side calibration
|
||||||
|
|
||||||
static constexpr int MIN_MOUSE_SENSE = 1;
|
|
||||||
static constexpr int MAX_MOUSE_SENSE = 20;
|
|
||||||
|
|
||||||
static int MOUSE_SENSITIVITY;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Position value in Mindlink controller
|
// Position value in Mindlink controller
|
||||||
// Gets transferred bitwise (16 bits)
|
// Gets transferred bitwise (16 bits)
|
||||||
|
|
|
@ -478,12 +478,6 @@ float Paddles::analogSensitivityValue(int sensitivity)
|
||||||
static_cast<float>(BSPF::clamp(sensitivity, MIN_ANALOG_SENSE, MAX_ANALOG_SENSE)));
|
static_cast<float>(BSPF::clamp(sensitivity, MIN_ANALOG_SENSE, MAX_ANALOG_SENSE)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
void Paddles::setAnalogDeadzone(int deadzone)
|
|
||||||
{
|
|
||||||
DEADZONE = BSPF::clamp(deadzone, MIN_ANALOG_DEADZONE, MAX_ANALOG_DEADZONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Paddles::setAnalogAccel(int accel)
|
void Paddles::setAnalogAccel(int accel)
|
||||||
{
|
{
|
||||||
|
@ -508,12 +502,6 @@ void Paddles::setDigitalSensitivity(int sensitivity)
|
||||||
DIGITAL_DISTANCE = 20 + (DIGITAL_SENSITIVITY << 3);
|
DIGITAL_DISTANCE = 20 + (DIGITAL_SENSITIVITY << 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
void Paddles::setMouseSensitivity(int sensitivity)
|
|
||||||
{
|
|
||||||
MOUSE_SENSITIVITY = BSPF::clamp(sensitivity, MIN_MOUSE_SENSE, MAX_MOUSE_SENSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Paddles::setDigitalPaddleRange(int range)
|
void Paddles::setDigitalPaddleRange(int range)
|
||||||
{
|
{
|
||||||
|
@ -525,7 +513,6 @@ 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;
|
||||||
int Paddles::DEADZONE = 0;
|
|
||||||
float Paddles::ACCEL = 1.0;
|
float Paddles::ACCEL = 1.0;
|
||||||
int Paddles::DEJITTER_BASE = 0;
|
int Paddles::DEJITTER_BASE = 0;
|
||||||
int Paddles::DEJITTER_DIFF = 0;
|
int Paddles::DEJITTER_DIFF = 0;
|
||||||
|
@ -533,4 +520,3 @@ int Paddles::TRIGRANGE = Paddles::TRIGMAX;
|
||||||
|
|
||||||
int Paddles::DIGITAL_SENSITIVITY = -1;
|
int Paddles::DIGITAL_SENSITIVITY = -1;
|
||||||
int Paddles::DIGITAL_DISTANCE = -1;
|
int Paddles::DIGITAL_DISTANCE = -1;
|
||||||
int Paddles::MOUSE_SENSITIVITY = -1;
|
|
||||||
|
|
|
@ -48,8 +48,6 @@ class Paddles : public Controller
|
||||||
~Paddles() override = default;
|
~Paddles() override = default;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static constexpr int MIN_ANALOG_DEADZONE = 0;
|
|
||||||
static constexpr int MAX_ANALOG_DEADZONE = 15000;
|
|
||||||
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;
|
||||||
|
@ -59,8 +57,6 @@ class Paddles : public Controller
|
||||||
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;
|
||||||
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 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 MIN_MOUSE_RANGE = 1;
|
||||||
|
@ -115,13 +111,6 @@ class Paddles : public Controller
|
||||||
*/
|
*/
|
||||||
static void setAnalogYCenter(int ycenter);
|
static void setAnalogYCenter(int ycenter);
|
||||||
|
|
||||||
/**
|
|
||||||
Sets the deadzone for analog paddles.
|
|
||||||
|
|
||||||
@param deadzone Value from 0 to 15000
|
|
||||||
*/
|
|
||||||
static void setAnalogDeadzone(int deadzone);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Sets the acceleration for analog paddles.
|
Sets the acceleration for analog paddles.
|
||||||
|
|
||||||
|
@ -161,15 +150,6 @@ class Paddles : public Controller
|
||||||
*/
|
*/
|
||||||
static void setDigitalSensitivity(int sensitivity);
|
static void setDigitalSensitivity(int sensitivity);
|
||||||
|
|
||||||
/**
|
|
||||||
Sets the sensitivity for analog emulation of paddle movement
|
|
||||||
using a mouse.
|
|
||||||
|
|
||||||
@param sensitivity Value from 1 to MAX_MOUSE_SENSE, with larger
|
|
||||||
values causing more movement
|
|
||||||
*/
|
|
||||||
static void setMouseSensitivity(int sensitivity);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Sets the maximum upper range for digital/mouse emulation of paddle
|
Sets the maximum upper range for digital/mouse emulation of paddle
|
||||||
movement (ie, a value of 50 means to only use 50% of the possible
|
movement (ie, a value of 50 means to only use 50% of the possible
|
||||||
|
@ -214,8 +194,7 @@ class Paddles : public Controller
|
||||||
static float SENSITIVITY, ACCEL;
|
static float SENSITIVITY, ACCEL;
|
||||||
|
|
||||||
static int DIGITAL_SENSITIVITY, DIGITAL_DISTANCE;
|
static int DIGITAL_SENSITIVITY, DIGITAL_DISTANCE;
|
||||||
static int DEADZONE, DEJITTER_BASE, DEJITTER_DIFF;
|
static int DEJITTER_BASE, DEJITTER_DIFF;
|
||||||
static int MOUSE_SENSITIVITY;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Swap two events.
|
Swap two events.
|
||||||
|
|
|
@ -115,7 +115,7 @@ Settings::Settings()
|
||||||
setPermanent("usemouse", "analog");
|
setPermanent("usemouse", "analog");
|
||||||
setPermanent("grabmouse", "true");
|
setPermanent("grabmouse", "true");
|
||||||
setPermanent("cursor", "2");
|
setPermanent("cursor", "2");
|
||||||
setPermanent("pdeadzone", "0");
|
setPermanent("adeadzone", "0");
|
||||||
setPermanent("paccel", "100");
|
setPermanent("paccel", "100");
|
||||||
setPermanent("dejitter.base", "0");
|
setPermanent("dejitter.base", "0");
|
||||||
setPermanent("dejitter.diff", "0");
|
setPermanent("dejitter.diff", "0");
|
||||||
|
@ -358,10 +358,10 @@ void Settings::validate()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
setValue("joydeadzone", BSPF::clamp(getInt("joydeadzone"),
|
setValue("joydeadzone", BSPF::clamp(getInt("joydeadzone"),
|
||||||
Joystick::DEAD_ZONE_MIN, Joystick::DEAD_ZONE_MAX));
|
Controller::MIN_DIGITAL_DEADZONE, Joystick::MAX_DIGITAL_DEADZONE));
|
||||||
|
|
||||||
setValue("pdeadzone", BSPF::clamp(getInt("pdeadzone"),
|
setValue("adeadzone", BSPF::clamp(getInt("adeadzone"),
|
||||||
Paddles::MIN_ANALOG_DEADZONE, Paddles::MAX_ANALOG_DEADZONE));
|
Controller::MIN_ANALOG_DEADZONE, Controller::MAX_ANALOG_DEADZONE));
|
||||||
|
|
||||||
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));
|
||||||
|
@ -379,7 +379,7 @@ void Settings::validate()
|
||||||
Paddles::MIN_DIGITAL_SENSE, Paddles::MAX_DIGITAL_SENSE));
|
Paddles::MIN_DIGITAL_SENSE, Paddles::MAX_DIGITAL_SENSE));
|
||||||
|
|
||||||
setValue("msense", BSPF::clamp(getInt("msense"),
|
setValue("msense", BSPF::clamp(getInt("msense"),
|
||||||
Paddles::MIN_MOUSE_SENSE, Paddles::MAX_MOUSE_SENSE));
|
Controller::MIN_MOUSE_SENSE, Controller::MAX_MOUSE_SENSE));
|
||||||
|
|
||||||
i = getInt("cursor");
|
i = getInt("cursor");
|
||||||
if(i < 0 || i > 3)
|
if(i < 0 || i > 3)
|
||||||
|
@ -514,7 +514,7 @@ void Settings::usage() const
|
||||||
<< " -loglevel <0|1|2> Set level of logging during application run\n"
|
<< " -loglevel <0|1|2> Set level of logging during application run\n"
|
||||||
<< endl
|
<< endl
|
||||||
<< " -logtoconsole <1|0> Log output to console/commandline\n"
|
<< " -logtoconsole <1|0> Log output to console/commandline\n"
|
||||||
<< " -joydeadzone <number> Sets 'deadzone' area for analog joysticks (0-29)\n"
|
<< " -joydeadzone <0-29> Sets digital 'dead zone' area for analog joysticks\n"
|
||||||
<< " -joyallow4 <1|0> Allow all 4 directions on a joystick to be\n"
|
<< " -joyallow4 <1|0> Allow all 4 directions on a joystick to be\n"
|
||||||
<< " pressed simultaneously\n"
|
<< " pressed simultaneously\n"
|
||||||
<< " -usemouse <always|\n"
|
<< " -usemouse <always|\n"
|
||||||
|
@ -523,7 +523,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"
|
||||||
<< " -pdeadzone <number> Sets 'deadzone' area for analog paddles (0-15000)\n"
|
<< " -adeadzone <number> Sets analog 'dead zone' area for analog joysticks\n"
|
||||||
|
<< " (0-16500)\n"
|
||||||
<< " -paccel <0-100> Sets paddle acceleration strength\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"
|
||||||
|
|
|
@ -112,34 +112,37 @@ void InputDialog::addDevicePortTab()
|
||||||
// Devices/ports
|
// Devices/ports
|
||||||
tabID = myTab->addTab(" Devices & Ports ", TabWidget::AUTO_WIDTH);
|
tabID = myTab->addTab(" Devices & Ports ", TabWidget::AUTO_WIDTH);
|
||||||
|
|
||||||
ypos = VBORDER;
|
xpos = HBORDER; ypos = VBORDER;
|
||||||
lwidth = _font.getStringWidth("Digital paddle sensitivity ");
|
lwidth = _font.getStringWidth("Digital paddle sensitivity ");
|
||||||
|
|
||||||
// Add joystick deadzone setting
|
// Add digital dead zone setting
|
||||||
myJoystickDeadzone = new SliderWidget(myTab, _font, HBORDER, ypos - 1, 13 * fontWidth, lineHeight,
|
myDigitalDeadzone = new SliderWidget(myTab, _font, xpos, ypos - 1, 13 * fontWidth, lineHeight,
|
||||||
"Joystick deadzone size", lwidth, kJDeadzoneChanged, 5 * fontWidth);
|
"Digital dead zone",
|
||||||
myJoystickDeadzone->setMinValue(Joystick::DEAD_ZONE_MIN);
|
lwidth, kDDeadzoneChanged, 3 * fontWidth, "%");
|
||||||
myJoystickDeadzone->setMaxValue(Joystick::DEAD_ZONE_MAX);
|
myDigitalDeadzone->setMinValue(Controller::MIN_DIGITAL_DEADZONE);
|
||||||
myJoystickDeadzone->setTickmarkIntervals(4);
|
myDigitalDeadzone->setMaxValue(Controller::MAX_DIGITAL_DEADZONE);
|
||||||
wid.push_back(myJoystickDeadzone);
|
myDigitalDeadzone->setTickmarkIntervals(4);
|
||||||
|
myDigitalDeadzone->setToolTip("Adjust dead zone size for analog joysticks when emulating digital controllers.");
|
||||||
|
wid.push_back(myDigitalDeadzone);
|
||||||
|
|
||||||
xpos = HBORDER; ypos += lineHeight + VGAP * (3 - 2);
|
// Add analog dead zone
|
||||||
|
ypos += lineHeight + VGAP;
|
||||||
|
myAnalogDeadzone = new SliderWidget(myTab, _font, xpos, ypos - 1, 13 * fontWidth, lineHeight,
|
||||||
|
"Analog dead zone",
|
||||||
|
lwidth, kADeadzoneChanged, 3 * fontWidth, "%");
|
||||||
|
myAnalogDeadzone->setMinValue(Controller::MIN_ANALOG_DEADZONE);
|
||||||
|
myAnalogDeadzone->setMaxValue(Controller::MAX_ANALOG_DEADZONE);
|
||||||
|
myAnalogDeadzone->setStepValue(500);
|
||||||
|
myAnalogDeadzone->setTickmarkIntervals(3);
|
||||||
|
myAnalogDeadzone->setToolTip("Adjust dead zone size for analog joysticks when emulating analog controllers.");
|
||||||
|
wid.push_back(myAnalogDeadzone);
|
||||||
|
|
||||||
|
ypos += lineHeight + VGAP * (3 - 2);
|
||||||
new StaticTextWidget(myTab, _font, xpos, ypos+1, "Analog paddle:");
|
new StaticTextWidget(myTab, _font, xpos, ypos+1, "Analog paddle:");
|
||||||
xpos += fontWidth * 2;
|
xpos += fontWidth * 2;
|
||||||
|
|
||||||
// Add analog paddle deadzone
|
|
||||||
ypos += lineHeight;
|
|
||||||
myPaddleDeadzone = new SliderWidget(myTab, _font, xpos, ypos - 1, 13 * fontWidth, lineHeight,
|
|
||||||
"Deadzone size",
|
|
||||||
lwidth - fontWidth * 2, 0, 5 * fontWidth);
|
|
||||||
myPaddleDeadzone->setMinValue(Paddles::MIN_ANALOG_DEADZONE);
|
|
||||||
myPaddleDeadzone->setMaxValue(Paddles::MAX_ANALOG_DEADZONE);
|
|
||||||
myPaddleDeadzone->setStepValue(500);
|
|
||||||
myPaddleDeadzone->setTickmarkIntervals(3);
|
|
||||||
wid.push_back(myPaddleDeadzone);
|
|
||||||
|
|
||||||
// Add analog paddle sensitivity
|
// Add analog paddle sensitivity
|
||||||
ypos += lineHeight + VGAP;
|
ypos += lineHeight;
|
||||||
myPaddleSpeed = new SliderWidget(myTab, _font, xpos, ypos - 1, 13 * fontWidth, lineHeight,
|
myPaddleSpeed = new SliderWidget(myTab, _font, xpos, ypos - 1, 13 * fontWidth, lineHeight,
|
||||||
"Sensitivity",
|
"Sensitivity",
|
||||||
lwidth - fontWidth * 2, kPSpeedChanged, 4 * fontWidth, "%");
|
lwidth - fontWidth * 2, kPSpeedChanged, 4 * fontWidth, "%");
|
||||||
|
@ -360,11 +363,11 @@ void InputDialog::loadConfig()
|
||||||
myCursorState->setSelected(settings.getString("cursor"), "2");
|
myCursorState->setSelected(settings.getString("cursor"), "2");
|
||||||
handleCursorState();
|
handleCursorState();
|
||||||
|
|
||||||
// Joystick deadzone
|
// Digital dead zone
|
||||||
myJoystickDeadzone->setValue(settings.getInt("joydeadzone"));
|
myDigitalDeadzone->setValue(settings.getInt("joydeadzone"));
|
||||||
|
// Analog dead zone
|
||||||
|
myAnalogDeadzone->setValue(settings.getInt("adeadzone"));
|
||||||
|
|
||||||
// Paddle deadzone (analog)
|
|
||||||
myPaddleDeadzone->setValue(settings.getInt("pdeadzone"));
|
|
||||||
// Paddle speed (analog)
|
// Paddle speed (analog)
|
||||||
myPaddleSpeed->setValue(settings.getInt("psense"));
|
myPaddleSpeed->setValue(settings.getInt("psense"));
|
||||||
// Paddle acceleration (analog)
|
// Paddle acceleration (analog)
|
||||||
|
@ -430,15 +433,15 @@ void InputDialog::saveConfig()
|
||||||
Settings& settings = instance().settings();
|
Settings& settings = instance().settings();
|
||||||
|
|
||||||
// *** Device & Ports ***
|
// *** Device & Ports ***
|
||||||
// Joystick deadzone
|
// Digital dead zone
|
||||||
int deadzone = myJoystickDeadzone->getValue();
|
int deadzone = myDigitalDeadzone->getValue();
|
||||||
settings.setValue("joydeadzone", deadzone);
|
settings.setValue("joydeadzone", deadzone);
|
||||||
Joystick::setDeadZone(deadzone);
|
Controller::setDigitalDeadZone(deadzone);
|
||||||
|
// Analog dead zone
|
||||||
|
deadzone = myAnalogDeadzone->getValue();
|
||||||
|
settings.setValue("adeadzone", deadzone);
|
||||||
|
Controller::setAnalogDeadzone(deadzone);
|
||||||
|
|
||||||
// Paddle deadzone (analog)
|
|
||||||
deadzone = myPaddleDeadzone->getValue();
|
|
||||||
settings.setValue("pdeadzone", deadzone);
|
|
||||||
Paddles::setAnalogDeadzone(deadzone);
|
|
||||||
// Paddle speed (analog)
|
// Paddle speed (analog)
|
||||||
int sensitivity = myPaddleSpeed->getValue();
|
int sensitivity = myPaddleSpeed->getValue();
|
||||||
settings.setValue("psense", sensitivity);
|
settings.setValue("psense", sensitivity);
|
||||||
|
@ -526,11 +529,11 @@ void InputDialog::setDefaults()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: // Devices & Ports
|
case 1: // Devices & Ports
|
||||||
// Joystick deadzone
|
// Digital dead zone
|
||||||
myJoystickDeadzone->setValue(0);
|
myDigitalDeadzone->setValue(0);
|
||||||
|
|
||||||
// Paddle deadzone
|
// Analog dead zone
|
||||||
myPaddleDeadzone->setValue(0);
|
myAnalogDeadzone->setValue(0);
|
||||||
|
|
||||||
// Paddle speed (analog)
|
// Paddle speed (analog)
|
||||||
myPaddleSpeed->setValue(20);
|
myPaddleSpeed->setValue(20);
|
||||||
|
@ -695,8 +698,12 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
setDefaults();
|
setDefaults();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kJDeadzoneChanged:
|
case kDDeadzoneChanged:
|
||||||
myJoystickDeadzone->setValueLabel(Joystick::deadZoneValue(myJoystickDeadzone->getValue()));
|
myDigitalDeadzone->setValueLabel(std::round(Controller::digitalDeadzoneValue(myDigitalDeadzone->getValue()) * 100.f / 32768));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kADeadzoneChanged:
|
||||||
|
myAnalogDeadzone->setValueLabel(std::round(myAnalogDeadzone->getValue() * 100.f / 32768));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kPSpeedChanged:
|
case kPSpeedChanged:
|
||||||
|
|
|
@ -72,12 +72,13 @@ class InputDialog : public Dialog
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum {
|
enum {
|
||||||
kJDeadzoneChanged = 'DZch',
|
kDDeadzoneChanged = 'DDch',
|
||||||
|
kADeadzoneChanged = 'ADch',
|
||||||
kPSpeedChanged = 'Ppch',
|
kPSpeedChanged = 'Ppch',
|
||||||
kPAccelChanged = 'PAch',
|
kPAccelChanged = 'PAch',
|
||||||
kDejitterAvChanged = 'JAch',
|
kDejitterAvChanged = 'JAch',
|
||||||
kDejitterReChanged = 'JRch',
|
kDejitterReChanged = 'JRch',
|
||||||
kDPSpeedChanged = 'PDch',
|
kDPSpeedChanged = 'DSch',
|
||||||
kAutoFireChanged = 'AFch',
|
kAutoFireChanged = 'AFch',
|
||||||
kTBSpeedChanged = 'TBch',
|
kTBSpeedChanged = 'TBch',
|
||||||
kDCSpeedChanged = 'DCch',
|
kDCSpeedChanged = 'DCch',
|
||||||
|
@ -98,9 +99,9 @@ class InputDialog : public Dialog
|
||||||
|
|
||||||
PopUpWidget* myAVoxPort{nullptr};
|
PopUpWidget* myAVoxPort{nullptr};
|
||||||
|
|
||||||
SliderWidget* myJoystickDeadzone{nullptr};
|
SliderWidget* myDigitalDeadzone{nullptr};
|
||||||
|
SliderWidget* myAnalogDeadzone{nullptr};
|
||||||
SliderWidget* myPaddleSpeed{nullptr};
|
SliderWidget* myPaddleSpeed{nullptr};
|
||||||
SliderWidget* myPaddleDeadzone{nullptr};
|
|
||||||
SliderWidget* myPaddleAccel{nullptr};
|
SliderWidget* myPaddleAccel{nullptr};
|
||||||
SliderWidget* myDejitterBase{nullptr};
|
SliderWidget* myDejitterBase{nullptr};
|
||||||
SliderWidget* myDejitterDiff{nullptr};
|
SliderWidget* myDejitterDiff{nullptr};
|
||||||
|
|
Loading…
Reference in New Issue